Modified to support separate usher for client and server packages
This commit is contained in:
@@ -32,9 +32,15 @@ case "$1" in
|
||||
exit $error
|
||||
;;
|
||||
stop)
|
||||
log_init_msg "Stopping OpenBSD Secure Shell server"
|
||||
pid=`pidofproc -p "$PIDFILE" "$DAEMON"`
|
||||
|
||||
killproc "$DAEMON" -TERM && log_success_msg || log_failure_msg
|
||||
if [ -n "$pid" ]; then
|
||||
log_init_msg "Stopping OpenBSD Secure Shell server"
|
||||
|
||||
killproc "$DAEMON" -TERM && log_success_msg || log_failure_msg
|
||||
else
|
||||
log_init_msg "OpenBSD Secure Shell server not running" && log_success_msg
|
||||
fi
|
||||
;;
|
||||
reload|restart)
|
||||
log_init_msg "Restarting OpenBSD Secure Shell server"
|
||||
|
||||
20
SNAP/usher-client
Executable file
20
SNAP/usher-client
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
case $1 in
|
||||
preinst)
|
||||
exit 0
|
||||
;;
|
||||
postinst)
|
||||
if [ ! -f ${TARGET}/etc/ssh/ssh_config ]; then
|
||||
cp ${TARGET}/usr/share/openssh/ssh_config ${TARGET}/etc/ssh
|
||||
fi
|
||||
;;
|
||||
prerm)
|
||||
exit 0
|
||||
;;
|
||||
postrm)
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
66
SNAP/usher-server
Executable file
66
SNAP/usher-server
Executable file
@@ -0,0 +1,66 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
case $1 in
|
||||
preinst)
|
||||
exit 0
|
||||
;;
|
||||
postinst)
|
||||
if [[ ${TARGET} ]]; then
|
||||
if ! chroot ${TARGET} 'getent group sshd 2>&1' > /dev/null; then
|
||||
if chroot ${TARGET} 'groupadd -g 50 sshd'; then
|
||||
echo 'Created group sshd'
|
||||
else
|
||||
echo 'Failed to create group sshd!'
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
if ! chroot ${TARGET} 'getent passwd sshd 2>&1 > /dev/null'; then
|
||||
if chroot ${TARGET} 'useradd -c "sshd PrivSep" \
|
||||
-d /var/run/sshd -g sshd -s /bin/false -u 50 sshd'; then
|
||||
echo 'Created user sshd'
|
||||
else
|
||||
echo 'Failed to create user sshd!'
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f ${TARGET}/etc/ssh/ssh_host_rsa_key ]; then
|
||||
chroot ${TARGET} 'ssh-keygen -A'
|
||||
fi
|
||||
else
|
||||
if ! getent group sshd 2>&1 > /dev/null; then
|
||||
if groupadd -g 50 sshd; then
|
||||
echo 'Created group sshd'
|
||||
else
|
||||
echo 'Failed to create group sshd!'
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
if ! getent passwd sshd 2>&1 > /dev/null; then
|
||||
if useradd -c 'sshd PrivSep' -d /var/run/sshd -g sshd \
|
||||
-s /bin/false -u 50 sshd; then
|
||||
echo 'Created user sshd'
|
||||
else
|
||||
echo 'Failed to create user sshd!'
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
|
||||
ssh-keygen -A
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f ${TARGET}/etc/ssh/sshd_config ]; then
|
||||
cp ${TARGET}/usr/share/openssh/sshd_config ${TARGET}/etc/ssh
|
||||
fi
|
||||
;;
|
||||
prerm)
|
||||
exit 0
|
||||
;;
|
||||
postrm)
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user