morytyann / OpenWrt-mihomo

Transparent Proxy with Mihomo on OpenWrt.
MIT License
668 stars 68 forks source link

[BUG] 无法进行进程匹配 #103

Closed PKC278 closed 4 weeks ago

PKC278 commented 4 weeks ago

自查步骤

确认

系统

OpenWrt

系统版本

OpenWrt 23.05.4 r24012-d8dd03c46f

插件版本

1.7.0

硬件架构

aarch64_generic

BUG 描述

已在Mihomo插件中设置了匹配进程:启动,但是查看webui发现没有识别任何一个进程 也测试过关闭劫持,手动在Dnsmasq中设置dns转发,一样没有识别进程

image

使用OpenClash,使用相同版本的meta内核测试,可以正常识别进程

image

预期行为

正常识别进程

复现步骤

Mihomo插件中设置匹配进程:启动 开启插件 查看webui

插件日志

[2024-08-22 12:32:27] App is enabled.
[2024-08-22 12:32:27] Starting...
[2024-08-22 12:32:29] Use Subscription: ...
[2024-08-22 12:32:29] Mixin is enabled, mixin all config.
[2024-08-22 12:32:31] Profile testing...
[2024-08-22 12:32:31] Profile test passed!
[2024-08-22 12:32:31] Start Core
[2024-08-22 12:32:31] Transparent Proxy is enabled.
[2024-08-22 12:32:31] Transparent Proxy: Start hijack.
[2024-08-22 12:32:31] Transparent Proxy: Using TPROXY mode.
[2024-08-22 12:32:31] Transparent Proxy: IPv4 DNS Hijack is enabled, IPv4 dns request will redirect to the core.
[2024-08-22 12:32:31] Transparent Proxy: IPv6 DNS Hijack is enabled, IPv6 dns request will redirect to the core.
[2024-08-22 12:32:31] Transparent Proxy: IPv4 Proxy is enabled, set proxy for IPv4 traffic.
[2024-08-22 12:32:31] Transparent Proxy: IPv6 Proxy is enabled, set proxy for IPv6 traffic.
[2024-08-22 12:32:31] Transparent Proxy: Destination TCP Port to Proxy: 21 25 80 110 143 443 465 587 853 993 995 8080 8443.
[2024-08-22 12:32:31] Transparent Proxy: Destination UDP Port to Proxy: 21 25 80 110 143 443 465 587 853 993 995 8080 8443.
[2024-08-22 12:32:31] Transparent Proxy: Add exclusions.
[2024-08-22 12:32:31] Transparent Proxy: Router Proxy is enabled, set proxy for router.
[2024-08-22 12:32:31] Transparent Proxy: Lan Proxy is enabled, set proxy for lan.
[2024-08-22 12:32:31] Transparent Proxy: Access Control is using all mode, set proxy for all client.
[2024-08-22 12:32:31] Start Successful!

核心日志

time="2024-08-22T12:32:31.151608642+08:00" level=info msg="Start initial configuration in progress"
time="2024-08-22T12:32:31.156404782+08:00" level=info msg="Geodata Loader mode: standard"
time="2024-08-22T12:32:31.156527281+08:00" level=info msg="Geosite Matcher implementation: succinct"
time="2024-08-22T12:32:31.159040267+08:00" level=info msg="Initial configuration complete, total time: 7ms"
configuration file /etc/mihomo/run/config.yaml test is successful

配置文件

mode: rule
dns:
  enable: true
  nameserver-policy:
    sub.pkcsublog.top: 223.5.5.5
    ghproxy.pkcsublog.top: 223.5.5.5
  listen: 0.0.0.0:1053
  enhanced-mode: redir-host
  fake-ip-range: 198.18.0.1/16
  ipv6: true
  use-system-hosts: false
  use-hosts: false
  default-nameserver:
    - 223.5.5.5
    - 119.29.29.29
  proxy-server-nameserver:
    - https://dns.alidns.com/dns-query
    - https://doh.pub/dns-query
  nameserver:
    - localhost:5335
geox-url:
  geoip: https://ghproxy.pkcsublog.top/https://github.com/Loyalsoldier/geoip/releases/latest/download/geoip-only-cn-private.dat
  geosite: https://ghproxy.pkcsublog.top/https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat
  mmdb: https://ghproxy.pkcsublog.top/https://github.com/Loyalsoldier/geoip/releases/latest/download/Country-only-cn-private.mmdb
  asn: https://ghproxy.pkcsublog.top/https://github.com/Loyalsoldier/geoip/releases/latest/download/Country-asn.mmdb
geo-auto-update: true
geo-update-interval: 168
unified-delay: true
tcp-concurrent: true
sniffer:
  enable: true
  force-dns-mapping: true
  parse-pure-ip: true
  override-destination: true
  skip-domain:
    - Mijia Cloud
  sniff:
    HTTP:
      override-destination: true
      ports:
        - 80
        - 8080-8880
    TLS:
      override-destination: true
      ports:
        - 443
        - 8443
    QUIC:
      override-destination: true
      ports:
        - 443
        - 8443
profile:
  store-selected: true
  store-fake-ip: true
external-ui-name: yacd
external-ui-url: https://ghproxy.pkcsublog.top/https://github.com/haishanh/yacd/archive/refs/heads/gh-pages.zip
...
find-process-mode: always
keep-alive-interval: 600
log-level: silent
ipv6: true
external-ui: ui
external-controller: 0.0.0.0:9090
secret: ...
allow-lan: true
port: 8080
socks-port: 1080
mixed-port: 7890
redir-port: 7891
tproxy-port: 7892
tun:
  stack: system
  device: tun
  mtu: 9000
  gso: true
  gso-max-size: 65536
  endpoint-independent-nat: false
  enable: false
geodata-mode: false
geodata-loader: standard
authentication:
  - ...
interface-name: pppoe-wan

附加信息

No response

morytyann commented 4 weeks ago

核心日志只有这些吗?有没有类似[Process] find process error:的日志

morytyann commented 4 weeks ago

哦……你日志级别设置了静默……这样的日志没有意义啊

PKC278 commented 4 weeks ago

忘了调日志级别了,这是mosdns发起的https dns连接

image
morytyann commented 4 weeks ago

编辑/etc/capabilities/mihomo.json,改为如下内容(添加CAP_SYS_PTRACE),保存后重启服务再观察日志。

/etc/capabilities/mihomo.json ```json { "permitted": [ "CAP_SYS_PTRACE", "CAP_FOWNER", "CAP_DAC_OVERRIDE", "CAP_NET_ADMIN", "CAP_NET_BIND_SERVICE", "CAP_NET_RAW" ], "effective": [ "CAP_SYS_PTRACE", "CAP_FOWNER", "CAP_DAC_OVERRIDE", "CAP_NET_ADMIN", "CAP_NET_BIND_SERVICE", "CAP_NET_RAW" ], "bounding": [ "CAP_SYS_PTRACE", "CAP_FOWNER", "CAP_DAC_OVERRIDE", "CAP_NET_ADMIN", "CAP_NET_BIND_SERVICE", "CAP_NET_RAW" ], "inheritable": [ "CAP_SYS_PTRACE", "CAP_FOWNER", "CAP_DAC_OVERRIDE", "CAP_NET_ADMIN", "CAP_NET_BIND_SERVICE", "CAP_NET_RAW" ], "ambient": [ "CAP_SYS_PTRACE", "CAP_FOWNER", "CAP_DAC_OVERRIDE", "CAP_NET_ADMIN", "CAP_NET_BIND_SERVICE", "CAP_NET_RAW" ] } ```
PKC278 commented 4 weeks ago

还是有这个错误

image
morytyann commented 4 weeks ago

确定是重启了哈,如果确定是重启后还复现,再在刚才说的文件里添加CAP_SYS_RESOURCE,保存后重启服务再观察一下。

PKC278 commented 4 weeks ago

确定重启了,我先关闭了mihomo,修改了这个文件,再启动的mihomo

image

mosdns进程还是不能识别

image

日志报错time="2024-08-22T06:47:46.993461595Z" level=debug msg="[Process] find process dns.google error: process of uid(0),inode(32679766) not found"

morytyann commented 4 weeks ago

一会试下v1.7.1的Build

PKC278 commented 4 weeks ago

还是报错

time="2024-08-22T09:12:24.684070939Z" level=debug msg="[Process] find process dns.google error: process of uid(0),inode(32793341) not found"
time="2024-08-22T09:12:24.684070939Z" level=debug msg="[Process] find process cloudflare-dns.com error: process of uid(0),inode(32794727) not found"
image image
morytyann commented 4 weeks ago

为何核心版本不一致? image 我测试是正常的呢…… image

PKC278 commented 4 weeks ago

可以了,正常了,我的软件仓库没更新,安装的时候自动用软件源的旧版本覆盖了