From 0062ebe7b4e524952eb2fb79e38d8bc3f3b213ef Mon Sep 17 00:00:00 2001 From: Stéphane Graber Date: Mon, 25 Mar 2013 16:55:41 +0000 Subject: Add ssh-agent upstart user job. This implements something similar to the 90x11-common_ssh-agent Xsession script. That is, start ssh-agent and set the appropriate environment variables (closes: #703906). --- debian/changelog | 5 +++++ debian/rules | 3 +++ debian/ssh-agent.user-session.upstart | 19 +++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 debian/ssh-agent.user-session.upstart diff --git a/debian/changelog b/debian/changelog index 78c582918..13b39f04e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,11 @@ openssh (1:6.1p1-4) UNRELEASED; urgency=low should be read, and move the pam_env calls from "auth" to "session" so that it's also read when $HOME is encrypted (LP: #952185). + [ Stéphane Graber ] + * Add ssh-agent upstart user job. This implements something similar to + the 90x11-common_ssh-agent Xsession script. That is, start ssh-agent + and set the appropriate environment variables (closes: #703906). + -- Colin Watson Thu, 14 Feb 2013 09:33:00 +0100 openssh (1:6.1p1-3) experimental; urgency=low diff --git a/debian/rules b/debian/rules index e3a11923b..1acbdbd8d 100755 --- a/debian/rules +++ b/debian/rules @@ -187,6 +187,9 @@ override_dh_install: $(DISTRIBUTOR_REPLACE) install -p -m 644 debian/openssh-client.apport debian/openssh-client/usr/share/apport/package-hooks/openssh-client.py install -p -m 644 debian/openssh-server.apport debian/openssh-server/usr/share/apport/package-hooks/openssh-server.py + # Upstart user job (only used under user sessions) + install -p -m 644 -D debian/ssh-agent.user-session.upstart debian/openssh-client/usr/share/upstart/sessions/ssh-agent.conf + override_dh_installdocs: dh_installdocs -Nopenssh-server -Nssh dh_installdocs -popenssh-server -pssh --link-doc=openssh-client diff --git a/debian/ssh-agent.user-session.upstart b/debian/ssh-agent.user-session.upstart new file mode 100644 index 000000000..8553e12f1 --- /dev/null +++ b/debian/ssh-agent.user-session.upstart @@ -0,0 +1,19 @@ +description "SSH Agent" +author "Stéphane Graber " + +start on starting xsession-init + +pre-start script + [ -e /etc/X11/Xsession.options ] || { stop; exit 0; } + grep -q "^use-ssh-agent$" /etc/X11/Xsession.options || { stop; exit 0; } + + eval "$(ssh-agent)" >/dev/null + initctl set-env --global SSH_AUTH_SOCK=$SSH_AUTH_SOCK + initctl set-env --global SSH_AGENT_PID=$SSH_AGENT_PID +end script + +post-stop script + kill $SSH_AGENT_PID 2>/dev/null || true + initctl unset-env --global SSH_AUTH_SOCK + initctl unset-env --global SSH_AGENT_PID +end script -- cgit v1.2.3