Running smp-server and xftp-server on the same host
In the installation guide for the SMP server, the configuration file explicitly specifies ports 5223 and 443. Port 443 is used by the built-in web server This raises a question: How do people run an xftp-server on the same host if port 443 is already in use? So, is this an outdated instruction, or am I misunderstanding something? (Or do I need to run the xftp-server on a completely different server?)
The answer is a proxy that understands SNI (I think most of them do), but you still need to use two different domains (or subdomains). I achieve that with Nginx stream module: I make the two servers run on different ports and then I make the proxy listen on 443 and decide where to redirect the traffic based on Server Name Indication.
Initially, when reading the instructions, I assumed by default that both the SMP server and the XFTP server should be installed on the same host. However, the instructions show that the SMP server uses port 5222 for transport and port 443 for the static page. Then, right after that, the manual for the XFTP server also requires port 443, which leads to a port conflict.
For the most part, I don’t really care about the minimal statistics web page as much as I do about having a fully functional XFTP server
I am trying to configure Nginx stream split to run SMP and XFTP server on ports 443 with single IP, but encountered some problems.
- The Android app does not send the SNI, even if the SMP server was created with the --fqdn option.
- Non-standard ALPN Protocol value "smp/1", which can be used, for example, as a pattern for blocking traffic (RKN).
Extension: application_layer_protocol_negotiation (len=8)
Type: application_layer_protocol_negotiation (16)
Length: 8
ALPN Extension Length: 6
ALPN Protocol
ALPN string length: 5
ALPN Next Protocol: smp/1
Nginx config
...
...
stream {
map $ssl_preread_server_name $backend_name {
smp.mydomain.local smp;
xftp.mydomain.local xftp;
default def;
}
upstream smp {
server 10.5.5.2:443;
}
upstream xftp {
server 10.5.5.3:443;
}
upstream def {
server 127.0.0.1:8080;
}
server {
listen 443 reuseport;
proxy_pass $backend_name;
proxy_ssl_verify off;
proxy_ssl_protocols TLSv1.2 TLSv1.3;
ssl_preread on;
}
}
SMP string in Android App (version 6.4.7 326):
smp://[email protected]