Skip to content

Commit 2f1b5a9

Browse files
authored
Merge pull request #1139 from thesamesam/avoid-dbus
authlogin: guard dbus_system_bus_client calls with optional_policy
2 parents ba84c15 + d156ca9 commit 2f1b5a9

4 files changed

Lines changed: 14 additions & 8 deletions

File tree

policy/modules/admin/sudo.if

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,9 @@ template(`sudo_role_template',`
208208
optional_policy(`
209209
auth_use_pam_systemd($1_sudo_t)
210210

211-
ifdef(`init_systemd',`
212-
init_dbus_chat($1_sudo_t)
211+
init_dbus_chat($1_sudo_t)
213212

214-
systemd_read_logind_state($1_sudo_t)
215-
')
213+
systemd_read_logind_state($1_sudo_t)
216214
')
217215

218216
optional_policy(`

policy/modules/services/ssh.te

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,12 +286,15 @@ ifdef(`distro_debian',`
286286
')
287287

288288
ifdef(`init_systemd',`
289-
auth_use_pam_systemd(sshd_t)
290-
init_dbus_chat(sshd_t)
291289
# dynamic users
292290
init_stream_connect(sshd_t)
293291
init_rw_stream_sockets(sshd_t)
294292
systemd_write_inherited_logind_sessions_pipes(sshd_t)
293+
294+
optional_policy(`
295+
auth_use_pam_systemd(sshd_t)
296+
init_dbus_chat(sshd_t)
297+
')
295298
')
296299

297300
tunable_policy(`ssh_sysadm_login',`

policy/modules/system/authlogin.if

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,17 @@ interface(`auth_use_pam',`
8787
## </param>
8888
#
8989
interface(`auth_use_pam_systemd',`
90-
dbus_system_bus_client($1)
9190
systemd_connect_machined($1)
9291
systemd_dbus_chat_logind($1)
9392
systemd_read_logind_state($1)
9493
systemd_use_logind_fds($1)
9594

9695
# to read /etc/machine-id
9796
files_read_etc_runtime_files($1)
97+
98+
optional_policy(`
99+
dbus_system_bus_client($1)
100+
')
98101
')
99102

100103
########################################

policy/modules/system/authlogin.te

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,9 @@ ifdef(`distro_ubuntu',`
168168
')
169169

170170
ifdef(`init_systemd',`
171-
auth_use_pam_systemd(chkpwd_t)
171+
optional_policy(`
172+
auth_use_pam_systemd(chkpwd_t)
173+
')
172174
')
173175

174176
optional_policy(`

0 commit comments

Comments
 (0)