Skip to content

Instantly share code, notes, and snippets.

@cianmcgovern
Created November 20, 2012 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cianmcgovern/4118375 to your computer and use it in GitHub Desktop.
Save cianmcgovern/4118375 to your computer and use it in GitHub Desktop.
Patch for encrypt to enable dropbear ssh unlocking support
--- encryptssh 2012-11-20 13:36:06.543242127 +0000
+++ encryptssh 2012-11-20 14:31:29.943244577 +0000
@@ -44,6 +44,9 @@
cryptname="root"
fi
+ echo ${cryptdev} > /.cryptdev
+ echo ${cryptname} > /.cryptname
+
warn_deprecated() {
echo "The syntax 'root=${root}' where '${root}' is an encrypted volume is deprecated"
echo "Use 'cryptdevice=${root}:root root=/dev/mapper/root' instead."
@@ -79,8 +82,39 @@
#loop until we get a real password
while ! eval cryptsetup luksOpen ${resolved} ${cryptname} ${cryptargs} ${CSQUIET}; do
- sleep 2;
+ if [ -f /.done ]; then
+ break
+ fi
+ sleep 2;
done
+
+ killall dropbear
+ . /ip_opts
+ /sbin/ip addr flush dev "$device"
+ /sbin/ip link set down "$device"
+
+ if [ -f /.done ]; then
+ rm /.done
+ fi
+
+ if [ -f /.cryptdev ]; then
+ rm /.cryptdev
+ fi
+
+ if [ -f /.cryptname ]; then
+ rm /.cryptname
+ fi
+
+ umount /dev/pts
+ rm -R /dev/pts
+
+ if [ -f /var/log/lastlog ]; then
+ rm /var/log/lastlog
+ fi
+
+ if [ -f /var/run/dropbear.pid ]; then
+ rm /var/run/dropbear.pid
+ fi
fi
if [ -e "/dev/mapper/${cryptname}" ]; then
if [ ${DEPRECATED_CRYPT} -eq 1 ]; then
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment