Mik*_*ike 8 linux configuration dbus qtdbus
我正在尝试创建一个在系统总线上运行的守护程序服务,其中从此服务发送和接收的权限应该完全对任何人开放.(安全性不是此服务的关注点).当我尝试使用QtDbus(使用PyQt)注册服务时,我收到此错误:Connection ":1.0" is not allowed to own the service "org.dbus.arduino" due to security policies in the configuration file.这个其他堆栈溢出具有相同的错误,但由于某种原因在这种情况下根本没有帮助.dbus_bus_request_name ():不允许连接拥有该服务.
通常你应该保留system.conf文件,并在目录中添加你的权限"打出"配置文件system.d.我已经做到了这一点,但它似乎没有改变任何东西,无论我如何打开我的权限.事实上,我几乎是积极的,它没有改变任何东西!这是我的conf文件,因为它就在这一刻.
<!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy user="myUser">
<allow own="*"/>
<allow own="org.dbus.arduino"/>
<allow send_type="method_call" log="true"/>
</policy>
<policy user="root">
<allow own="*"/>
<allow own="org.dbus.arduino"/>
<allow send_type="method_call" log="true"/>
</policy>
<policy context="default">
</policy>
</busconfig>
Run Code Online (Sandbox Code Playgroud)
即使我这样做或类似的东西,它仍然不起作用.
<busconfig>
<policy context="default">
<allow own="*"/>
<allow own="org.dbus.arduino"/>
<allow send_type="method_call" log="true"/>
</policy>
</busconfig>
Run Code Online (Sandbox Code Playgroud)
我甚至把文件的名称以az开头,以便它可能是最后一个读入的文件.这是system.conf文件,注意我已经注释掉了"允许自己"部分.这是使其工作的唯一方法(以及最糟糕的"修复").
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<!-- Our well-known bus type, do not change this -->
<type>system</type>
<!-- Run as special user -->
<user>messagebus</user>
<!-- Fork into daemon mode -->
<fork/>
<!-- We use system service launching using a helper -->
<standard_system_servicedirs/>
<!-- This is a setuid helper that is used to launch system services -->
<servicehelper>/lib/dbus-1/dbus-daemon-launch-helper</servicehelper>
<!-- Write a pid file -->
<pidfile>/var/run/dbus/pid</pidfile>
<!-- Enable logging to syslog -->
<syslog/>
<!-- Only allow socket-credentials-based authentication -->
<auth>EXTERNAL</auth>
<!-- Only listen on a local socket. (abstract=/path/to/socket
means use abstract namespace, don't really create filesystem
file; only Linux supports this. Use path=/whatever on other
systems.) -->
<listen>unix:path=/var/run/dbus/system_bus_socket</listen>
<policy context="default">
<!-- All users can connect to system bus -->
<allow user="*"/>
<!-- Holes must be punched in service configuration files for
name ownership and sending method calls -->
<deny own="*"/>
<deny send_type="method_call" log="true"/>
<!-- THIS IS THE ONLY WAY TO GET THIS TO WORK
<allow own="*"/>
<allow send_type="method_call" log="true"/>
-->
<!-- Signals and reply messages (method returns, errors) are allowed
by default -->
<allow send_type="signal"/>
<allow send_requested_reply="true" send_type="method_return"/>
<allow send_requested_reply="true" send_type="error"/>
<!-- All messages may be received by default -->
<allow receive_type="method_call"/>
<allow receive_type="method_return"/>
<allow receive_type="error"/>
<allow receive_type="signal"/>
<!-- Allow anyone to talk to the message bus -->
<allow send_destination="org.freedesktop.DBus"/>
<!-- But disallow some specific bus services -->
<deny send_destination="org.freedesktop.DBus"
send_interface="org.freedesktop.DBus"
send_member="UpdateActivationEnvironment"/>
</policy>
<!-- Config files are placed here that among other things, punch
holes in the above policy for specific services. -->
<includedir>system.d</includedir>
<!-- This is included last so local configuration can override what's
in this standard file -->
<include ignore_missing="yes">system-local.conf</include>
<include if_selinux_enabled="yes" selinux_root_relative="yes">contexts/dbus_contexts</include>
</busconfig>
Run Code Online (Sandbox Code Playgroud)
我绝对必须使用系统总线,因为我将它部署在没有GUI的Raspberry Pi上(没有x11,没有会话总线).我只能通过完全允许系统总线上的所有内容来获得Raspberry Pi的工作(安全性并不是这个设备上的大部分交易).显然,我不允许在我的开发机器上发生这种情况.作为背景我使用的是Opensuse 12.2,Raspberry Pi是Debian Squeeze.我无法使用我的用户帐户或root用户拥有该服务,除非我完全打开权限,在这种情况下它可以正常工作.我还要注意,当我完全打开系统总线时,我仍然必须使用root来向守护进程发送消息(终止命令).我希望解决方案能够通过具有访问权限的root的特定用户运行.我也很满意解决方案只允许同一个用户和root用户向它发送消息.
感谢您的帮助,我相信这是一个小问题!
我终于找到了这个问题.当Dbus查找配置文件以查找权限(如所有权)时,该文件不仅必须在system.d /中,而且还必须以.conf结尾.
我的配置文件"org.dbus.arduino"应该是"org.dbus.arduino.conf".我从system.conf中删除了代码.确认我不再拥有权限,在"system.d/org.dbus.arduino.conf"创建配置文件,我被授予权限.然后我尝试将文件重命名为"org.dbus.arduino"并确认权限被拒绝.
| 归档时间: |
|
| 查看次数: |
7592 次 |
| 最近记录: |