Skip to content

Commit fee2147

Browse files
committed
FIx dbus
1 parent d777690 commit fee2147

File tree

3 files changed

+178
-0
lines changed

3 files changed

+178
-0
lines changed

script_bootloader/usr/samba/bin/samba_install

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,18 @@ then
9292
# 安装wsdd2
9393
opkg install wsdd2
9494
#
95+
# Configure dbus-daemon
96+
# 配置dbus-daemon
97+
mv /opt/etc/dbus-1/system.d/avahi-dbus.conf /opt/etc/dbus-1/system.d/avahi-dbus.conf.bak
98+
sed -i "s/root/${ADMINUSER}/g" ${PRIVATE_ETC}/dbus/avahi-dbus.conf
99+
cp ${PRIVATE_ETC}/dbus/avahi-dbus.conf /opt/etc/dbus-1/system.d/
100+
chmod 644 /opt/etc/dbus-1/system.d/avahi-dbus.conf
101+
#
102+
mv /opt/share/dbus-1/system.conf /opt/share/dbus-1/system.conf.bak
103+
sed -i "s/root/${ADMINUSER}/g" ${PRIVATE_ETC}/dbus/system.conf
104+
cp ${PRIVATE_ETC}/dbus/system.conf /opt/share/dbus-1/
105+
chmod 644 /opt/share/dbus-1/system.conf
106+
#
95107
# Disable /opt/etc/init.d/S91smb
96108
# 禁用/opt/etc/init.d/S91smb
97109
mv /opt/etc/init.d/S91smb ${PRIVATE_ETC}/S91smb.bak
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!DOCTYPE busconfig PUBLIC
2+
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
3+
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
4+
<busconfig>
5+
6+
<!-- Only root or user nobody can own the Avahi service -->
7+
<policy user="nobody">
8+
<allow own="org.freedesktop.Avahi"/>
9+
</policy>
10+
<policy user="root">
11+
<allow own="org.freedesktop.Avahi"/>
12+
</policy>
13+
14+
<!-- Allow anyone to invoke methods on Avahi server, except SetHostName -->
15+
<policy context="default">
16+
<allow send_destination="org.freedesktop.Avahi"/>
17+
<allow receive_sender="org.freedesktop.Avahi"/>
18+
19+
<deny send_destination="org.freedesktop.Avahi"
20+
send_interface="org.freedesktop.Avahi.Server" send_member="SetHostName"/>
21+
</policy>
22+
23+
<!-- Allow everything, including access to SetHostName to users of the group "netdev" -->
24+
<policy user="root">
25+
<allow send_destination="org.freedesktop.Avahi"/>
26+
<allow receive_sender="org.freedesktop.Avahi"/>
27+
</policy>
28+
</busconfig>
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
<!-- This configuration file controls the systemwide message bus.
2+
Add a system-local.conf and edit that rather than changing this
3+
file directly. -->
4+
5+
<!-- Note that there are any number of ways you can hose yourself
6+
security-wise by screwing up this file; in particular, you
7+
probably don't want to listen on any more addresses, add any more
8+
auth mechanisms, run as a different user, etc. -->
9+
10+
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
11+
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
12+
<busconfig>
13+
14+
<!-- Our well-known bus type, do not change this -->
15+
<type>system</type>
16+
17+
<!-- Run as special user -->
18+
<user>root</user>
19+
20+
<!-- Fork into daemon mode -->
21+
<fork/>
22+
23+
<!-- We use system service launching using a helper -->
24+
<standard_system_servicedirs/>
25+
26+
<!-- This is a setuid helper that is used to launch system services -->
27+
<servicehelper>/opt/lib/dbus-daemon-launch-helper</servicehelper>
28+
29+
<!-- Write a pid file -->
30+
<pidfile>/opt/var/run/dbus.pid</pidfile>
31+
32+
<!-- Enable logging to syslog -->
33+
<syslog/>
34+
35+
<!-- Only allow socket-credentials-based authentication -->
36+
<auth>EXTERNAL</auth>
37+
38+
<!-- Only listen on a local socket. (abstract=/path/to/socket
39+
means use abstract namespace, don't really create filesystem
40+
file; only Linux supports this. Use path=/whatever on other
41+
systems.) -->
42+
<listen>unix:path=/opt/var/run/dbus/system_bus_socket</listen>
43+
44+
<policy context="default">
45+
<!-- All users can connect to system bus -->
46+
<allow user="*"/>
47+
48+
<!-- Holes must be punched in service configuration files for
49+
name ownership and sending method calls -->
50+
<deny own="*"/>
51+
<deny send_type="method_call"/>
52+
53+
<!-- Signals and reply messages (method returns, errors) are allowed
54+
by default -->
55+
<allow send_type="signal"/>
56+
<allow send_requested_reply="true" send_type="method_return"/>
57+
<allow send_requested_reply="true" send_type="error"/>
58+
59+
<!-- All messages may be received by default -->
60+
<allow receive_type="method_call"/>
61+
<allow receive_type="method_return"/>
62+
<allow receive_type="error"/>
63+
<allow receive_type="signal"/>
64+
65+
<!-- Allow anyone to talk to the message bus -->
66+
<allow send_destination="org.freedesktop.DBus"
67+
send_interface="org.freedesktop.DBus" />
68+
<allow send_destination="org.freedesktop.DBus"
69+
send_interface="org.freedesktop.DBus.Introspectable"/>
70+
<allow send_destination="org.freedesktop.DBus"
71+
send_interface="org.freedesktop.DBus.Properties"/>
72+
<!-- But disallow some specific bus services -->
73+
<deny send_destination="org.freedesktop.DBus"
74+
send_interface="org.freedesktop.DBus"
75+
send_member="UpdateActivationEnvironment"/>
76+
<deny send_destination="org.freedesktop.DBus"
77+
send_interface="org.freedesktop.DBus.Debug.Stats"/>
78+
<deny send_destination="org.freedesktop.DBus"
79+
send_interface="org.freedesktop.systemd1.Activator"/>
80+
</policy>
81+
82+
<!-- Only systemd, which runs as root, may report activation failures. -->
83+
<policy user="root">
84+
<allow send_destination="org.freedesktop.DBus"
85+
send_interface="org.freedesktop.systemd1.Activator"/>
86+
</policy>
87+
88+
<!-- root may monitor the system bus. -->
89+
<policy user="root">
90+
<allow send_destination="org.freedesktop.DBus"
91+
send_interface="org.freedesktop.DBus.Monitoring"/>
92+
</policy>
93+
94+
<!-- If the Stats interface was enabled at compile-time, root may use it.
95+
Copy this into system.local.conf or system.d/*.conf if you want to
96+
enable other privileged users to view statistics and debug info -->
97+
<policy user="root">
98+
<allow send_destination="org.freedesktop.DBus"
99+
send_interface="org.freedesktop.DBus.Debug.Stats"/>
100+
</policy>
101+
102+
<!-- Include legacy configuration location -->
103+
<include ignore_missing="yes">/opt/etc/dbus-1/system.conf</include>
104+
105+
<!-- The defaults for these limits are hard-coded in dbus-daemon.
106+
Some clarifications:
107+
Times are in milliseconds (ms); 1000ms = 1 second
108+
133169152 bytes = 127 MiB
109+
33554432 bytes = 32 MiB
110+
150000ms = 2.5 minutes -->
111+
<!-- <limit name="max_incoming_bytes">133169152</limit> -->
112+
<!-- <limit name="max_incoming_unix_fds">64</limit> -->
113+
<!-- <limit name="max_outgoing_bytes">133169152</limit> -->
114+
<!-- <limit name="max_outgoing_unix_fds">64</limit> -->
115+
<!-- <limit name="max_message_size">33554432</limit> -->
116+
<!-- <limit name="max_message_unix_fds">16</limit> -->
117+
<!-- <limit name="service_start_timeout">25000</limit> -->
118+
<!-- <limit name="auth_timeout">5000</limit> -->
119+
<!-- <limit name="pending_fd_timeout">150000</limit> -->
120+
<!-- <limit name="max_completed_connections">2048</limit> -->
121+
<!-- <limit name="max_incomplete_connections">64</limit> -->
122+
<!-- <limit name="max_connections_per_user">256</limit> -->
123+
<!-- <limit name="max_pending_service_starts">512</limit> -->
124+
<!-- <limit name="max_names_per_connection">512</limit> -->
125+
<!-- <limit name="max_match_rules_per_connection">512</limit> -->
126+
<!-- <limit name="max_replies_per_connection">128</limit> -->
127+
128+
<!-- Config files are placed here that among other things, punch
129+
holes in the above policy for specific services. -->
130+
<includedir>system.d</includedir>
131+
132+
<includedir>/opt/etc/dbus-1/system.d</includedir>
133+
134+
<!-- This is included last so local configuration can override what's
135+
in this standard file -->
136+
<include ignore_missing="yes">/opt/etc/dbus-1/system-local.conf</include>
137+
138+
</busconfig>

0 commit comments

Comments
 (0)