[SOLVED] Admin Webinterface aus Internet blockieren

the_Uli

New Member
Feb 17, 2020
6
1
3
31
Hallo zusammen,

gibt es einen einfachen weg die "Admin Login Seite" welche unter https://pmg.domain.tld:8006/ erreichbar ist aus dem Internet zu blockieren?
Das Ziel ist, nur die Quarantine-URL von extern erreichbar zu machen: https://pmg.domain.tld:8006/quarantine.

Vor dem PMG läuft einen NGINX reverse Proxy, welcher die Veröffentlichung des Webinterfaces in richtung Internet übernimmt.
Scheinbar gibt es jedoch keine logische Trennung zwischen dem "/" (Admin Login) und der "/quarantine".
Eine einfacher "301 Redirect von "/" auf https://pmg.domain.tld:8006/quarantine" funktioniert wohl nicht, da aus dem Web-Root Verzeichnis "/" noch diverse Pfade geladen werden müssen (siehe unten) und somit nur eine weiße Seite angezeigt wird:
/quarantine
/pwt/*
/pve2/*
/proxmoxlib.js
/fontawesome/*
/api2/*

vielleicht denke ich ja einfach zu kompliziert und jemand hat einen einfachen weg das Admin Webinterface zu blocken? :rolleyes:


Grüße
the_Uli
 
nein so müsste man es machen, ist aber nicht wirklich hilfreich, da mit /api2/ die ganze api zur verfügung steht..
warum genau soll denn das admin interface blockiert werden?
 
Danke für die Antwort!
Ziel ist es Admin Tätigkeiten nur von lokal zu erlauben.
Grundsätzlich bin ich kein Freund davon Administrative Ports / URLs ins Internet zu veröffentlichen, wenn nicht unbedingt benötig.
Ist eben immer ein weiteres Sicherheitsrisiko.
Das mit der API ist natürlich gut zu wissen.
 
Last edited:
Hm - ich habe mal eine grobe nginx-config erstellt, die einiges einschraenkt aber den zugang zum quarantaene interface erlauben sollte.

Es ist ein convenience-feature - da der login path auch exposed wird (und dieser ist der einzige in der API, der unauthentifiziert erreichbar ist)

Code:
server {
    listen 80 default_server;
    rewrite ^(.*) https://$host$1 permanent;
}
 
server {
    listen 443;
    server_name _;
    ssl on;
    ssl_certificate /etc/pmg/pmg-api.pem;
    ssl_certificate_key /etc/pmg/pmg-api.pem;
    proxy_redirect off;

    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade"; 
    proxy_buffering off;
    client_max_body_size 0;
    proxy_connect_timeout  3600s;
    proxy_read_timeout  3600s;
    proxy_send_timeout  3600s;
    send_timeout  3600s;
    # proxy requests for static components
    location ~ /proxmoxlib.js$|/favicon.ico$|/pve2/(locale|ext6|images|css|js)/|/fontawesome/(css|fonts)/|/framework7/(css|fonts)/|/pwt/css/ {
        proxy_pass https://localhost:8006;
    }
    location /quarantine {
        proxy_pass https://localhost:8006;
    }

    location /api2 {
        location ~ /api2/(extjs|json|htmlmail)/(access/ticket$|version$) {
            proxy_pass https://localhost:8006;
        }
        location ~ /api2/(extjs|json|htmlmail)/nodes/.+/subscription$ {
            proxy_pass https://localhost:8006;
        }
        location ~ /api2/(extjs|json|htmlmail)/quarantine {
            proxy_pass https://localhost:8006;
        }
        return 403;
    }

    location / {
        return 403;
    }
}

bitte bescheidgeben, ob es wie gewünscht funktioniert.
 
  • Like
Reactions: the_Uli
Wow, vielen Dank!
Funktioniert genauso wie gewünscht!! :D

Hab ganz unten nur noch folgende Änderung gemacht:

Code:
    location / { return 301 https://pmg.domain.tld/quarantine; }
 
Last edited:
  • Like
Reactions: Stoiko Ivanov
Danke fürs testen und feedback geben! Vl. veröffentlichen wir die config für andere User mit dem use-case

Bitte den thread als 'SOLVED' markieren
 
Hier einmal die vollständige Konfiguration:

Code:
server {
        server_name pmg.domain.tld;
        listen 80;
       
        location ^~ /.well-known/ {
        alias /var/www/letsencrypt/.well-known/;
        allow all;
        }
       
        location / {
            return 301 https://$server_name$request_uri;
        }
}

server {
        server_name pmg.domain.tld;
        listen 443 ssl http2;
       
        access_log /var/log/nginx/pmg.domain.tld-access.log;
        error_log /var/log/nginx/pmg.domain.tld-error.log;
       
        ssl_certificate /etc/letsencrypt/live/pmg.domain.tld/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/pmg.domain.tld/privkey.pem;
        ssl_trusted_certificate /etc/letsencrypt/live/pmg.domain.tld/chain.pem;
       
        ssl_protocols TLSv1.2 TLSv1.3;
        ssl_prefer_server_ciphers on;
        ssl_ciphers EECDH+AESGCM:EDH+AESGCM;
        ssl_ecdh_curve secp384r1;
        ssl_session_cache shared:SSL:10m;
        ssl_session_tickets off;
        ssl_stapling on;
        ssl_stapling_verify on;
       
        add_header Strict-Transport-Security "max-age=63072000; preload";
       
        client_max_body_size 0;
        send_timeout  3600s;
        proxy_redirect off;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_buffering off;
        proxy_connect_timeout  3600s;
        proxy_read_timeout  3600s;
        proxy_send_timeout  3600s;

        location ~ /proxmoxlib.js$|/favicon.ico$|/pve2/(locale|ext6|images|css|js)/|/fontawesome/(css|fonts)/|/framework7/(css|fonts)/|/pwt/css/ {
            proxy_pass https://pmg.domain.local:8006;
        }
        location /quarantine {
            proxy_pass https://pmg.domain.local:8006;
        }
       
        location /api2 {
            location ~ /api2/(extjs|json|htmlmail)/(access/ticket$|version$) {
                proxy_pass https://pmg.domain.local:8006;
            }
            location ~ /api2/(extjs|json|htmlmail)/nodes/.+/subscription$ {
                proxy_pass https://pmg.domain.local:8006;
            }
            location ~ /api2/(extjs|json|htmlmail)/quarantine {
                proxy_pass https://pmg.domain.local:8006;
            }
            return 403;
        }
       
        location / {
            return 301 https://pmg.domain.tld/quarantine;
        }
}
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!