#!/bin/sh -e umask 0077 mkdir -p ~/.ssh : > ~/.ssh/authorized_keys fetch_keys() { curl -fsSL "${1}" >> ~/.ssh/authorized_keys } # shellcheck disable=SC2046 set -- $(cat /proc/cmdline) while [ $# -ge 1 ]; do case "$1" in sshkeys.*=*) arg=${1#*.} user=${arg%=*} url=${arg#*=} if [ "${user}" = "${USER}" ]; then fetch_keys "${url}" fi ;; esac shift done if [ -x "$(command -v selinuxenabled)" ] && selinuxenabled; then restorecon -RF ~/.ssh fi