• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2set -e
3
4test "$1" = 'configure' || exit 0
5
6if 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
15fi
16if 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
25fi
26if 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
30OpenSSH appears to be installed.  Setting /etc/default/dropbear so that
31Dropbear will not start by default.  Edit this file to change this behaviour.
32
33EOT
34    cat >>/etc/default/dropbear <<EOT
35# disabled because OpenSSH is installed
36# change to NO_START=0 to enable Dropbear
37NO_START=1
38
39EOT
40  fi
41  cat >>/etc/default/dropbear <<EOT
42# the TCP port that Dropbear listens on
43DROPBEAR_PORT=22
44
45# any additional arguments for Dropbear
46DROPBEAR_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"
50DROPBEAR_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"
57EOT
58fi
59
60if 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
67fi
68