The following changes were made:
* Corrected PrivSep home directory (/var/lib/sshd -l /var/run/sshd) * Minor cleanup of duplication in usher * Cleaned up init script
This commit is contained in:
24
SNAP/usher
24
SNAP/usher
@@ -18,7 +18,7 @@ case $1 in
|
||||
fi
|
||||
if ! chroot ${TARGET} 'getent passwd sshd 2>&1 > /dev/null'; then
|
||||
if chroot ${TARGET} 'useradd -c "sshd PrivSep" \
|
||||
-d /var/lib/sshd -g sshd -s /bin/false -u 50 sshd'; then
|
||||
-d /var/run/sshd -g sshd -s /bin/false -u 50 sshd'; then
|
||||
echo 'Created user sshd'
|
||||
else
|
||||
echo 'Failed to create user sshd!'
|
||||
@@ -29,14 +29,6 @@ case $1 in
|
||||
if [ ! -f ${TARGET}/etc/ssh/ssh_host_rsa_key ]; then
|
||||
chroot ${TARGET} 'ssh-keygen -A'
|
||||
fi
|
||||
|
||||
if [ ! -f ${TARGET}/etc/ssh/ssh_config ]; then
|
||||
cp ${TARGET}/usr/share/openssh/ssh_config ${TARGET}/etc/ssh
|
||||
fi
|
||||
|
||||
if [ ! -f ${TARGET}/etc/ssh/sshd_config ]; then
|
||||
cp ${TARGET}/usr/share/openssh/sshd_config ${TARGET}/etc/ssh
|
||||
fi
|
||||
else
|
||||
if ! getent group sshd 2>&1 > /dev/null; then
|
||||
if groupadd -g 50 sshd; then
|
||||
@@ -47,7 +39,7 @@ case $1 in
|
||||
fi
|
||||
fi
|
||||
if ! getent passwd sshd 2>&1 > /dev/null; then
|
||||
if useradd -c 'sshd PrivSep' -d /var/lib/sshd -g sshd \
|
||||
if useradd -c 'sshd PrivSep' -d /var/run/sshd -g sshd \
|
||||
-s /bin/false -u 50 sshd; then
|
||||
echo 'Created user sshd'
|
||||
else
|
||||
@@ -59,14 +51,14 @@ case $1 in
|
||||
if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
|
||||
ssh-keygen -A
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/ssh/ssh_config ]; then
|
||||
cp /usr/share/openssh/ssh_config /etc/ssh
|
||||
fi
|
||||
if [ ! -f ${TARGET}/etc/ssh/ssh_config ]; then
|
||||
cp ${TARGET}/usr/share/openssh/ssh_config ${TARGET}/etc/ssh
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/ssh/sshd_config ]; then
|
||||
cp /usr/share/openssh/sshd_config /etc/ssh
|
||||
fi
|
||||
if [ ! -f ${TARGET}/etc/ssh/sshd_config ]; then
|
||||
cp ${TARGET}/usr/share/openssh/sshd_config ${TARGET}/etc/ssh
|
||||
fi
|
||||
;;
|
||||
prerm)
|
||||
|
||||
Reference in New Issue
Block a user