From 94e268f4d359d6d2de417f991b8ea6f420d60d58 Mon Sep 17 00:00:00 2001 From: Alex Landau Date: Sun, 28 Dec 2008 08:55:04 +0000 Subject: rapid-tunneling: - deb support (not tested, probably not working) git-svn-id: svn+ssh://xorcom/home/svn/debs/components/rapid-tunneling@6500 283159da-0705-0410-b60c-f2062b4bb6ad --- Makefile | 8 ++- debian/changelog | 6 ++ debian/compat | 1 + debian/control | 25 ++++++++ debian/copyright | 38 ++++++++++++ debian/dirs | 2 + debian/postinst | 43 ++++++++++++++ debian/prerm | 41 +++++++++++++ debian/rules | 18 ++++++ sshd_support_debian | 165 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 10 files changed, 346 insertions(+), 1 deletion(-) create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/dirs create mode 100644 debian/postinst create mode 100644 debian/prerm create mode 100755 debian/rules create mode 100755 sshd_support_debian diff --git a/Makefile b/Makefile index ddbc85c..7cdcce6 100644 --- a/Makefile +++ b/Makefile @@ -9,12 +9,18 @@ SOURCES = Makefile $(SPEC) $(SCRIPTS) $(CONFIGS) $(INIT_D) VER = $(shell awk '/^Version: / {print $$2}' $(SPEC)| head -n 1) REL = $(shell awk '/^Release: / {print $$2}' $(SPEC)| head -n 1) -all: rpm +all: rpm deb rpm: $(SPEC) SOURCES/$(PACKAGE)-$(VER).tar.gz mkdir -p BUILD RPMS SOURCES SRPMS [ -e SPECS ] || ln -s . SPECS cd SPECS; rpmbuild --target noarch --define "_topdir $(PWD)" -ba $(SPEC) + mkdir -p OUTPUT + cp RPMS/rapid-tunneling{,-server}-$(VER)-$(REL).noarch.rpm OUTPUT/ + cp SRPMS/rapid-tunneling-$(VER)-$(REL).src.rpm OUTPUT/ + +deb: + debuild -uc -us SOURCES/$(PACKAGE)-$(VER).tar.gz: $(SOURCES) tar czf $@ --transform 's|^|$(PACKAGE)-$(VER)/|' $^ diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..31b2930 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,6 @@ +rapid-tunneling (1.0-1) unstable; urgency=low + + * Initial release (Closes: #nnnn) + + -- Alex Landau Sun, 14 Dec 2008 17:20:04 +0200 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +7 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..f9a165e --- /dev/null +++ b/debian/control @@ -0,0 +1,25 @@ +Source: rapid-tunneling +Section: net +Priority: extra +Maintainer: Alex Landau +Build-Depends: cdbs, debhelper (>= 7) +Standards-Version: 3.8.0 +Homepage: http://www.xorcom.com/ + +Package: rapid-tunneling +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends} openssh-client +Description: RapidTunneling (tm) client + RapidTunneling (tm) allows remote access to machines behind firewalls + and NAT routers via SSH port forwarding. + . + This package contains the client-side scripts. + +Package: rapid-tunneling-server +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends} openssh-server +Description: RapidTunneling (tm) server + RapidTunneling (tm) allows remote access to machines behind firewalls + and NAT routers via SSH port forwarding. + . + This package contains the server-side scripts. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..58250d1 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,38 @@ +This package was debianized by Alex Landau on +Sun, 14 Dec 2008 17:20:04 +0200. + +It was downloaded from + +Upstream Author(s): + + Alex Landau + +Copyright: + + Copyright (C) 2008 Alex Landau + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This package 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. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + +The Debian packaging is (C) 2008, Alex Landau and +is licensed under the GPL, see above. + + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 0000000..ca882bb --- /dev/null +++ b/debian/dirs @@ -0,0 +1,2 @@ +usr/bin +usr/sbin diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..25fde56 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,43 @@ +#!/bin/sh +# postinst script for rapid-tunneling +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + configure) + # add a user with uid=gid=0 + useradd -d /var/lib/rapid-tunneling/home -m -u 0 -g 0 -o rapid-tunneling 2>/dev/null || true + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/debian/prerm b/debian/prerm new file mode 100644 index 0000000..7602eac --- /dev/null +++ b/debian/prerm @@ -0,0 +1,41 @@ +#!/bin/sh +# prerm script for rapid-tunneling +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `upgrade' +# * `failed-upgrade' +# * `remove' `in-favour' +# * `deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + remove) + userdel -r rapid-tunneling || : + ;; + + failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..ab0251a --- /dev/null +++ b/debian/rules @@ -0,0 +1,18 @@ +#!/usr/bin/make -f + + +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/makefile.mk + +DEB_MAKE_BUILD_TARGET = dummy +DEB_MAKE_INSTALL_TARGET = install DESTDIR=$(DEB_DESTDIR) + +clean:: + rm -f debian/rapid-tunneling-server.ssh_support.init + +build/rapid-tunneling-server:: + cp sshd_support_debian debian/rapid-tunneling-server.ssh_support.init + +install/rapid-tunneling-server:: + dh_installinit -p rapid-tunneling-server --name=ssh_support + diff --git a/sshd_support_debian b/sshd_support_debian new file mode 100755 index 0000000..4b9577f --- /dev/null +++ b/sshd_support_debian @@ -0,0 +1,165 @@ +#! /bin/sh + +### BEGIN INIT INFO +# Provides: sshd_support +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 1 +# Short-Description: OpenBSD Secure Shell server for RapidTunneling (tm) +### END INIT INFO + +set -e + +# /etc/init.d/ssh: start and stop the OpenBSD "secure shell(tm)" daemon for RapidTunneling (tm) + +test -x /usr/sbin/sshd || exit 0 +( /usr/sbin/sshd -\? 2>&1 | grep -q OpenSSH ) 2>/dev/null || exit 0 + +export SSHD_OOM_ADJUST=-17 +if test -f /etc/default/ssh; then + . /etc/default/ssh +fi + +. /lib/lsb/init-functions + +PID_FILE=/var/run/sshd_support.pid +SSHD_OPTS="$SSHD_OPTS -f /etc/ssh/sshd_support_config -o 'PidFile $PID_FILE'" +if [ -n "$2" ]; then + SSHD_OPTS="$SSHD_OPTS $2" +fi + +# Are we running from init? +run_by_init() { + ([ "$previous" ] && [ "$runlevel" ]) || [ "$runlevel" = S ] +} + +check_for_no_start() { + # forget it if we're trying to start, and /etc/ssh/sshd_not_to_be_run exists + if [ -e /etc/ssh/sshd_not_to_be_run ]; then + if [ "$1" = log_end_msg ]; then + log_end_msg 0 + fi + if ! run_by_init; then + log_action_msg "OpenBSD Secure Shell server not in use (/etc/ssh/sshd_not_to_be_run)" + fi + exit 0 + fi +} + +check_dev_null() { + if [ ! -c /dev/null ]; then + if [ "$1" = log_end_msg ]; then + log_end_msg 1 || true + fi + if ! run_by_init; then + log_action_msg "/dev/null is not a character device!" + fi + exit 1 + fi +} + +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 +} + +check_config() { + if [ ! -e /etc/ssh/sshd_not_to_be_run ]; then + /usr/sbin/sshd -t || exit 1 + fi +} + +export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" + +case "$1" in + start) + check_privsep_dir + check_for_no_start + check_dev_null + log_daemon_msg "Starting RapidTunneling server" "sshd_support" + if start-stop-daemon --start --quiet --oknodo --pidfile $PID_FILE --exec /usr/sbin/sshd -- $SSHD_OPTS; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + stop) + log_daemon_msg "Stopping RapidTunneling server" "sshd_support" + if start-stop-daemon --stop --quiet --oknodo --pidfile $PID_FILE; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + + reload|force-reload) + check_for_no_start + check_config + log_daemon_msg "Reloading RapidTunneling server's configuration" "sshd_support" + if start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile $PID_FILE --exec /usr/sbin/sshd; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + + restart) + check_privsep_dir + check_config + log_daemon_msg "Restarting RapidTunneling server" "sshd_support" + start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $PID_FILE + check_for_no_start log_end_msg + check_dev_null log_end_msg + if start-stop-daemon --start --quiet --oknodo --pidfile $PID_FILE --exec /usr/sbin/sshd -- $SSHD_OPTS; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + + try-restart) + check_privsep_dir + check_config + log_daemon_msg "Restarting RapidTunneling server" "sshd_support" + set +e + start-stop-daemon --stop --quiet --retry 30 --pidfile $PID_FILE + RET="$?" + set -e + case $RET in + 0) + # old daemon stopped + check_for_no_start log_end_msg + check_dev_null log_end_msg + if start-stop-daemon --start --quiet --oknodo --pidfile $PID_FILE --exec /usr/sbin/sshd -- $SSHD_OPTS; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + 1) + # daemon not running + log_progress_msg "(not running)" + log_end_msg 0 + ;; + *) + # failed to stop + log_progress_msg "(failed to stop)" + log_end_msg 1 + ;; + esac + ;; + + status) + status_of_proc -p $PID_FILE /usr/sbin/sshd sshd_support && exit 0 || exit $? + ;; + + *) + log_action_msg "Usage: /etc/init.d/sshd_support {start|stop|reload|force-reload|restart|try-restart|status}" + exit 1 +esac + +exit 0 -- cgit v1.2.3