소스 검색

ssh renew and hostname added/modified

Laurent HUBERT 6 년 전
부모
커밋
c79ff52817
3개의 변경된 파일27개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      deploy
  2. 24 0
      scripts/01-renew-ssh-keys
  3. 0 0
      scripts/50-hostname

+ 3 - 0
deploy

@@ -17,6 +17,9 @@ cp scripts/* $FIRST_BOOT_SCRIPTS_DIR
 # Resets the flag file
 touch $FIRST_BOOT_BASE_DIR/.mustrun
 
+# Deploys
+systemctl enable first-boot-init.service
+
 echo "You can now run rm -r on this directory"
 echo "e.g. :"
 echo "\$ cd .."

+ 24 - 0
scripts/01-renew-ssh-keys

@@ -0,0 +1,24 @@
+#!/bin/bash
+# Licence : GPL v3
+# Author: Laurent HUBERT
+#
+# Renews the ssh server keys if they exist
+#
+cat <<EOF
+##################################
+# Renewing SSH server keys       #
+##################################
+EOF
+status=0
+ls /etc/ssh/ssh_host_*key* > /dev/null 2>&1 && dpkg-reconfigure openssh-server || status=1
+if [ 0 -ne "$status" ]
+then
+  # Exit with non zero status
+  echo "Error renewing SSH keys"
+  exit 1
+else
+  cat <<-EOF
+# Renewing SSH server keys: OK   #
+##################################
+EOF
+fi

scripts/00-hostname → scripts/50-hostname