-
Notifications
You must be signed in to change notification settings - Fork 296
Installation
- Installing Git
- Install Dependencies
- Database Setup
- Autostart at boot (optional)
- Application Configuration
- Game Setup
- Avatar Packs (optional)
- SSL/TLS/HTTPS (optional)
- Pypy (optional)
- Nginx (optional)
- Debugging
sudo apt-get install git
- Clone the Github repo,
git clone git://github.com/moloch--/RootTheBox.git
- Switch into the repo directory,
cd RootTheBox
- Pull the Github repo,
cd RootTheBox
thengit pull
- Alternatively:
rootthebox.py --update
(callsgit pull
)
- Follow Docker Deployment instructions
- Run the dependency installation script,
sudo ./setup/depends.sh
follow on screen prompts
If you are on any operating system other than Ubuntu/Debian, you will need to install the dependencies manually, or at least until I get around to improving the setup script. On Windows, memcached needs to be manually downloaded and run prior to launching the framework.
Root the Box supports MySQL, SQLite, and Postgres.
- Login to mysql
sudo mysql -u root -p
- Create a local user
create user '<user>'@'localhost' identified by '<password>';
Remember your <user> and <password>, we'll need these later. - Create the database
create database rootthebox character set utf8mb4;
- Setup database permissions
grant all on rootthebox.* to '<user>'@'localhost';
- Exit MySQL
exit
- Clear your MySQL history
echo "" > ~/.mysql_history
- You will need to install the Python Postgres driver, this is not automatically installed by the setup scripts, you can easily install it using
sudo pip install py-postgresql
- Updated your configuration file accordingly
- No setup required, just edit your .cfg file; find the [Database] section and set sql_dialect to sqlite a database file will be created based on the sql_database setting.
On servers using SystemD, you can setup a service to start RTB at boot time. For this you can find an example service in setup/rtb.service
that you can copy to /etc/systemd/system
. To install and enable it, do the following :
cp setup/rtb.service /etc/systemd/system/
systemctl daemon-reload
systemctl enable rtb
Then, to start it, systemctl start rtb
and check its status with systemctl status rtb
. To examine the logs, journalctl -u rtb -f
.
- First create a default configuration file by executing the following command:
./rootthebox.py --save
This should create a file in ./files/rootthebox.cfg
with the default config; (note: ./files/
is the only directory where the application user needs write-access). These directories can also be optionally changed via the command line interface or thru the config file.
- Find the [Database] section, and edit settings accordingly.
- Be sure to whitelist any IP addresses that need access to the admin interface. This can be done by editing the admin_ips setting, in the [Server] section.
- Ensure that origin is set correctly under the [Server] section, this will be used for websocket connections; if any real-time features are not working properly (notifications, scoreboards, etc) this setting is most likely incorrect.
- To access the admin interface memcached need to be started:
sudo systemctl start memcached
Edit any other applicable settings, please note that you can also modify some settings from the administrative web interface later. For an explanation of each settings please see the configuration details page.
- Next we need to create and initialize the database tables, execute the following command (you only need to do this once):
./rootthebox.py --setup=prod
- Optionally, run
./rootthebox.py --xml foo.xml
to import any XML file(s), you can also import/export XML files later through the web interface. - You may also optionally recompile the Windows botnet binaries if you don't trust the ones from the repo, this can be done using the bot/build_bot.py script (requires Py2Exe). (I'm planning to add cross-compile support at a later time)
- Run the application
./rootthebox.py --start
or if you want to use pypypypy rootthebox.py --start
- Open a Web browser and go to http://<domain>:<port> and you should be greeted with a splash screen.
If everything seems to be working move on to the game setup. NOTE: The admin web interface can only be accessed from whitelisted ip addresses, by default only localhost
is whitelisted. If you need to reset the admin password, you can do so via the recovery console ./rootthebox.py --recovery
Some preformatted Avatar images have been assembled to make getting started a little easier: Marvel User Pack and Assorted Team Pack (pw: rootthebox)
. Extract the packs into the relevant user or team directories under files/avatars
. Have an Avatar Pack we should distribute? Let us know.
-
Get cert - self-signed or issued
- CA-signed example: Let's Encrypt works great
- Self-signed example:
sudo openssl req -x509 -nodes -days 365 -newkey rsa:4096 -keyout domain.key -out domain.crt
-
Edit your RTB configuration file Server section.
- ssl = True
- certfile = "path/to/domain.crt"
- keyfile = "path/to/domain.key"
Root the Box runs well on the Pypy v2.4 (Python 2.7.x) JIT Python implementation. You can find instructions here for building the latest version of Pypy on your platform. There are also binary releases available here. Please note the you will need to install the dependencies into Pypy's site-packages; this is easy to do if you install Pip into Pypy's directory, for example:
$ curl -O https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py
$ ./pypy-2.4/bin/pypy get-pip.py
$ ./pypy-2.4/bin/pip install tornado
You may wish to use Nginx in front of Root the Box; this can be useful for a variety of things. For example we can offload serving static content to Nginx, there is a sample Nginx config file distributed with Root the Box in the setup/
directory. However, you may need to make modifications depending on your platform. If you do use Nginx it is important to firewall off Root The Box's listen port so that it can only talk to Nginx, and enable x_headers
in your Root the Box configuration. If a Content-Security-Policy is applied, style-src should be set to allow unsafe-inline. See Deployment With Nginx
If you run into problems and need to debug here are some useful commands to help, be warned running the application in debug mode will disable certain security features
- Start the application in debug mode:
rootthebox.py --start --debug
- Increase the verbosity of the logs:
rootthebox.py --start --logging=debug
- All of the above:
rootthebox.py --start --debug --logging=debug
- All of the above and log SQL queries:
rootthebox.py --start --debug --logging=debug --log_sql
- Write the logs to a file:
rootthebox.py --start --logging=debug --log_file_prefix=./files/rtb.log
- Recovery Console:
rootthebox.py --recovery