v2ray / v2ray-core

A platform for building proxies to bypass network restrictions.
https://www.v2ray.com/
MIT License
45.47k stars 8.96k forks source link

使用路径分流ws返回x509: certificate signed by unknown authority,必须开启allowInsecure:true才可以使用 #988

Closed LarkinZero closed 6 years ago

LarkinZero commented 6 years ago

Please skip to the English section below if you don't write Chinese.

中文: 提交 Issue 之前请先阅读 Issue 指引,然后回答下面的问题,谢谢。 除非特殊情况,请完整填写所有问题。不按模板发的 issue 将直接被关闭。

1) 你正在使用哪个版本的 V2Ray?(如果服务器和客户端使用了不同版本,请注明) v3.14 2) 你的使用场景是什么?比如使用 Chrome 通过 Socks/VMess 代理观看 YouTube 视频。 访问任何地址 3) 你看到的不正常的现象是什么?(请描述具体现象,比如访问超时,TLS 证书错误等) 使用路径分流ws返回x509: certificate signed by unknown authority,必须开启allowInsecure:true才可以使用 4) 你期待看到的正确表现是怎样的? 返回正常结果 5) 请附上你的配置(提交 Issue 前请隐藏服务器端IP地址)。

服务器端配置:

{
    "log": {
        "loglevel": "warning"
    },
    "inbound": {
        "port": 6880,
        "listen": "127.0.0.1",
        "protocol": "vmess",
        "allocate": {
            "strategy": "always"
        },
        "settings": {
            "clients": [
                {
                    "id": "xxx",
                    "level": 1,
                    "alterId": 32,
                    "security": "aes-128-gcm"
                }
            ],
            "default": {
                "level": 1,
                "alterId": 32
            }
        },
        "streamSettings": {
            "network": "ws",
            "wsSettings": {
                "connectionReuse": true,
                "path": "/phpmyadmin"
            }
        }
    },
    "outbound": {
        "protocol": "freedom",
        "settings": {
            "timeout": 30
        }
    }
}

客户端配置:

{
  "log": {
    "loglevel": "info"
  },
  "inbound": {
    "port": 1080,
    "listen": "127.0.0.1",
    "protocol": "socks",
    "settings": {
      "auth": "noauth",
      "udp": true
    }
  },
  "outbound": {
    "protocol": "vmess",
    "settings": {
      "vnext": [
        {
          "address": "abc.com",
          "port": 443,
          "users": [
            {
              "id": "xxx",
              "alterId": 32,
              "security": "aes-128-gcm"
            }
          ]
        }
      ]
    },
    "streamSettings": {
      "network": "ws",
      "security": "tls",
      "tlsSettings": {
        "serverName": "abc.com",
        "allowInsecure": true
      },
      "wsSettings": {
        "connectionReuse": true,
        "path": "/phpmyadmin"
      }
    },
    "mux": {
      "enabled": true
    }
  }
}

6) 请附上出错时软件输出的错误日志。在 Linux 中,日志通常在 /var/log/v2ray/error.log 文件中。

服务器端错误日志:

    // 在这里附上服务器端日志

客户端错误日志:

2018/03/27 10:25:47 [Warning] failed to handler mux client connection > Proxy|VMess|Outbound: failed to find an available destination > Retry: [Transport|Internet|WebSocket: failed to dial WebSocket > Transport|Internet|WebSocket: failed to dial to (wss://abc.com/phpmyadmin):  > x509: certificate signed by unknown authority] > Retry: all retry attempts failed

7) 请附上访问日志。在 Linux 中,日志通常在 /var/log/v2ray/access.log 文件中。

    // 在这里附上服务器端日志

8) 其它相关的配置文件(如 Nginx)和相关日志。

Caddyfile

http://abc.com {
    redir https://abc.com{url}
}
https://abc.com {
    root /home/wwwroot/www.abc.com
    gzip
    index index.html
    tls /root/.acme.sh/abc.com/abc.com.cer /root/.acme.sh/abc.com/abc.com.key
    proxy /phpmyadmin localhost:6880 {
        websocket
        header_upstream Connection {>Connection}
        header_upstream Upgrade {>Upgrade}
        header_upstream Host {Host}
    }
}
LarkinZero commented 6 years ago

看起来是我的证书问题,将caddyfile的tls字段移除后,使用caddy签名ssl证书后就可以正常访问了

kyalipay commented 4 months ago

经过测试,报这错时,把客户端 tls 设置里的,allowInsecure" 设置为 true, 即可解决, 缺省为 false.