fixed devzat rc script, user creation with skell, +new todo

This commit is contained in:
2024-12-16 16:10:11 +01:00
parent e6baefdbd5
commit 8d7fad0060
4 changed files with 37 additions and 14 deletions

View File

@@ -82,12 +82,9 @@ for root in "$rootdir" ""; do
args=""
skel=""
if test -n "$root"; then
root="-R $root"
if test -d "$root/etc/skel"; then
skel="-k /etc/skel"
fi
skel="-k /etc/skel"
fi
if test -n "$groups"; then
@@ -95,9 +92,9 @@ for root in "$rootdir" ""; do
fi
if test -n "$home"; then
args="$args -d $home $skel -m -M 700"
args="$args -d $home -m -M 700"
else
args="$args -d /home/$user $skel -m -M 700"
args="$args -d /home/$user -m -M 700"
fi
if test -n "$shell"; then
@@ -130,7 +127,7 @@ for root in "$rootdir" ""; do
fi
else
# create user
run pw $root user add "$user" $args
run pw $root user add "$user" $args $skel
# if we're running on host and the user is a regular jail user, lock them
if test -z "$root" -a "$groups" != "wheel"; then
@@ -140,9 +137,8 @@ for root in "$rootdir" ""; do
if test -e "/usr/local/bastille/keys/$user" -a ! -e "/home/$user/.ssh/authorized_keys"; then
# install ssh key
uid=$(getuid "$root" "$user")
run install -m 700 -o "$uid" -g "$uid" -d "/home/$user/.ssh"
run install -m 600 -o "$uid" -g "$uid" "/usr/local/bastille/keys/$user" "/home/$user/.ssh/authorized_keys"
run install -m 700 -o "$user" -g "$user" -d "/home/$user/.ssh"
run install -m 600 -o "$user" -g "$user" "/usr/local/bastille/keys/$user" "/home/$user/.ssh/authorized_keys"
# generate chat key, which is required so login to
# kobayashi, so that ssh-chat works even if the user does
@@ -164,7 +160,7 @@ for root in "$rootdir" ""; do
) > "/home/$user/.ssh/config"
fi
run chown "$uid:$uid" /home/$user/.ssh/*
run chown "$user:$user" /home/$user/.ssh/*
fi
;;
absent)