ubuntuusers.de

XMPP over HTTPS / port multiplexing mit sslh

Status: Gelöst | Ubuntu-Version: Server 16.10 (Yakkety Yak)
Antworten |

teachai

Anmeldungsdatum:
17. Januar 2012

Beiträge: 172

Hallo zusammen,

ich habe folgende Plan. An der Umsetzung bin ich leider bisher gescheitert. Ich habe einen Prosody Server und Nginx mit Nextcloud auf der selbern Maschine am laufen. Gerne möchte ich das "XEP-0368: SRV records for XMPP over TLS…" umsetzen.

Natürlich ist eigentlich Port 443 schon von nginx belegt. Zur Info, Nextcloud habe ich mithilfe dieser super Anleitung konfiguriert https://www.c-rieger.de/nextcloud-installation-guide/. Das Port multiplexing möchte ich mit http://www.rutschle.net/sslh realisieren. Hier habe ich mich angelehnt an https://wiki.debian.org/InstallingProsody#XMPP_over_HTTPS.

Folgendes habe ich bisher konfiguriert:

  1. nginx gateway.conf listen auf 4433 gesetzt:

...
server {
       listen 80 default_server;
       server_name nc.mydomain.de 192.168.2.218;
       charset utf-8;
       root /var/www;
       location ^~ /.well-known/acme-challenge {
               proxy_pass http://127.0.0.1:81;
               proxy_redirect off;
       }
       location / {
               return 301 https://$host$request_uri;
       }
}

server {
       listen 4433 ssl http2 default_server;
       server_name nc.mydomain.de 192.168.2.218;
       charset utf-8;
       include /etc/nginx/geo.conf;
       include /etc/nginx/sslnc.conf;

       ### Nextcloud ####
       location ^~ / {
               client_max_body_size 10240M;
               proxy_max_temp_file_size 10240M;
               proxy_connect_timeout 300;
               proxy_send_timeout 300;
               proxy_read_timeout 300;
               send_timeout 300;
               proxy_set_header Host $host;
               proxy_set_header X-Real-IP $remote_addr;
               proxy_set_header X-Forwarded-Proto $scheme;
               proxy_pass http://127.0.0.1:82;
               proxy_http_version 1.1;
               proxy_set_header Connection "";
               proxy_redirect off;
               proxy_buffering off;
               proxy_request_buffering off;
       }
...

2. legacy_ssl_ports = { 5223 } zur prosody.cfg.lua hinzugefügt

3. SRV records erstellt an mydoamin.de (No-IP.com):

_xmpp-client._tcp 5 / 1 xmpp.evolizzy.de 5222

_xmpp-client._tcp 15 / 1 xmpp.evolizzy.de 443

_xmpps-client._tcp 20 / 1 xmpp.evolizzy.de 443

_xmpps-client._tcp 10 / 1 xmpp.evolizzy.de 5223

1
2
3
dig srv _xmpp-client._tcp.mydomain.de @8.8.8.8 +short 
5 1 5222 xmpp.mydomain.de.
15 1 443 xmpp.mydomain.de.
1
2
3
dig srv _xmpps-client._tcp.mydomain.de @8.8.8.8 +short
10 1 5223 xmpp.mydomain.de.
20 1 443 xmpp.mydoamin.de.

4. sslh.cfg erstellt:

verbose: false;        
foreground: false;     
inetd: false;          
numeric: false;        
transparent: false;    
timeout: 2;            
user: "nobody";        
pidfile: "/var/run/sslh/sslh.pid";             


# Change hostname with your external address name. Note: It should not be resolving to 127.0.0$
listen:                
(                      
    { host: "xmpp.mydomain.de"; port: "443"; }                 
);                     

protocols:             
(                      
   { name: "tls"; host: "localhost"; port: "5223"; alpn_protocols: [ "xmpp-client" ]; log_leve$   # catch anything else TLS                   
   { name: "tls"; host: "localhost"; port: "4433";},                                           
   { name: "xmpp";    host: "localhost"; port: "5222"; },                                      
   { name: "timeout"; host: "localhost"; port: "4433";}                                        
);                     

on-timeout: "timeout";

So jetzt habe ich den webserver neugestartet.

Dann sslh gestartet:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
sudo sslh  -v -f -F/home/homeuser/sslh.cfg
tls addr: localhost.localdomain:hpvirtgrp. libwrap service: (null) log_level: 0 family 10 10 []
tls addr: localhost.localdomain:vop. libwrap service: (null) log_level: 1 family 10 10 []
xmpp addr: localhost.localdomain:xmpp-client. libwrap service: (null) log_level: 1 family 10 10 []
timeout addr: localhost.localdomain:vop. libwrap service: (null) log_level: 1 family 10 10 []
listening on:
        p.t-ipconnect.de:https     []
timeout: 2
on-timeout: timeout
listening to 1 addresses
turning into nobody
sslh-fork v1.18-28-gf4d2a8d started

Probem es kommt nix bei sslh an. Nicht wenn ich nc.mydomain.de noch wenn ich mich per xmpp.mydomain.de:443 per xmpp verbinden will. Wenn ich in der sslh config den { host: "xmpp.mydomain.de"; port: "443"; } auf { host: "0.0.0.0"; port: "443"; } stelle bekomme ich wenigsten eine Rückmeldung vom sslh. Wenn ich nc.mydoamin.de aufrufe:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
sudo sslh  -v -f -F/home/homeuser/sslh.cfg
tls addr: localhost.localdomain:hpvirtgrp. libwrap service: (null) log_level: 0 family 10 10 []
tls addr: localhost.localdomain:vop. libwrap service: (null) log_level: 1 family 10 10 []
xmpp addr: localhost.localdomain:xmpp-client. libwrap service: (null) log_level: 1 family 10 10 []
timeout addr: localhost.localdomain:vop. libwrap service: (null) log_level: 1 family 10 10 []
listening on:
        0.0.0.0:https   []
timeout: 2
on-timeout: timeout
listening to 1 addresses
turning into nobody
sslh-fork v1.18-28-gf4d2a8d started
accepted fd 4
**** writing deferred on fd -1
probing for tls
matching [h2] with [xmpp-client]
Unknown ALPN name: h2
matching [http/1.1] with [xmpp-client]
Unknown ALPN name: http/1.1
probing for tls
connecting to localhost.localdomain:vop family 10 len 28
forward to tls failed:connect: Connection refused
connecting to localhost.localdomain:vop family 2 len 16
tls:connection from p.d.t-ipconnect.de:51352 to odroid:https forwarded from localhost.localdomain:37091 to localhost.localdomain:vop
flushing deferred data to fd 3

Allerdings schmeißt mein nginx hier ein:

403 Forbidden.

xmpp auf xmpp.mydomain.de:443 per conversations android app:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
...
accepted fd 4
**** writing deferred on fd -1
probing for tls
Request did not begin with TLS handshake.
probing for tls
probing for xmpp
**** writing deferred on fd -1
probing for xmpp
connecting to localhost.localdomain:xmpp-client family 10 len 28
xmpp:connection from p508782A7.dip0.t-ipconnect.de:43369 to odroid:https forwarded from localhost.localdomain:46420 to localhost.localdomain:xmpp-client
flushing deferred data to fd 3

Meine Fragen sind:

1. Warum kommt "keine Verbindung rein" wenn ich sslh auf listen: { host: "xmpp.mydomain.de"; port: "443"; } stehen habe?

2. Warum wird nicht richtig an nginx weitergeleitet (403 Forbidden)

Wäre super wenn hier hier jemand helfen kann.

Vielen Dank schonmal

teachai

(Themenstarter)

Anmeldungsdatum:
17. Januar 2012

Beiträge: 172

So. Ich bin selber schon mal einen Schritt weiter:

1. Warum kommt "keine Verbindung rein" wenn ich sslh auf listen: { host: "xmpp.mydomain.de"; port: "443"; } stehen habe?

Das liegt wohl daran das das Interface hinter einem NAT hängt. Ich lasse es also auf host: "0.0.0.0". Ich komme also je nachdem am porsody oder ngnix raus. So wie es sein soll.

2. Warum wird nicht richtig an nginx weitergeleitet (403 Forbidden)

Jetzt habe ich aber noch das Problem mit nginx. Ich habe keine Ahnung warum ich nicht auf nc.mydomain.de Zugriff bekomme.

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14314

teachai schrieb:

2. Warum wird nicht richtig an nginx weitergeleitet (403 Forbidden)

Bekommst Du ohne den Multiplexer, diese Meldung (http status code) vom nginx nicht?

teachai

(Themenstarter)

Anmeldungsdatum:
17. Januar 2012

Beiträge: 172

@lubux: Nein..Die habe ich nicht bekommen.

Allerdings habe ich das Problem gelößt bekommen. Leider kann ich nicht genau sagen was es war. Ich habe sslh deaktiviert. Listen port von nginx auf 443 gestellt. Dann habe ich gesehen des es ein nextcloud update gibt. Habe geupdated. Listenport wieder geändert. sslh gestartet. Und jetzt läuft es.

Ich weiß nicht genau was es war.

Trotzdem vielen dank.

Antworten |