summaryrefslogtreecommitdiff
path: root/debian/openssh-server.config
diff options
context:
space:
mode:
Diffstat (limited to 'debian/openssh-server.config')
-rw-r--r--debian/openssh-server.config84
1 files changed, 84 insertions, 0 deletions
diff --git a/debian/openssh-server.config b/debian/openssh-server.config
new file mode 100644
index 000000000..8bc23020d
--- /dev/null
+++ b/debian/openssh-server.config
@@ -0,0 +1,84 @@
1#!/bin/sh
2
3action=$1
4version=$2
5
6# Source debconf library.
7. /usr/share/debconf/confmodule
8db_version 2.0
9
10
11get_config_option() {
12 option="$1"
13
14 [ -f /etc/ssh/sshd_config ] || return
15
16 # TODO: actually only one '=' allowed after option
17 perl -ne 'print if s/^[[:space:]]*'"$option"'[[:space:]=]+//i' \
18 /etc/ssh/sshd_config 2>/dev/null
19}
20
21
22if [ -e /etc/init.d/ssh ] && ! grep -q pidfile /etc/init.d/ssh
23then
24 db_fset ssh/use_old_init_script seen false
25 db_input medium ssh/use_old_init_script || true
26 db_go
27
28 db_get ssh/use_old_init_script
29 [ "$RET" = "false" ] && exit 0
30else
31 db_set ssh/use_old_init_script true
32 db_fset ssh/use_old_init_script seen true
33fi
34
35if [ -e /etc/ssh/sshd_config ]
36then
37 if dpkg --compare-versions "$version" lt-nl 1:1.3 ;
38 then db_input medium ssh/new_config || true
39 db_go
40 fi
41
42 # An empty version means we're upgrading from before the package split,
43 # so check.
44 if dpkg --compare-versions "$version" lt 1:3.8.1p1-11
45 then
46 passwordauth="$(get_config_option PasswordAuthentication)"
47 crauth="$(get_config_option ChallengeResponseAuthentication)"
48 if [ "$passwordauth" = no ] && \
49 ([ -z "$crauth" ] || [ "$crauth" = yes ])
50 then
51 db_input critical ssh/disable_cr_auth || true
52 fi
53 fi
54fi
55
56if [ -x /usr/sbin/in.telnetd ] && grep -q "^telnet\b" /etc/inetd.conf
57then
58 if ! /usr/sbin/in.telnetd -? 2>&1 | grep -q ssl 2>/dev/null
59 then
60 db_input low ssh/insecure_telnetd || true
61 fi
62fi
63
64key=/etc/ssh/ssh_host_key
65export key
66if [ -n "$version" ] && [ -f $key ] && [ ! -x /usr/bin/ssh-keygen ] &&
67 dpkg --compare-versions "$version" lt 1.2.28
68then
69 # make sure that keys get updated to get rid of IDEA; preinst
70 # actually does the work, but if the old ssh-keygen is not found,
71 # it can't do that -- thus, we tell the user that he must create
72 # a new host key.
73 echo -en '\0\0' | 3<&0 sh -c \
74 'dd if=$key bs=1 skip=32 count=2 2>/dev/null | cmp -s - /dev/fd/3' || {
75 # this means that bytes 32&33 of the key were not both zero, in which
76 # case the key is encrypted, which we need to fix
77 db_input high ssh/encrypted_host_key_but_no_keygen || true
78 }
79fi
80
81
82db_go
83
84exit 0