Replies: 1 comment
-
@triuk - Yes, if the webadmin is only accessible on your local network, then HTTP is fine. Still, setting up a reverse proxy in that scenario works around port 8080 being included in the rate limiting rule. I'm personally running my servers on a VPS. I seem to recall reading the KF2 webadmin had security exploits - but I don't think there was any detail on what these were. So while it might not be the case, if allowing access to it via the Internet, it's wise to treat it as potentially exploitable, using HTTPS and also restricting access to only your own IP address. Anyway, here's my draft notes on setting up a reverse proxy. @triuk - for you all the optional steps wouldn't apply, as they're only applicable to HTTPS and Cloudflare proxying. First a few things to note:
(Optional) - Setting up sub-domain for accessing webadminIf you own a domain, for convenience and to setup an auto-renewing Let's Encrypt certificate for HTTPS, it's recommended to set up a sub-domain for accessing webadmin. In the DNS records editor for your domain, create a new A name record set to the KF2 server IP address. Eg. kf2server. So when accessing the webadmin, you'll go to eg. https://kf2server.yourdomain.com If your domain is with Cloudflare, recommend the new A name record is set to proxied to protect against DDOS attacks. Installing nginx and configuring as a reverse proxyInstall nginx by running the following: If SELinux is enabled, run the following for the reverse proxy to work. Otherwise you'll get a bad gateway error when trying to access webadmin.
Setting up the reverse proxy in nginx.confRun the following (replacing nano with your editor of choice): (Optional) If using sub-domain for accessing webadmin, change server_name from _ to sub-domain set up earlier. Eg. kf2server.yourdomain.com (Optional) If using Cloudflare and record set to proxied, the following needs to be added to set the correct IP address in the request header. This is especially important if you want to only allow your own IP address to access webadmin for security purposes. In server section (after 'location = /50x.html {
Now to add a new location for reverse proxying to the webadmin. Add the following in server section:
The 'allow REPLACE_THIS_YOUR_IP_ADDRESS;' and 'deny all;' lines are for only allowing your own IP address to access the webadmin and denying all others. Both these lines need to deleted if you're not doing this, but it's recommended the IP address is restricted for security purposes. The IP address is your outwardly facing IP (not the IP address on your LAN). This can be found at the following http://whatismyipaddress.com/. You'll want to use your IPv4 address, not IPv6. So now the server section should look something like the following:
Run the following commands to start nginx and add firewall rules for HTTP (and optional HTTPS) access.
Now in your VPS firewall or router, add port forwarding rules for HTTP (TCP port 80) and HTTPS (TCP port 443). Test if we can get there via HTTP. Eg. navigate to http://kf2server.yourdomain.com in your browser. (Optional) Setting up Certbot for automatic renewal of Let's Encrypt certificates for HTTPSRun the following, replacing kf2server.yourdomain.com with your sub-domain.
This will install Certbot and configure it for your sub-domain. You'll be asked to accept ToS and for your email address. Test if we can get there via HTTPS eg. https://kf2server.yourdomain.com Note: Certbot will make changes to nginx.conf, so opening it up again, it will now look a bit different. To test automatic renewal of certificates run following: If your certificate renewal is working properly, it should display 'Congratulations, all simulated renewals succeeded' as part of the output. Final stepIf you've previously been accessing the webadmin via port 8080 over the Internet, that port forwarding rule should be removed in your VPS firewall or router. Otherwise, the reverse proxy can be by-passed via that port. |
Beta Was this translation helpful? Give feedback.
-
This is continuation of #70 (comment)
First I would like to clarify - is running HTTP really a threat? Well yes if you do not want your login to be somehow sniffed. In my case I do not care as the whole thing is running inside a separate environment, I connect to the webinterface from the intranet and run the server only when I use it.
For others, it might be useful to have a step by step guide with the reverse proxy. I can try it out for you.
Beta Was this translation helpful? Give feedback.
All reactions