Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Installation Guide, Development

Steve Collmann edited this page Dec 20, 2017 · 19 revisions

Overview

The FBCTF platform was designed with flexibility in mind, allowing for different types of installations, depending on the needs of the end user. The FBCTF platform can be installed either in Development Mode, or Production Mode. Development is for testing and agility, and production is for better performance and typically used for live events. Production mode utilizes an HHVM web cache, which speed up processing.

Development Installation

Development is intended for FBCTF development. There are several commonalities, regardless of development installation method.

The operating system for the FBCTF platform should be Ubuntu 16.04 x64 (Xenial). This is the only supported operating system at the current time.

The default admin username and password for the FBCTF platform will always be admin and password.

Regardless of your installation method, ensure the date and time is correct on your base system. This will prevent certificate invalidation issues when downloading certain packages. Follow the below instructions to force a time update on Ubuntu 16.04 x64 (Xenial):

sudo apt-get install ntp
sudo service ntp stop
sudo ntpd -gq
sudo service ntp start

Vagrant (Preferred)

It is highly recommended that you utilize a Vagrant VM to perform development of the platform. This provides a consistent environment for developers.

Vagrant is a tool for building complete development environments. The VagrantFile generated by the FBCTF team provides automated instructions to Vagrant which configure the proper environment. The VagrantFile includes some of the following parameters:

The below parameter specifies the type of system to be utilized. At this time only Ubuntu 16.04 x64 (Xenial) is supported:

config.vm.box = "ubuntu/xenial64"

This below parameter specifies network settings for the environment. You can change the IP address if desired:

config.vm.network "private_network", ip: "10.10.10.5"

This below parameter specifies the hostname of the FBCTF platform. This can be changed if desired:

config.vm.hostname = "facebookCTF-Dev"

The Vagrant VM will automatically run the provision script, which installs the FBCTF platform itself.

To get started with a Vagrant installation, first install VirtualBox, a general-purpose full virtualizer. VirtualBox will be used as the Vagrant provider. Note that it is possible to utilize other providers such as VMWare. However, these are not officially supported.

Next, install Vagrant itself.

After installing the Vagrant software, run the following commands to bring up the Vagrant VM and initiate installation of the FBCTF platform:

git clone https://github.com/facebook/fbctf
cd fbctf

[change VagrantFile parameters as desired]

vagrant up

If you are experiencing any issues, check the HHVM log for any errors:

/var/log/hhvm/error.log

Also ensure that HHVM and NGINX are both running, by entering the commands below:

ps aux | grep nginx
ps aux | grep hhvm

You should now have a fully functioning FBCTF platform. This platform can be accessed at https://10.10.10.5 by default. Note that in development mode, the platform utilizes a self-signed SSL certificate.

After installing the FBCTF platform, you can login with the credentials admin and password by clicking the Login link at the top right of the window. You will then be redirected to the administration page. The gameboard can be accessed at the bottom of the navigation bar located on the left side of the window.

To access the Vagrant VM over SSH, run the following command in the fbctf folder:

vagrant ssh

If you are using a non-English locale on the host system, you may run into problems during the installation. The easiest solution is to run vagrant with a default English locale:

LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 vagrant up

Docker (Alternate)

Although Vagrant is the recommended installation method for Development, you can provision a system through Docker if desired.

Similar to Vagrant, Docker is a tool for building complete development environments. The DockerFile, generated by the FBCTF team, provides automated instructions to Docker which configure the proper environment.

The Docker VM will automatically run the provision script, which installs the FBCTF platform itself.

Update repositories on the Ubuntu system, to ensure you are getting the latest packages:

sudo apt-get update

Install Docker, a virtual container application:

sudo apt-get install docker-ce

After installing Docker, install git:

sudo apt-get install git

Clone the FBCTF project as shown below:

git clone https://github.com/facebook/fbctf

Navigate to the fbctf directory:

cd fbctf

Run the following command to initiate a FBCTF Development installation. Do not forget the dot at the end of the line:

sudo docker build --build-arg MODE=dev -t="fbctf_in_dev" .

To bring up the Docker instance, run the below command:

sudo docker run --name fbctf -p 80:80 -p 443:443 fbctf_in_dev

After installing the FBCTF platform, access it through your web browser using the provided IP address.

Login with the credentials admin and password by clicking the Login link at the top right of the window. You will then be redirected to the administration page. The gameboard can be accessed at the bottom of the navigation bar located on the left side of the window.

Manual (Alternate)

Although Vagrant is the recommended installation method for Development, you can provision a system manually if desired.

Ubuntu 16.04 x64 (Xenial) should first be installed as the hosting system. This is currently the only supported operating system. Ensure that you only install the base system without extras such as LAMP. This will cause issues with the FBCTF installation.

Update repositories on the Ubuntu system, to ensure you are getting the latest packages:

sudo apt-get update

Install the git package which will allow you to clone the FBCTF project to your local system:

sudo apt-get install git

Clone the FBCTF project by running the following command. This will create folder called fbctf in the current directory:

git clone https://github.com/facebook/fbctf

Navigate to the fbctf directory:

cd fbctf

Run the provision script in order to install the FBCTF platform. To perform a default installation, run the command below. However, check the provision script section for custom installations:

./extra/provision.sh -m dev -s $PWD

After installing the FBCTF platform, access it through your web browser using the configured IP address.

Login with the credentials admin and password by clicking the Login link at the top right of the window. You will then be redirected to the administration page. The gameboard can be accessed at the bottom of the navigation bar located on the left side of the window.