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.config40
1 files changed, 40 insertions, 0 deletions
diff --git a/debian/openssh-server.config b/debian/openssh-server.config
new file mode 100644
index 000000000..1cad01cff
--- /dev/null
+++ b/debian/openssh-server.config
@@ -0,0 +1,40 @@
1#! /bin/sh
2set -e
3
4. /usr/share/debconf/confmodule
5db_version 2.0
6
7get_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
19permit_root_login="$(get_config_option PermitRootLogin)" || true
20if [ -f /etc/ssh/sshd_config ]; then
21 # Make sure the debconf database is in sync with the current state
22 # of the system.
23 if [ "$permit_root_login" = yes ]; then
24 db_set openssh-server/permit-root-login false
25 else
26 db_set openssh-server/permit-root-login true
27 fi
28fi
29
30if dpkg --compare-versions "$2" lt-nl 1:6.6p1-1 && \
31 [ "$permit_root_login" = yes ]; then
32 if [ "$(getent shadow root | cut -d: -f2)" = "!" ]; then
33 db_set openssh-server/permit-root-login true
34 else
35 db_input high openssh-server/permit-root-login || true
36 db_go
37 fi
38fi
39
40exit 0