summaryrefslogtreecommitdiff
path: root/debian/ssh-krb5.postinst
blob: 989a66801c0355070bf28fdca9f7ecba1e519b60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh

set -e

action="$1"
oldversion="$2"

if [ "$action" = configure ] ; then
    if dpkg --compare-versions "$oldversion" lt-nl 1:4.3p2-7; then
        if [ ! -L /usr/share/doc/ssh-krb5 ]; then
            rm -rf /usr/share/doc/ssh-krb5
            ln -s openssh-client /usr/share/doc/ssh-krb5
        fi

        # Replaced by /etc/init.d/ssh.
        if [ -f /etc/init.d/ssh-krb5 ]; then
            mv /etc/init.d/ssh-krb5 /etc/init.d/ssh-krb5.dpkg-old
            update-rc.d ssh-krb5 remove || true
        fi
    fi

    if dpkg --compare-versions "$oldversion" ge 1:4.3p2-7 || \
       grep -qi '^[ 	]*GSSAPI' /etc/ssh/sshd_config ; then
        :
    else
        if grep -qi '^#GSSAPI' /etc/ssh/sshd_config ; then
            perl -pe 's/^\#(GSSAPI(Authentication|KeyExchange))\b/$1/i' \
                < /etc/ssh/sshd_config > /etc/ssh/sshd_config.dpkg-new
            chown --reference /etc/ssh/sshd_config \
                /etc/ssh/sshd_config.dpkg-new
            chmod --reference /etc/ssh/sshd_config \
                /etc/ssh/sshd_config.dpkg-new
            mv /etc/ssh/sshd_config.dpkg-new /etc/ssh/sshd_config
        else
            cat >> /etc/ssh/sshd_config <<EOF

# GSSAPI authentication
GSSAPIAuthentication yes
GSSAPIKeyExchange yes
EOF
        fi
        if [ -x /etc/init.d/ssh ] ; then
            if [ -x /usr/sbin/invoke-rc.d ] ; then
                invoke-rc.d ssh restart
            else
                /etc/init.d/ssh restart
            fi
        fi
    fi
fi

#DEBHELPER#

exit 0