Discobot's certificate und hijack.rb sind in einer Bar

…und web.socketed.template geht los :grin:

Das hier verwirrt mich… Ich habe ein scheinbar einwandfreies https-Discourse, außer dass certificate.svg nicht lädt. (Fehler 500, es ist kein Bug, es liegt definitiv an meiner Einrichtung :sob:)

  • Ich verwende web.socketed.template und handle SSL außerhalb des Containers (daher ist web.ssl.template in der app.yml noch immer auskommentiert)
  • Das Rails-Log sagt: Failed to process hijacked response correctly : Failed to open TCP connection to my.domain:443 (Connection refused - connect(2) for "my.domain" port 443)

Ich bin in den Container gegangen, um zu prüfen, was in /etc/nginx/conf.d/discourse.conf steht. Wie erwartet habe ich keinen https-Block gesehen (der meines Erachtens erschienen wäre, wenn web.ssl.template aktiviert wäre).

Ist es möglich, dass dieser Teil von web.socketed.template:

 - replace:
  filename: "/etc/nginx/conf.d/discourse.conf"
  from: /listen 443 ssl http2;/
  to: |
    listen unix:/shared/nginx.https.sock ssl http2;
    set_real_ip_from unix:;

nicht angewendet werden konnte, weil web.ssl.template nicht aktiviert ist, und dies somehow dazu führt, dass der Hijack fehlschlägt?

Aber warum nur für Discobots Zertifikat? Wird Hijack nicht oft verwendet, zum Beispiel für Oneboxing? Arg… Ich befinde mich am Rand meines Wissens, mein Kopf schmerzt :sweat_smile:

ps. Das SSL-Snippet

ssl_dhparam /etc/ssl/certs/dhparam.pem;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:1m;
ssl_session_tickets off;

ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers off;
add_header Strict-Transport-Security 'max-age=31536000';

und der nginx-Block

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name my.domain;

    ssl on;
    ssl_certificate /etc/letsencrypt/live/my.domain/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/my.domain/privkey.pem;
    include /etc/nginx/snippets/ssl.conf;

    client_max_body_size 0;

    http2_idle_timeout 5m; 

    location / {
        proxy_pass http://unix:/var/discourse/shared/standalone/nginx.http.sock:;
        proxy_set_header Host $http_host;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
    }
}