commit 9b4a197003cefdbd0ee4c3e700288cbcf8765a3b Author: Jay Larson Date: Tue Oct 4 08:51:34 2016 -0500 First check in diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2ee7a14 --- /dev/null +++ b/Makefile @@ -0,0 +1,93 @@ +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation here: +# (http://www.gnu.org/licenses/gpl-2.0.html) +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +DEPENDS = +ARCH = x86_64 +URL = http://www.openssh.com/ +DESC = OpenSSH is the premier connectivity tool for remote login with the \ +SSH protocol. +SNAPVER = sr0 + +ARCHIVE := $(PWD)/SRC/$(shell ls SRC|egrep '(bz2|gz|tar|xz)$$'|tail -1) +TYPE := $(shell file -ib $(ARCHIVE)|cut -d';' -f1|tr -d '\n') +SRCDIR := $(shell tar -tf $(ARCHIVE)|head -1|sed 's/\/.*//') +PATCHDIR := $(PWD)/SRC/patches +VERSION := $(shell echo $(SRCDIR)|egrep -o '\-[0-9].*'|sed 's/^-//')$(SNAPVER) + +MAKE = make +MAKEINST = make install +SNAPHACKS = install -v -d -m 755 $(ROOT)/etc/init.d && \ + install -v -d -m 755 $(ROOT)/usr/share/doc/openssh && \ + install -v -d -m 700 $(ROOT)/var/run/sshd && \ + install -v -m 755 $(SRCDIR)/contrib/ssh-copy-id $(ROOT)/usr/bin && \ + install -v -m 755 SNAP/sshd.init $(ROOT)/etc/init.d/sshd && \ + install -v -m 644 $(SRCDIR)/contrib/ssh-copy-id.1 \ + $(ROOT)/usr/share/man/man1 && \ + cd $(SRCDIR) && install -v -m644 INSTALL LICENCE OVERVIEW README* \ + $(ROOT)/usr/share/doc/openssh + +include /usr/share/snap/Makefile.snaplinux + +$(SRCDIR)/configure: $(ARCHIVE) + @if [ '$(TYPE)' == 'application/x-bzip2' ]; then \ + tar -jxf $(ARCHIVE); \ + elif [ '$(TYPE)' == 'application/x-gzip' ]; then \ + tar -zxf $(ARCHIVE); \ + elif [ '$(TYPE)' == 'application/x-tar' ]; then \ + tar -xf $(ARCHIVE); \ + elif [ '$(TYPE)' == 'application/x-xz' ]; then \ + tar -xf $(ARCHIVE); \ + else \ + echo 'Unable to determine archive type'; \ + exit 1; \ + fi + @touch $(SRCDIR)/configure + +$(SRCDIR)/config.log: $(SRCDIR)/configure + @cd $(SRCDIR) && for patch in `find $(PATCHDIR) -name \*.patch`; do \ + patch --verbose -Np1 -i $$patch; \ + done + @cd $(SRCDIR); \ + ./configure \ + --prefix=/usr \ + --sysconfdir=/etc/ssh \ + --with-md5-passwords \ + --with-privsep-path=/var/run/sshd \ + --build=x86_64-snap-linux-gnu \ + --host=x86_64-snap-linux-gnu \ + --target=x86_64-snap-linux-gnu + +$(SRCDIR)/sshd: $(SRCDIR)/config.log + @cd $(SRCDIR); \ + $(MAKE) + +$(ROOT): $(SRCDIR)/sshd + @if [ -d $(ROOT) ]; then \ + touch $(ROOT); \ + else \ + mkdir -v $(ROOT); \ + fi + + @cd $(SRCDIR); \ + $(MAKEINST) DESTDIR=$(ROOT) + + @$(SNAPHACKS) + +test: $(ROOT) + @cd $(SRCDIR); \ + make tests + +clean: + @rm -rvf $(ROOT) \ + $(SNAPINFO) \ + $(MANIFEST) \ + $(FILES) \ + $(SRCDIR) + diff --git a/SNAP/README b/SNAP/README new file mode 100644 index 0000000..19a3ff1 --- /dev/null +++ b/SNAP/README @@ -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. diff --git a/SNAP/sshd.init b/SNAP/sshd.init new file mode 100755 index 0000000..7fb3113 --- /dev/null +++ b/SNAP/sshd.init @@ -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 diff --git a/SNAP/usher b/SNAP/usher new file mode 100755 index 0000000..eab6656 --- /dev/null +++ b/SNAP/usher @@ -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 diff --git a/SRC/openssh-7.3p1.tar.gz b/SRC/openssh-7.3p1.tar.gz new file mode 100644 index 0000000..0e64373 Binary files /dev/null and b/SRC/openssh-7.3p1.tar.gz differ diff --git a/SRC/openssh-7.3p1.tar.gz.asc b/SRC/openssh-7.3p1.tar.gz.asc new file mode 100644 index 0000000..c48550a --- /dev/null +++ b/SRC/openssh-7.3p1.tar.gz.asc @@ -0,0 +1,14 @@ +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2 + +iQGsBAABCgAGBQJXnq2YAAoJENPl9Wttkg0wi3cMgJK+IzC4zWlrzzNIezpWN1cB +m7LUZAmsu8M8NAXBawxWok1Ldi2AG3Dl/cr5BW3L4P03EFSAo9EQmA1SnFIYp4MO +E3C2PPB4c90PicBsGheA0Rr21sooX+th5dctZxz1zNCsM8WTLk/HX4zJmCUmXAx0 +hNTdjqfVN5a/ILy9cXr6ESKpjUqvO99ttXYt+YPD287jI1YtqiEeZQ8WWZnGs0Sh +MV/iQaJ/lEkdcE4O41O6JnpRyYrEddMc0xX6J5iPtu4Js2uUKZxUo13/tqLtcvKu +XTIgZronS2zCb4vML29pq8K6jhd/5YgVWgKu/6xjXqTOqSFMNO9f8Vryf/mAih77 +VCISu4iWc0SREf6yGjG/sAM6DLzkRe/nDz+9UCG59X83aYXhS2PRS1znwD5O2J3i +Yh18tCF8aVF2YzcCZc9DrIHmkHf4Urhh7lepl9TUf+0GHR5oKen1Bcy9Y9Ul/2/p +jVaZENNVRierZavW4scWKdWjkZ0hU4gl9MyoUO3w06LxCnYEnpCD6TwBmZK5fow= +=P0oH +-----END PGP SIGNATURE----- diff --git a/SRC/patches/README b/SRC/patches/README new file mode 100644 index 0000000..253cdcd --- /dev/null +++ b/SRC/patches/README @@ -0,0 +1,2 @@ +Place any patch files here and preface each with a number indicating +the order of execution. Patch files are expected to use a .patch extension.