| 1 |
#! /bin/sh |
| 2 |
# Check whether debian/openssh-server.ucf-md5sum is up to date. |
| 3 |
set -e |
| 4 |
|
| 5 |
contains_md5sum () { |
| 6 |
# shellcheck disable=SC3043 |
| 7 |
local md5sum |
| 8 |
md5sum="$(md5sum | sed 's/ -$//')" |
| 9 |
if grep -qx "$md5sum" debian/openssh-server.ucf-md5sum; then |
| 10 |
return 0 |
| 11 |
else |
| 12 |
echo "Missing from debian/openssh-server.ucf-md5sum: $md5sum" >&2 |
| 13 |
return 1 |
| 14 |
fi |
| 15 |
} |
| 16 |
|
| 17 |
ret=0 |
| 18 |
|
| 19 |
<sshd_config contains_md5sum || ret=1 |
| 20 |
<sshd_config \ |
| 21 |
sed 's/^#*PermitRootLogin .*/PermitRootLogin yes/' | \ |
| 22 |
contains_md5sum || ret=1 |
| 23 |
<sshd_config \ |
| 24 |
sed 's/^#PasswordAuthentication .*/PasswordAuthentication no/' | \ |
| 25 |
contains_md5sum || ret=1 |
| 26 |
<sshd_config \ |
| 27 |
sed 's/^#*PermitRootLogin .*/PermitRootLogin yes/' | \ |
| 28 |
sed 's/^#PasswordAuthentication .*/PasswordAuthentication no/' | \ |
| 29 |
contains_md5sum || ret=1 |
| 30 |
|
| 31 |
exit "$ret" |