restrict install to a single user

This commit is contained in:
Emil Lerch 2019-07-16 10:55:52 -07:00
parent a5ea5c2350
commit e175d088aa
Signed by: lobo
GPG Key ID: CEC5F37C1BE5A481
2 changed files with 11 additions and 2 deletions

View File

@ -1,5 +1,8 @@
#!/bin/sh
# NOTE: %1 is the user being authorized. However, we'll make this only for
# the primary user
# Accomodate for local install
PATH=$HOME/.local/bin:$PATH

View File

@ -1,8 +1,14 @@
#!/bin/sh
if [ $# -ne 1 ]; then
echo 'usage: makeitso <primaryusername>' >&2
exit 1
fi
sudo adduser --disabled-login --gecos 'User for AuthorizedKeysCommand' authorizedkeysuser
sudo sh -c "echo 'AuthorizedKeysCommand /etc/ssh/get_authorized_keys
sudo sh -c "echo 'Match User $1
AuthorizedKeysCommand /etc/ssh/get_authorized_keys
AuthorizedKeysCommandUser authorizedkeysuser' >> /etc/ssh/sshd_config"
sudo cp authorized_keys /etc/ssh