Move openssh-server to its own module. Move the key onto the systemid device.

This commit is contained in:
Ian Gulliver
2016-04-12 05:00:04 +00:00
parent 9fb8b2bc70
commit 5a55f3bb27
3 changed files with 52 additions and 1 deletions

View File

@@ -60,7 +60,6 @@ class ImageBuilder(object):
'iputils-ping',
'linux-firmware',
'linux-firmware-nonfree',
'openssh-server',
'ubuntu-minimal',
'ubuntu-standard',
'user-setup',

43
server/modules/openssh.py Executable file
View File

@@ -0,0 +1,43 @@
#!/usr/bin/python3
import argparse
import glob
import os
import subprocess
parser = argparse.ArgumentParser(description='iconograph openssh')
parser.add_argument(
'--chroot-path',
dest='chroot_path',
action='store',
required=True)
FLAGS = parser.parse_args()
def Exec(*args, **kwargs):
print('+', args)
subprocess.check_call(args, **kwargs)
def ExecChroot(*args, **kwargs):
Exec('chroot', FLAGS.chroot_path, *args, **kwargs)
def main():
ExecChroot(
'apt-get',
'install',
'--assume-yes',
'openssh-server')
for path in glob.glob(os.path.join(FLAGS.chroot_path, 'etc', 'ssh', 'ssh_host_*')):
os.unlink(path)
os.symlink(
'/systemid/ssh_host_ed25519_key',
os.path.join(FLAGS.chroot_path, 'etc', 'ssh', 'ssh_host_ed25519_key'))
if __name__ == '__main__':
main()