Dxcufgb's Workshop

Admin Page on a Public Address

WIPWork in progress: may be very buggy and can change a lot between versions.

You can give the admin page a public name and reach it from the internet. Two ways.

For example an nginx or Apache server block managed in Webmin. The web server does HTTPS with a real certificate (Let's Encrypt) and forwards to the admin port, which then listens on 127.0.0.1 only. In the proxy's env (/etc/foundry-release-proxy/env):

ADMIN_PORT=8788
ADMIN_HOST=127.0.0.1
ADMIN_TLS=off
ADMIN_TRUST_PROXY=1
ADMIN_PUBLIC_URL=https://proxy.example.com

then sudo systemctl restart foundry-release-proxy. Webmin cannot host the page inside its own interface, but its nginx or Apache module can create this server block / virtual host (or add it to the files by hand):

server {
    listen 443 ssl;
    server_name proxy.example.com;
    ssl_certificate     /etc/letsencrypt/live/proxy.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/proxy.example.com/privkey.pem;

    location / {
        proxy_pass http://127.0.0.1:8788;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-Proto https;
    }
}
<VirtualHost *:443>
    ServerName proxy.example.com
    SSLEngine on
    SSLCertificateFile    /etc/letsencrypt/live/proxy.example.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/proxy.example.com/privkey.pem
    ProxyPreserveHost On
    ProxyPass        / http://127.0.0.1:8788/
    ProxyPassReverse / http://127.0.0.1:8788/
    RequestHeader set X-Forwarded-Proto "https"
</VirtualHost>

(Apache: a2enmod ssl proxy proxy_http headers; it adds X-Forwarded-For itself.) Point only at the admin port, never at the proxy's port 8787: the module routes have no password and must stay private.

If nginx or Apache runs on a different machine, bind the admin port to an address that machine can reach and set ADMIN_TRUST_PROXY to that machine's IP address instead of 1.

B. Directly

Keep ADMIN_HOST=0.0.0.0, forward the admin port on your router, set ADMIN_PUBLIC_URL and give it a certificate browsers trust: ADMIN_TLS_CERT / ADMIN_TLS_KEY. Let's Encrypt's files are readable by root only, so copy them for the proxy in a renewal hook, for example /etc/letsencrypt/renewal-hooks/deploy/foundry-proxy.sh:

#!/bin/sh
install -m 644 -o root -g foundry-proxy "$RENEWED_LINEAGE/fullchain.pem" /etc/foundry-release-proxy/admin-tls.crt
install -m 640 -o root -g foundry-proxy "$RENEWED_LINEAGE/privkey.pem" /etc/foundry-release-proxy/admin-tls.key
systemctl restart foundry-release-proxy

On the internet

Use a long password (a passphrase of 16+ characters), keep automatic updates on, and if you can, limit who may connect (e.g. allow/deny in the nginx server block, or your router).

This page mirrors the Private GitHub Proxy wiki on GitHub.