5 Commits

Author SHA1 Message Date
Jay Larson
efba61d10d The following changes were made:
* Modified Makefile to work with /bin/sh
  * Added REPO to Makefile.client and Makefile.server
  * Modified usher-client and usher-server to use /bin/sh
2018-03-30 09:36:15 -05:00
Jay Larson
ad3ba89a0c The following changes were made:
* Added shadow as dependency (for useradd and groupadd)
  * Removed old usher script
  * Modified client and server usher to not use chroot
2017-11-26 13:34:08 -06:00
Jay Larson
a5b7bc71d0 Added openssh-client as dependency for openssh-server (ssh-keygen) 2017-11-24 11:58:28 -06:00
Jay Larson
c840a57934 Modified to support separate usher for client and server packages 2017-11-24 11:27:56 -06:00
Jay Larson
fbb00bd666 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
2017-05-16 18:30:53 -05:00
7 changed files with 115 additions and 108 deletions

View File

@@ -10,12 +10,13 @@
export SRCPKG = openssh
export DEPENDS = glibc,openssl,zlib
export BUILDDEPS = file,gcc,linux-libc,openssl-dev
export ARCH = x86_64
export URL = http://www.openssh.com/
BRIEF = OpenSSH client and server
DESC = OpenSSH is the premier connectivity tool for remote login with the \
SSH protocol.
SNAPVER = 5
SNAPVER = 11
ARCHIVE := $(PWD)/SRC/$(shell ls SRC|egrep '(bz2|gz|tar|xz)$$'|tail -1)
TYPE := $(shell file -ib $(ARCHIVE)|cut -d';' -f1|tr -d '\n')
@@ -30,6 +31,7 @@ SERVER := $(PWD)/openssh-server
SERVERROOT := $(SERVER)/ROOT
$(SERVERROOT): $(CLIENTROOT)
cp -v $(PWD)/SNAP/usher-server $(SERVER)/SNAP/usher && \
cd $(SERVER) && make -f ../Makefile.server && mv *.snap ../
$(CLIENTROOT): $(SRCDIR)/sshd
@@ -52,9 +54,12 @@ $(CLIENTROOT): $(SRCDIR)/sshd
$(CLIENTROOT)/usr/share/openssh && \
install -v -d $(SERVER)/SNAP && \
install -v -d $(SERVERROOT) && \
install -v -d -m 755 $(SERVERROOT)/etc/{ssh,init.d} && \
install -v -d -m 755 $(SERVERROOT)/usr/{libexec,sbin} && \
install -v -d -m 755 $(SERVERROOT)/usr/share/man/man{5,8} && \
install -v -d -m 755 $(SERVERROOT)/etc/init.d && \
install -v -d -m 755 $(SERVERROOT)/etc/ssh && \
install -v -d -m 755 $(SERVERROOT)/usr/libexec && \
install -v -d -m 755 $(SERVERROOT)/usr/sbin && \
install -v -d -m 755 $(SERVERROOT)/usr/share/man/man5 && \
install -v -d -m 755 $(SERVERROOT)/usr/share/man/man8 && \
install -v -d -m 755 $(SERVERROOT)/usr/share/openssh && \
install -v -m 755 $(PWD)/SNAP/sshd.init \
$(SERVERROOT)/etc/init.d/sshd && \
@@ -68,16 +73,17 @@ $(CLIENTROOT): $(SRCDIR)/sshd
$(SERVERROOT)/usr/share/man/man5/sshd_config.5 && \
mv -v $(CLIENTROOT)/usr/share/man/man8/sftp-server.8 \
$(SERVERROOT)/usr/share/man/man8/sftp-server.8 && \
cp -v $(PWD)/SNAP/usher-client $(CLIENT)/SNAP/usher && \
cd $(CLIENT) && make -f ../Makefile.client && mv *.snap ../
$(SRCDIR)/configure: $(ARCHIVE)
@if [ '$(TYPE)' == 'application/x-bzip2' ]; then \
@if [ '$(TYPE)' = 'application/x-bzip2' ]; then \
tar -jxf $(ARCHIVE); \
elif [ '$(TYPE)' == 'application/x-gzip' ]; then \
elif [ '$(TYPE)' = 'application/x-gzip' ]; then \
tar -zxf $(ARCHIVE); \
elif [ '$(TYPE)' == 'application/x-tar' ]; then \
elif [ '$(TYPE)' = 'application/x-tar' ]; then \
tar -xf $(ARCHIVE); \
elif [ '$(TYPE)' == 'application/x-xz' ]; then \
elif [ '$(TYPE)' = 'application/x-xz' ]; then \
tar -xf $(ARCHIVE); \
else \
echo 'Unable to determine archive type'; \

View File

@@ -8,6 +8,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
REPO = main
BRIEF = OpenSSH client
DESC = The OpenSSH client provides a secure method of remotely \
accessing computer systems

View File

@@ -8,6 +8,8 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
REPO = server
DEPENDS = glibc,openssh-client,openssl,shadow,zlib
BRIEF = OpenSSH server
DESC = The OpenSSH server allows remote users to access the system securely

View File

@@ -1,9 +1,10 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: sshd
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Should-Start:
# Should-Stop:
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: OpenBSD Secure Shell server
@@ -12,38 +13,51 @@
. /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
}
PIDFILE=/var/run/sshd.pid
PRIVSEPDIR=/var/run/sshd
case "$1" in
start)
check_privsep_dir
log_info_msg "Starting OpenBSD Secure Shell server"
$DAEMON && log_success_msg || log_failure_msg
log_init_msg "Starting OpenBSD Secure Shell server"
if [ ! -d "$PRIVSEPDIR" ]; then
mkdir "$PRIVSEPDIR" || error=1
fi
chmod 0755 "$PRIVSEPDIR" || error=1
start_daemon "$DAEMON" || error=1
[ -z "$error" ] && log_success_msg || log_failure_msg
exit $error
;;
stop)
log_info_msg "Stopping OpenBSD Secure Shell server"
pid=`pidofproc -p "$PIDFILE" "$DAEMON"`
if ! test -f /var/run/sshd.pid; then
echo -n " - No sshd running"
log_warning_msg
if [ -n "$pid" ]; then
log_init_msg "Stopping OpenBSD Secure Shell server"
killproc "$DAEMON" -TERM && log_success_msg || log_failure_msg
else
kill -TERM $(cat /var/run/sshd.pid) && log_success_msg || log_failure_msg
log_init_msg "OpenBSD Secure Shell server not running" && log_success_msg
fi
;;
restart)
$0 stop
sleep 1
$0 start
reload|restart)
log_init_msg "Restarting OpenBSD Secure Shell server"
killproc -p "$PIDFILE" "$DAEMON" -HUP && log_success_msg || log_failure_msg
;;
status)
pid=$(pidofproc -p "$PIDFILE" "$DAEMON")
if [ "$?" -ne 0 ]; then
echo "OpenBSD Secure Shell server not running"
else
echo "OpenBSD Secure Shell server running with PID: $pid"
fi
;;
*)
echo "Usage: $0 [start|stop|restart]"
echo "Usage: $0 [start|stop|reload|restart|status]"
exit 1
;;
esac

View File

@@ -1,78 +0,0 @@
#!/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/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
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
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
if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
ssh-keygen -A
fi
if [ ! -f /etc/ssh/ssh_config ]; then
cp /usr/share/openssh/ssh_config /etc/ssh
fi
if [ ! -f /etc/ssh/sshd_config ]; then
cp /usr/share/openssh/sshd_config /etc/ssh
fi
fi
;;
prerm)
exit 0
;;
postrm)
exit 0
;;
esac

20
SNAP/usher-client Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/sh
set -e
case $1 in
preinst)
exit 0
;;
postinst)
if [ ! -f /etc/ssh/ssh_config ]; then
cp /usr/share/openssh/ssh_config /etc/ssh
fi
;;
prerm)
exit 0
;;
postrm)
exit 0
;;
esac

42
SNAP/usher-server Executable file
View File

@@ -0,0 +1,42 @@
#!/bin/sh
set -e
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/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
if [ ! -f /etc/ssh/sshd_config ]; then
cp /usr/share/openssh/sshd_config /etc/ssh
fi
;;
prerm)
exit 0
;;
postrm)
exit 0
;;
esac