v2fly / v2ray-core

A platform for building proxies to bypass network restrictions.
https://v2fly.org
MIT License
29.46k stars 4.65k forks source link

Allow setting permission for domain socket file #2554

Closed raidenii closed 1 year ago

raidenii commented 1 year ago

What version of V2Ray are you using?

v5.7.0

What's your scenario of using V2Ray?

Running v2ray in docker container, inbound Trojan, listening on unix domain socket, serving as backend for nginx proxy

What problems have you encountered?

The socket file has default file mode of 0755 and not changable via config file. nginx has to run as the same user as v2ray to access the socket file, which is not feasible in prod env.

What's your expectation?

Allowing setting socket file permission via config file - this feature exists in xray, in the format like "listen": "/dev/shm/v2fly.sock,0666" Abstract domain socket is not a solution because 1) neither nginx nor caddy supports that as of now, and 2) even if they do, for docker, there is no way to share the abstracted domain socket between container and the host.

Please attach your configuration here

Server configuration:

{
    "inbounds": [
        {
            "protocol": "trojan",
            "settings": {
                "users": [
                    "some-long-user-password"
                ]
            },
            "listen": "/dev/shm/v2fly/v2fly0.sock",
            "streamSettings": {
                "transport": "ws",
                "transportSettings": {
                    "path": "some-random-ws-path"
                },
                "security": "none"
            }
        }
    ],

    "outbounds": [
        {
            "protocol": "freedom"
        }
    ]
}

Other configurations (such as Nginx) and logs here

...
location /some-random-ws-path/ {
                ...
                if ($http_upgrade = "websocket") {
                        proxy_pass http://unix:/dev/shm/v2fly0.sock;
                }
                ...
        }
...
github-actions[bot] commented 1 year ago

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

raidenii commented 1 year ago

Bump - can we please have the PR reviewed and merged when appropriate? Thanks.