🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: URL Retrieval bug

#239858
From: StealthMonger
Date: Sat, 17 Jul 2010 00:26
205 lines
9262 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Zax <admin@bananasplit.info> writes:

> Next issue with large files (such as the one above) is that newsservers
> won't accept them.  Even if they could, I'm not convinced I'll make many
> friends if I frequently write that kind of volume to a.a.m for everybody
> to subsequently download.  I'm open to suggestions on how best to handle
> this.

Do as my aamgate does.  Or use aamgate as is.

I published aamgate here in 2006.  It's appended again below.  These
days, I would use hsub rather than esubbf, and code it in Python.  It
could probably easily be translated.

I also published some aamgate client scripts around that time.

aamgate uses several measures to cope with the problems.  The size of
the response is limited according to the amount of hashcash included
with the request.  As the comment in the code says, the "Service price
(bits-10) deters multi-megabyte downloads".  Moreover, aamgate sends a
response in all cases, even if the response is nothing but a failure
report, so if the response is too big (and often the user has no way
to know beforehand), the user at least learns this fact.  Zax,
probably your sense of "user friendliness" could be accommodated by
treating absence of hashcash the same as some modest amount of given
hashcash.  In any case, if the response is too big, it is split into
pieces before posting to a.a.m.  All these things are done after first
compressing the response with gzip.

Here's the original aamgate.


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.10 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8+ <http://mailcrypt.sourceforge.net/>

iEYEARECAAYFAkxA1oIACgkQDkU5rhlDCl71XwCfbg7jufvBPeVbGnChp1h8fzvG
3g4AoJyAQCvwW93oqOHmZLQ6IT/RTRsN
=Elh8
-----END PGP SIGNATURE-----
Technical Details
Message-ID: <20100717002656.70B1881404@fleegle.mixmin.net>
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!border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!feeder3.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.84.MISMATCH!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!news.wiretrip.org!news.dizum.com!sewer-output!mail2news
References: <slrni3gn27.4mg.admin@fleegle.mixmin.net> <589b294ef98c02b28d7d4bfe455c7484@dizum.com> <066f1db75451b4ce5233fbc611bd0a49@dizum.com> <slrni40koh.2jj.admin@fleegle.mixmin.net> <slrni417gn.512.admin@fleegle.mixmin.net>

Show Full Headers
Complete Article Headers
Message-ID: <20100717002656.70B1881404@fleegle.mixmin.net>
Subject: Re: URL Retrieval bug
Date: Sat, 17 Jul 2010 00:26:56 +0000
From: StealthMonger <Use-Author-Supplied-Address-Header@[127.1]>
References: <slrni3gn27.4mg.admin@fleegle.mixmin.net> <589b294ef98c02b28d7d4bfe455c7484@dizum.com> <066f1db75451b4ce5233fbc611bd0a49@dizum.com> <slrni40koh.2jj.admin@fleegle.mixmin.net> <slrni417gn.512.admin@fleegle.mixmin.net>
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!border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!feeder3.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.84.MISMATCH!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!news.wiretrip.org!news.dizum.com!sewer-output!mail2news
Author-Supplied-Address: StealthMonger <AT> nym <DOT> mixmin <DOT> net
Newsgroups: alt.privacy.anon-server
Mail-To-News-Contact: abuse@dizum.com
Organization: mail2news@dizum.com
Lines: 204
X-Original-Bytes: 9067