🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.privacy.anon-server
Article #203430

Help wanted: AAMGATE server operators

#203430
From: StealthMonger
Date: Wed, 22 Mar 2006 23:07
173 lines
7609 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Appended below is a new server script AAMGATE for strongly-anonymous
surfing.  Please consider running it at your site.

Providing an anonymous service gives you excellent cover and plausible
deniability for your own activities.

The optional supporting programs esub and esubbf were coincidentally
published here just a couple days ago.  It should still be on your
news server.

Here's the script.

#!/bin/sh

# AAMGATE --
# Copy arbitrary Internet pages to alt.anonymous.messages, encrypted.

# User instructions:

# Encrypt wget command-line parameters to the public key of an AAMGATE
# server and mail it to that server with sufficient hashcash through a
# chain of remailers.  Results of the wget will be tarred, gzipped,
# split if necessary, encrypted to the key you supply, given a
# Subject: that you determine, and posted to alt.anonymous.messages.
# You take a full feed of a.a.m at all times without interruption, and
# separate the wheat from the chaff only behind closed doors.  Is this
# private surfing, or what?

# Operator instructions:

# Set up an AAMGATE server as follows.  Create a new user aamgate on a
# host able to receive mail and post news.  Create a new GnuPG key for
# aamgate.  Store the passphrase in ~/.key with mode 0400.  Install
# this script in ~/bin and arrange for each mail to be presented to it
# on stdin.  Announce the new server and publish its public key.

# Method of operation:

# For each received mail, AAMGATE creates a fresh temporary directory
# to accumulate the results.  The mail is checked for valid hashcash
# and decrypted.  If the wget parameters are legitimate and safe, wget
# is run with a quota determined by the bits of hashcash.  The results
# go into the temporary directory.  The result is tarred and gzipped.
# If it's small enough, as determined by the hashcash bit count, it's
# split as necessary and each piece is encrypted to the user's
# supplied symmetric key, given a Subject: determined by the user, and
# published to a.a.m.

# The following keyword-value pairs are recognized.  Where possible,
# the syntax and semantics are close to those of the remailers.

#   Encrypt-Key: the GnuPG symmetric key to encrypt the tgz file.
#   Subject: The Subject: line for the postings to a.a.m, or for esub.
#   Request: The wget command line parameters.
#   Encrypt-Subject: If supplied, Subject: is determined by IDEA esub.
#   Encrypt-Subject-BF: As Encrypt-Subject: but Blowfish, not IDEA.

# If neither Encrypt-Subject parameter is supplied, the response(s)
# will have the supplied Subject, unprocessed.  Otherwise, AAMGATE
# generates a fresh subject (for each posting individually in case of
# split) using the original IDEA algorithm or its new Blowfish
# equivalent.  Note that the user should generate Encrypt-Key,
# Subject, and Encrypt-Subject* (if used) fresh for each AAMGATE
# request, to prevent even the operator from linking requests.

# To-Do

#  SECURITY REVIEW.
#  Accept a wider range of wget command-line parameters.
#  Support curl, as well as wget.
#  Provide for random-size split of the response.
#  Accept rpow as well as (or instead of) hashcash.  http://rpow.net.

# License: GPL
# Version: 0.5
# Author: StealthMonger
#   <StealthMonger@nym.panta-rhei.eu.org>
#   <StealthMonger@nym.alias.net>
#   <StealthMonger@hod.aarg.net>  (not working, 060321)

# Borrowed from autoconf for portability:
a_letters='abcdefghijklmnopqrstuvwxyz'
a_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
a_Letters=$a_letters$a_LETTERS
a_digits='0123456789'
a_alnum=$a_Letters$a_digits
# Sed expression to map a string onto a valid variable name.
a_sh="eval sed 'y%*$a_letters%P$a_LETTERS%;s%[^_$a_alnum]%_%g'"

# Process a mail request

export PATH=$HOME/bin:/bin:$PATH
DIR=$HOME/aamgate$$
mkdir $DIR
mkdir $DIR/result
cd $DIR/result

while read kwd OFFER wds && test "$kwd" != "X-Hashcash:" ; do : ; done

if ( hashcash -cd -b 10 -f $HOME/hashcash.sdb -r aamgate@`hostname` \
      "$OFFER" 2>hashcash-stderr ) ; then
  if ( gpg --passphrase-fd 3 3<$HOME/.key --batch --no-tty \
         2>gpg-stderr > parameters) ; then
  # de-fang user input before using:
  sed y%\($\)\\[\\]\'\`\"%________% parameters 2>defang-err |
    ( while read kwd vals ; do
      eval AG_`echo "$kwd" | $a_sh`="$vals"
      done # Prefix user-supplied name with "AG_": prevent collision.

      # Service price (bits-10) deters multi-megabyte downloads:
      LOG2=$((`echo "$OFFER" | sed 's/^[^:]*:\([0-9]*\).*$/\1/'`-10))
      if test $LOG2 -gt 21 ; then LOG2=21; fi
      SIZE_LIMIT=$((2**$LOG2)) # Applies to the gzipped result.
      QUOTA=$((8*SIZE_LIMIT))

      if ( echo "$AG_REQUEST_" |
            egrep -q '^(http|https|ftp)://[-a-zA-Z0-9./~?]*$' ) ; then
        wget --quota=$QUOTA -P wgot "$AG_REQUEST_" >> opt 2>>err
      else
        echo "$AG_REQUEST_" does not seem to be a legitimate URL. \
                 >> opt
      fi

      cd ..
      tar zcpf result.tgz result
      GOT_SIZE=`ls -l result.tgz | sed \
       's/\t/ /g;s/^[^ ]* *[^ ]* *[^ ]* *[^ ]* *\([0-9]*\).*$/\1/'`
      if test $GOT_SIZE -gt $SIZE_LIMIT ; then
        echo Compressed tar file size $GOT_SIZE exceeds size limit \
          $SIZE_LIMIT >> result/opt
        rm -rf result/wgot
        tar zcpf result.tgz result
      fi
      split result.tgz -b 20k
      echo "$AG_ENCRYPT_KEY_" > ekey
      test -n "$AG_SUBJECT_" || AG_SUBJECT_="nosubject"
      for f in x*; do
        echo Newsgroups: alt.anonymous.messages > $f.post
        if test -n "$AG_ENCRYPT_SUBJECT_" ; then
           echo Subject: \
            `esub "$AG_ENCRYPT_SUBJECT" "$AG_SUBJECT_"` \
              >> $f.post
        elif test -n "$AG_ENCRYPT_SUBJECT_BF_" ; then
           echo Subject: \
            `esubbf "$AG_ENCRYPT_SUBJECT_BF_" "$AG_SUBJECT_"` \
              >> $f.post
        else
           echo Subject: "$AG_SUBJECT_" >> $f.post
        fi
        echo >> $f.post
        gpg -a -c --passphrase-fd 4 4<ekey --batch --no-tty $f
	cat $f.asc >> $f.post
#       inews -D -S -h $f.post > /tmp/$f.past
        inews    -S -h $f.post
      done
    )
  fi
fi
cd ..
rm -rf $DIR

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.6 <http://mailcrypt.sourceforge.net/>

iD8DBQFEIbF+DkU5rhlDCl4RAqbEAJ9gYn0psqAfXxwa9ivXpKabpu/VDgCfT3g8
MGWf6QSeBbtAumVo6wBlGtY=
=uz+Z
-----END PGP SIGNATURE-----
Technical Details
Message-ID: <20060322230739.B0EFF47ABC@remailer-debian.panta-rhei.eu.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.privacy.anon-server.20141023.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!213.132.189.2.MISMATCH!multikabel.net!feed20.multikabel.net!txtfeed2.tudelft.nl!tudelft.nl!txtfeed1.tudelft.nl!feeder1.cambrium.nl!feed.tweaknews.nl!news.wiretrip.org!news.dizum.com!sewer-output!mail2news

Show Full Headers
Complete Article Headers
Message-ID: <20060322230739.B0EFF47ABC@remailer-debian.panta-rhei.eu.org>
Subject: Help wanted: AAMGATE server operators
Date: Wed, 22 Mar 2006 23:07:39 +0000
From: StealthMonger <Use-Author-Supplied-Address-Header@[127.1]>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.privacy.anon-server.20141023.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!213.132.189.2.MISMATCH!multikabel.net!feed20.multikabel.net!txtfeed2.tudelft.nl!tudelft.nl!txtfeed1.tudelft.nl!feeder1.cambrium.nl!feed.tweaknews.nl!news.wiretrip.org!news.dizum.com!sewer-output!mail2news
Author-Supplied-Address: StealthMonger <AT> nym <DOT> panta-rhei <DOT> eu
 <DOT> org
Newsgroups: alt.privacy.anon-server
Mail-To-News-Contact: abuse@dizum.com
Organization: mail2news@dizum.com
Lines: 173