summaryrefslogtreecommitdiff
path: root/debian/ssh-krb5.postinst.in
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2013-05-22 01:45:40 +0100
committerColin Watson <cjwatson@debian.org>2013-05-22 01:45:40 +0100
commit6e950945da7a2acbb48fa4138208018f09d66991 (patch)
tree1e99c1fb54755277a8c441cf503b71bb2c5be748 /debian/ssh-krb5.postinst.in
parentafd3292952a9f0bb107046785ddcfad446d69b89 (diff)
Switch to new unified layout for Upstart jobs as documented in
https://wiki.ubuntu.com/UpstartCompatibleInitScripts: the init script checks for a running Upstart, and we now let dh_installinit handle most of the heavy lifting in maintainer scripts. Ubuntu users should be essentially unaffected except that sshd may no longer start automatically in chroots if the running Upstart predates 0.9.0; but the main goal is simply not to break when openssh-server is installed in a chroot.
Diffstat (limited to 'debian/ssh-krb5.postinst.in')
-rw-r--r--debian/ssh-krb5.postinst.in77
1 files changed, 0 insertions, 77 deletions
diff --git a/debian/ssh-krb5.postinst.in b/debian/ssh-krb5.postinst.in
deleted file mode 100644
index 9ed03f343..000000000
--- a/debian/ssh-krb5.postinst.in
+++ /dev/null
@@ -1,77 +0,0 @@
1#!/bin/sh
2
3set -e
4
5action="$1"
6oldversion="$2"
7
8if [ "$action" = configure ] ; then
9 # Make sure that GSSAPI is enabled. If there is no uncommented GSSAPI
10 # configuration, uncomment any commented-out configuration if present
11 # (this will catch the case of a fresh install of openssh-server).
12 # Otherwise, add configuration turning on GSSAPIAuthentication and
13 # GSSAPIKeyExchange.
14 #
15 # If there is some configuration, we may be upgrading from ssh-krb5. It
16 # enabled GSSAPIKeyExchange without any configuration option. Therefore,
17 # if it isn't explicitly set, always enable it for compatible behavior
18 # with ssh-krb5.
19 if dpkg --compare-versions "$oldversion" ge 1:4.3p2-9; then
20 :
21 else
22 changed=
23 if grep -qi '^[ ]*GSSAPI' /etc/ssh/sshd_config ; then
24 if grep -qi '^[ ]*GSSAPIKeyExchange' /etc/ssh/sshd_config ; then
25 :
26 else
27 changed=true
28 cat >> /etc/ssh/sshd_config <<EOF
29
30# GSSAPI key exchange (added by ssh-krb5 transitional package)
31GSSAPIKeyExchange yes
32EOF
33 fi
34 else
35 changed=true
36 if grep -qi '^#GSSAPI' /etc/ssh/sshd_config ; then
37 perl -pe 's/^\#(GSSAPI(Authentication|KeyExchange))\b.*/$1 yes/i' \
38 < /etc/ssh/sshd_config > /etc/ssh/sshd_config.dpkg-new
39 chown --reference /etc/ssh/sshd_config \
40 /etc/ssh/sshd_config.dpkg-new
41 chmod --reference /etc/ssh/sshd_config \
42 /etc/ssh/sshd_config.dpkg-new
43 mv /etc/ssh/sshd_config.dpkg-new /etc/ssh/sshd_config
44 else
45 cat >> /etc/ssh/sshd_config <<EOF
46
47# GSSAPI authentication (added by ssh-krb5 transitional package)
48GSSAPIAuthentication yes
49GSSAPIKeyExchange yes
50EOF
51 fi
52 fi
53 case '@DISTRIBUTOR@' in
54 Ubuntu)
55 # Both init script and Upstart job are present; we want to
56 # operate on the Upstart job.
57 if [ -n "$changed" ] && [ -e /etc/init/ssh.conf ] ; then
58 stop ssh || true
59 start ssh || true
60 fi
61 ;;
62 *)
63 if [ -n "$changed" ] && [ -x /etc/init.d/ssh ] ; then
64 if [ -x /usr/sbin/invoke-rc.d ] ; then
65 invoke-rc.d ssh restart
66 else
67 /etc/init.d/ssh restart
68 fi
69 fi
70 ;;
71 esac
72 fi
73fi
74
75#DEBHELPER#
76
77exit 0