]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Adding and using snippets/tpl.320.root-ssh-login.sh
authorFrank Brehm <frank.brehm@pixelpark.com>
Fri, 19 Jun 2020 11:34:54 +0000 (13:34 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Fri, 19 Jun 2020 11:34:54 +0000 (13:34 +0200)
kickstart/template-centos8.ks
snippets/tpl.320.root-ssh-login.sh [new file with mode: 0644]

index 528a16c84da77e2ecca00df53b739aa1b6872971..59ea29ab6b34c8a998d4c7af0293c1ffd4c3f3e7 100644 (file)
@@ -217,6 +217,11 @@ echo
 echo "Using snippet $create_motd_snippet"
 $SNIPPET($create_motd_snippet)
 
+#set $root_ssh_snippet = "per_status/" + $SYSTEM_STATUS + "/tpl.320.root-ssh-login.sh"
+echo
+echo "Using snippet $root_ssh_snippet"
+$SNIPPET($root_ssh_snippet)
+
 #set $legato_snippet = "per_status/" + $SYSTEM_STATUS + "/tpl.350.legato.sh"
 echo
 echo "Using snippet $legato_snippet"
diff --git a/snippets/tpl.320.root-ssh-login.sh b/snippets/tpl.320.root-ssh-login.sh
new file mode 100644 (file)
index 0000000..8b95972
--- /dev/null
@@ -0,0 +1,25 @@
+## !/bin/bash
+#raw
+
+#-----------------------------------------------------------
+disable_root_ssh_login_pw() {
+
+    echo
+    echo "${HASH_LINE}"
+    echo "Calling disable_root_ssh_login_pw() ..."
+    echo
+    log "Disabling SSH access for root with password ..."
+
+    if grep -P -w -i 'PermitRootLogin' /etc/ssh/sshd_config >/dev/null ; then
+        perl -p -i -e 's/^\s*#?\s*PermitRootLogin\s.*/PermitRootLogin without-password/i' /etc/ssh/sshd_config
+    else
+        echo "PermitRootLogin without-password" >> /etc/ssh/sshd_config
+    fi
+
+}
+
+disable_root_ssh_login_pw
+
+
+#end raw
+## vim: ts=4 et list