Commit c94e60d1 by Purcareata Bogdan-B43198 Committed by Stéphane Graber

Add Dropbear SSH support for lxc-busybox template

Dropbear implements lightweight SSH2 server and client functionality and is likely to be included in embedded Linux distros. Signed-off-by: 's avatarPurcareata Bogdan <B43198@freescale.com> Acked-by: 's avatarStéphane Graber <stgraber@ubuntu.com>
parent f6d3e3e4
......@@ -33,7 +33,9 @@ $rootfs/root \
$rootfs/etc \
$rootfs/etc/init.d \
$rootfs/bin \
$rootfs/usr/bin \
$rootfs/sbin \
$rootfs/usr/sbin \
$rootfs/proc \
$rootfs/mnt \
$rootfs/tmp \
......@@ -63,6 +65,8 @@ $rootfs/usr/lib64"
chmod 600 ram0 || res=1
mknod null c 1 3 || res=1
chmod 666 null || res=1
mknod urandom c 1 9 || res=1
chmod 666 urandom || res=1
popd > /dev/null
......@@ -188,6 +192,35 @@ configure_busybox()
echo "setting root passwd to root"
echo "root:root" | chroot $rootfs chpasswd
# add ssh functionality if dropbear package available on host
type dropbear >/dev/null
if [ $? -eq 0 ]; then
# copy dropbear binary
cp $(which dropbear) $rootfs/usr/sbin
if [ $? -ne 0 ]; then
echo "Failed to copy dropbear in the rootfs"
return 1
fi
# make symlinks to various ssh utilities
utils="\
$rootfs/usr/bin/dbclient \
$rootfs/usr/bin/scp \
$rootfs/usr/bin/ssh \
$rootfs/usr/sbin/dropbearkey \
$rootfs/usr/sbin/dropbearconvert \
"
echo $utils | xargs -n1 ln -s /usr/sbin/dropbear
# add necessary config files
mkdir $rootfs/etc/dropbear
dropbearkey -t rsa -f $rootfs/etc/dropbear/dropbear_rsa_host_key &> /dev/null
dropbearkey -t dss -f $rootfs/etc/dropbear/dropbear_dss_host_key &> /dev/null
echo "'dropbear' ssh utility installed"
fi
return 0
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment