Skip to content

Commit

Permalink
SYSTEMD: replace 'sssd_check_socket_activated_responders'
Browse files Browse the repository at this point in the history
with a schell script.

All sockets already have
```
After=sssd.service
BindsTo=sssd.service
```
 - this ensures SSSD was started and running before socket
activation.

New 'ExecStartPre' condition checks if a responder with the
same name is running and, if so, if it runs in the same
mnt namespace. The latter is to ignore processes run in
a container on the same host.

Resolves: #4333
Resolves: #5013
  • Loading branch information
alexey-tikhonov committed Sep 20, 2024
1 parent 67ba42c commit cceb66a
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 175 deletions.
19 changes: 0 additions & 19 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,6 @@ endif
if BUILD_PAC_RESPONDER
sssdlibexec_PROGRAMS += sssd_pac
endif
if HAVE_SYSTEMD_UNIT
sssdlibexec_PROGRAMS += sssd_check_socket_activated_responders
endif

if HAVE_CHECK
non_interactive_check_based_tests = \
Expand Down Expand Up @@ -1999,22 +1996,6 @@ sss_ssh_knownhostsproxy_LDADD = \
$(CLIENT_LIBS) $(TALLOC_LIBS) $(POPT_LIBS)
endif

if HAVE_SYSTEMD_UNIT
sssd_check_socket_activated_responders_SOURCES = \
src/tools/sssd_check_socket_activated_responders.c \
$(NULL)
sssd_check_socket_activated_responders_CFLAGS = \
$(AM_CFLAGS) \
$(NULL)
sssd_check_socket_activated_responders_LDADD = \
$(SSSD_INTERNAL_LTLIBS) \
$(LTLIBINTL) \
$(TALLOC_LIBS) \
$(POPT_LIBS) \
$(INI_CONFIG_LIBS) \
$(NULL)
endif

pkgconfig_DATA += src/lib/certmap/sss_certmap.pc
libsss_certmap_la_DEPENDENCIES = src/lib/certmap/sss_certmap.exports
libsss_certmap_la_SOURCES = \
Expand Down
1 change: 0 additions & 1 deletion contrib/sssd.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,6 @@ install -D -p -m 0644 %{SOURCE1} %{buildroot}%{_sysusersdir}/sssd.conf
%{_libexecdir}/%{servicename}/sssd_ssh
%{_libexecdir}/%{servicename}/sssd_sudo
%{_libexecdir}/%{servicename}/p11_child
%{_libexecdir}/%{servicename}/sssd_check_socket_activated_responders

%dir %{_libdir}/%{name}
%if 0%{?rhel} == 9
Expand Down
2 changes: 1 addition & 1 deletion src/sysv/systemd/sssd-autofs.socket.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ DefaultDependencies=no
Conflicts=shutdown.target

[Socket]
ExecStartPre=@libexecdir@/sssd/sssd_check_socket_activated_responders -r autofs
ExecStartPre=/bin/sh -c "! (pidof -q sssd_autofs && pidof sssd_autofs | xargs ps -o mntns -p | grep -q `lsns -n -t mnt -o NS -p \\$\\$`)"
ListenStream=@pipepath@/autofs
SocketUser=@SSSD_USER@
SocketGroup=@SSSD_USER@
Expand Down
2 changes: 1 addition & 1 deletion src/sysv/systemd/sssd-nss.socket.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DefaultDependencies=no
Conflicts=shutdown.target

[Socket]
ExecStartPre=@libexecdir@/sssd/sssd_check_socket_activated_responders -r nss
ExecStartPre=/bin/sh -c "! (pidof -q sssd_nss && pidof sssd_nss | xargs ps -o mntns -p | grep -q `lsns -n -t mnt -o NS -p \\$\\$`)"
ListenStream=@pipepath@/nss
@nss_socket_user_group@

Expand Down
2 changes: 1 addition & 1 deletion src/sysv/systemd/sssd-pac.socket.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ DefaultDependencies=no
Conflicts=shutdown.target

[Socket]
ExecStartPre=@libexecdir@/sssd/sssd_check_socket_activated_responders -r pac
ExecStartPre=/bin/sh -c "! (pidof -q sssd_pac && pidof sssd_pac | xargs ps -o mntns -p | grep -q `lsns -n -t mnt -o NS -p \\$\\$`)"
ListenStream=@pipepath@/pac
SocketUser=@SSSD_USER@
SocketGroup=@SSSD_USER@
Expand Down
2 changes: 1 addition & 1 deletion src/sysv/systemd/sssd-pam.socket.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ DefaultDependencies=no
Conflicts=shutdown.target

[Socket]
ExecStartPre=@libexecdir@/sssd/sssd_check_socket_activated_responders -r pam
ExecStartPre=/bin/sh -c "! (pidof -q sssd_pam && pidof sssd_pam | xargs ps -o mntns -p | grep -q `lsns -n -t mnt -o NS -p \\$\\$`)"
ListenStream=@pipepath@/pam
SocketUser=@SSSD_USER@
SocketGroup=@SSSD_USER@
Expand Down
2 changes: 1 addition & 1 deletion src/sysv/systemd/sssd-ssh.socket.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ DefaultDependencies=no
Conflicts=shutdown.target

[Socket]
ExecStartPre=@libexecdir@/sssd/sssd_check_socket_activated_responders -r ssh
ExecStartPre=/bin/sh -c "! (pidof -q sssd_ssh && pidof sssd_ssh | xargs ps -o mntns -p | grep -q `lsns -n -t mnt -o NS -p \\$\\$`)"
ListenStream=@pipepath@/ssh
SocketUser=@SSSD_USER@
SocketGroup=@SSSD_USER@
Expand Down
2 changes: 1 addition & 1 deletion src/sysv/systemd/sssd-sudo.socket.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ DefaultDependencies=no
Conflicts=shutdown.target

[Socket]
ExecStartPre=@libexecdir@/sssd/sssd_check_socket_activated_responders -r sudo
ExecStartPre=/bin/sh -c "! (pidof -q sssd_sudo && pidof sssd_sudo | xargs ps -o mntns -p | grep -q `lsns -n -t mnt -o NS -p \\$\\$`)"
ListenStream=@pipepath@/sudo
SocketUser=@SSSD_USER@
SocketGroup=@SSSD_USER@
Expand Down
149 changes: 0 additions & 149 deletions src/tools/sssd_check_socket_activated_responders.c

This file was deleted.

0 comments on commit cceb66a

Please sign in to comment.