Installing and configuring gw.run as service to expose your local web server [Ubuntu]
In this article, we'll work through the simple yet complex configuration of the gw service that allows the secure exposure of your local web server for testing. Their documentation is basic and explains very simply how to make it work manually, however, if you want it to run as a service, there is a bit more that is required to do.
Preconditions:
- Ubuntu (or any other Linux distro)
- Java Installed
- Have an account on gw.run along with the tunnel and downloaded the JSON file with the ACL info.
- Tomcat installed (or another web server)
Step-by-step guide:
- Create a gw folder in /home and switch to it
mkdir gw && cd gw
Download the executable file the keys file (ACL). They both should be moved to the recently created folder.
wget https://storage.googleapis.com/gw.run/builds/master/gwrun-linux-amd64
Note: The ACL file cannot be downloaded directly from the terminal, you can create a new file in the directory and copy/paste the values.
Make the gw script executable
sudo chmod +x gwrun-linux-amd64
- Create a new service
sudo nano /etc/systemd/system/gw.service
Copy and paste the following info. Note: Make sure to use your folder locations and such.
[Unit] Description=GW [Service] ExecStart=/home/<user>/gw/gwrun-linux-amd64 tunnel --url http://localhost:8080 --secrets /home/<user>/gw/<your_acl_file> [Install] WantedBy=multi-user.target
Reload the systemd daemon so it can find our new service file
sudo systemctl daemon-reload
- Start our gw service
sudo systemctl start gw
- Verify the status of the service
sudo systemctl status gw
- Bonus: Run when the system starts
sudo systemctl enable gw
Done! Now your web server is securely exposed to the internet, only for those users you've added to the ACL.