diff --git a/openssh.spec b/openssh.spec index 4eb4d16..a620fe7 100644 --- a/openssh.spec +++ b/openssh.spec @@ -75,6 +75,7 @@ Source11: sshd.service Source12: sshd-keygen@.service Source13: sshd-keygen Source15: sshd-keygen.target +Source16: ssh-agent.service #https://bugzilla.mindrot.org/show_bug.cgi?id=2581 Patch100: openssh-6.7p1-coverity.patch @@ -210,6 +211,7 @@ BuildRequires: pam-devel BuildRequires: openssl-devel >= 0.9.8j BuildRequires: perl-podlators BuildRequires: systemd-devel +BuildRequires: systemd-rpm-macros BuildRequires: gcc make BuildRequires: p11-kit-devel BuildRequires: libfido2-devel @@ -508,6 +510,7 @@ install -m644 %{SOURCE10} $RPM_BUILD_ROOT/%{_unitdir}/sshd.socket install -m644 %{SOURCE11} $RPM_BUILD_ROOT/%{_unitdir}/sshd.service install -m644 %{SOURCE12} $RPM_BUILD_ROOT/%{_unitdir}/sshd-keygen@.service install -m644 %{SOURCE15} $RPM_BUILD_ROOT/%{_unitdir}/sshd-keygen.target +install -m644 %{SOURCE16} $RPM_BUILD_ROOT/%{_unitdir}/ssh-agent.service 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/ @@ -564,6 +567,12 @@ test -f %{sysconfig_anaconda} && \ %postun server %systemd_postun_with_restart sshd.service +%post clients +%systemd_user_post ssh-agent.service + +%preun clients +%systemd_user_preun ssh-agent.service + %files %license LICENCE %doc CREDITS ChangeLog OVERVIEW PROTOCOL* README README.platform README.privsep README.tun README.dns TODO @@ -598,6 +607,7 @@ test -f %{sysconfig_anaconda} && \ %attr(0644,root,root) %{_mandir}/man1/ssh-copy-id.1* %attr(0644,root,root) %{_mandir}/man8/ssh-pkcs11-helper.8* %attr(0644,root,root) %{_mandir}/man8/ssh-sk-helper.8* +%attr(0644,root,root) %{_unitdir}/ssh-agent.service %files server %dir %attr(0711,root,root) %{_datadir}/empty.sshd diff --git a/ssh-agent.service b/ssh-agent.service new file mode 100644 index 0000000..c215022 --- /dev/null +++ b/ssh-agent.service @@ -0,0 +1,14 @@ +# Requires SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket" +# set in environment, handled for example in plasma via +# /etc/xdg/plasma-workspace/env/ssh-agent.sh +[Unit] +ConditionEnvironment=!SSH_AGENT_PID +Description=OpenSSH key agent +Documentation=man:ssh-agent(1) man:ssh-add(1) man:ssh(1) + +[Service] +Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket +ExecStart=/usr/bin/ssh-agent -a $SSH_AUTH_SOCK +PassEnvironment=SSH_AGENT_PID +SuccessExitStatus=2 +Type=forking