Source for https://theguestwifi.com
Prerequisites:
- A web server with PHP.
- The qrencode package.
- A dictionary file. I installed the wamerican-small package in Ubuntu.
On your server:
- Install the prerequisites
apt install php qrencode wamerican-small
- Put the theguestwifi script someplace and make it executable
curl https://raw.githubusercontent.com/drmessano/theguestwifi/master/theguestwifi > /usr/local/bin/theguestwifi
chmod +x /usr/local/bin/theguestwifi
- Put the index.php on your web server in /var/www/theguestwifi
mkdir /var/www/theguestwifi
curl https://raw.githubusercontent.com/drmessano/theguestwifi/master/index.php > /var/www/theguestwifi/index.php
- Run the theguestwifi script to create the password file and QR images
- Create a systemd timer for the theguestwifi so it rotates regularly:
printf '[Unit]
Description=TheGuestWifi Updater
[Service]
Type=simple
ExecStart=/usr/local/bin/theguestwifi
[Install]
WantedBy=multi-user.target
' | sudo tee /etc/systemd/system/theguestwifi.service
printf '[Unit]
Description=TheGuestWifi Updater
[Timer]
OnCalendar=04:59:00 America/New_York
Unit=theguestwifi.service
[Install]
WantedBy=multi-user.target
' | sudo tee /etc/systemd/system/theguestwifi.timer
sudo systemctl daemon-reload
sudo systemctl enable theguestwifi.timer
- Uncomment the
primary=
line in/usr/local/bin/theguestwifi
, replacing the API call with the address of your Primary server:
# Optional API address of Primary server if this is a Replica
# primary=https://www.theguestwifi.com?api
- Edit
/etc/systemd/system/theguestwifi.service
and change theExecStart
line to the following:
ExecStart=/usr/local/bin/theguestwifi -r
- Edit
/etc/systemd/system/theguestwifi.timer
and change theOnCalendar
line to the following:
OnCalendar=04:59:30 America/New_York
This gives the Primary 30 seconds to update before the Replica updates
- Optional: Create a file named
serverid
in/var/www/theguestwifi
. Creating this file will generate a hidden paragraph, viewable with 'View Page Source' in the browser, that displays the identity of the server instance you are viewing.
printf 'primary' | tee /var/www/theguestwifi/serverid
Which will display in 'View Page Source':
<p hidden />##### ServerID: primary #####
RouterOS:
- Set up a guest wireless network with the SSID "TheGuestWifi"
- Set up a security profile named "theguestwifi" and apply it to the "TheGuestWifi" network
- Copy the RouterOS script to your router and run it
- Set the Scheduler to run the RouterOS script a few seconds after the theguestwifi script runs on your server
4a. If you are using this script with https://www.theguestwifi.com, set the scheduler to run at 4:59:00 Eastern Time