On Mon, 14 Jan 2013 09:37:05 -0500 Stéphane Graber <stgra...@ubuntu.com> wrote:
> Forwarding this from Bogdan as for some weird reason his e-mails are > put in the mailing-list moderation queue (even though he's > subscribed). > > Personally I think this change is good and would make the busybox > template behave similarly than the others where SSH is usually > automatically enabled. > > But I'm not actually using that template so I'd prefer if someone > actually using it could give their opinion on whether they're fine > with this behaviour by default or would rather have it moved behind a > command line option to the template. I only use it when I want to test something quickly in a very light system container. Since it checks for dropbear availability (see below for type vs which), I think it shouldn't break anything. > -----Original Message----- > From: Purcareata Bogdan-B43198 Sent: Monday, January 14, 2013 11:51 AM > To: 'lxc-us...@lists.sourceforge.net' > Subject: FW: [PATCH] Add Dropbear SSH support for lxc-busybox template > > Hello, > > I've sent this patch to lxc-devel and received a notification of > pending for approval from a maintainer. Since I didn't receive any > answer yet, I was not sure it was the right place. > > Bogdan P. > > > -----Original Message----- > From: Purcareata Bogdan-B43198 Sent: Thursday, January 10, 2013 2:23 > PM To: 'lxc-devel@lists.sourceforge.net' > Subject: [PATCH] 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. > > Patch is done against staging branch. > > Bogdan P. > > diff --git a/templates/lxc-busybox.in b/templates/lxc-busybox.in index > f2751d8..014aac4 100644 > --- a/templates/lxc-busybox.in > +++ b/templates/lxc-busybox.in > @@ -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,36 @@ 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 nit: I think we should use which instead of type here since which is what is used below, and type might include shell functions/builtin's that we don't want here. > + 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 > } > > ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122412 _______________________________________________ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel