First check in

This commit is contained in:
2016-10-04 08:51:34 -05:00
commit 9b4a197003
7 changed files with 207 additions and 0 deletions

3
SNAP/README Normal file
View File

@@ -0,0 +1,3 @@
This is the directory where the manifest, snapinfo, and files.tar.gz
files will be created. It is also where the usher file should be
placed if it is required by the package.

60
SNAP/sshd.init Executable file
View File

@@ -0,0 +1,60 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: sshd
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: OpenBSD Secure Shell server
### END INIT INFO
. /lib/lsb/init-functions
DAEMON=/usr/sbin/sshd
check_privsep_dir() {
# Create the PrivSep empty dir if necessary
if [ ! -d /var/run/sshd ]; then
mkdir /var/run/sshd
chmod 0755 /var/run/sshd
fi
}
if ! test -f $DAEMON; then
log_info_msg "Failed to locate ssh daemon!"
log_failure_msg2
exit 1;
fi
case ${1} in
start)
check_privsep_dir
log_info_msg "Starting OpenBSD Secure Shell server"
$DAEMON
evaluate_retval
;;
stop)
if ! test -f /var/run/sshd.pid; then
log_info_msg "No sshd running"
log_failure_msg2
exit 1
exit
fi
log_info_msg "Stopping OpenBSD Secure Shell server"
kill -TERM $(cat /var/run/sshd.pid)
evaluate_retval
;;
restart)
log_info_msg "Restarting OpenBSD Secure Shell server"
kill -TERM $(cat /var/run/sshd.pid)
$DAEMON
evaluate_retval
;;
*)
echo "Usage: ${0} {start|stop|restart}"
exit 1
;;
esac
exit 0

35
SNAP/usher Executable file
View File

@@ -0,0 +1,35 @@
#!/bin/bash
case $1 in
preinst)
exit 0
;;
postinst)
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/lib/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
chown -v root:root /var/run/sshd
;;
prerm)
exit 0
;;
postrm)
exit 0
;;
esac