SagerNet / sing-box

The universal proxy platform
https://sing-box.sagernet.org/
Other
20.49k stars 2.45k forks source link

Route rules not work with user (router: failed to search process: netlink message: NLMSG_ERROR) #231

Closed meinthebox closed 2 years ago

meinthebox commented 2 years ago

Welcome

Description of the problem

Tried vmess user inbound, same error.

Version of sing-box

```console $ sing-box version sing-box version 1.1-beta14 Environment: go1.19.3 linux/amd64 Tags: with_quic,with_wireguard,with_acme CGO: disabled ```

Server and client configuration file

```console server: { "inbounds":[ { "tag":"socks-in", "type":"mixed", "listen":"::", "listen_port":2080 }, { "tag":"socks-test", "type":"mixed", "listen":"::", "listen_port":2081, "users": [ { "username": "test", "password": "admin" } ] } ], "outbounds":[ { "type":"vmess", "tag":"vmess-o1", "server":"my.vmessserver.xyz", "server_port":443, "uuid":"77777777-7777-7777-7777-777777777777", "network":"tcp", "tls":{ "enabled":true }, "packet_encoding":"", "transport":{ "type":"ws", "path":"/vvpath", "headers":{ }, "max_early_data":0, "early_data_header_name":"" } }, { "type":"shadowsocks", "tag":"rl-1", "server":"my.ssserver.xyz", "server_port":2444, "method":"aes-128-gcm", "password":"C45q3*x3^c!U0qs.", "plugin":"", "plugin_opts":"", "network":"tcp", "udp_over_tcp":true, "multiplex":{ } }, { "type":"direct", "tag":"direct" }, { "type":"block", "tag":"block" } ], "route":{ "rules":[ { "geosite":"cn", "geoip":"cn", "outbound":"direct" }, { "geoip":"private", "outbound":"direct" }, { "geosite":"category-ads-all", "outbound":"block" }, { "user":[ "test" ], "outbound":"rl-1" } ], "final": "vmess-o1", "auto_detect_interface":true } } client: { "dns":{ "disableFallbackIfMatch":true, "servers":[ { "address":"localhost", "domains":[ "geosite:cn" ], "skipFallback":true } ], "tag":"dns" }, "inbounds":[ { "listen":"127.0.0.1", "port":1079, "protocol":"socks", "settings":{ "auth":"noauth", "udp":true }, "sniffing":{ "destOverride":[ "http", "tls", "quic" ], "enabled":true, "metadataOnly":false, "routeOnly":true }, "tag":"socks-in" }, { "listen":"127.0.0.1", "port":1080, "protocol":"http", "sniffing":{ "destOverride":[ "http", "tls", "quic" ], "enabled":true, "metadataOnly":false, "routeOnly":true }, "tag":"http-in" } ], "log":{ "loglevel":"warning" }, "outbounds":[ { "domainStrategy":"AsIs", "protocol":"socks", "settings":{ "servers":[ { "address":"192.168.203.134", "port":2081, "users":[ { "pass":"admin", "user":"test" } ] } ] }, "streamSettings":{ "network":"tcp" }, "tag":"proxy" }, { "protocol":"freedom", "tag":"direct" }, { "protocol":"freedom", "tag":"bypass" }, { "protocol":"blackhole", "tag":"block" }, { "protocol":"dns", "proxySettings":{ "tag":"proxy", "transportLayer":true }, "settings":{ "address":"8.8.8.8", "network":"tcp", "port":53, "userLevel":1 }, "tag":"dns-out" } ], "policy":{ "levels":{ "1":{ "connIdle":30 } }, "system":{ "statsOutboundDownlink":true, "statsOutboundUplink":true } }, "routing":{ "domainMatcher":"mph", "domainStrategy":"AsIs", "rules":[ { "ip":[ "224.0.0.0/3", "169.254.0.0/16" ], "outboundTag":"block", "type":"field" }, { "outboundTag":"block", "port":"135-139", "type":"field" }, { "inboundTag":[ "socks-in", "http-in" ], "outboundTag":"dns-out", "port":"53", "type":"field" }, { "inboundTag":[ "dns-in" ], "outboundTag":"dns-out", "type":"field" }, { "domain":[ "geosite:category-ads-all", "domain:appcenter.ms", "domain:app-measurement.com", "domain:firebase.io", "domain:crashlytics.com", "domain:google-analytics.com" ], "outboundTag":"block", "type":"field" }, { "ip":[ "geoip:cn", "geoip:private" ], "outboundTag":"bypass", "type":"field" }, { "domain":[ "geosite:cn" ], "outboundTag":"bypass", "type":"field" } ] }, "stats":{ } } ```

Server and client log file

```console INFO[0000] router: using vmess[vmess-o1] as default outbound for connection INFO[0000] router: using direct[direct] as default outbound for packet connection WARN[0000] router: geoip database not exists: geoip.db INFO[0000] router: downloading geoip database INFO[0000] outbound/vmess[vmess-o1]: outbound connection to github.com:443 DEBUG[0000] dns: lookup domain my.vmessserver.xyz INFO[0000] dns: lookup succeed for my.vmessserver.xyz: 172.67.163.241 104.21.50.154 2606:4700:3036::6815:329a 2606:4700:3033::ac43:a3f1 INFO[0000] router: updated default interface ens33, index 2 INFO[0002] outbound/vmess[vmess-o1]: outbound connection to objects.githubusercontent.com:443 DEBUG[0002] dns: lookup domain my.vmessserver.xyz INFO[0002] dns: lookup succeed for my.vmessserver.xyz: 172.67.163.241 104.21.50.154 2606:4700:3036::6815:329a 2606:4700:3033::ac43:a3f1 INFO[0004] router: loaded geoip database: 250 codes WARN[0004] router: geosite database not exists: geosite.db INFO[0004] router: downloading geosite database INFO[0004] outbound/vmess[vmess-o1]: outbound connection to github.com:443 DEBUG[0004] dns: lookup domain my.vmessserver.xyz INFO[0004] dns: lookup succeed for my.vmessserver.xyz: 172.67.163.241 104.21.50.154 2606:4700:3036::6815:329a 2606:4700:3033::ac43:a3f1 INFO[0007] outbound/vmess[vmess-o1]: outbound connection to objects.githubusercontent.com:443 DEBUG[0007] dns: lookup domain my.vmessserver.xyz INFO[0007] dns: lookup succeed for my.vmessserver.xyz: 172.67.163.241 104.21.50.154 2606:4700:3036::6815:329a 2606:4700:3033::ac43:a3f1 INFO[0009] router: loaded geosite database: 1319 codes INFO[0009] inbound/mixed[socks-in]: tcp server started at [::]:2080 INFO[0009] inbound/mixed[socks-test]: tcp server started at [::]:2081 INFO[0009] sing-box started (9.533s) INFO[0023] [1185114784] inbound/mixed[socks-test]: inbound connection from 192.168.203.1:52033 INFO[0023] [1185114784] inbound/mixed[socks-test]: [test] inbound connection to vortex.data.microsoft.com:443 INFO[0023] [1185114784] router: failed to search process: netlink message: NLMSG_ERROR INFO[0023] [1185114784] outbound/vmess[vmess-o1]: outbound connection to vortex.data.microsoft.com:443 DEBUG[0023] [1185114784] dns: lookup domain my.vmessserver.xyz INFO[0023] [1185114784] dns: lookup succeed for my.vmessserver.xyz: 172.67.163.241 104.21.50.154 2606:4700:3036::6815:329a 2606:4700:3033::ac43:a3f1 INFO[0043] [450711210] inbound/mixed[socks-test]: inbound connection from 192.168.203.1:52043 INFO[0043] [450711210] inbound/mixed[socks-test]: [test] inbound connection to www.google.com:443 INFO[0043] [450711210] router: failed to search process: netlink message: NLMSG_ERROR INFO[0043] [450711210] outbound/vmess[vmess-o1]: outbound connection to www.google.com:443 DEBUG[0043] [450711210] dns: lookup domain my.vmessserver.xyz INFO[0043] [450711210] dns: lookup succeed for my.vmessserver.xyz: 172.67.163.241 104.21.50.154 2606:4700:3036::6815:329a 2606:4700:3033::ac43:a3f1 INFO[0045] [1294593220] inbound/mixed[socks-test]: inbound connection from 192.168.203.1:52046 INFO[0045] [1294593220] inbound/mixed[socks-test]: [test] inbound connection to d27xxe7juh1us6.cloudfront.net:443 INFO[0045] [1294593220] router: failed to search process: netlink message: NLMSG_ERROR INFO[0045] [1294593220] outbound/vmess[vmess-o1]: outbound connection to d27xxe7juh1us6.cloudfront.net:443 DEBUG[0045] [1294593220] dns: lookup domain my.vmessserver.xyz INFO[0045] [1294593220] dns: lookup succeed for my.vmessserver.xyz: 172.67.163.241 104.21.50.154 2606:4700:3036::6815:329a 2606:4700:3033::ac43:a3f1 ```
meinthebox commented 2 years ago

Solved. I should use 'auth_user' instead of 'user' in the server config.