openssh-clients: create a user socket unit for ssh-agent (rhbz#2125576)

Signed-off-by: Anthony Rabbito <hello@anthonyrabbito.com>
This commit is contained in:
Anthony Rabbito 2022-09-11 10:36:25 -04:00
parent aa843e85ee
commit 9417892cb7
No known key found for this signature in database
3 changed files with 28 additions and 2 deletions

View File

@ -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 <hello@anthonyrabbito.com> - 9.0p1-6
- Add a socket unit to ssh-agent user unit (rhbz#2125576)
* Thu Sep 29 2022 Dmitry Belyavskiy <dbelyavs@redhat.com> - 9.0p1-5
- RSAMinSize => RequiredRSASize

View File

@ -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

14
ssh-agent.socket Normal file
View File

@ -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