]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tmpfiles: add lines for provisioning ssh keys for root by default
authorLennart Poettering <lennart@poettering.net>
Thu, 15 Sep 2022 18:35:36 +0000 (19:35 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 23 Sep 2022 07:30:00 +0000 (09:30 +0200)
With this, I can now easily do:

    systemd-nspawn --load-credential=ssh.authorized_keys.root:/home/lennart/.ssh/authorized_keys --image=… --boot

To boot into an image with my SSH key copied in. Yay!

tmpfiles.d/provision.conf
units/systemd-tmpfiles-setup.service

index a4d7aaf99b264a3ab56e77d28719aa2b46117960..3c56f42d585880a71fd59b0f016563a79cb717c0 100644 (file)
@@ -15,3 +15,8 @@ f^ /etc/issue.d/50-provision.conf - - - - login.issue
 
 # Provision a /etc/hosts file from credentials.
 f^ /etc/hosts - - - - network.hosts
+
+# Provision SSH key for root
+d /root :0700 root :root -
+d /root/.ssh :0700 root :root -
+f^ /root/.ssh/authorized_keys :0600 root :root - ssh.authorized_keys.root
index 7e11eb941445ab539a38212fb3ea2d317c23bd27..a420465534985616ae14dd30cdf8c8cac4d1da34 100644 (file)
@@ -27,3 +27,4 @@ LoadCredential=tmpfiles.extra
 LoadCredential=login.motd
 LoadCredential=login.issue
 LoadCredential=network.hosts
+LoadCredential=ssh.authorized_keys.root