diff --git a/openssh.spec b/openssh.spec index 212a65f..570f6a3 100644 --- a/openssh.spec +++ b/openssh.spec @@ -72,8 +72,9 @@ Source12: sshd-keygen@.service Source13: sshd-keygen Source15: sshd-keygen.target Source16: ssh-agent.service -Source17: openssh-systemd-sysusers.conf -Source18: openssh-server-systemd-sysusers.conf +Source17: ssh-agent.socket +Source18: openssh-systemd-sysusers.conf +Source19: openssh-server-systemd-sysusers.conf #https://bugzilla.mindrot.org/show_bug.cgi?id=2581 Patch100: openssh-6.7p1-coverity.patch @@ -577,6 +578,7 @@ install -m644 %{SOURCE12} $RPM_BUILD_ROOT/%{_unitdir}/sshd-keygen@.service install -m644 %{SOURCE15} $RPM_BUILD_ROOT/%{_unitdir}/sshd-keygen.target install -d -m755 $RPM_BUILD_ROOT/%{_userunitdir} install -m644 %{SOURCE16} $RPM_BUILD_ROOT/%{_userunitdir}/ssh-agent.service +install -m644 %{SOURCE16} $RPM_BUILD_ROOT/%{_userunitdir}/ssh-agent.socket install -m744 %{SOURCE13} $RPM_BUILD_ROOT/%{_libexecdir}/openssh/sshd-keygen install -m755 contrib/ssh-copy-id $RPM_BUILD_ROOT%{_bindir}/ install contrib/ssh-copy-id.1 $RPM_BUILD_ROOT%{_mandir}/man1/ @@ -635,9 +637,11 @@ test -f %{sysconfig_anaconda} && \ %post clients %systemd_user_post ssh-agent.service +%systemd_user_post ssh-agent.socket %preun clients %systemd_user_preun ssh-agent.service +%systemd_user_preun ssh-agent.socket %files %license LICENCE @@ -675,6 +679,7 @@ test -f %{sysconfig_anaconda} && \ %attr(0644,root,root) %{_mandir}/man8/ssh-pkcs11-helper.8* %attr(0644,root,root) %{_mandir}/man8/ssh-sk-helper.8* %attr(0644,root,root) %{_userunitdir}/ssh-agent.service +%attr(0644,root,root) %{_userunitdir}/ssh-agent.socket %files server %dir %attr(0711,root,root) %{_datadir}/empty.sshd @@ -717,6 +722,9 @@ test -f %{sysconfig_anaconda} && \ %endif %changelog +* Fri Oct 5 2022 Anthony Rabbito - 9.0p1-6 +- Add a socket unit to ssh-agent user unit (rhbz#2125576) + * Thu Sep 29 2022 Dmitry Belyavskiy - 9.0p1-5 - RSAMinSize => RequiredRSASize diff --git a/ssh-agent.service b/ssh-agent.service index c215022..50a9ea1 100644 --- a/ssh-agent.service +++ b/ssh-agent.service @@ -5,6 +5,7 @@ ConditionEnvironment=!SSH_AGENT_PID Description=OpenSSH key agent Documentation=man:ssh-agent(1) man:ssh-add(1) man:ssh(1) +Requires=ssh-agent.socket [Service] Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket @@ -12,3 +13,6 @@ ExecStart=/usr/bin/ssh-agent -a $SSH_AUTH_SOCK PassEnvironment=SSH_AGENT_PID SuccessExitStatus=2 Type=forking + +[Install] +Also=ssh-agent.socket diff --git a/ssh-agent.socket b/ssh-agent.socket new file mode 100644 index 0000000..d589cbc --- /dev/null +++ b/ssh-agent.socket @@ -0,0 +1,14 @@ +[Unit] +Description=OpenSSH key agent +Documentation=man:ssh-agent(1) man:ssh-add(1) man:ssh(1) + +[Socket] +ListenStream=%t/ssh-agent.socket +Service=ssh-agent.service +Priority=6 +Backlog=5 +SocketMode=0600 +DirectoryMode=0700 + +[Install] +WantedBy=sockets.target