allows to add a public key to the root authorized_keys file

This commit is contained in:
Jacen 2019-09-25 23:52:41 +02:00
parent 6df8cf63f5
commit bcc7d1fea6
3 changed files with 10 additions and 0 deletions

View File

@ -122,6 +122,10 @@ The following environment variables are supported:
Password for the first user Password for the first user
* `ROOT_PUBLIC_KEY` (Default: "")
If set this public key will be added to the authorized_keys of the root user.
* `WPA_ESSID`, `WPA_PASSWORD` and `WPA_COUNTRY` (Default: unset) * `WPA_ESSID`, `WPA_PASSWORD` and `WPA_COUNTRY` (Default: unset)
If these are set, they are use to configure `wpa_supplicant.conf`, so that the Raspberry Pi can automatically connect to a wifi network on first boot. If `WPA_ESSID` is set and `WPA_PASSWORD` is unset an unprotected wifi network will be configured. If set, `WPA_PASSWORD` must be between 8 and 63 characters. If these are set, they are use to configure `wpa_supplicant.conf`, so that the Raspberry Pi can automatically connect to a wifi network on first boot. If `WPA_ESSID` is set and `WPA_PASSWORD` is unset an unprotected wifi network will be configured. If set, `WPA_PASSWORD` must be between 8 and 63 characters.

View File

@ -166,7 +166,9 @@ export TARGET_HOSTNAME=${TARGET_HOSTNAME:-raspberrypi}
export FIRST_USER_NAME=${FIRST_USER_NAME:-pi} export FIRST_USER_NAME=${FIRST_USER_NAME:-pi}
export FIRST_USER_PASS=${FIRST_USER_PASS:-raspberry} export FIRST_USER_PASS=${FIRST_USER_PASS:-raspberry}
export ROOT_PUBLIC_KEY="${ROOT_PUBLIC_KEY}"
export RELEASE=${RELEASE:-buster} export RELEASE=${RELEASE:-buster}
export WPA_ESSID export WPA_ESSID
export WPA_PASSWORD export WPA_PASSWORD
export WPA_COUNTRY export WPA_COUNTRY

View File

@ -21,6 +21,10 @@ else
systemctl disable ssh systemctl disable ssh
fi fi
systemctl enable regenerate_ssh_host_keys systemctl enable regenerate_ssh_host_keys
if [ -n "${ROOT_PUBLIC_KEY}" ]; then
mkdir -p /root/.ssh
echo "${ROOT_PUBLIC_KEY}" >> /root/.ssh/authorized_keys
fi
EOF EOF
if [ "${USE_QEMU}" = "1" ]; then if [ "${USE_QEMU}" = "1" ]; then