Pastebin launched a little side project called HostCabi.net, check it out ;-)Pastebin is 300% more awesome when you are logged in. Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 27th, 2011  |  syntax: Diff  |  size: 5.50 KB  |  hits: 311  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. diff -u dropbear_initrd_encrypt/dropbear_hook dropbear_initrd_encrypt-new/dropbear_hook
  2. --- dropbear_initrd_encrypt/dropbear_hook       1970-01-01 10:13:08.000000000 +0100
  3. +++ dropbear_initrd_encrypt-new/dropbear_hook   2010-12-20 13:15:10.000000000 +0100
  4. @@ -7,7 +7,7 @@
  5.         NETMASK="255.255.255.0"
  6.         GATEWAY="192.168.1.1"
  7.        
  8. -       echo "setting static ip"
  9. +       echo "Setting static IP address."
  10.         /sbin/ifconfig $DEV $IP netmask $NETMASK up
  11.         /sbin/route add default gw $GATEWAY
  12.  
  13. diff -u dropbear_initrd_encrypt/dropbear_initrd_encrypt.install dropbear_initrd_encrypt-new/dropbear_initrd_encrypt.install
  14. --- dropbear_initrd_encrypt/dropbear_initrd_encrypt.install     1970-01-01 10:13:08.000000000 +0100
  15. +++ dropbear_initrd_encrypt-new/dropbear_initrd_encrypt.install 2010-12-20 13:20:33.000000000 +0100
  16. @@ -3,19 +3,25 @@
  17.    mkdir -p /etc/dropbear
  18.    touch /etc/dropbear/root_key
  19.    chmod 600 /etc/dropbear/root_key
  20. -  
  21. -  echo "insert ssh public key into '/etc/dropbear/root_key' (cat ~/.ssh/id_rsa.pub >> /etc/dropbear/root_key)"
  22. -  echo "set DEV, IP, NETMASK and GATEWAY in '/lib/initcpio/hooks/dropbear' "
  23. -  echo "insert 'dropbear encryptssh' before 'filesystems' into 'HOOKS' in '/etc/mkinitcpio.conf' "
  24. -  echo "and then run as root 'mkinitcpio -p kernel26'"
  25. +
  26. +  cat <<EOH
  27. +1. Insert your SSH public key into /etc/dropbear/root_key
  28. +2. Set DEV, IP, NETMASK and GATEWAY in /lib/initcpio/hooks/dropbear
  29. +3. Insert 'dropbear encryptssh' before 'filesystems' into HOOKS in /etc/mkinitcpio.conf
  30. +4. Run as root: mkinitcpio -p kernel26
  31. +EOH
  32.  }
  33.  
  34.  post_remove() {  
  35. -  echo "remove 'net dropbear encryptssh' from 'HOOKS' in '/etc/mkinitcpio.conf' "
  36. -  echo "run 'mkinitcpio -p kernel26'"
  37. +  cat <<EOH
  38. +1. Remove 'dropbear encryptssh' from HOOKS in /etc/mkinitcpio.conf
  39. +2. Run as root: mkinitcpio -p kernel26
  40. +EOH
  41.  }
  42.  
  43.  post_upgrade() {
  44. -  echo "set DEV, IP, NETMASK and GATEWAY in '/lib/initcpio/hooks/dropbear' "
  45. -  echo "and then run as root 'mkinitcpio -p kernel26'"
  46. -}
  47. \ Kein Zeilenumbruch am Dateiende.
  48. +  cat <<EOH
  49. +1. Set DEV, IP, NETMASK and GATEWAY in /lib/initcpio/hooks/dropbear
  50. +2. Run as root: mkinitcpio -p kernel26
  51. +EOH
  52. +}
  53. diff -u dropbear_initrd_encrypt/dropbear_install dropbear_initrd_encrypt-new/dropbear_install
  54. --- dropbear_initrd_encrypt/dropbear_install    1970-01-01 10:13:08.000000000 +0100
  55. +++ dropbear_initrd_encrypt-new/dropbear_install        2010-12-20 13:20:11.000000000 +0100
  56. @@ -1,28 +1,40 @@
  57.  # vim: set ft=sh:
  58.  
  59.  get_fingerprint() {
  60. -        local keyfile="$1"
  61. -        dropbearkey -y -f "${keyfile}" | sed -n '/^Fingerprint:/ {s/Fingerprint: *//; p}'
  62. +  local keyfile="$1"
  63. +  dropbearkey -y -f "${keyfile}" | sed -n '/^Fingerprint:/ {s/Fingerprint: *//; p}'
  64.  }
  65.  
  66.  display_fingerprints() {
  67. -        local keyfile
  68. +  local keyfile
  69.  
  70. -        for keyfile in "/etc/dropbear/dropbear_dss_host_key" "/etc/dropbear/dropbear_rsa_host_key" ; do
  71. -                if [ ! -r "${keyfile}" ] ; then
  72. -                        return 1
  73. -                fi
  74. -                echo "$(basename "${keyfile}") : $(get_fingerprint "${keyfile}")"
  75. -        done
  76. +  for keyfile in "/etc/dropbear/dropbear_dss_host_key" "/etc/dropbear/dropbear_rsa_host_key" ; do
  77. +    if [ ! -r "${keyfile}" ] ; then
  78. +      return 1
  79. +    fi
  80. +    echo "$(basename "${keyfile}") : $(get_fingerprint "${keyfile}")"
  81. +  done
  82. +}
  83. +
  84. +copy_openssh_keys() {
  85. +  local osshrsa="/etc/ssh/ssh_host_rsa_key"
  86. +  local osshdsa="/etc/ssh/ssh_host_dsa_key"
  87. +
  88. +  local dbpre="/etc/dropbear/dropbear_"
  89. +
  90. +  [ -f "$osshrsa" ] && [ -f "$osshdsa" ] || return 1
  91. +
  92. +  dropbearconvert openssh dropbear $osshrsa ${dbpre}rsa_host_key
  93. +  dropbearconvert openssh dropbear $osshdsa ${dbpre}dss_host_key
  94.  }
  95.  
  96.  generate_keys() {
  97. -        local keyfile keytype
  98. -        for keytype in dss rsa ; do
  99. -                keyfile="/etc/dropbear/dropbear_${keytype}_host_key"
  100. -                echo "Generating ${keytype} host key for dropbear ..."
  101. -                dropbearkey -t "${keytype}" -f "${keyfile}"
  102. -        done
  103. +  local keyfile keytype
  104. +  for keytype in dss rsa ; do
  105. +    keyfile="/etc/dropbear/dropbear_${keytype}_host_key"
  106. +    echo "Generating ${keytype} host key for dropbear ..."
  107. +    dropbearkey -t "${keytype}" -f "${keyfile}"
  108. +  done
  109.  }
  110.  
  111.  make_etc_passwd() {
  112. @@ -45,7 +57,7 @@
  113.  
  114.         [ -d /etc/dropbear ] && mkdir -p /etc/dropbear
  115.  
  116. -       display_fingerprints || generate_keys
  117. +       display_fingerprints || copy_openssh_keys || generate_keys
  118.  
  119.         [ -e "${TMPDIR}/passwd" ] && ( grep -q -e '^root:' "${TMPDIR}/passwd" ) || make_etc_passwd
  120.  
  121. diff -u dropbear_initrd_encrypt/PKGBUILD dropbear_initrd_encrypt-new/PKGBUILD
  122. --- dropbear_initrd_encrypt/PKGBUILD    1970-01-01 10:13:08.000000000 +0100
  123. +++ dropbear_initrd_encrypt-new/PKGBUILD        2010-12-20 13:23:13.000000000 +0100
  124. @@ -1,8 +1,9 @@
  125. -# Maintainer: allspark <allspark at cyb0rg dot org>
  126. +# Maintainer: allspark <allspark at planetcyborg dot org>
  127. +# Contributor: henning mueller <henning@orgizm.net>
  128.  
  129.  pkgname=dropbear_initrd_encrypt
  130. -pkgver=0.7
  131. -pkgrel=4
  132. +pkgver=0.8
  133. +pkgrel=1
  134.  pkgdesc="enables ssh in initrd to type root luks passphrase "
  135.  arch=('i686' 'x86_64')
  136.  url="http://allspark.cyb0rg.org/?p=38"
  137. @@ -20,8 +21,8 @@
  138.  source=("dropbear_hook" "dropbear_install" "encryptssh_hook" "encryptssh_install")
  139.  noextract=()        
  140.  
  141. -md5sums=('25204806eaabca26f2a1a46d2be5ebc9'
  142. -         'ef8c37bdc722d048eb1e9dd41c6ecf30'
  143. +md5sums=('a0fb6a9043b246b6d70d2897912784a0'
  144. +         '99bd9eeff3a4e340667da77caf53e064'
  145.           'ae42b969ca6d2ea3acfb38880070aec5'
  146.           'ae4d3533d178833904dd65965f251c85')