Closed scavenger-caesar closed 4 months ago
xray的服务端streamsettings里加上
...
"tcpSettings": {
"acceptProxyProtocol": true
}
即可从nginx的stram转发中获取真实的用户ip
{
"log": {
"loglevel": "debug"
},
"inbounds": [
{
"listen": "0.0.0.0", // "0.0.0.0" 代表同时监听所有的IPv4和IPv6
"port": 4443,
"protocol": "vless",
"settings": {
"clients": [
{
"id": "3dc3b7b3-56c1-4d8a-9f15-a4831bf8f7a1",
"flow": "xtls-rprx-vision"
}
],
"decryption": "none"
},
"streamSettings": {
"network": "tcp",
"security": "reality",
"realitySettings": {
"show": true,
"dest": "pytorch.org:443", // A website that support TLS1.3 and h2. You can also use `1.1.1.1:443` as dest
// 证书列表里允许的域名
"serverNames": [
"pytorch.org" // A server name in the cert of dest site. If you use `1.1.1.1:443` as dest, then you can leave `serverNames` empty, it is a possible ways to bypass Iran's internet speed restrictions.
],
"privateKey": "kIuej6RPn2Hgcg_VN9gAhC_w5i-MjecCkizkRJtJzlE", // run `xray x25519` to generate. Public and private keys need to be corresponding.
"shortIds": [// Required, list of shortIds available to clients, can be used to distinguish different clients
"d88a233765897aa6" // openssl rand -hex <1-8>
]
},
"tcpSettings": {
// 仅用于 inbound,指示是否接收 PROXY protocol
"acceptProxyProtocol": true
}
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls",
"quic"
]
// "routeOnly": true
}
}
],
"outbounds": [
{
"protocol": "freedom",
"tag": "direct"
}
]
}
TIPS: streamsettings里的"xver"不能开启,否则会给伪装网站发送带有PROXY协议头的请求;
楼主这个nginx配置比项目里的精简很多。 @chika0801 能说明一下项目里这个配置的nginx.conf-http-server-location里面的是什么吗?
set $website www.lovelive-anime.jp;
proxy_pass https://$website;
这个www.lovelive-anime.jp是做什么的?楼主这个配置那些东西也没有不是就够用吗?
它的意思是,NGINX反向代理这个网址,显示这网址的内容。
比如你在浏览器输入自己的域名时,显示的就是这网站的内容。
它只是我个人的爱好,你换其它网站也不影响什么。
它的意思是,NGINX反向代理这个网址,显示这网址的内容。
比如你在浏览器输入自己的域名时,显示的就是这网站的内容。
它只是我个人的爱好,你换其它网站也不影响什么。
知道了。非常感谢解答哈!
还有个地方不明白需要请教,就是项目里比楼主多出来的另一部分:
server {
listen 127.0.0.1:8002 ssl proxy_protocol;
http2 on; # This directive appeared in version 1.25.1. Otherwise use it like this. "listen 127.0.0.1:8002 ssl http2 proxy_protocol;"
set_real_ip_from 127.0.0.1;
real_ip_header proxy_protocol;
ssl_certificate /etc/ssl/private/example.com.cer;
ssl_certificate_key /etc/ssl/private/example.com.key;
...
}
这一部分楼主是没有的。尤其ssl_certificate这的证书需要自己申请吗?这不是伪装目标sni的证书吗?自己怎么做?
尤其ssl_certificate这的证书需要自己申请吗?
是的
这不是伪装目标sni的证书吗?自己怎么做?
这应该是REALITY的偷自己形式,NGINX监听本机 8002 端口,你自己事前申请(准备)好 SSL 证书。
至于怎么申请SSL证书,先自己买个域名,再用比如acme,网上都有教程来申请 。
这有2个初略流程
https://github.com/chika0801/Xray-install/blob/main/acme.md
https://github.com/chika0801/Xray-install/blob/main/certbot.md
尤其ssl_certificate这的证书需要自己申请吗?
是的
这不是伪装目标sni的证书吗?自己怎么做?
这应该是REALITY的偷自己形式,NGINX监听本机 8002 端口,你自己事前申请(准备)好 SSL 证书。
至于怎么申请SSL证书,先自己买个域名,再用比如acme,网上都有教程来申请 。
这有2个初略流程
https://github.com/chika0801/Xray-install/blob/main/acme.md
https://github.com/chika0801/Xray-install/blob/main/certbot.md
好,那明白了。不知道是不是把steal oneself文件夹和shunting的重整下好点。小白有点晕。。
NGINX SNI分流那个链接,其实是NGINX SNI分流加REALITY偷自己 2合1,我只是没写得非常明白而以。
(希望能请教一下nginx和xray server的配置要如何修改可以实现如下结果)
1. 期望结果
1) 流入xray请求的SNI和伪装的目标网站一致 2) 通过nginx筛选SNI, 不符合伪装的SNI连接均拒绝
2. 尝试过程
2.1 实现思路
2.2 测试环境
利用docker部署测试环境
2.2.1 docker compose内容
2.2.2 xray server内容
2.2.3 nginx配置内容
2.2.4 xray client配置内容
2.3 测试结果
无法正常fq
2.3.1 服务端log (nginx + xray server)
2.3.2 客户端log (xray client)