繁体   English   中英

Linux DBus 远程 TCP 与 SystemD 的连接失败

[英]Linux DBus Remote TCP Connection with SystemD Fails

我正在使用 SystemD 版本 241 和 Linux Kernel 版本 4.19.78 的嵌入式 Linux 平台上工作。

我想用 D-Feet 远程检查各种 DBus 接口。

我过去使用这些说明使用旧版本的 SystemD 完成了此操作。

我创建了一个新的 DBus 配置文件/usr/share/dbus-1/system.d/d-feet.conf

<listen>tcp:host=localhost,bind=*,port=55556,family=ipv4</listen>
<listen>unix:tmpdir=/tmp</listen>

<busconfig>
  <auth>ANONYMOUS</auth>
  <allow_anonymous/>
</busconfig>

当我运行netstat -plntu | grep 55556 netstat -plntu | grep 55556 ,我可以看到端口已绑定:

tcp6       0      0 :::55556                :::*                    LISTEN      1/init

我还编辑了/lib/systemd/system/dbus.socket文件:

[Unit]
Description=D-Bus System Message Bus Socket

[Socket]
ListenStream=/var/run/dbus/system_bus_socket
ListenStream=55556

但是,当我尝试从同一网络上的 Ubuntu 18.04 Linux 机器连接时,我看到它失败并且没有提供我定义的“匿名”身份验证方法:

can not connect to 'tcp:host=192.168.1.16,port=55556': g-io-error-quark: Exhausted all available authentication mechanisms (tried: EXTERNAL) (available: EXTERNAL) (0)

我怎样才能让它工作? 谢谢你。

更新:我尝试使用 '0.0.0.0' 作为绑定地址:

<listen>tcp:host=localhost,bind=0.0.0.0,port=55556,family=ipv4</listen>
<listen>unix:tmpdir=/tmp</listen>

<busconfig>
  <auth>ANONYMOUS</auth>
  <allow_anonymous/>
</busconfig>

但是,它仍然失败并出现相同的错误,并且systemctl show dbus.socket包括以下内容:

PassCredentials=no
PassSecurity=no
RemoveOnStop=no
Listen=/var/run/dbus/system_bus_socket (Stream)
Listen=[::]:55556 (Stream)
Mark=-1
MaxConnections=64
MaxConnectionsPerSource=0
MessageQueueMaxMessages=0

我只是偶然发现了一些有效的东西。 如果我编辑 /usr/share/dbus-1/system.conf 文件,并添加以下内容:

<listen>tcp:host=localhost,bind=0.0.0.0,port=55556,family=ipv4</listen>
<listen>unix:tmpdir=/tmp</listen>

<busconfig>
  <auth>ANONYMOUS</auth>
  <allow_anonymous/>
</busconfig>

它似乎有效,如果我不这样做,并且依赖于我在 d-feet.conf 文件中的更改,那么它似乎会失败。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM