v2ray-core
v2ray-core copied to clipboard
ssh 访问 GitHub 出现 kex_exchange_identification
你正在使用哪个版本的 V2Ray?
服务器:
V2Ray 4.44.0 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.17.3 linux/amd64)
客户端:
V2Ray 4.44.0 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.17.3 darwin/amd64)
你的使用场景是什么?
服务器使用 nginx 设置反向代理,客户端通过 v2ray 可以上网
但使用 ssh 访问 GitHub 出现 kex_exchange_identification(换 shadowsocks 则正常)
你看到的异常现象是什么?
% ssh [email protected] -v
OpenSSH_8.1p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/qianbinbin/.ssh/config
debug1: /Users/qianbinbin/.ssh/config line 1: Applying options for *
debug1: /Users/qianbinbin/.ssh/config line 9: Applying options for github.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 47: Applying options for *
debug1: Executing proxy command: exec nc -X 5 -x 127.0.0.1:1088 github.com 22
debug1: identity file /Users/qianbinbin/.ssh/id_ed25519 type 3
debug1: identity file /Users/qianbinbin/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.1
debug1: kex_exchange_identification: banner line 0: host\[email protected]
kex_exchange_identification: banner line contains invalid characters
你期待看到的正常表现是怎样的?
正常访问 GitHub
请附上你的配置
服务端配置:
{
"log": {
"loglevel": "warning"
},
"inbounds": [
{
"port": 50000,
"listen":"localhost",
"protocol": "vmess",
"settings": {
"clients": [
{
"id": ""
}
]
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"path": "/ray"
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}
客户端配置:
{
"log": {
"loglevel": "warning",
"access": "/usr/local/var/log/v2ray-access.log",
"error": "/usr/local/var/log/v2ray-error.log"
},
"inbounds": [
{
"port": 1088,
"listen": "localhost",
"protocol": "socks",
"sniffing": {
"enabled": true,
"destOverride": ["http", "tls"]
},
"settings": {
"auth": "noauth",
"udp": false
}
}
],
"outbounds": [
{
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": "",
"port": 443,
"users": [
{
"id": ""
}
]
}
]
},
"streamSettings": {
"network": "ws",
"security": "tls",
"wsSettings": {
"path": "/ray"
}
}
}
]
}
请附上出错时软件输出的错误日志
服务器端错误日志:
// 在这里附上服务器端日志
客户端错误日志:
// 在这里附上客户端日志
请附上访问日志
// 在这里附上服务器端日志
其它相关的配置文件(如 Nginx)和相关日志
ssh 配置文件:
% cat ~/.ssh/config
Host *
AddKeysToAgent yes
UseKeychain yes
# IdentityFile ~/.ssh/id_rsa
IdentityFile ~/.ssh/id_ed25519
#
#
Host github.com
# HostName github.com
User git
#
# ProxyCommand socat - PROXY:127.0.0.1:%h:%p,proxyport=8080
#
# ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p
ProxyCommand nc -X 5 -x 127.0.0.1:1088 %h %p
1080 是 shadowsocks 端口,1088 是 v2ray 端口
nginx 日志正常
如果 V2Ray 无法启动,请附上 --test
命令的输出
如果 V2Ray 服务运行异常,请附上 journal 日志
疑似有用链接:https://www.v2ex.com/t/807649
根据 这个 ,要不看看你 nginx 的配置
nginx 配置是用的 https://toutyrater.github.io/advanced/wss_and_web.html ,我也感觉哪里不对
server {
root /var/www/domain.com/html;
server_name domain.com;
# https://toutyrater.github.io/advanced/wss_and_web.html
location /ray { # 与 V2Ray 配置中的 path 保持一致
proxy_redirect off;
proxy_pass http://localhost:50000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
# Show realip in v2ray access.log
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = domain.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
server_name domain.com;
return 404; # managed by Certbot
}
可能找到问题所在了,与 socks5 兼容性有关,代理时使用 nc -X 4
指定 socks4 就可以正常访问:
ProxyCommand nc -X 4 -x 127.0.0.1:1088 %h %p
没怀疑过原来是这里,浏览器 SwitchyOmega 插件也用的 socks5,一直可以正常浏览网页,而且根据 官方文档:
This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 5 days
这是否属于 bug,请开发者自行确认一下
This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 5 days