Package: vmdebootstrap Version: 0.7-1 Tags: upstream patch
>From 5b48e4d8e535a858e638156dc2a09896d1aafc9c Mon Sep 17 00:00:00 2001 From: Jan Gerber <j...@mailb.org> Date: Mon, 27 Apr 2015 12:08:57 +0200 Subject: add option to install ssh key for root (--root-ssh-key)
diff --git a/vmdebootstrap b/vmdebootstrap index 49c21c8..d951d31 100755 --- a/vmdebootstrap +++ b/vmdebootstrap @@ -131,6 +131,10 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth ['lock-root-password'], 'lock root account so they cannot login?') self.settings.string( + ['root-ssh-key'], + "install given public ssh key in /root/.ssh/authorized_keys", + metavar='SSHKEY') + self.settings.string( ['customize'], 'run SCRIPT after setting up system', metavar='SCRIPT') @@ -544,6 +548,12 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth else: self.message('Give root an empty password') self.delete_password(rootdir, 'root') + if self.settings['root-ssh-key']: + self.message('Copy root ssh key %s' % self.settings['root-ssh-key']) + os.mkdir(os.path.join(rootdir, 'root', '.ssh')) + os.chmod(os.path.join(rootdir, 'root', '.ssh'), 0700) + shutil.copy(self.settings['root-ssh-key'], + os.path.join(rootdir, 'root', '.ssh', 'authorized_keys')) def create_users(self, rootdir): def create_user(user): diff --git a/vmdebootstrap.8.in b/vmdebootstrap.8.in index 80df9bc..7ab5607 100644 --- a/vmdebootstrap.8.in +++ b/vmdebootstrap.8.in @@ -24,7 +24,7 @@ vmdebootstrap \- install basic Debian system into virtual disk image [\-\-output=FILE] [\-\-verbose |\-\-no-verbose] \-\-image=FILE \-\-size=SIZE [\-\-tarball=FILE] [\-\-mirror=URL] [\-\-arch=ARCH] [\-\-distribution=NAME] [\-\-package=PACKAGE] [\-\-custom-package=DEB] [\-\-no-kernel] -[\-\-enable-dhcp | \-\-no-enable-dhcp] [\-\-root-password=PASSWORD] +[\-\-enable-dhcp | \-\-no-enable-dhcp] [\-\-root-password=PASSWORD] [\-\-root-ssh-key=KEY] [\-\-customize=SCRIPT] [\-\-hostname=HOSTNAME] [\-\-user=USER/PASSWORD] [\-\-serial-console | \-\-no-serial-console] [\-\-sudo |\-\-no-sudo] [\-\-owner=OWNER] [\-\-bootsize=BOOTSIZE] [\-\-boottype=FSTYPE] [\-\-roottype=FSTYPE] [\-\-foreign=PATH] @@ -166,6 +166,8 @@ do not install a linux package enable DHCP on eth0 .IP \-\-root-password=PASSWORD set root password +.IP \-\-root-ssh-key=KEY +install ssh key in /root/.ssh/authorized_keys .IP \-\-customize=SCRIPT run SCRIPT after setting up system. If the script does not exist in the current working directory, /usr/share/vmdebootstrap/examples/ will be checked as a -- 2.2.1.209.g41e5f3a