Merge ~andrea-frittoli/cirros:bug_1564948 into cirros:0.3

Proposed by Andrea Frittoli
Status: Superseded
Proposed branch: ~andrea-frittoli/cirros:bug_1564948
Merge into: cirros:0.3
Diff against target: 74 lines (+68/-0)
1 file modified
src/etc/init.d/S50dropbear (+68/-0)
Reviewer Review Type Date Requested Status
cirros developers Pending
Review via email: mp+315067@code.launchpad.net

Description of the change

This branch includes one commit (cherry-picked from master), which fixes https://launchpad.net/bugs/1564948.

The content of the commit is http://bazaar.launchpad.net/~cirros-dev/cirros/trunk/revision/366, rebased on top of branch 3.0, with the only conflict being the removal of dropbear-init-generate-keys.patch from patches-buildroot/series.

A Tempest test for hard reboot in some cases hits the case where the host key is empty, as the file system flush does not happen quickly enough. This triggers bugs/1564948, i.e. the ssh daemon does not start at all, and the Tempest test fails with "connection refused", which is misleading.

Using a new release of CirrOS which includes this branch would solve the problem.

To post a comment you must log in.
Revision history for this message
Scott Moser (smoser) wrote :

some conversationin irc.. andreaf foundn this not to work, i suggest trying on top of this
http://paste.ubuntu.com/23905445/

Unmerged commits

093f907... by Hugh Saunders <email address hidden>

Ensure dropbear will start even if keyfiles are empty.

Copy the dropbear init script inside cirros rather than
patching it. That makes this easier to read.

LP: #1564948

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/src/etc/init.d/S50dropbear b/src/etc/init.d/S50dropbear
0new file mode 1007550new file mode 100755
index 0000000..1ce463f
--- /dev/null
+++ b/src/etc/init.d/S50dropbear
@@ -0,0 +1,68 @@
1#!/bin/sh
2#
3# Starts dropbear sshd.
4#
5
6echo "Top of dropbear init script"
7
8# Allow a few customizations from a config file
9test -r /etc/default/dropbear && . /etc/default/dropbear
10
11start() {
12 DROPBEAR_ARGS="$DROPBEAR_ARGS -R"
13
14 echo -n "Starting dropbear sshd: "
15 umask 077
16 # Ensure host keys are changed when instance ID changes
17 cirros-per instance remove-dropbear-host-keys -- rm -rf /etc/dropbear
18
19 # Make sure dropbear directory exists
20 if [ ! -d /etc/dropbear ]; then
21 mkdir -p /etc/dropbear
22 fi
23
24 # Regenerate invalid or missing keys
25 local ktype file
26 for ktype in rsa dss ecdsa; do
27 file="/etc/dropbear/dropbear_${ktype}_host_key"
28 # -f = input file, -y = validate and print pubkey info
29 if ! dropbearkey -f "$file" -y &>/dev/null; then
30 if [ -e "$file" ]; then
31 echo "Removing invalid key: $file"
32 rm -f "$file"
33 fi
34 # -t = type (dss, rsa, ecdsa), -f = output file
35 dropbearkey -t "$ktype" -f "$file" >/dev/null 2>&1 ||
36 echo "WARN: generating key of type $ktype failed!"
37 fi
38 done
39 start-stop-daemon -S -q -p /var/run/dropbear.pid \
40 --exec /usr/sbin/dropbear -- $DROPBEAR_ARGS
41 [ $? = 0 ] && echo "OK" || echo "FAIL"
42}
43stop() {
44 echo -n "Stopping dropbear sshd: "
45 start-stop-daemon -K -q -p /var/run/dropbear.pid
46 [ $? = 0 ] && echo "OK" || echo "FAIL"
47}
48restart() {
49 stop
50 start
51}
52
53case "$1" in
54 start)
55 start
56 ;;
57 stop)
58 stop
59 ;;
60 restart|reload)
61 restart
62 ;;
63 *)
64 echo "Usage: $0 {start|stop|restart}"
65 exit 1
66esac
67
68exit $?

Subscribers

People subscribed via source and target branches