Diskussion:HTTPS-Absicherung & Authentifizierung via nginx Webserver

Aus FHEMWiki
Zur Navigation springen Zur Suche springen

Websocket

Ich würde gerne die Anleitung um den Punkt Websocket Konfiguration erweitern, möchte das aber gerne vorher abstimmen.

Die gezeigte Konfiguration erlaubt es aktuell nicht das das Webfrontend websockets nutzt. Basierend auf dem Foren Eintrag https://forum.fhem.de/index.php/topic,67220.msg587019.html#msg587019 habe ich folgende Konfiguration erstellt:

server {
    listen 80;
    return 301 https://$host$request_uri;
}

server {

    listen 443;
    server_name fhempi;

    ssl_certificate           /etc/nginx/cert.crt;
    ssl_certificate_key       /etc/nginx/cert.key;

    ssl on;
    ssl_session_cache  builtin:1000  shared:SSL:10m;
    ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
    ssl_prefer_server_ciphers on;

    access_log            /var/log/nginx/fhem.access.log;

    location / {

      set $my_http_upgrade "";
      set $my_connection "Connection";

      proxy_set_header        Host $host;
      proxy_set_header        X-Real-IP $remote_addr;
      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header        X-Forwarded-Proto $scheme;
      proxy_http_version      1.1;

      if ($http_upgrade = "websocket") {
        set $my_http_upgrade $http_upgrade;
        set $my_connection "upgrade";
      }

      proxy_set_header Upgrade $my_http_upgrade;
      proxy_set_header Connection $my_connection;

      proxy_pass          http://localhost:8083;
      #proxy_read_timeout  20736000;
      #proxy_buffering     off;

      auth_basic "Restricted Content";
      auth_basic_user_file /etc/nginx/.htpasswd;

      # proxy_redirect      http://localhost:8083 https://localhost;
    }

}

--Sickboy (Diskussion) 16:57, 28. Apr. 2017 (CEST)




Hi Sickboy! Danke für deine Anregung! Sorry für die späte Antwort ;-)

Ich baue dein Websocket-Beispiel in die Vorzeige-Cfg ein und kommentiere sie aber erstmal. Klingt wirklich vielversprechend und ich werde das demnächst mal testen.

--Andremotz (Diskussion) 11:22, 29. Okt. 2017 (CET)