Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

[Bug] v1.2.4-beta.3回落启用PROXY protocol后程序崩溃 #154

Closed
xiya233 opened this issue Sep 27, 2022 · 2 comments
Closed

[Bug] v1.2.4-beta.3回落启用PROXY protocol后程序崩溃 #154

xiya233 opened this issue Sep 27, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@xiya233
Copy link

xiya233 commented Sep 27, 2022

Describe the bug【描述 bug】

nginx前置,使用ngx_stream_ssl_preread模块做sni分流,verysimple后置回落到nginx的站点,当verysimple回落启用xver =1或者xver =2后程序崩溃退出。

To Reproduce【如何复现该bug】

verysimple回落启用xver=1或者2,nginx配置接收proxy_protocol,之后用浏览器访问回落站点触发bug。

Expected behavior【预期的行为】

测试旧版本v1.2.4-beta.2是正常的。

Envs (please complete the following information):【系统环境】

Debian11

Config file 【配置文件,客户端服务端配置都提供】

verysimple服务端配置:

[[listen]]
protocol = "vlesss"
version = -1
uuid = ""
ip = "127.0.0.1"
host = "vlesss.example.com"
port = 62000
sniffing.enabled = true
cert = "vlesss.example.com.pem"
key = "vlesss.example.com.key"
insecure = false
extra = { tls_minVersion = "1.2" } 
xver = 2
fullcone = true

[[fallback]]
dest = 62001
xver = 2

[[dial]]
protocol = "direct"
fullcone = true

nginx.conf:

stream {
        map $ssl_preread_server_name $verysimple {
                vlesss.example.com vlesss;
        }
        upstream vlesss {
                server 127.0.0.1:62000;
        }
        server {
                listen 443      reuseport;
                listen [::]:443 reuseport;
                proxy_pass      $verysimple;
                ssl_preread     on;
                proxy_protocol  on;
        }
}

nginx回落站点的配置:

server {
        listen 80;
        server_name vlesss.example.com;
        if ($host = vlesss.example.com) {
                return 301 https://$host$request_uri;
        }
        return 404;
}

server {
        listen 127.0.0.1:62001 proxy_protocol;
        set_real_ip_from 127.0.0.1;
        real_ip_header proxy_protocol;
        server_name vlesss.example.com;
        index index.html;
        root /var/www/html;
}

Debug Log 【Debug日志, 客户端 和 服务端 的 日志 都提供】

服务端崩溃日志:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x86e31b]

goroutine 11 [running]:
github.com/e1732a364fed/v2ray_simple/netLayer.WritePROXYprotocol(0x2, {0x7ff60dd75598, 0xc00020fba0}, {0x0, 0x0})
        github.com/e1732a364fed/v2ray_simple/netLayer/proxyProtocol.go:69 +0x49b
github.com/e1732a364fed/v2ray_simple.dialClient({0x34cbf, {0xcb4d08, 0xc000219730}, {0xcb3130, 0xc00020fba0}, {0xcb6b18, 0xc00023c1e0}, {0xcb7980, 0xc0000e82a0}, 0x0, ...}, ...)
        github.com/e1732a364fed/v2ray_simple/main.go:1124 +0x132d
github.com/e1732a364fed/v2ray_simple.dialClient_andRelay({0x34cbf, {0xcb4d08, 0xc000219730}, {0xcb3130, 0xc00020fba0}, {0xcb6b18, 0xc00023c1e0}, {0xcb7980, 0xc0000e82a0}, 0x0, ...}, ...)
        github.com/e1732a364fed/v2ray_simple/main.go:1426 +0x2d7
github.com/e1732a364fed/v2ray_simple.passToOutClient({0x34cbf, {0xcb4d08, 0xc000219730}, {0xcb3130, 0xc00020fba0}, {0xcb6b18, 0xc00023c1e0}, {0xcb7980, 0xc0000e82a0}, 0x0, ...}, ...)
        github.com/e1732a364fed/v2ray_simple/main.go:944 +0x29e9
github.com/e1732a364fed/v2ray_simple.handshakeInserver_and_passToOutClient({0x34cbf, {0xcb4d08, 0xc000219730}, {0xcb3130, 0xc00020fba0}, {0xcb6b18, 0xc00023c1e0}, {0xcb7980, 0xc0000e82a0}, 0x0, ...})
        github.com/e1732a364fed/v2ray_simple/main.go:526 +0x1eb
github.com/e1732a364fed/v2ray_simple.handleNewIncomeConnection({0xcb6b18, 0xc00023c1e0}, {0xcb7980, 0xc0000e82a0}, {0xcb4d08, 0xc000219730}, 0x1100bc0)
        github.com/e1732a364fed/v2ray_simple/main.go:371 +0x1498
github.com/e1732a364fed/v2ray_simple.ListenSer.func2({0xcb4d08?, 0xc000219730?})
        github.com/e1732a364fed/v2ray_simple/main.go:141 +0x45
created by github.com/e1732a364fed/v2ray_simple/netLayer.loopAccept
        github.com/e1732a364fed/v2ray_simple/netLayer/listen.go:63 +0x2cd
@xiya233 xiya233 added the bug Something isn't working label Sep 27, 2022
@e1732a364fed
Copy link
Owner

收到。

@e1732a364fed
Copy link
Owner

e1732a364fed commented Oct 31, 2022

新的beta版本应该修复了该问题, 见 89e70ed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants