From 4e1b9c8280a3a157af8d2aa5e0dd405a82b71c5b Mon Sep 17 00:00:00 2001 From: Matt Johnston Date: Fri, 23 Sep 2022 18:35:08 +0800 Subject: [PATCH] Import Maemo changes from 0.52-2 Taken from source tarball http://maemo.org/packages/source/view/fremantle_extras-devel_free_source/dropbear/0.52-2/ --- Makefile.in | 2 +- debian/changelog | 18 ++++ debian/control | 79 ++++++++++++++++- debian/dropbear-server.conffiles | 3 + debian/dropbear-server.postinst | 79 +++++++++++++++++ debian/dropbear-server.postrm | 12 +++ debian/dropbear-server.prerm | 11 +++ debian/dropbear.init | 4 +- debian/rules | 148 ++++++++++++++++++++++++++----- 9 files changed, 328 insertions(+), 28 deletions(-) create mode 100644 debian/dropbear-server.conffiles create mode 100644 debian/dropbear-server.postinst create mode 100644 debian/dropbear-server.postrm create mode 100644 debian/dropbear-server.prerm diff --git a/Makefile.in b/Makefile.in index e824491..c179548 100644 --- a/Makefile.in +++ b/Makefile.in @@ -43,7 +43,7 @@ COMMONOBJS=dbutil.o buffer.o dbhelpers.o \ SVROBJS=svr-kex.o svr-auth.o sshpty.o \ svr-authpasswd.o svr-authpubkey.o svr-authpubkeyoptions.o svr-session.o svr-service.o \ svr-chansession.o svr-runopts.o svr-agentfwd.o svr-main.o svr-x11fwd.o\ - svr-tcpfwd.o svr-authpam.o + svr-tcpfwd.o svr-authpam.o @CRYPTLIB@ CLIOBJS=cli-main.o cli-auth.o cli-authpasswd.o cli-kex.o \ cli-session.o cli-runopts.o cli-chansession.o \ diff --git a/debian/changelog b/debian/changelog index f7e2ffa..231a070 100644 --- a/debian/changelog +++ b/debian/changelog @@ -173,6 +173,24 @@ dropbear (0.53-0.1) unstable; urgency=low -- Matt Johnston Thu, 24 Feb 2011 22:54:00 +0900 +dropbear (0.52-2) unstable; urgency=low + + * Make key utils part of dropbear-server package (since it's + required anyway, single binary saves space), rename -common to + -keyutils + * Don't make clean between builds, just rm *.o since only + top-level files change + + -- Matt Johnston Wed, 19 Nov 2008 21:54:00 +0900 + +dropbear (0.52-1) unstable; urgency=low + + * Maemo port, split into 5 packages + (dropbear, dropbear-server, dropbear-client, dropbear-common, dropbear-scp). + This avoids conflicts with openssh package. + + -- Matt Johnston Wed, 19 Nov 2008 20:54:00 +0900 + dropbear (0.52-0.1) unstable; urgency=low * New upstream release. diff --git a/debian/control b/debian/control index e2731f6..49e490e 100644 --- a/debian/control +++ b/debian/control @@ -1,7 +1,7 @@ Source: dropbear -Section: net +Section: user/network Priority: optional -Maintainer: Gerrit Pape +Maintainer: Matt Johnston Build-Depends: libz-dev Standards-Version: 3.7.3.0 @@ -9,6 +9,9 @@ Package: dropbear Architecture: any Depends: ${shlibs:Depends} Suggests: openssh-client, runit +Section: user/network +Conflicts: dropbear-server, dropbear-client, dropbear-keyutils, dropbear-scp +XB-Maemo-Display-Name: Dropbear SSH Client and Server Description: lightweight SSH2 server and client dropbear is a SSH 2 server and client designed to be small enough to be used in small memory environments, while still being functional and @@ -17,4 +20,76 @@ Description: lightweight SSH2 server and client It implements most required features of the SSH 2 protocol, and other features such as X11 and authentication agent forwarding. . + This package provides Dropbear client and server as a single binary, + as well as key utilities and SCP. + . See http://matt.ucc.asn.au/dropbear/dropbear.html + +Package: dropbear-server +Architecture: any +Depends: ${shlibs:Depends} +Section: user/network +Conflicts: dropbear, dropbear-keyutils +Provides: dropbear-keyutils +Recommends: dropbear-scp +XB-Maemo-Display-Name: Dropbear SSH Server +Description: lightweight SSH2 server + dropbear is a SSH 2 server and client designed to be small enough to + be used in small memory environments, while still being functional and + secure enough for general use. + . + It implements most required features of the SSH 2 protocol, and other + features such as X11 and authentication agent forwarding. + . + This package provides only the Dropbear server. + . + See http://matt.ucc.asn.au/dropbear/dropbear.html + +Package: dropbear-client +Architecture: any +Conflicts: dropbear +Section: user/network +Depends: ${shlibs:Depends} +Recommends: dropbear-scp +Suggests: dropbear-keyutils +XB-Maemo-Display-Name: Dropbear SSH Client +Description: lightweight SSH2 client + dropbear is a SSH 2 server and client designed to be small enough to + be used in small memory environments, while still being functional and + secure enough for general use. + . + It implements most required features of the SSH 2 protocol, and other + features such as X11 and authentication agent forwarding. + . + This package provides only the Dropbear client. + . + See http://matt.ucc.asn.au/dropbear/dropbear.html + +Package: dropbear-keyutils +Architecture: any +Conflicts: dropbear, dropbear-server +Section: user/network +XB-Maemo-Display-Name: Dropbear SSH Key Utils +Depends: ${shlibs:Depends} +Description: lightweight SSH2, key management utilities + dropbear is a SSH 2 server and client designed to be small enough to + be used in small memory environments, while still being functional and + secure enough for general use. + . + This package provides dropbearkey and dropbearconvert programs, + for generating keys and converting to/from OpenSSH keys. + . + See http://matt.ucc.asn.au/dropbear/dropbear.html + +Package: dropbear-scp +Architecture: any +Section: user/network +Conflicts: dropbear +XB-Maemo-Display-Name: Dropbear SCP +Depends: ${shlibs:Depends} +Description: lightweight SSH2 scp + dropbear is a SSH 2 server and client designed to be small enough to + be used in small memory environments, while still being functional and + secure enough for general use. + . + This dropbear-scp package provides /usr/bin/scp. diff --git a/debian/dropbear-server.conffiles b/debian/dropbear-server.conffiles new file mode 100644 index 0000000..6919006 --- /dev/null +++ b/debian/dropbear-server.conffiles @@ -0,0 +1,3 @@ +/etc/init.d/dropbear +/etc/dropbear/run +/etc/dropbear/log/run diff --git a/debian/dropbear-server.postinst b/debian/dropbear-server.postinst new file mode 100644 index 0000000..2491e45 --- /dev/null +++ b/debian/dropbear-server.postinst @@ -0,0 +1,79 @@ +#!/bin/sh +set -e + +test "$1" = 'configure' || exit 0 + +if test ! -e /etc/dropbear/dropbear_rsa_host_key; then + if test -f /etc/ssh/ssh_host_rsa_key; then + echo "Converting existing OpenSSH RSA host key to Dropbear format." + /usr/lib/dropbear/dropbearconvert openssh dropbear \ + /etc/ssh/ssh_host_rsa_key /etc/dropbear/dropbear_rsa_host_key + else + echo "Generating Dropbear RSA key. Please wait." + dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key + fi +fi +if test ! -e /etc/dropbear/dropbear_dss_host_key; then + if test -f /etc/ssh/ssh_host_dsa_key; then + echo "Converting existing OpenSSH RSA host key to Dropbear format." + /usr/lib/dropbear/dropbearconvert openssh dropbear \ + /etc/ssh/ssh_host_dsa_key /etc/dropbear/dropbear_dss_host_key + else + echo "Generating Dropbear DSS key. Please wait." + dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key + fi +fi +if test ! -s /etc/default/dropbear; then + # check whether OpenSSH seems to be installed. + if test -x /usr/sbin/sshd; then + cat <>/etc/default/dropbear <>/etc/default/dropbear </dev/null + if test -x /usr/sbin/invoke-rc.d; then + invoke-rc.d dropbear restart + else + /etc/init.d/dropbear restart + fi +fi + +if test -n "$2" && dpkg --compare-versions "$2" lt '0.50-4' && +update-service --check dropbear 2>/dev/null; then + update-service --remove /etc/dropbear 2>/dev/null || : + sleep 6 + rm -rf /var/run/dropbear /var/run/dropbear.log + update-service --add /etc/dropbear || : +fi diff --git a/debian/dropbear-server.postrm b/debian/dropbear-server.postrm new file mode 100644 index 0000000..d09dab0 --- /dev/null +++ b/debian/dropbear-server.postrm @@ -0,0 +1,12 @@ +#! /bin/sh +set -e + +test "$1" = 'purge' || exit 0 +if test -e /etc/dropbear; then + rm -f /etc/dropbear/dropbear_rsa_host_key + rm -f /etc/dropbear/dropbear_dss_host_key + rmdir --ignore-fail-on-non-empty /etc/dropbear +fi +update-rc.d dropbear remove >/dev/null +rm -f /etc/default/dropbear +rm -rf /etc/dropbear/supervise /etc/dropbear/log/supervise diff --git a/debian/dropbear-server.prerm b/debian/dropbear-server.prerm new file mode 100644 index 0000000..e63cdb8 --- /dev/null +++ b/debian/dropbear-server.prerm @@ -0,0 +1,11 @@ +#!/bin/sh +set -e + +test "$1" = 'remove' || test "$1" = 'deconfigure' || exit 0 +if test -x /etc/init.d/dropbear; then + if test -x /usr/sbin/invoke-rc.d; then + invoke-rc.d dropbear stop + else + /etc/init.d/dropbear stop + fi +fi diff --git a/debian/dropbear.init b/debian/dropbear.init index ef3ec3f..6c5f193 100644 --- a/debian/dropbear.init +++ b/debian/dropbear.init @@ -39,7 +39,7 @@ test -n "$DROPBEAR_RECEIVE_WINDOW" || \ case "$1" in start) - test "$NO_START" = "0" || cancel 'NO_START is not set to zero.' + test "$NO_START" = "0" || cancel '/etc/default/dropbear NO_START is set, Dropbear will not run.' echo -n "Starting $DESC: " start-stop-daemon --start --quiet --pidfile /var/run/"$NAME".pid \ --exec "$DAEMON" -- -d "$DROPBEAR_DSSKEY" -r "$DROPBEAR_RSAKEY" \ @@ -52,7 +52,7 @@ case "$1" in echo "$NAME." ;; restart|force-reload) - test "$NO_START" = "0" || cancel 'NO_START is not set to zero.' + test "$NO_START" = "0" || cancel '/etc/default/dropbear NO_START is set, Dropbear will not run.' echo -n "Restarting $DESC: " start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/"$NAME".pid sleep 1 diff --git a/debian/rules b/debian/rules index c6b2e85..ccde20e 100755 --- a/debian/rules +++ b/debian/rules @@ -20,8 +20,6 @@ ifneq (,$(findstring diet,$(DEB_BUILD_OPTIONS))) CC =diet -v -Os gcc -nostdinc endif -DIR =$(shell pwd)/debian/dropbear - patch: deb-checkdir patch-stamp patch-stamp: for i in `ls -1 debian/diff/*.diff || :`; do \ @@ -36,13 +34,15 @@ config.status: patch-stamp configure --build='$(DEB_BUILD_GNU_TYPE)' --prefix=/usr \ --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info \ $(CONFFLAGS) + $(MAKE) clean build: deb-checkdir build-stamp build-stamp: config.status $(MAKE) CC='$(CC)' LD='$(CC)' touch build-stamp -clean: deb-checkdir deb-checkuid +clean: DIR=$(shell pwd)/debian/dropbear +clean: deb-checkdir deb-checkuid test ! -r Makefile || $(MAKE) distclean rm -f libtomcrypt/Makefile libtommath/Makefile test ! -e patch-stamp || \ @@ -51,22 +51,117 @@ clean: deb-checkdir deb-checkuid done rm -f patch-stamp build-stamp config.log config.status rm -rf '$(DIR)' + rm -rf '$(DIR)'-client + rm -rf '$(DIR)'-server + rm -rf '$(DIR)'-keyutils + rm -rf '$(DIR)'-scp rm -f debian/files debian/substvars debian/copyright changelog -install: deb-checkdir deb-checkuid build-stamp - rm -rf '$(DIR)' +install-server: DIR=$(shell pwd)/debian/dropbear-server +install-server: deb-checkdir deb-checkuid config.status + rm -f '$(DIR)' + rm *.o + $(MAKE) CC='$(CC)' LD='$(LD)' PROGRAMS="dropbear dropbearkey dropbearconvert" MULTI=1 install -d -m0755 '$(DIR)'/etc/dropbear # programs - install -d -m0755 '$(DIR)'/usr/sbin - install -m0755 dropbear '$(DIR)'/usr/sbin/dropbear install -d -m0755 '$(DIR)'/usr/bin - install -m0755 dbclient '$(DIR)'/usr/bin/dbclient - install -m0755 dropbearkey '$(DIR)'/usr/bin/dropbearkey + install -d -m0755 '$(DIR)'/usr/sbin install -d -m0755 '$(DIR)'/usr/lib/dropbear - install -m0755 dropbearconvert \ - '$(DIR)'/usr/lib/dropbear/dropbearconvert - $(STRIP) -R .comment -R .note '$(DIR)'/usr/sbin/* \ - '$(DIR)'/usr/bin/* '$(DIR)'/usr/lib/dropbear/* + install -m0755 dropbearmulti \ + '$(DIR)'/usr/lib/dropbear/dropbearmulti + ln -s ../lib/dropbear/dropbearmulti '$(DIR)'/usr/bin/dropbearkey + ln -s ../lib/dropbear/dropbearmulti '$(DIR)'/usr/sbin/dropbear + ln -s dropbearmulti '$(DIR)'/usr/lib/dropbear/dropbearconvert + # init and run scripts + install -d -m0755 '$(DIR)'/etc/init.d + install -m0755 debian/dropbear.init '$(DIR)'/etc/init.d/dropbear + install -m0755 debian/service/run '$(DIR)'/etc/dropbear/run + install -d -m0755 '$(DIR)'/etc/dropbear/log + install -m0755 debian/service/log '$(DIR)'/etc/dropbear/log/run + ln -s /var/log/dropbear '$(DIR)'/etc/dropbear/log/main + install -d -m0755 '$(DIR)'/usr/share/man/man8 + for i in dropbear.8 ; do \ + install -m644 $$i '$(DIR)'/usr/share/man/man8/ || exit 1; \ + done + gzip -9 '$(DIR)'/usr/share/man/man8/*.8 + # copyright, changelog + cat debian/copyright.in LICENSE > debian/copyright + test -r changelog || ln -s CHANGES changelog + $(STRIP) -R .comment -R .note '$(DIR)'/usr/lib/dropbear/* + + install -d -m0755 '$(DIR)'/DEBIAN + test '$(CC)' != 'gcc' || \ + dpkg-shlibdeps '$(DIR)'/usr/lib/dropbear/* + +install-client: DIR=$(shell pwd)/debian/dropbear-client +install-client: deb-checkdir deb-checkuid config.status + rm -f '$(DIR)' + rm *.o + $(MAKE) CC='$(CC)' LD='$(LD)' PROGRAMS=dbclient dbclient + install -d -m0755 '$(DIR)'/usr/bin + install -m0755 dbclient '$(DIR)'/usr/bin/dbclient + install -d -m0755 '$(DIR)'/usr/share/man/man1 + install -m644 dbclient.1 '$(DIR)'/usr/share/man/man1/ + gzip -9 '$(DIR)'/usr/share/man/man1/*.1 + $(STRIP) -R .comment -R .note '$(DIR)'/usr/bin/* + + install -d -m0755 '$(DIR)'/DEBIAN + test '$(CC)' != 'gcc' || \ + dpkg-shlibdeps '$(DIR)'/usr/bin/* + +install-keyutils: DIR=$(shell pwd)/debian/dropbear-keyutils +install-keyutils: deb-checkdir deb-checkuid config.status + rm -f '$(DIR)' + rm *.o + $(MAKE) CC='$(CC)' LD='$(LD)' PROGRAMS="dropbearkey dropbearconvert" MULTI=1 + install -d -m0755 '$(DIR)'/usr/bin + install -d -m0755 '$(DIR)'/usr/lib/dropbear + install -m0755 dropbearmulti \ + '$(DIR)'/usr/lib/dropbear/dropbearmulti + ln -s ../lib/dropbear/dropbearmulti '$(DIR)'/usr/bin/dropbearkey + ln -s dropbearmulti '$(DIR)'/usr/lib/dropbear/dropbearconvert + install -d -m0755 '$(DIR)'/usr/share/man/man8 + for i in dropbearkey.8; do \ + install -m644 $$i '$(DIR)'/usr/share/man/man8/ || exit 1; \ + done + gzip -9 '$(DIR)'/usr/share/man/man8/*.8 + $(STRIP) -R .comment -R .note \ + '$(DIR)'/usr/lib/dropbear/* + + install -d -m0755 '$(DIR)'/DEBIAN + test '$(CC)' != 'gcc' || \ + dpkg-shlibdeps '$(DIR)'/usr/lib/dropbear/* + +install-scp: DIR=$(shell pwd)/debian/dropbear-scp +install-scp: deb-checkdir deb-checkuid config.status + rm -f '$(DIR)' + rm *.o + $(MAKE) CC='$(CC)' LD='$(LD)' PROGRAMS="scp" scp + install -d -m0755 '$(DIR)'/usr/bin + install -m0755 scp '$(DIR)'/usr/bin/scp + $(STRIP) -R .comment -R .note '$(DIR)'/usr/bin/* + + install -d -m0755 '$(DIR)'/DEBIAN + test '$(CC)' != 'gcc' || \ + dpkg-shlibdeps '$(DIR)'/usr/bin/* + +install-multi: DIR=$(shell pwd)/debian/dropbear +install-multi: deb-checkdir deb-checkuid config.status + rm -f '$(DIR)' + rm *.o + $(MAKE) CC='$(CC)' LD='$(LD)' PROGRAMS="dropbearkey dropbearconvert scp dropbear dbclient" MULTI=1 + install -d -m0755 '$(DIR)'/etc/dropbear + # programs + install -d -m0755 '$(DIR)'/usr/bin + install -d -m0755 '$(DIR)'/usr/sbin + install -d -m0755 '$(DIR)'/usr/lib/dropbear + install -m0755 dropbearmulti \ + '$(DIR)'/usr/lib/dropbear/dropbearmulti + ln -s ../lib/dropbear/dropbearmulti '$(DIR)'/usr/bin/dropbearkey + ln -s ../lib/dropbear/dropbearmulti '$(DIR)'/usr/bin/dbclient + ln -s ../lib/dropbear/dropbearmulti '$(DIR)'/usr/bin/scp + ln -s ../lib/dropbear/dropbearmulti '$(DIR)'/usr/sbin/dropbear + ln -s dropbearmulti '$(DIR)'/usr/lib/dropbear/dropbearconvert # init and run scripts install -d -m0755 '$(DIR)'/etc/init.d install -m0755 debian/dropbear.init '$(DIR)'/etc/init.d/dropbear @@ -74,7 +169,6 @@ install: deb-checkdir deb-checkuid build-stamp install -d -m0755 '$(DIR)'/etc/dropbear/log install -m0755 debian/service/log '$(DIR)'/etc/dropbear/log/run ln -s /var/log/dropbear '$(DIR)'/etc/dropbear/log/main - # man pages install -d -m0755 '$(DIR)'/usr/share/man/man8 install -d -m0755 '$(DIR)'/usr/share/man/man1 install -m644 dropbear.8 '$(DIR)'/usr/share/man/man8/ @@ -83,18 +177,26 @@ install: deb-checkdir deb-checkuid build-stamp done gzip -9 '$(DIR)'/usr/share/man/man8/*.8 gzip -9 '$(DIR)'/usr/share/man/man1/*.1 - # copyright, changelog - cat debian/copyright.in LICENSE >debian/copyright - test -r changelog || ln -s CHANGES changelog + $(STRIP) -R .comment -R .note '$(DIR)'/usr/lib/dropbear/* + install -d -m0755 '$(DIR)'/DEBIAN + test '$(CC)' != 'gcc' || \ + dpkg-shlibdeps '$(DIR)'/usr/lib/dropbear/* + +install: install-client install-server install-keyutils install-multi install-scp binary-indep: -binary-arch: install dropbear.deb - test '$(CC)' != 'gcc' || \ - dpkg-shlibdeps '$(DIR)'/usr/sbin/* '$(DIR)'/usr/bin/* \ - '$(DIR)'/usr/lib/dropbear/* - dpkg-gencontrol -isp -pdropbear -P'$(DIR)' - dpkg -b '$(DIR)' .. +binary-arch: install dropbear.deb dropbear-server.deb dropbear-keyutils.deb dropbear-scp.deb dropbear-client.deb + dpkg-gencontrol -isp -pdropbear -P'$(shell pwd)/debian'/dropbear + dpkg-gencontrol -isp -pdropbear-server -P'$(shell pwd)/debian'/dropbear-server + dpkg-gencontrol -isp -pdropbear-client -P'$(shell pwd)/debian'/dropbear-client + dpkg-gencontrol -isp -pdropbear-keyutils -P'$(shell pwd)/debian'/dropbear-keyutils + dpkg-gencontrol -isp -pdropbear-scp -P'$(shell pwd)/debian'/dropbear-scp + dpkg -b '$(shell pwd)/debian'/dropbear .. + dpkg -b '$(shell pwd)/debian'/dropbear-server .. + dpkg -b '$(shell pwd)/debian'/dropbear-keyutils .. + dpkg -b '$(shell pwd)/debian'/dropbear-scp .. + dpkg -b '$(shell pwd)/debian'/dropbear-client .. binary: binary-arch binary-indep