项目场景:
提示:windows10 20H1
nginx 443 proxy server_name to softether ssl
xxx域名nginx部分配置文件
server {
# listen 443 ssl;
# server_name sstp.xxx.xxx;
# access_log /var/log/nginx/sstphost.access.log main;
# ssl_certificate /etc/nginx/conf.d/fullchain.crt;
# ssl_certificate_key /etc/nginx/conf.d/private_all.key;
# ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; #加密算法
# ssl_prefer_server_ciphers on;
# location / {
# # proxy_pass https://127.0.0.1:5555/;
# proxy_pass sstpbackend; #只能使用分流模式不然400
# proxy_http_version 1.1; #代理使用的http协议
# #反向代理,
# proxy_set_header Host $host;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# fastcgi_param HTTPS $https if_not_empty;
# proxy_set_header X-Forwarded-Proto https;
# }
# # 拦截websocket请求
# location /websocket {
# proxy_pass http://127.0.0.1:5555;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "upgrade";
# }
}
问题描述:
由于本地系统网络终止, the network connection was aborted by the local system nginx 在服务器中调试: tcpdump -i eth0 tcp port 443 -v
发现收到了数据,所以不是防火墙的原因
在 nginx中配置中 加入 access_log /var/log/nginx/sstphost.access.log main;
日志记录到了
[26/May/2021:11:00:04 +0800] "SSTP_DUPLEX_POST /sra_{BA195980-CD49-458b-9E23-C84EE0ADCD75}/ HTTP/1.1" 400 157 "-" "-" "-"
400错误
sstp window也可以开启log日志,好像是在适配器哪里配置。
原因分析:
百度一下,nginx 说 content-length 过大,所以400
也有的说sstp 要full stack 的代理才能解决
解决方案:
- 方案1:找个能full stack. 像sniproxy。 不想换代理。不用
- 方案2:修改长度值。没试过。
- 方案3:nginx的stream模式。这个可以成功,但不能用server_name区别。不能域名区别。因为https在应用层,而stream在网络层
- 方案4:使用nginx的ngx_stream_ssl_preread_module模块,with-stream-ssl-preread-module原理是先到应用层拿到一些如域名信息,再回网络层转发。不过这是1.9版本之后才能的功能
- 方案5:直接在window里使用域名加端口访问如xxx.xxx:5555。 一样可以。多打几个字而已。
/ngx_stream_core_module
ngx_stream_ssl_module
ngx_http_map_module
测试配置
nginx -t -c /etc/nginx/nginx.conf
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
map 是在http结构里是$http_host,在stream里是 ?
map $ssl_preread_server_name $name{
sstp.xxx.xxx sstpbackend;
}
upstream sstpbackend {
# hash $remote_addr consistent;
server 127.0.0.1:5555;
}
stream是顶层结构?
systemctl restart nginx
ok
但这出现了另一个问题:证书的CN名称与传递的值不匹配。 xx.i.a 不匹配 i.a 浏览器输入https:// xx.i.a 显示不安全。
原因,map 函数没起作用。 泛域名不起作用。nginx还是用其他域名证书。ssl_pread on 只能在stream模块?
在代理下,443又被其它证书占用,softether证书完全用不上。。。
待解决.