Home | History | Annotate | Download | only in debian
      1 #!/bin/sh
      2 set -e
      3 
      4 test "$1" = 'configure' || exit 0
      5 
      6 if test ! -e /etc/dropbear/dropbear_rsa_host_key; then
      7   if test -f /etc/ssh/ssh_host_rsa_key; then
      8     echo "Converting existing OpenSSH RSA host key to Dropbear format."
      9     /usr/lib/dropbear/dropbearconvert openssh dropbear \
     10       /etc/ssh/ssh_host_rsa_key /etc/dropbear/dropbear_rsa_host_key
     11   else
     12     echo "Generating Dropbear RSA key. Please wait."
     13     dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
     14   fi
     15 fi
     16 if test ! -e /etc/dropbear/dropbear_dss_host_key; then
     17   if test -f /etc/ssh/ssh_host_dsa_key; then
     18     echo "Converting existing OpenSSH RSA host key to Dropbear format."
     19     /usr/lib/dropbear/dropbearconvert openssh dropbear \
     20       /etc/ssh/ssh_host_dsa_key /etc/dropbear/dropbear_dss_host_key
     21   else
     22     echo "Generating Dropbear DSS key. Please wait."
     23     dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key
     24   fi
     25 fi
     26 if test ! -s /etc/default/dropbear; then 
     27   # check whether OpenSSH seems to be installed.
     28   if test -x /usr/sbin/sshd; then
     29     cat <<EOT
     30 OpenSSH appears to be installed.  Setting /etc/default/dropbear so that
     31 Dropbear will not start by default.  Edit this file to change this behaviour.
     32 
     33 EOT
     34     cat >>/etc/default/dropbear <<EOT
     35 # disabled because OpenSSH is installed
     36 # change to NO_START=0 to enable Dropbear
     37 NO_START=1
     38 
     39 EOT
     40   fi
     41   cat >>/etc/default/dropbear <<EOT
     42 # the TCP port that Dropbear listens on
     43 DROPBEAR_PORT=22
     44 
     45 # any additional arguments for Dropbear
     46 DROPBEAR_EXTRA_ARGS=
     47 
     48 # specify an optional banner file containing a message to be
     49 # sent to clients before they connect, such as "/etc/issue.net"
     50 DROPBEAR_BANNER=""
     51 
     52 # RSA hostkey file (default: /etc/dropbear/dropbear_rsa_host_key)
     53 #DROPBEAR_RSAKEY="/etc/dropbear/dropbear_rsa_host_key"
     54 
     55 # DSS hostkey file (default: /etc/dropbear/dropbear_dss_host_key)
     56 #DROPBEAR_DSSKEY="/etc/dropbear/dropbear_dss_host_key"
     57 EOT
     58 fi
     59 
     60 if test -x /etc/init.d/dropbear; then
     61   update-rc.d dropbear defaults >/dev/null
     62   if test -x /usr/sbin/invoke-rc.d; then
     63     invoke-rc.d dropbear restart
     64   else
     65     /etc/init.d/dropbear restart
     66   fi
     67 fi
     68