- Cloud Provider (Oracle Cloud Recommended. others include; AWS, Google Cloud, IBM Cloud, Azure)
- LAMP Stack
- Linux (Ubuntu Server 22.04.* LTS)
- Apache
- MySQL
- PHP (8.1.2-1ubuntu2.13)
- Certbot by EFF
- Tailwindcss
- Page styling and use of prebuilt elements (table, header)
- Cloudflare Turnstile
- Captcha (stops someone from botting the player registration page)
This guide will take you through setting up a web server to host a production ready version of the hack me light bulb demo.
- A cloud provider account (This guide uses Oracle Cloud)
- Even though this won't cost any money, be prepared to enter a debit/credit card for verification
- Access to a Domain Name and ability to access DNS Configuration
- Within your cloud provider, create an web instance
- Select Ubuntu as the guide-files/image (22.04 is supported by security updates until April 2032)
- (optional) For a free service with Oracle Cloud, change the shape to a Virtual Machine with Ampere Processor
- Select CPUs & RAM (2022 - 2023 Server had 1 OCPU and 6GB of RAM)
- Download both Private and Public SSH Keys (this will be used later for connecting to the server, DONT LOOSE THESE FILES)
-
Create Instance (rest of the default settings are fine, we want a public IP address)
-
Wait for instance to start
- Open up a terminal and with the IP address and username from the cloud provider
ssh username@IPADDRESS -i "PRIVATEKEYLOCATION.key"
- Update the instance (updates everything and automatically says yes to all recommended updates)
sudo apt update && sudo apt upgrade -y
- sometimes a restart is required, type in
reboot
to restart
- Install Apache2
sudo apt install apache2
- View Firewall rules and allow apache through the firewall
sudo ufw app list
sudo ufw app info "Apache Full"
sudo ufw allow "Apache Full"
sudo ufw enable
- Reboot Instance
sudo reboot
- Wait a few mins for instance to start again
- Try going to the IP address in the web browser (HTTP ONLY)
- you should see a page as show above
- don't proceed if you dont get this page
- could be problems with the firewall, apache2 not being installed correctly, firewall rules on the cloud provider
- Install MySQL and start setup
sudo apt install mysql-server
sudo mysql_secure_installation
-
Go through the process of setting up MySQL, most questions are security based and different levels of security can be setup
-
Set a secure MySQL password that you can save and use later
-
Once setup finished, run
sudo mysql
and something like this should appear:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.34-0ubuntu0.18.04.1 (Ubuntu)
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
-
Type
exit
to exit -
Install PHP
sudo apt install php libapache2-mod-php php-mysql
- Changing Apache’s Directory Index
- you'll want to move index.php to the first entry in the line (see below)
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
sudo nano /etc/apache2/mods-enabled/dir.conf
- Restart Apache
sudo systemctl restart apache2
- Add DNS Record to DNS Provider
- We use cloudflare
- Login and select flinderscybersociety.org
- add A record using the config options below
-
Check if going to the domain makes you go to the webserver eg: beta-oweek.flinderscybersociety.org
-
Get SSL Setup using certbot
sudo apt update
sudo apt install snapd
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
sudo certbot --apache
- Fill out the questions cert bot asks, pretty easy. If any issues restart with
sudo certbot --apache
- Go to website and check that it has redirected to https:// and that we have the lock icon in the browser
-
Move into the web directory on the server
cd /var/www/html
-
Remove all files in this folder
sudo rm *
- MAKE SURE THAT YOU ARE IN THE FOLDER AS LISTED ABOVE
-
Go to https://github.com/Flinders-Cybersecurity-Society/Hack-Me-Lightbulb/releases and right click the release.zip file and copy the link
-
cd
to move back to the home directory -
Run
wget https://github.com/Flinders-Cybersecurity-Society/Hack-Me-Lightbulb/releases/download/releases/release.zip
(with the copied link) -
Install unzip, extract the file and move to web servers directory
sudo apt-get install unzip
unzip release.zip
sudo mv src/* /var/www/html/