diff options
Diffstat (limited to 'debian/openssh-server.config')
-rw-r--r-- | debian/openssh-server.config | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/debian/openssh-server.config b/debian/openssh-server.config new file mode 100644 index 000000000..dbde2cbb0 --- /dev/null +++ b/debian/openssh-server.config | |||
@@ -0,0 +1,29 @@ | |||
1 | #! /bin/sh | ||
2 | set -e | ||
3 | |||
4 | . /usr/share/debconf/confmodule | ||
5 | db_version 2.0 | ||
6 | |||
7 | get_config_option() { | ||
8 | option="$1" | ||
9 | |||
10 | [ -f /etc/ssh/sshd_config ] || return | ||
11 | |||
12 | # TODO: actually only one '=' allowed after option | ||
13 | perl -lne ' | ||
14 | s/[[:space:]]+/ /g; s/[[:space:]]+$//; | ||
15 | print if s/^[[:space:]]*'"$option"'[[:space:]=]+//i' \ | ||
16 | /etc/ssh/sshd_config 2>/dev/null | ||
17 | } | ||
18 | |||
19 | if dpkg --compare-versions "$2" lt-nl 1:6.6p1-1 && \ | ||
20 | [ "$(get_config_option PermitRootLogin)" = yes ]; then | ||
21 | if [ "$(getent shadow root | cut -d: -f2)" = "!" ]; then | ||
22 | db_set openssh-server/permit-root-login true | ||
23 | else | ||
24 | db_input high openssh-server/permit-root-login || true | ||
25 | db_go | ||
26 | fi | ||
27 | fi | ||
28 | |||
29 | exit 0 | ||