Forum archive
I messed up. How do I fix it?
Hi everyone.
I've been using TKL LAMP for awhile now, and in my attempts to set up a Softether server, I managed to lock myself out of webmin, web shell, and adminer.
The last thing I remember doing was removing the reference to port 443 in the apache server, and removing the reference to port 443 in the linux firewall.
In an attempt to fix it, I went into
/etc/apache2/sites-available/000-default.conf
And tried to re-add the reference to port 443
<VirtualHost *:443>
SSLEngine on
ServerAdmin webmaster@localhost
DocumentRoot /var/www/
</VirtualHost>
I also went into
/etc/iptables.up.rules
and tried to re-add the rule to port 443.
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
Not sure what else I broke, but despite those changes, I cannot access the webmin login page. I get an error saying something along the lines of "Connection refused". Same goes for the web shell, and when logging into adminer, I get the error message " Session expired, please login again. "
The end goal that I was trying to accomplish is enable Softether to run a multiple VPNs each on ports 25, 443, and 53. Not sure how to set up the server so that accessing a port from a specifc domain results in the VPN handling it while accessing a port from another domain results in the default TKL behavior.
In the meantime--in an attempt to recover--I'm trying to duplicate this server on another server from a backup, and then will use rsync to copy the restored server over this mistake and hopefully get back to where I was before trying to install softether.
Thank you for your help.
TBH, I'd never heard of Softether until now, so other than the really brief read I just had, I'm not very familiar with it, but it does sound quite cool.
Using VPN behind port 53 shouldn't be any issue, but I'm not surprised that setting it up to listen on ports 25 and 443 is causing issues. As you possibly know, port 25 is used by SMTP and port 443 is used by Apache (HTTPS). By default only one application can listen on any particular port.
I can certainly understand why Softether may suggest or recommend you use these particular ports for VPN. As they are "standard" ports for other protocols, they are often unblocked by corporate firewalls. Although OTOH, port 25 is often blocked by ISPs
Personally, I'd recommend that you start using ports that aren't required for other protocols. Then use those for your VPN traffic. Or you could stop those services from listening on those ports (as it sounds like you tried doing).
If you really need to use those ports for both VPN and SMTP, then you'll need to install some sort of protocol multiplexer to listen on those ports (e.g. sslh). Then depending on the traffic it gets, it will forward to the relevant application.
As for what has gone wrong with your current set up. TBH, I'm not really sure, but I'd recommend that you inspect the logs and double check that all the services are running. Both Webmin and Webshell (aka shellinabox - that's the service name) are behind stunnel, so also check that stunnel is running. E.g. something like this:
If any of those aren't running, start them like this:If any of them fail to start, then hopefully the status messages will give you a hint of what the issue may be and/or what logs to check. Logs can generally be found in /var/log. If you are running this as a "proper" VM (i.e. not a container) then you can also leverage SystemD's journalctl tool to inspect SystemD's binary logs.
Personally, in situations like this, I would disable the firewall until you have resolved the issue. Otherwise it's really hard to work out whether it's a firewall issue, or something else. Then once you have everything working as it should, then re-enable the firewall. If that breaks things, then you know that you'll need to tweak your firewall rules.
Adminer runs on Apache and TBH, the error that you are noting sounds weird. Perhaps MySQL isn't running either? (Try above commands, but use mysql as the service name). Alternatively, it could just be a cookie issue. Perhaps try logging in from a different web browser, or use "private" or "incognito" mode (depending on what browser you're using, it's called different things).
Another thing worth keeping in mind is that TurnKey comes with etckeeper preinstalled. That keeps the whole /etc directory (where most of the config settings are) under version control (git). So you should even be able to checkout previous versions of your config files if you wish.
Also, out of interest, if you have a current backup, why not just restore this server? Or did you want to try to fix this one?