File: 005_ssh_key_generation.diff

package info (click to toggle)
lessdisks 0.5.3cvs.20040906-16
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,480 kB
  • ctags: 271
  • sloc: sh: 3,058; makefile: 92
file content (34 lines) | stat: -rw-r--r-- 1,029 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
--- lessdisks-0.5.3cvs.20040906.orig/base/init.d-scripts/lessdisks
+++ lessdisks-0.5.3cvs.20040906/base/init.d-scripts/lessdisks
@@ -60,6 +60,16 @@
     ;;
 esac
 
+if [ "true" = "$ssh_reset_keys" ]; then
+  if [ -d /etc/ssh ]; then
+    copy_dirs="$copy_dirs /etc/ssh"
+  else
+    echo 'WARNING: ssh_reset_keys is set, but /etc/ssh is not a directory!'
+    echo 'disabling ssh_reset_keys'
+    ssh_reset_keys=false
+  fi
+fi
+
 if [ "$rwfilesystem" = "translucency" ] ; then
   # requires the translucency kernel module
   # makes / appear to be read-writeable...
@@ -108,6 +118,14 @@
 
 fi
 
+if [ "true" = "$ssh_reset_keys" ]; then
+  echo "(re)generating ssh keys... this will take a bit..."
+  echo "ssh-keygen -t rsa -N "" -f /etc/ssh/ssh_host_rsa_key"
+  ssh-keygen -t rsa -N "" -f /etc/ssh/ssh_host_rsa_key
+  echo "ssh-keygen -t dsa -N "" -f /etc/ssh/ssh_host_dsa_key"
+  ssh-keygen -t dsa -N "" -f /etc/ssh/ssh_host_dsa_key
+fi
+
 # generates the MAC address
 macaddress=`ifconfig | grep HWaddr | awk '{print $5}'`