Re: Problem with multiple sites and crossposting

Janne Jalkanen <[email protected]>
Newsgroups gmane.network.sn
Message-ID <[email protected]>
Well, I've been playing with SN for a while, now and I got the
loop-prevention script working, so and so.  We'll see if it works
properly.

Anyway, I've included that script here and also a script that rips off
the sender information from the incoming message to provide anonymous
newsgroups.  Anonymization for a newsgroup is done if a file called
.anonymize exists in the newsgroup directory.  This file is meant to
replace the standard POST.  It probably does not do everything a
proper anonymizer should (it filters some of the headings and kills
the signature) do, but it should suffice.

The loop-filtering script bypasses the 'snstore' naming problem by
having a temporary binary directory, where 'snstore' is a link to the
real 'snsend'.  Kludge, but what'cha gonna do...

Feel free to do whatever you want with the scripts (maybe include the
anonymizer script to the next release?) - they are under GPL as usual.

Diffs are given to the 0.3.3 version of POST.

---anonymizing POST---
[news@iso bin]$ diff -c POST POST-anon 
*** POST  Wed Dec  6 09:11:18 2000
--- POST-anon Thu Dec 14 04:57:52 2000
***************
*** 59,64 ****
--- 59,65 ----
  
  postable=
  exists=
+ anonymize=
  
  for ng in $NEWSGROUPS; do
    mentioned=x$mentioned
***************
*** 68,73 ****
--- 69,80 ----
    # .nopost files "belong" to us; we alone control group post access
    [ -f $ng/.nopost ] && continue
    [ "x$postable" = x ] || postable="$postable,"
+ 
+   if [ -f $ng/.anonymize ]
+   then
+     anonymize='true'
+   fi
+ 
    postable="$postable$ng"
  done
  
***************
*** 79,85 ****
    # VERIFIED_SENDER is inherited from the authenticating script that
    # invoked snntpd, if any.
    [ "x$VERIFIED_SENDER" = x ] || echo "Sender: $VERIFIED_SENDER"
!   cat
  } |snsend -v || fail "Unable to post"
  echo "Posted to $postable"
  : Success
--- 86,106 ----
    # VERIFIED_SENDER is inherited from the authenticating script that
    # invoked snntpd, if any.
    [ "x$VERIFIED_SENDER" = x ] || echo "Sender: $VERIFIED_SENDER"
! 
!   if [ $anonymize = 'true' ]
!   then
!      sed -e 's/^From:.*/From: Anonymous coward/' \
!          -e 's/^NNTP-Posting-Host:.*/NNTP-Posting-Host: 127.0.0.1/' \
!          -e 's/^Organization:.*/Organization: Anonymous Newsposters/' \
!          -e 's/^Message-ID: <\([^@]*\)@\([^>]*\)>/Message-ID: <\1@anonymous>/' \
!          -e '/^--/,/^\./{ d; }'
!      echo "--"
!      echo "Anonymized to protect the innocent."
!      echo "."
!   else
!      cat
!   fi
! 
  } |snsend -v || fail "Unable to post"
  echo "Posted to $postable"


--- snstore-fix.sh ---
#!/bin/bash
#
#  This shell script should be invoked instead of snstore.
#  It is smart enough to check if an article has already been here
#  (i.e. removing loops)
#

TMPFILE=/tmp/.sn_filter_$$

cat > ${TMPFILE}

#
#  Check if already been here.
#
if [ `cat ${TMPFILE} | grep -c "Path:.*${HOSTNAME}.*${HOSTNAME}"` != 0 ]
then
    echo "Article already been here - removed"
    trap 'rm -f ${TMPFILE}' 0
    exit 9
fi

#
#  Major kludge to make sure we can run snstore (who checks its
#  own name and won't work unless it's called snstore).
#
export PATH=/usr/local/sn/bin//tmpbin/:${PATH}

#
#  Send to real snstore, adding our own header.
#
{
    echo "X-Filtered-By: snstore-fix on ${HOSTNAME}"
    cat ${TMPFILE}
} | snstore $*

trap 'rm -f ${TMPFILE}' 0


-- 
Janne Jalkanen                          Regex Pty Ltd
[email protected]             Level 11
Tel: +61-438 428 041                    530 Lt Collins St
Fax: +61-3-9909 7510                    Melbourne, VIC 3000
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.