tls+websocket+nginx配置下rejected: invalid user
- 你正在使用哪个版本的 V2Ray? 服务器:V2Ray 4.18.0 (Po) 20190228 客户端:V2Ray 4.18.0 (Po) 20190228
- 你的使用场景是什么? Chrome通过socks代理上Google
- 你看到的不正常的现象是什么? chrome连接被关闭,服务器日志显示rejected: invalid user
- 你期待看到的正确表现是怎样的? 正常访问google
- 请附上你的配置
服务器端配置:
{
"log": {
"access": "/var/log/v2ray/access.log",
"error": "/var/log/v2ray/error.log",
"loglevel": "info"
},
"inbounds": [{
"port": 10086,
"listen": "127.0.0.1",
"protocol": "vmess",
"settings": {
"client": [{
"id": "12377893-c759-42ff-b43a-b48030d122a2",
"alterId": 64
}]
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"path": "/12377893-c759-42ff-b43a-b48030d122a2/"
}
}
}],
"outbounds": [{
"protocol": "freedom",
"settings": {},
"tag": "out"
}]
}
客户端配置:
{
"log": {
"access": "/var/log/v2ray/access.log",
"error": "/var/log/v2ray/error.log",
"loglevel": "info"
},
"inbounds": [{
"listen": "127.0.0.1",
"protocol": "socks",
"port": 10086,
"sniffing": {
"enabled": true,
"destOverride": ["http", "tls"]
},
"settings": {
"auth": "noauth",
"udp": false
}
}],
"outbounds": [{
"protocol": "vmess",
"settings": {
"vnext": [{
"address": "fakedomain.me",
"port": 443,
"users": [{
"id": "12377893-c759-42ff-b43a-b48030d122a2",
"alterId": 64
}]
}]
},
"streamSettings": {
"network": "ws",
"security": "tls",
"tlsSettings": {
"serverName": "fakedomain.me",
"allowInsecure": true
},
"wsSettings": {"path": "/12377893-c759-42ff-b43a-b48030d122a2/"}
}
}]
}
- 请附上出错时软件输出的错误日志。在 Linux 中,日志通常在
/var/log/v2ray/error.log文件中。
服务器端错误日志:
2019/03/31 07:43:40 [Info] [1471985136] v2ray.com/core/app/proxyman/inbound: connection ends > v2ray.com/core/proxy/vmess/inbound: invalid request from 39.000.000.000:51738 > v2ray.com/core/proxy/vmess/encoding: invalid user
客户端错误日志:
2019/03/31 15:43:40 [Info] [405034652] v2ray.com/core/proxy/vmess/outbound: tunneling request to tcp:www.google.com:443 via tcp:fakedomain.me:443
2019/03/31 15:43:40 [Info] [405034652] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/vmess/outbound: connection ends > v2ray.com/core/proxy/vmess/outbound: failed to read header > v2ray.com/core/proxy/vmess/encoding: failed to read response header > websocket: close 1000 (normal)
2019/03/31 15:43:40 [Info] [405034652] v2ray.com/core/app/proxyman/inbound: connection ends > v2ray.com/core/proxy/socks: connection ends > v2ray.com/core/proxy/socks: failed to transport all TCP response > io: read/write on closed pipe
- 请附上访问日志。在 Linux 中,日志通常在
/var/log/v2ray/access.log文件中。
2019/03/31 07:43:37 39.000.000.000:51728 rejected v2ray.com/core/proxy/vmess/encoding: failed to read request header > read tcp 127.0.0.1:10086->39.000.000.000:51728: i/o timeout
2019/03/31 07:43:40 39.000.000.000:51738 rejected v2ray.com/core/proxy/vmess/encoding: invalid user
客户端的访问日志都是类似
2019/03/31 15:43:37 tcp:127.0.0.1:54332 accepted tcp:www.google.com:443
- 其它相关的配置文件(如 Nginx)和相关日志。
server {
listen 443 ssl;
listen [::]:443 ssl;
ssl_certificate fakedomain.me.crt;
ssl_certificate_key fakedomain.me.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name fakedomain.me;
location / {
try_files $uri $uri/ =404;
}
location /12377893-c759-42ff-b43a-b48030d122a2 {
proxy_redirect off;
proxy_pass http://127.0.0.1:10086;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
- 如果 V2Ray 无法启动,请附上
--test输出。
可以启动
- 如果 V2Ray 服务运行不正常,请附上 journal 日志。
运行正常
- 其他信息:
客户端OS:Manjaro 18.0.4 Illyria 服务器OS:Ubuntu 18.10
以上信息域名均用fakedomain.me替换,客户端ip均用39.000.000.000替换。 证书是用acme.sh脚本申请的,chrome测试访问https页面正常,访问websocket地址会显示bad request. ~~tlsSettings里如果allowInsecure设置为false,则客户端会报"certificate signed by unknown authority".~~ 补全证书链之后,已经没有这个问题了。
以下为两个系统的时间,输出时间相差不超过1s 客户端时间:“2019年 03月 31日 星期日 16:04:37 CST” 服务器时间:“Sun Mar 31 08:04:38 UTC 2019”
你的工作系统是什么?为什么acme签发的是无效的,你能保证证书链正确吗
你的工作系统是什么?为什么acme签发的是无效的,你能保证证书链正确吗
客户端OS:Manjaro 18.0.4 Illyria 服务器OS:Ubuntu 18.10
证书的话,我目前用chrome访问的话是可以正常访问的,并不会显示不安全。证书链我google了一下,不是很懂是什么意思orz 下面是chrome显示的证书信息的一部分。
Issued by
Common Name (CN) Let's Encrypt Authority X3
Organization (O) Let's Encrypt
Organizational Unit (OU) <Not Part Of Certificate>
但是你现在打开了allowInsecure 前几天有报告Linux acme签发的问题,我建议你补全一下证书,然后打开NTP,看看有什么变化
但是你现在打开了allowInsecure 前几天有报告Linux acme签发的问题,我建议你补全一下,然后打开NTP,看看有什么变化
补全什么?没搞懂orz
https://certificatechain.io/
https://certificatechain.io/
好的,我用myssl.com提供的工具把证书链补全了,现在allowInsecure可以关闭了。 当然invalid user认证的问题还是没有解决= =
客户端和服务器端的用户 ID 不匹配; 客户端和服务器端的用户 alterId 不匹配; 客户端与服务器的时间不匹配,误差不能超过90秒钟
你再检查一遍吧
客户端和服务器端的用户 ID 不匹配; 客户端和服务器端的用户 alterId 不匹配; 客户端与服务器的时间不匹配,误差不能超过90秒钟
你再检查一遍吧
目前情况是这样,我改成普通的方式连接,一样invalid user。 我稍微看了v2ray的代码,写了一个go的输出unix时间的程序,分别在服务器和自己系统上运行,时间相差不到2s,算上延时,也不会超过90s。 uuid我重新换了一个,通过ssh拷贝粘贴到服务器配置上,删除了alterId项,还是一样invalid user。 我是真的绝望。。。 我之前搞过一个普通配置的,在手机上能正常连接,不知道为什么这次这么多问题。。。
查出来了,配置有问题。client没有写成复数形式,因为测试配置没有问题因此没有检查。 Issue close.