I have not been so good at writing the log lately, but will try to be better again. The server is currently standing at the Sandberg. That means, it's hidden behind a firewall/the router, since I don't have access to the router to set up port forwarding etc.
I got around this by asking Jan Kees to help me get around it. He set up a Reverse Poxy (I think that's the correct term), which means that all the traffic of the Server is forwarded through the pub.sandberg.nl server. In simple terms: we created a new subdomain, cloud0.192168285.xyz, which points to pub.sandberg.nl. Pub Sandberg then forwards this request to our server. It knows where my server is, because our server has an open SSH connection with pub.sandberg.nl.
Effectively this renders our server nomadic, in that it can serve from everywhere in the world, as long as it has an internet connection, and the pub server is online. So far so good.
The setup is a bit more complicated, and I will go into detail in one of the next logs. For now the issue is how to open this connection on boot. Right now, whenever I start the server, I have to run the ssh command
ssh -fNR 18443:localhost:443 si &
The ampersand means it will run in the background, apparently. This opens the SSH tunnel. But, ssh connections sometimes drop. This is why I use the autossh command instead:
autossh -M 18444 -o "PubkeyAuthentication=yes" -fNR 18443:localhost:443 si &
This actually works really well, and even over night the services I run remain online. Now the question is how to get this to work automatically when the server boots. This way I could restart it remotely, for example, and ensure I would be able to connect to it again once it has started up (I actually still need to set up the reverse tunnel for ssh but that's another thing).
There is a file called rc.local which runs things when we boot, but I am unable to get this to work. I also followed this description, and created a systemd service file, but the result is the same. It seems that both these approaches run the command as root, which doesn't work for some reason (might be because no ssh setup with si?). Also as soon as the command is run as root once, it doesn't work anymore to run it as a user.
I've had to do a lot of other things during the day but frustratingly this has taken me all day. I briefly ran into Ada just now, she mentioned I should try setting up a cronjob. Turned out very easy. I followed this guide. The cron job I defined is, giving it 10 seconds before running the script to make sure it's logged into the wifi :
@reboot sleep 10 && /home/pleb/fw2si.ssl.autossh.sh
The executable script we run (fw2si.ssl.autossh.sh) looks like this:
#!/bin/bash
autossh -M 18444 -o "PubkeyAuthentication=yes" -fNR 18443:localhost:443 si
I am happy to say that this finally worked!
Talked with my friend Franz. To set up SSH tunneling, I have to google it lol.