61 lines
2.9 KiB
Bash
61 lines
2.9 KiB
Bash
#!/hint/bash -euE
|
|
# Copyright (C) 2018 Luke Shumaker
|
|
# Copyright (C) 2023-2024 Umorpha Systems
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
load_module "$(dirname -- "${BASH_SOURCE[0]}")/base-sshd.sh"
|
|
|
|
packages+=(
|
|
# Functionality
|
|
sudo
|
|
|
|
# Experience
|
|
less
|
|
bash-completion
|
|
rxvt-unicode-terminfo
|
|
man-db
|
|
lsof
|
|
htop
|
|
)
|
|
|
|
post_install+=(
|
|
20:umorpha-sshusers:early
|
|
70:umorpha-sshusers:late
|
|
)
|
|
|
|
umorpha-sshusers:early() {
|
|
local arg_mountpoint=$1
|
|
|
|
echo en_US.UTF-8 UTF-8 >"${arg_mountpoint}/etc/locale.gen"
|
|
arch-chroot -- "$arg_mountpoint" locale-gen
|
|
|
|
cat >"${arg_mountpoint}/etc/locale.conf" <<-EOF
|
|
LANG=en_US.UTF-8
|
|
LC_COLLATE=C
|
|
EOF
|
|
|
|
echo '%wheel ALL=(ALL) ALL' >"$arg_mountpoint/etc/sudoers.d/00-wheel"
|
|
|
|
useradd --root="$arg_mountpoint" --gid=users --comment='Luke T. Shumaker' --create-home lukeshu
|
|
passwd --root="$arg_mountpoint" --delete --expire lukeshu
|
|
gpasswd --root="$arg_mountpoint" --add=lukeshu wheel
|
|
mkdir "$arg_mountpoint/home/lukeshu/.ssh"
|
|
echo >"$arg_mountpoint/home/lukeshu/.ssh/authorized_keys" 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDIOENnrA4fx+1DZE0oTpX84Rncc0yYKtUXM+1WIa+jHB4L0d5dCnvKshD5yi3G4TT5PhUSM+S/8zrnt9Ytug75Y3BRqG6ZIAeWc662X2z97ExDJZlV5KW7C1dVzMjM/EVyRV2ey0AqiaW/71lOkVw/AR2crggV2YfA24ecDN5tHVJGoxdi6isQyD2w0w1PnMWiXQR9aQ2kp9qv4MdW8sEYMmVSi3i5CNOQdYc+YIXsYfUSDiQ1YYVdvtHE7HprX86SCtqZCETKiYXxY0rtvJ+uI9aPmSpdEEo34EgwFtuYr+9sIfEhjL9+Hy/5+6HuksSpEY61UamiLUJhD7c1lZUpo93+oxHhRSzTvdTVoTRbZCu2iAmOJRhcqpLmhuHz2JesD73I+RmatTXGPaCkMex12QqGPvmhArxg8Btkd9ZiXFJZJgn11GiHBVTiAlf27pKXy0k2Il3iS+gcU7yndgoMI45WLh/vSHveHJ3IMEc1cZmBE70e8D3yp16cusn9bZ8= lukeshu@lukeshu-thinkpad-e15'
|
|
|
|
useradd --root="$arg_mountpoint" --gid=users --comment='Jason Prince' --create-home 3000farad
|
|
passwd --root="$arg_mountpoint" --delete --expire 3000farad
|
|
gpasswd --root="$arg_mountpoint" --add=3000farad wheel
|
|
mkdir "$arg_mountpoint/home/3000farad/.ssh"
|
|
echo >"$arg_mountpoint/home/3000farad/.ssh/authorized_keys" 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCVmi7bD44ogENL44uu9aH+bXuOmAC1s/E4QtPLJQJL/K5f+zgBpXQwvC5vC7JoEX1GeLa3hoYq5ywhSyrCzCRlcrw188OD1yPUJmHchel/jQ5ZTiX7tLZqswtKPuH55xhEm8cpZD9pgbdZY99X/p5hH8Y/8caQNbNkUtxqxbx8IpfQx4tuPs3ACniSu9WqrIGy2z+ZJl3HZ8pdtfW5R0ETwK7ZrjYqm6+GfSaKqEmXQsxwMH+Zw34vP0REpZt0JyG1IIQZg83mOKOBjFwnajfWWnbyejNgHTSSYejVjI9LtwFsIfg9lX0ECkrvkLRWE+iPjXfB7MpB3aZEvp718gh3RnzDmiVLfuMqqp1BMTxMnTTsaoK//z9ZB1IaHNYDiOtoDUs57y5DSc2eA1ardNRm8cahmZ5BdtklotytaoUoMUq186hM8lArDKLA1K0cVe9nVEWwf/ECcWKtR2fx70xeV3mTHGWJ7Srf2eDcthHrU6HNj+epmuiK6eUHqjLtjOsgitSeA5M5SW7uDcBdhH+qq6tV25n0aM70kZ/ms5MUfNhLTU7BTCbKX2FzeK9xP8wDV9mb5udYH1O6K6FoQFFx+Od/zuuqS5NPq3dcXP/T4s3CqiNwJpkNMg5fOimgl+eWugdc/m9YJY0cIOAxvpD5vUZYmI6taCUWmmNpp463Q== jp2021c'
|
|
}
|
|
|
|
umorpha-sshusers:late() {
|
|
local arg_mountpoint=$1
|
|
|
|
local user uidgid
|
|
for user in lukeshu; do
|
|
uidgid=$(awk -v FS=: -v OFS=: "\$1 == \"$user\" { print \$3, \$4 }" <"$arg_mountpoint/etc/passwd")
|
|
chown -R -- "$uidgid" "$arg_mountpoint/home/$user"
|
|
done
|
|
}
|