【发布时间】:2019-02-08 03:01:31
【问题描述】:
借助以下 Stackoverflow 答案 here 和 here,我能够通过 TCP/IP 远程成功连接到系统 DBUS。 并使用D-FEET 我能够验证连接。
从上面的截图可以看出,我可以访问远程总线,并且可以成功调用org.freedesktop.hostname1对象及其接口。
但在尝试访问 com.aldogroup.Calculator 时,我收到以下异常
这个AccessDenied在访问其他服务时也会出现,比如org.bluez(我一直没能找到模式)
更新
我的 system.conf 文件
<busconfig>
<listen>tcp:host=0.0.0.0,port=55557,family=ipv4</listen>
<listen>unix:tmpdir=/tmp</listen>
<auth>ANONYMOUS</auth>
<allow_anonymous/>
<apparmor mode="disabled"/>
<policy user="root">
<allow own="com.aldogroup.Calculator"/>
<allow send_destination="com.aldogroup.Calculator"/>
<allow send_interface="com.aldogroup.Calculator"/>
<allow send_type="method_call"/>
</policy>
</busconfig>
DBUS 总线控制输出
root@aldogroup-dart-6ul-1b6be6:~# busctl introspect com.aldogroup.Calculator /com/aldogroup/Calculator
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
com.aldogroup.Calculator interface - - -
.Divide method xx x -
.Multiply method xx x -
org.freedesktop.DBus.Introspectable interface - - -
.Introspect method - s -
org.freedesktop.DBus.Peer interface - - -
.GetMachineId method - s -
.Ping method - - -
org.freedesktop.DBus.Properties interface - - -
.Get method ss v -
.GetAll method s a{sv} -
.Set method ssv - -
.PropertiesChanged signal sa{sv}as - -
最好的问候,
西蒙
【问题讨论】: