From e3806b2546f03be8c8b1827e375a6e349045c1c9 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sun, 11 Aug 2002 18:46:21 +0000 Subject: Initial import --- debian/README.Debian | 26 ++++++++ debian/changelog | 6 ++ debian/control | 20 +++++++ debian/copyright | 38 ++++++++++++ debian/echolot.config | 93 +++++++++++++++++++++++++++++ debian/echolot.dirs | 5 ++ debian/echolot.docs | 2 + debian/echolot.examples | 1 + debian/echolot.init | 146 +++++++++++++++++++++++++++++++++++++++++++++ debian/echolot.links | 2 + debian/echolot.logrotate | 11 ++++ debian/echolot.manpages | 2 + debian/echolot.postinst.in | 113 +++++++++++++++++++++++++++++++++++ debian/echolot.postrm | 28 +++++++++ debian/echolot.templates | 28 +++++++++ debian/example.procmailrc | 4 ++ debian/pingd.conf | 18 ++++++ debian/remailers | 1 + debian/rules | 84 ++++++++++++++++++++++++++ 19 files changed, 628 insertions(+) create mode 100644 debian/README.Debian create mode 100644 debian/changelog create mode 100644 debian/control create mode 100644 debian/copyright create mode 100755 debian/echolot.config create mode 100644 debian/echolot.dirs create mode 100644 debian/echolot.docs create mode 100644 debian/echolot.examples create mode 100755 debian/echolot.init create mode 100644 debian/echolot.links create mode 100644 debian/echolot.logrotate create mode 100644 debian/echolot.manpages create mode 100755 debian/echolot.postinst.in create mode 100755 debian/echolot.postrm create mode 100644 debian/echolot.templates create mode 100644 debian/example.procmailrc create mode 100644 debian/pingd.conf create mode 100644 debian/remailers create mode 100755 debian/rules diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 0000000..39c2fee --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,26 @@ +Echolot for Debian +------------------ + +Make sure mail to the Echolot pinger reaches ~echolot/mail/ + +In /usr/share/doc/mixmaster/examples you can find examples for use with +procmail. You can of course use any other means to deliver to the Maildir +~echolot/mail/ too. + + + +Make sure your MTA supports user defined mailboxes. so that +my_localpart+anything@my_domain also reaches Echolot. + ^^^^^^^^^ +If you use another character instead of + to indicate a user defined +extension set recipient_delimiter accordingly in echolot.conf. + +postfix: add »recipient_delimiter = +« to main.cf. + + +To send commands to pingd it's best to use the /etc/init.d/echolot script. +It takes care that pingd is only called as the correct user. See pingd(1) for a +list of commands and their description. + + + -- Peter Palfrader , Sun, 11 Aug 2002 16:21:18 +0200 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..23c22ae --- /dev/null +++ b/debian/changelog @@ -0,0 +1,6 @@ +echolot (2.0-0.beta25.1) unstable; urgency=low + + * Initial Release. + + -- Peter Palfrader Sun, 11 Aug 2002 16:21:18 +0200 + diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..0cafc4a --- /dev/null +++ b/debian/control @@ -0,0 +1,20 @@ +Source: echolot +Section: mail +Priority: extra +Maintainer: Peter Palfrader +Build-Depends-Indep: debhelper (>> 3.0.0) +Standards-Version: 3.5.2 + +Package: echolot +Architecture: all +Depends: ${shlibs:Depends}, debconf, gnupg (>= 1.0.7), postfix | mail-transport-agent, mixmaster, libdigest-MD5-perl, libhtml-template-perl, libgnupg-interface-perl (>= 0.33) +Suggests: procmail +Description: pinger for anonymous remailers + A Pinger in the context of anonymous remailers is a program that regularily + sends messages through remailers to check their reliability. It then + calculates reliability statistics which are used by remailer clients to choose + the chain of remailers to use. + . + Additionally Echolot collects configuration parameters and keys of all + remailers and offers them in a format readable by humans as well as remailer + clients. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..70fb011 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,38 @@ +This package was debianized by Peter Palfrader on +Mon, 22 Jul 2002 10:30:40 +0200. + +It was downloaded from http://www.palfrader.org/echolot/ + +Upstream Authors: Peter Palfrader + +Copyright: + (c) 2001, 2002 Peter Palfrader + +Echolot 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 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. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 59 Temple +Place, Suite 330, Boston, MA 02111-1307 USA + +On Debian systems you can find a copy of the GNU General Public License in +/usr/share/common-licenses/GPL. + + + +This package (and the echolot upstream tarball) also includes software by +Peter J. Acklam : + + - Math::SpecFun::Erf + - Statistics::Distrib::Normal + +Those modules may be distributed under the same terms as Perl itself (the GNU +General Public License and the Artistic License). + +You can find a copy of the Artistic License in /usr/share/common-licenses too. diff --git a/debian/echolot.config b/debian/echolot.config new file mode 100755 index 0000000..e2d8938 --- /dev/null +++ b/debian/echolot.config @@ -0,0 +1,93 @@ +#!/usr/bin/perl -w + +use strict; + +use Debconf::Client::ConfModule; +use English; + +my $address; +my $operator; +my $sitename; + +if ( -e '/etc/echolot/pingd.conf' ) { + my $CONFIG; + { + local $/ = undef; + open(CONFIGCODE, '/etc/echolot/pingd.conf') or + die ("Cannot open /etc/echolot/pingd.conf: $!"); + my $config_code = ; + close (CONFIGCODE); + ($config_code) = $config_code =~ /^(.*)$/s; + eval ($config_code); + ($EVAL_ERROR) and + die("Evaling config code from /etc/echolot/pingd.conf returned error: $EVAL_ERROR"); + } + + $sitename = $CONFIG->{'my_localpart'}.'@'.$CONFIG->{'my_domain'} if (defined $CONFIG->{'my_localpart'} && defined $CONFIG->{'my_domain'}); + $operator = $CONFIG->{'operator_address'} if (defined $CONFIG->{'operator_address'}); + $sitename = $CONFIG->{'sitename'} if (defined $CONFIG->{'sitename'}); +}; + +my $mailname; +$mailname = `cat /etc/mailname` if ( -e '/etc/mailname' ); +$mailname = `hostname` unless ( defined $mailname ); +$mailname = 'example.org' unless ( defined $mailname ); +chomp $mailname; + +$address = 'echolot@'.$mailname unless defined $address; +$operator = 'abuse@'.$mailname unless defined $operator; +$sitename = $mailname unless defined $sitename; + +Debconf::Client::ConfModule::set('echolot/address', $address); +Debconf::Client::ConfModule::set('echolot/operator', $operator); +Debconf::Client::ConfModule::set('echolot/sitename', $sitename); + + +my $state = 1; +my $numerr = 0; + +Debconf::Client::ConfModule::version('2.0'); +Debconf::Client::ConfModule::capb('backup'); +while (1) { + if ($state == 0) { + $state = 1; + } elsif ($state == 1) { + Debconf::Client::ConfModule::input('high', 'echolot/address'); + my @return = Debconf::Client::ConfModule::go(); + + $address = Debconf::Client::ConfModule::get('echolot/address'); + unless ($address =~ /@/) { + $address .= '@'.$mailname; + Debconf::Client::ConfModule::set('echolot/address', $address); + $numerr++; + next if ($numerr <= 5); + }; + + if ($return[0] == 30) { + $numerr = 0; + $state--; + } else { + $numerr = 0; + $state++; + }; + next; + } elsif ($state == 2) { + Debconf::Client::ConfModule::input('high', 'echolot/operator'); + Debconf::Client::ConfModule::input('high', 'echolot/sitename'); + Debconf::Client::ConfModule::input('medium', 'echolot/addnow'); + } elsif ($state == 3) { + last; + } else { + die ("Unknown state $state"); + }; + + my @return = Debconf::Client::ConfModule::go(); + if ($return[0] == 30) { + $state--; + } else { + $state++; + }; +}; + +# vim:set ts=4: +# vim:set shiftwidth=4: diff --git a/debian/echolot.dirs b/debian/echolot.dirs new file mode 100644 index 0000000..8af5c03 --- /dev/null +++ b/debian/echolot.dirs @@ -0,0 +1,5 @@ +usr/lib/echolot +var/lib/echolot +var/run/echolot +var/log/echolot +etc/echolot diff --git a/debian/echolot.docs b/debian/echolot.docs new file mode 100644 index 0000000..724e084 --- /dev/null +++ b/debian/echolot.docs @@ -0,0 +1,2 @@ +README +TODO diff --git a/debian/echolot.examples b/debian/echolot.examples new file mode 100644 index 0000000..103b60e --- /dev/null +++ b/debian/echolot.examples @@ -0,0 +1 @@ +debian/example.procmailrc diff --git a/debian/echolot.init b/debian/echolot.init new file mode 100755 index 0000000..3e38c05 --- /dev/null +++ b/debian/echolot.init @@ -0,0 +1,146 @@ +#!/bin/sh +# +# pingcntl: echolot control + wrapper +# Written by admin@arancio.net, peter@palfrader.org + +set -e + +VERBOSE=0 + +# You probably don't want to mess with stuff below this line +################################################################ + +PIDFILE=/var/run/echolot/pingd.pid +CHECKULIMIT=1 +CHECKUID=1 +USER=echolot +GROUP=echolot +DAEMON=/usr/lib/echolot/pingd +DESC="Echolot Ping Daemon" +NAME="pingd" +test -f $DAEMON || exit 0 + +wait_for_deaddaemon () { + PID=$1 + sleep 3 + if test -n "$PID" && kill -0 $PID 2>/dev/null + then + echo -n "Waiting for pid $PID ." + cnt=0 + while kill -0 $PID 2>/dev/null + do + cnt=`expr $cnt + 1` + if [ $cnt -gt 30 ] + then + echo -n " Failed.. " + break + fi + sleep 2 + echo -n "." + done + fi +} + + +# Check for evil ulimits +if [ "$CHECKULIMIT" -gt "0" ]; then + FDs=`ulimit -n` + HFDs=`ulimit -H -n` + if [ "$FDs" -lt "512" ]; then + if [ "$HFDs" -lt "512" ]; then + echo "Hardlimit for open File Descriptors is less than 512." >&2 + echo "Please consider raising it." >&2 + if [ "$FDs" -lt "$HFDs" ]; then + echo "Raising it to $HFDs" >&2 + ulimit -n $HFDs + fi + else + if [ "$HFDs" -lt "1024" ]; then + FDs=$HFDs + else + FDs=1024 + fi + echo "Softlimit for open File Descriptors is less than 512." >&2 + echo "Raising it to $FDs" >&2 + ulimit -n $FDs + fi + fi +fi + + +# set VERBOSE +if [ $VERBOSE -gt 0 ]; then + VERBOSE="--verbose" +else + VERBOSE="" +fi + + +case $1 in + +start) + if [ -f $PIDFILE ] ; then + echo "Pidfile $PIDFILE already exists" >&2 + exit 1 + fi + echo -n "Starting $DESC: " + start-stop-daemon \ + --start \ + --quiet \ + --pidfile $PIDFILE \ + --chuid $USER:$GROUP \ + --exec $DAEMON -- --detach $VERBOSE start + echo "$NAME." + ;; + +stop) + echo -n "Stopping $DESC: " + PID=`cat $PIDFILE 2>/devnull` || true + start-stop-daemon \ + --stop \ + --quiet \ + --oknodo \ + --pidfile $PIDFILE \ + --user $USER + wait_for_deaddaemon $PID + echo "$NAME." + ;; + +reload|force-reload|restart) + PID=`cat $PIDFILE 2>/devnull` || true + $0 stop + wait_for_deaddaemon $PID + $0 start + ;; +process|add|delete|set|setremailercaps|deleteremailercaps|getkeyconf|buildstats|buildkeys|buildthesaurus|dumpconf) + # Check for right User + SU="" + if [ "$CHECKUID" -gt "0" ]; then + CUID=`id -u` + CUIDNAME=`id -nu` + if [ "$CUIDNAME" = "$USER" ]; then + SU="" + elif [ "$CUID" = "0" ]; then + SU="su $USER -c" + else + echo "You are neither $USER nor root. Aborting." >&2 + exit 1; + fi + fi + + echo "Running $DESC: $NAME $1..." + $SU $DAEMON "$@" + echo "done." + ;; +*) + echo "Usage: $0 (start|stop|reload|force-reload|restart)" >&2 + echo " $0 [parameters]" >&2 + echo "See the pingd(1) manual page for valid commands" >&2 + exit 1 + ;; +esac + +exit 0 + +# vim:set ts=2: +# vim:set shiftwidth=2: diff --git a/debian/echolot.links b/debian/echolot.links new file mode 100644 index 0000000..791735c --- /dev/null +++ b/debian/echolot.links @@ -0,0 +1,2 @@ +/etc/echolot/templates /var/lib/echolot/templates +/var/log/echolot/echolot.log /var/lib/echolot/output diff --git a/debian/echolot.logrotate b/debian/echolot.logrotate new file mode 100644 index 0000000..0397e16 --- /dev/null +++ b/debian/echolot.logrotate @@ -0,0 +1,11 @@ +/var/log/echolot/echolot.log { + weekly + rotate 5 + compress + missingok + notifempty + postrotate + /etc/init.d/echolot process + endscript + create 640 echolot adm +} diff --git a/debian/echolot.manpages b/debian/echolot.manpages new file mode 100644 index 0000000..f1c1209 --- /dev/null +++ b/debian/echolot.manpages @@ -0,0 +1,2 @@ +doc/pingd.1 +doc/pingd.conf.5 diff --git a/debian/echolot.postinst.in b/debian/echolot.postinst.in new file mode 100755 index 0000000..7f33347 --- /dev/null +++ b/debian/echolot.postinst.in @@ -0,0 +1,113 @@ +#!/bin/sh -e + +# postinst for Echolot + +. /usr/share/debconf/confmodule + +# Make sure the echolot user exists +getent group echolot >/dev/null 2>&1 || ( + echo Adding echolot group + addgroup echolot ) +getent passwd echolot >/dev/null 2>&1 || ( + echo Adding echolot user + adduser --system --shell /bin/bash --home /var/lib/echolot --ingroup echolot --gecos "Echolot Pinger" echolot ) + +# Give the echolot user write permissions to /var/log/echolot/echolot.log +touch /var/log/echolot/echolot.log +chown echolot.adm /var/log/echolot/echolot.log +chmod 640 /var/log/echolot/echolot.log +# and /var/lib/echolot +if ( ! dpkg-statoverride --list /var/lib/echolot > /dev/null ); then + dpkg-statoverride --update --add root echolot 02770 /var/lib/echolot +fi +# and /var/run/echolot +if ( ! dpkg-statoverride --list /var/run/echolot > /dev/null ); then + dpkg-statoverride --update --add root echolot 02770 /var/run/echolot +fi + + +######################################################################## +# User configuration +######################################################################## +if [ "$1" = "configure" ]; then + + ######################## + # Echolot configuration + + filename=`tempfile`; +cat > $filename << 'EOF' +#!/usr/bin/perl -w + + use strict; + use Debconf::Client::ConfModule; + use IO::File; + + my $postblock = ""; + my $preblock = ""; + + if ( -e "/etc/echolot/pingd.conf" ) { + my $fh = new IO::File; + $fh->open("/etc/echolot/pingd.conf") or + die ("Cannot open /etc/echolot/pingd.conf: $!"); + while (<$fh>) { + last if (/^### BEGIN DEBCONF SECTION/); + $preblock .= $_; + }; + while (<$fh>) { + last if (/^### END DEBCONF SECTION/); + }; + while (<$fh>) { + $postblock .= $_; + }; + $fh->close() or + die ("Cannot close /etc/echolot/pingd.conf: $!"); + }; + + my $address = Debconf::Client::ConfModule::get("echolot/address"); + my $operator = Debconf::Client::ConfModule::get("echolot/operator"); + my $sitename = Debconf::Client::ConfModule::get("echolot/sitename"); + + my ($local, $domain) = split (/@/, $address, 2); + + my $debconf = sprintf("\$CONFIG->{q{my_localpart} } = q{%s};\n", $local); + $debconf .= sprintf("\$CONFIG->{q{my_domain} } = q{%s};\n", $domain); + $debconf .= sprintf("\$CONFIG->{q{operator_address}} = q{%s};\n", $operator); + $debconf .= sprintf("\$CONFIG->{q{sitename} } = q{%s};\n", $sitename); + + my $fh = new IO::File; + $fh->open(">/etc/echolot/pingd.conf") or + die ("Cannot open /etc/echolot/pingd.conf: $!"); + print $fh $preblock . + "### BEGIN DEBCONF SECTION\n" . + $debconf . + "1;\n" . + "### END DEBCONF SECTION\n" . + $postblock or + die ("Cannot write to /etc/echolot/pingd.conf: $!"); + $fh->close or + die ("Cannot close /etc/echolot/pingd.conf: $!"); +EOF + chmod +x $filename; + $filename + rm $filename +fi + +#DEBHELPER# + +######################################################################## +# Configuration reprise +######################################################################## +if [ "$1" = "configure" ]; then + db_get echolot/addnow || true + if [ "$RET" = "true" ]; then + /etc/init.d/echolot add REMAILER_LIST + # But don't do it again unless the user asks for it + db_set echolot/addnow false + fi +fi + + +db_stop + +# vim:set ts=4: +# vim:set shiftwidth=4: diff --git a/debian/echolot.postrm b/debian/echolot.postrm new file mode 100755 index 0000000..ea9b021 --- /dev/null +++ b/debian/echolot.postrm @@ -0,0 +1,28 @@ +#!/bin/sh -e + +# postrm for Echolot + +case "$1" in + purge) + rm -rf /var/lib/echolot/* + rmdir /etc/echolot/templates 2>/dev/null || true + rmdir /etc/echolot 2>/dev/null || true + dpkg-statoverride --remove /var/run/echolot >/dev/null 2>&1 || true + dpkg-statoverride --remove /var/lib/echolot >/dev/null 2>&1 || true + ;; + remove|upgrade|deconfigure) + ;; + failed-upgrade) + ;; + abort-upgrade) + ;; + *) + echo "unknown argument --> $1" >&2 + exit 0 + ;; +esac + +#DEBHELPER# + +# vim:set ts=2: +# vim:set shiftwidth=2: diff --git a/debian/echolot.templates b/debian/echolot.templates new file mode 100644 index 0000000..6a0d97a --- /dev/null +++ b/debian/echolot.templates @@ -0,0 +1,28 @@ +Template: echolot/address +Type: string +Description: The e-mail address of your pinger: + Email to this address must reach your pinger somehow. Either it gets + delivered to your box directly or you have fetchmail installed or some + other way. + +Template: echolot/operator +Type: string +Description: Operator address for your pinger: + Specify an address for the pinger operator. + +Template: echolot/sitename +Type: string +Description: Site name: + Choose a name for your pinger site. This will be shown in all pages echolot + produces. + +Template: echolot/addnow +Type: boolean +Default: true +Description: Add known remailers? + This package has a built in list of some remailers. If you want they can + be added to Echolot's database now. Otherwise you have to populate it + by hand. + . + If you choose to add them Echolot will also fetch keys and configuration + data immediatly. diff --git a/debian/example.procmailrc b/debian/example.procmailrc new file mode 100644 index 0000000..8118f9d --- /dev/null +++ b/debian/example.procmailrc @@ -0,0 +1,4 @@ +PATH=/usr/local/bin:/usr/bin:/bin + +:0 +$HOME/mail/ diff --git a/debian/pingd.conf b/debian/pingd.conf new file mode 100644 index 0000000..6f734ce --- /dev/null +++ b/debian/pingd.conf @@ -0,0 +1,18 @@ +# vim:set syntax=perl: + +# see man pingd.conf(5) for a list of all available configuration options. + +$CONFIG = { + 'seperate_rlists' => 0, + 'combined_list' => 0, + }; + +$CONFIG->{'homedir'} = '/var/lib/echolot'; +$CONFIG->{'pidfile'} = '/var/run/echolot/pingd.pid'; + +### BEGIN DEBCONF SECTION +# not configured yet +1; +### END DEBCONF SECTION + +1; diff --git a/debian/remailers b/debian/remailers new file mode 100644 index 0000000..878c32e --- /dev/null +++ b/debian/remailers @@ -0,0 +1 @@ +rot26@mix.uucico.de diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..7439923 --- /dev/null +++ b/debian/rules @@ -0,0 +1,84 @@ +#!/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 + +# This is the debhelper compatibility version to use. +export DH_COMPAT=3 + +version=`grep 'VERSION =' pingd | sed -e "s/.* '//" -e "s/'.*//"` +REMAILERS=`tr '\n' ' ' < debian/remailers` + +ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) + CFLAGS += -g +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif + +build: build-stamp +build-stamp: + pod2man --section=1 --release="$(version)" --center=Echolot pingd doc/pingd.1 + pod2man --section=5 --release="$(version)" --center=Echolot doc/pingd.conf.pod doc/pingd.conf.5 + sed -e "s/REMAILER_LIST/$(REMAILERS)/" < debian/echolot.postinst.in > debian/echolot.postinst + touch build-stamp + +clean: + dh_testdir + dh_testroot + + rm -f build-stamp + rm -f doc/pingd.1 + rm -f doc/pingd.conf.5 + rm -f debian/echolot.postinst + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + tar c --exclude CVS --exclude .cvsignore Echolot | tar xv -C $(CURDIR)/debian/echolot/usr/lib/echolot + tar c --exclude CVS --exclude .cvsignore lib | tar xv -C $(CURDIR)/debian/echolot/usr/lib/echolot + tar c --exclude CVS --exclude .cvsignore templates | tar xv -C $(CURDIR)/debian/echolot/etc/echolot + install -m 755 pingd $(CURDIR)/debian/echolot/usr/lib/echolot + install -m 644 debian/pingd.conf $(CURDIR)/debian/echolot/etc/echolot + + +binary-indep: build install + dh_testdir + dh_testroot + dh_installdebconf + dh_installdocs + dh_installmenu + dh_installlogrotate + dh_installexamples + dh_installman + dh_installchangelogs NEWS + dh_installinit + dh_link + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary-arch: +# We have nothing to do by default. + +binary: binary-indep binary-arch + +update-remailers: + dh_testdir + wget -O - http://stats.melontraffickers.com/mlist2.txt | grep '@' | sed -e 's/.*.*//' > debian/remailers + +debian/remailers: update-remailers + +.PHONY: build clean binary-indep binary-arch binary install configure remailers -- cgit v1.2.3