-
Notifications
You must be signed in to change notification settings - Fork 47
AWS Deployment
These instructions are for administrators who like to provision a Segfault.net Server Centre (SSC) onto a newly created AWS instance. The step by step instructions turn a fresh (vanilla) AWS Instance into a Segfault.net Server Centre.
This is how we deploy a SSC onto AWS.
Note: We use Route53 so that the user always connects to the nearest SSC. E.g. segfault.net resolves to us.segfault.net or de.segfault.net depending on your physical location. You likely wont need this.
Create 3 EBS volumes
- 16GB, gp2, encrypted, name=sf-docker
- 1TB, sc1, encrypted, name=sf-data
- 1GB, gp2, encrypted, name=sf-config
- Launch a t3a.medium instance (Ubuntu, amd64).
- Attach the 3 volumes (in order sf-docker, sf-data, sf-config).
- Assign an Elastic IP to the instance.
Log in to the instance.
Download the SSC source:
mkdir /home/ubuntu/src
cd /home/ubuntu/src
git clone https://github.com/hackerschoice/segfault.git
cd segfaultFormat the volumes:
source provision/funcs_aws.sh
aws_fs_add /dev/nvme1n1 /sf/docker
aws_fs_add /dev/nvme2n1 /sf/data
aws_fs_add /dev/nvme3n1 /sf/configThis part is optional and only needed if you like to route all outgoing traffic via NordVPN. The default is to route through TOR if NordVPN is not configured (TCP only).
Execute the following on your workstation (not the AWS instance) to retrieve the NordVPN Private Key. Replace XXX and YYY with your NordVPN Username and Password:
docker run --rm --cap-add=NET_ADMIN -e USER=XXX -e PASS=YYY bubuntux/nordvpn:get_private_keyThe following command will:
- Install all software (docker, curl, git, ..) onto the AWS
- Move the SSHD to port 64222 and assign Port 22 to the SSC.
- Create a random MASTER SEED.
- Configure the SSC (generate tor secrets, ssh-keys, ...)
- Replace ZZZ with your NordVPN Private Key or remove the line if NordVPN is not used.
- Change SF_FQDN= to whatever domain you are using.
- Change SF_PACKAGES="MINI_BASE NET HACK" for a smaller deployment (1 GB instead of 8 GB).
- We limited outbound traffic to 10Mbit. Remove the SF_MAXOUT= line otherwise.
- We Limit the user's root fs to 128MB. Remove the SF_USER_ROOT_FS_LIMIT= line otherwise.
Please refer to the list of all variables for more information.
SF_PACKAGES=ALL \
SF_BASEDIR=/sf \
SF_SEED="$(head -c 1024 /dev/urandom | tr -dc '[:alpha:]' | head -c 32)" \
SF_MAXOUT=10Mbit \
SF_USER_ROOT_FS_LIMIT=128MB \
SF_FQDN=mydomain.segfault.net \
SF_NORDVPN_PRIVATE_KEY=ZZZ \
provision/init-linux.shThe script will finish with an output similar to this one:
--> System's SSHD was in the way and got moved to 64222
--> Basedir : /sf
--> SF_SEED : RandomlyCreatedMasterSeed1234567
--> Password : segfault
--> SSH : ssh root@mydomain.segfault.net
--> SSH (gsocket) : gsocket -s RandomSecret ssh root@mydomain.segfault.gsocket- Write down the SF_SEED
- Log in to your SSC (
ssh root@mydomain.segfault.net) with password "segfault" (without parentheses).
Stopping:
cd /home/ubuntu/segfault
docker-compose downThe SSC wont start automatically if the AWS instance reboots. This is prevent the SF_SEED of needing to be stored with AWS. Instead a log in to the AWS Instance is needed to start the SSC manually:
Starting:
cd /home/ubuntu/segfault
SF_SEED=RandomlyCreatedMasterSeed1234567 docker-compose upJoin us on Telegram if you have any questions or comments.