--- dhis-tools-dns-5.0.orig/register-p.sh +++ dhis-tools-dns-5.0/register-p.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Parameters # 1 = hostname @@ -7,32 +7,28 @@ # # Constants # -SENDER=requests@domain.com +if [ -e /etc/default/dhis-tools-dns ] ; then + . /etc/default/dhis-tools-dns +else + echo "Cannot read default definitions from /etc/default/dhis-tools-dns. Aborting" >&2 + exit 1 +fi + +temp_pass==`mktemp -p $TEMP pass.XXXXXX` || { echo "$0: Cannot create temporary file" >&2; exit 1; } +temp_id=`mktemp -p $TEMP id.XXXXXX` || { echo "$0: Cannot create temporary file" >&2; exit 1; } +temp_nsupdate=`mktemp -p $TEMP nsupdate.XXXXXX` || { echo "$0: Cannot create temporary file" >&2; exit 1; } +# Remove Files on exit +trap "/bin/rm -f -- \"$temp_id\" \"$temp_nsupdate\" \"$temp_keys\"" 0 1 2 3 13 15 -# Define locations -TEMP=/etc/dhis/temp -GENID=/etc/dhis/bin/genid -GENKEYS=/etc/dhis/bin/genkeys -GENPASS=/etc/dhis/bin/genpass -DBDIR=/etc/dhis/db -DBFILE=/etc/dhis/db/dhis.db - -ISADDR=123.123.123.123 ; IP address of DHIS server -MXADDR=122.222.222.222 ; IP address of relay server -DHISD_PID=/etc/dhis/pid/dhisd.pid - -RELAY=relay.domain.com -NSUPDATE=/usr/sbin/nsupdate - -$GENPASS > $TEMP/pass.$$ -$GENID > $TEMP/id.$$ +$GENPASS > $temp_pass +$GENID > $temp_id # DB File # echo "" >> $DBFILE -echo `cat $TEMP/id.$$ | awk '{ print $2 }'`" {" >> $DBFILE +echo `cat $temp_id | awk '{ print $2 }'`" {" >> $DBFILE echo "\thostname\t$1" >> $DBFILE -cat $TEMP/pass.$$ >> $DBFILE +cat $temp_pass >> $DBFILE echo "\tcontact\t\t$2" >> $DBFILE echo "\temail\t\t$3" >> $DBFILE echo "\tservice\t\tdns" >> $DBFILE @@ -41,14 +37,12 @@ # Update DNS # -echo "update add $1. 60 in a 192.168.255.0" > $TEMP/nsupdate.$$ -echo "update add $1. 86600 in mx 0 $1." >> $TEMP/nsupdate.$$ -echo "update add $1. 86600 in mx 10 $RELAY." >> $TEMP/nsupdate.$$ -echo "" >> $TEMP/nsupdate.$$ -$NSUPDATE $TEMP/nsupdate.$$ -rm -f $TEMP/nsupdate.$$ - +echo "update add $1. 60 in a 192.168.255.0" > $temp_nsupdate +echo "update add $1. 86600 in mx 0 $1." >> $temp_nsupdate +if [ -n "$RELAY" ]; then + echo "update add $1. 86600 in mx 10 $RELAY." >> $temp_nsupdate +fi +echo "" >> $temp_nsupdate +$NSUPDATE $temp_nsupdate -# Remove Files -rm -f $TEMP/id.$$ -rm -f $TEMP/pass.$$ +exit 0 --- dhis-tools-dns-5.0.orig/genid.c +++ dhis-tools-dns-5.0/genid.c @@ -76,7 +76,7 @@ unsigned char str[1024]; int id=1000; - fp=fopen("/etc/dhis/db/dhis.db","r"); + fp=fopen("/etc/dhis-server/dhis.db","r"); if(fp==NULL) return(0); while(fgets(str,1024,fp)!=NULL) { off_nl(str); --- dhis-tools-dns-5.0.orig/register-q.sh +++ dhis-tools-dns-5.0/register-q.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Parameters # 1 = hostname @@ -7,32 +7,29 @@ # # Constants # -SENDER=requests@domain.com +if [ -e /etc/default/dhis-tools-dns ] ; then + . /etc/default/dhis-tools-dns +else + echo "Cannot read default definitions from /etc/default/dhis-tools-dns. Aborting" >&2 + exit 1 +fi + +temp_keys==`mktemp -p $TEMP keys.XXXXXX` || { echo "$0: Cannot create temporary file" >&2; exit 1; } + +temp_id=`mktemp -p $TEMP id.XXXXXX` || { echo "$0: Cannot create temporary file" >&2; exit 1; } +temp_nsupdate=`mktemp -p $TEMP nsupdate.XXXXXX` || { echo "$0: Cannot create temporary file" >&2; exit 1; } +# Remove Files on exit +trap "/bin/rm -f -- \"$temp_id\" \"$temp_nsupdate\" \"$temp_keys\"" 0 1 2 3 13 15 -# Define locations -TEMP=/etc/dhis/temp -GENID=/etc/dhis/bin/genid -GENKEYS=/etc/dhis/bin/genkeys -GENPASS=/etc/dhis/bin/genpass -DBDIR=/etc/dhis/db -DBFILE=/etc/dhis/db/dhis.db - -ISADDR=123.123.123.123 ; IP address of DHIS server -MXADDR=122.222.222.222 ; IP address of relay server -DHISD_PID=/etc/dhis/pid/dhisd.pid - -RELAY=relay.domain.com -NSUPDATE=/usr/sbin/nsupdate - -$GENKEYS > $TEMP/keys.$$ -$GENID > $TEMP/id.$$ +$GENKEYS > $temp_keys +$GENID > $temp_id # DB File # echo "" >> $DBFILE -echo `cat $TEMP/id.$$ | awk '{ print $2 }'`" {" >> $DBFILE +echo `cat $temp_id | awk '{ print $2 }'`" {" >> $DBFILE echo "\thostname\t$1" >> $DBFILE -cat $TEMP/keys.$$ >> $DBFILE +cat $temp_keys >> $DBFILE echo "\tcontact\t\t$2" >> $DBFILE echo "\temail\t\t$3" >> $DBFILE echo "\tservice\t\tdns" >> $DBFILE @@ -41,14 +38,12 @@ # Update DNS # -echo "update add $1. 60 in a 192.168.255.0" > $TEMP/nsupdate.$$ -echo "update add $1. 86600 in mx 0 $1." >> $TEMP/nsupdate.$$ -echo "update add $1. 86600 in mx 10 $RELAY." >> $TEMP/nsupdate.$$ -echo "" >> $TEMP/nsupdate.$$ -$NSUPDATE $TEMP/nsupdate.$$ -rm -f $TEMP/nsupdate.$$ - +echo "update add $1. 60 in a 192.168.255.0" > $temp_nsupdate +echo "update add $1. 86600 in mx 0 $1." >> $temp_nsupdate +if [ -n "$RELAY" ]; then + echo "update add $1. 86600 in mx 10 $RELAY." >> $temp_nsupdate +fi +echo "" >> $temp_nsupdate +$NSUPDATE $temp_nsupdate -# Remove Files -rm -f $TEMP/id.$$ -rm -f $TEMP/keys.$$ +exit 0 --- dhis-tools-dns-5.0.orig/Makefile +++ dhis-tools-dns-5.0/Makefile @@ -1,15 +1,21 @@ CC=gcc +INSTALLDIR=$(DESTDIR)/usr/sbin + all: genpass genkeys genid install: all - cp genpass genkeys genid /etc/dhis/bin + cp genpass $(INSTALLDIR)/dhis-genpass + cp genkeys $(INSTALLDIR)/dhis-genkeys + cp genid $(INSTALLDIR)/dhis-genid + cp register-p.sh $(INSTALLDIR)/dhis-register-p + cp register-q.sh $(INSTALLDIR)/dhis-register-q genpass: genpass.c $(CC) -Wall -o genpass genpass.c genkeys: genkeys.c - $(CC) -Wall -o genkeys genkeys.c -I/usr/local/include -L/usr/local/lib -lgmp + $(CC) -Wall -o genkeys genkeys.c -lgmp genid: genid.c $(CC) -Wall -o genid genid.c --- dhis-tools-dns-5.0.orig/debian/dhis-tools-dns.docs +++ dhis-tools-dns-5.0/debian/dhis-tools-dns.docs @@ -0,0 +1 @@ +README --- dhis-tools-dns-5.0.orig/debian/dhis-tools-genkeys.dirs +++ dhis-tools-dns-5.0/debian/dhis-tools-genkeys.dirs @@ -0,0 +1,2 @@ +usr/sbin +usr/share/man/man8 --- dhis-tools-dns-5.0.orig/debian/dhis-tools-genkeys.docs +++ dhis-tools-dns-5.0/debian/dhis-tools-genkeys.docs @@ -0,0 +1 @@ +README --- dhis-tools-dns-5.0.orig/debian/dhis-genid.8 +++ dhis-tools-dns-5.0/debian/dhis-genid.8 @@ -0,0 +1,31 @@ +.Dd 2004-09-17 +.Dt DHIS-GENID 8 +.Os "Debian GNU/Linux" +.\" Manual page created by Guus Sliepen +.Sh NAME +.Nm dhis\-genid +.Nd Dynamic Host Information System client ID generation. +.Sh SYNOPSIS +.Nm +.Sh DESCRIPTION +.Nm +is a tool to generate a client ID entry in the DHIS client database. +When run +.Nm +will create a new entry in the client database with a unique ID. +.Sh FILES +.Bl -tag -width indent +.It Pa /etc/dhis\-server/dhis.db +DHIS client database. +Contains the credentials of clients. +.El +.Sh SEE ALSO +.Xr dhisd 8 +.Sh AUTHOR +.Nm +has been written by +.An Joao Cabral Aq jcnc@dhis.org . +.Pp +This manual page was written by +.An Guus Sliepen Aq guus@debian.org +for the Debian GNU/Linux system. --- dhis-tools-dns-5.0.orig/debian/dhis-tools-genkeys.files +++ dhis-tools-dns-5.0/debian/dhis-tools-genkeys.files @@ -0,0 +1,4 @@ +usr/sbin/dhis-genkeys +usr/sbin/dhis-genpass +usr/share/man/man8/dhis-genkeys.8 +usr/share/man/man8/dhis-genpass.8 --- dhis-tools-dns-5.0.orig/debian/compat +++ dhis-tools-dns-5.0/debian/compat @@ -0,0 +1 @@ +4 --- dhis-tools-dns-5.0.orig/debian/copyright +++ dhis-tools-dns-5.0/debian/copyright @@ -0,0 +1,34 @@ +This package was debianized by Guus Sliepen on +Sat, 22 Jun 2002 11:28:45 +0200. + +It was downloaded from http://www.dhis.org/dhis/r5/ + +Upstream Author: Joao Cabral + +Copyright: + + Copyright (c) 1998-2001 Joao Cabral (jcnc@dhis.org) + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + DHIS(c) Dynamic Host Information System Release 5.1 --- dhis-tools-dns-5.0.orig/debian/control +++ dhis-tools-dns-5.0/debian/control @@ -0,0 +1,24 @@ +Source: dhis-tools-dns +Section: net +Priority: optional +Maintainer: Guus Sliepen +Build-Depends: debhelper (>> 3.0.0), libgmp-dev +Standards-Version: 3.7.3 +Homepage: http://www.dhis.org/ + +Package: dhis-tools-dns +Architecture: any +Section: net +Depends: ${shlibs:Depends}, dhis-server, dhis-dns-engine, dhis-tools-genkeys, bind9 | bind +Description: Dynamic Host Information System - DNS configuration tools + This package includes a set of tools that may be used to manually + create DHIS records on a dynamic DNS server. + +Package: dhis-tools-genkeys +Architecture: any +Section: net +Depends: ${shlibs:Depends} +Suggests: dhis-client | dhis-server +Description: Dynamic Host Information System - key generation tools + This package includes a set of tools that may be used to manually + create shared or public/private keys for DHIS client/server authentication. --- dhis-tools-dns-5.0.orig/debian/dhis-genkeys.8 +++ dhis-tools-dns-5.0/debian/dhis-genkeys.8 @@ -0,0 +1,39 @@ +.Dd 2004-09-17 +.Dt DHIS-GENKEYS 8 +.Os "Debian GNU/Linux" +.\" Manual page created by Guus Sliepen +.Sh NAME +.Nm dhis\-genkeys +.Nd Dynamic Host Information System key generation. +.Sh SYNOPSIS +.Nm +.Sh DESCRIPTION +.Nm +is a tool to generate QRC keys. +When run +.Nm +will output a few lines containing a private key +(these begin with AuthP and AuthQ) +and lines containing the corresponding public key +(these begin with AuthN). +.Pp +The AuthP and AuthQ lines should be +sent to the client wishing to authenticate using QRC. +.Pp +The AuthN lines should be copied to the DHIS server's client database file. +.Sh FILES +.Bl -tag -width indent +.It Pa /etc/dhis\-server/dhis.db +DHIS client database. +Contains the credentials of clients. +.El +.Sh SEE ALSO +.Xr dhisd 8 +.Sh AUTHOR +.Nm +has been written by +.An Joao Cabral Aq jcnc@dhis.org . +.Pp +This manual page was written by +.An Guus Sliepen Aq guus@debian.org +for the Debian GNU/Linux system. --- dhis-tools-dns-5.0.orig/debian/dhis-genpass.8 +++ dhis-tools-dns-5.0/debian/dhis-genpass.8 @@ -0,0 +1,33 @@ +.Dd 2004-09-17 +.Dt DHIS-GENPASS 8 +.Os "Debian GNU/Linux" +.\" Manual page created by Guus Sliepen +.Sh NAME +.Nm dhis\-genpass +.Nd Dynamic Host Information System password generation. +.Sh SYNOPSIS +.Nm +.Sh DESCRIPTION +.Nm +is a tool to generate a password. +When run +.Nm +will output a line containing a password than can be used +as a shared secret by both the DHIS server and client. +.Sh FILES +.Bl -tag -width indent +.It Pa /etc/dhis\-server/dhis.db +DHIS client database. +Contains the credentials of clients. +.El +.Sh SEE ALSO +.Xr dhisd 8 , +.Xr dhis\-genkeys 8 +.Sh AUTHOR +.Nm +has been written by +.An Joao Cabral Aq jcnc@dhis.org . +.Pp +This manual page was written by +.An Guus Sliepen Aq guus@debian.org +for the Debian GNU/Linux system. --- dhis-tools-dns-5.0.orig/debian/dhis-register.8 +++ dhis-tools-dns-5.0/debian/dhis-register.8 @@ -0,0 +1,47 @@ +.Dd 2004-09-17 +.Dt DHIS-REGISTER 8 +.Os "Debian GNU/Linux" +.\" Manual page created by Guus Sliepen +.Sh NAME +.Nm dhis\-register\-p , +.Nm dhist\-register\-q +.Nd Dynamic Host Information System client registration. +.Sh SYNOPSIS +.Nm dhis\-register\-p , +.Nm dhis\-register\-q +.Ar hostname +.Ar contact +.Ar email +.Sh DESCRIPTION +.Nm dhis\-register +is a tool to generate a new entry in the DHIS client database. +When run it will create an entry with a unique client ID, +create a password +.Pq Nm dhis\-register\-p +or QRC keypair +.Pq Nm dhis\-register\-q +and add an entry for the specified +.Ar hostname +to the corresponding nameserver zonefile. +.Sh FILES +.Bl -tag -width indent +.It Pa /etc/dhis\-server/dhis.db +DHIS client database. +Contains the credentials of clients. +.It Pa /etc/default/dhis\-tools\-dns +Default parameters to use when creating DNS records. +.El +.Sh SEE ALSO +.Xr dhisd 8 , +.Xr dhis\-genid 8 , +.Xr dhis\-genpass 8 , +.Xr dhis\-genkeys 8 , +.Xr nsupdate 8 +.Sh AUTHOR +.Nm dhis\-register +has been written by +.An Joao Cabral Aq jcnc@dhis.org . +.Pp +This manual page was written by +.An Guus Sliepen Aq guus@debian.org +for the Debian GNU/Linux system. --- dhis-tools-dns-5.0.orig/debian/changelog +++ dhis-tools-dns-5.0/debian/changelog @@ -0,0 +1,52 @@ +dhis-tools-dns (5.0-6.1) unstable; urgency=low + + * NMU. Change dependency libgmp3-dev --> libgmp-dev. + + -- Steve M. Robbins Wed, 16 Mar 2011 22:16:42 -0500 + +dhis-tools-dns (5.0-6) unstable; urgency=low + + * Upstream's scripts rely heavily on bash, therefore explicitly use it by + changing the first line to #!/bin/bash. Closes: 480594 + * Bump Standards-version, add debian/compat, add Homepage field to + debian/control. + + -- Guus Sliepen Mon, 19 May 2008 11:10:36 +0200 + +dhis-tools-dns (5.0-5) unstable; urgency=high + + * Applied patch from Javier Fernández-Sanguino Peña to fix tempfile + insecurity [CVE-2005-3341]. + + -- Guus Sliepen Sat, 29 Oct 2005 12:44:57 +0200 + +dhis-tools-dns (5.0-4) unstable; urgency=low + + * Link against libgmp3c2. Closes: #329274 + + -- Guus Sliepen Wed, 21 Sep 2005 15:27:47 +0200 + +dhis-tools-dns (5.0-3) unstable; urgency=low + + * Move configurable part of dhis-register scripts to + /etc/default/dhis-tools-dns. Closes: #271900, #271902 + * Mention this in the manpage. Closes: #271901 + * Update standards version. + * Remove cruft from package descriptions. + + -- Guus Sliepen Fri, 17 Sep 2004 13:25:05 +0200 + +dhis-tools-dns (5.0-2) unstable; urgency=low + + * Split in two binary packages, put dhis-genkeys and dhis-genpass in + a seperate one so DHIS clients can use it without having to depend + on the DHIS server and bind. + + -- Guus Sliepen Sat, 22 Jun 2002 23:05:58 +0200 + +dhis-tools-dns (5.0-1) unstable; urgency=low + + * Initial Release. + + -- Guus Sliepen Sat, 22 Jun 2002 13:11:29 +0200 + --- dhis-tools-dns-5.0.orig/debian/rules +++ dhis-tools-dns-5.0/debian/rules @@ -0,0 +1,96 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) + CFLAGS += -g +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + $(MAKE) clean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/dhis-tools-dns. + mkdir -p $(CURDIR)/debian/tmp/usr/sbin + mkdir -p $(CURDIR)/debian/tmp/usr/share/man/man8 + mkdir -p $(CURDIR)/debian/tmp/etc/default + $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp + cp debian/dhis-genid.8 debian/dhis-genkeys.8 debian/dhis-genpass.8 debian/dhis-register.8 $(CURDIR)/debian/tmp/usr/share/man/man8/ + cp debian/default $(CURDIR)/debian/tmp/etc/default/dhis-tools-dns + ln -s dhis-register.8 $(CURDIR)/debian/tmp/usr/share/man/man8/dhis-register-p.8 + ln -s dhis-register.8 $(CURDIR)/debian/tmp/usr/share/man/man8/dhis-register-q.8 + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_movefiles + +# dh_installdebconf + dh_installdocs +# dh_installexamples +# dh_installmenu +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_installinit +# dh_installcron + dh_installman +# dh_installinfo +# dh_undocumented + dh_installchangelogs + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_makeshlibs + dh_installdeb +# dh_perl + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure --- dhis-tools-dns-5.0.orig/debian/default +++ dhis-tools-dns-5.0/debian/default @@ -0,0 +1,12 @@ +# Define locations +TEMP=/tmp +GENID=/usr/sbin/dhis-genid +GENKEYS=/usr/sbin/dhis-genkeys +GENPASS=/usr/sbin/dhis-genpass +DBDIR=/etc/dhis-server +DBFILE=$DBDIR/dhis.db +DHISD_PID=/var/run/dhisd.pid +NSUPDATE=/usr/bin/nsupdate + +# Set this to the email relay server +RELAY= --- dhis-tools-dns-5.0.orig/debian/dhis-tools-dns.dirs +++ dhis-tools-dns-5.0/debian/dhis-tools-dns.dirs @@ -0,0 +1,3 @@ +usr/sbin +usr/share/man/man8 +etc/default --- dhis-tools-dns-5.0.orig/debian/dhis-tools-dns.files +++ dhis-tools-dns-5.0/debian/dhis-tools-dns.files @@ -0,0 +1,5 @@ +usr/sbin/dhis-register* +usr/sbin/dhis-genid +usr/share/man/man8/dhis-register*.8 +usr/share/man/man8/dhis-genid.8 +etc/default/dhis-tools-dns