🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #85531

Re: X-Trace Header Hashing?

#85531
From: Tony
Date: Mon, 03 Jun 2013 22:24
42 lines
2502 bytes
In news.software.nntp, Jesse <jesse.rehmer@blueworldhosting.com> wrote:

>I've tried to find recent/useable documentation on hashing the X-Trace 
>header in INN but am not finding anything that I (a Usenet admin 
>newbee) can follow and make work.
>
>Any tips or links to working documentation?

In $pathetc/filter, change filter_nnrpd.pl.

This is what I'm doing (my perl sucks, btw, but this does work for me),

Near the top,

use Digest::SHA qw(sha256_base64);

then inside 'sub filter_post {'

    if (hdr->{'X-Trace'} =~ m/^(\S+)\s+(.*)/)
    {
      $info .= $1; #
      $newhdr = $1 . ' ' . sha256_base64('some secret key'.$2);
      while (length($newhdr) % 4) {
           $newhdr .= '=';
      }
      $hdr{'X-Trace'}=$newhdr;
    }

    $modify_headers = 1;


The while loop is required to pad the hashed entry to the right length (for
base64).

200 perl experts can now step in and condense it to one line, but I tend to
build things incrementally.
-- 
Tony Evans
Saving trees and wasting electrons since 1993
blog  -> http://perceptionistruth.com/
books -> http://www.bookthing.co.uk/
[ anything below this line wasn't written by me ]
Technical Details
Message-ID: <koj52n$i2d$1@matrix.darkstorm.co.uk>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!news.snarked.org!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!matrix.darkstorm.co.uk!.POSTED!not-for-mail
References: <koisur$usg$1@nnrp.blueworldhosting.com>

Show Full Headers
Complete Article Headers
Message-ID: <koj52n$i2d$1@matrix.darkstorm.co.uk>
Subject: Re: X-Trace Header Hashing?
Date: Mon, 03 Jun 2013 23:24:50 +0100
From: Tony <tony@darkstorm.invalid>
References: <koisur$usg$1@nnrp.blueworldhosting.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!news.snarked.org!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!matrix.darkstorm.co.uk!.POSTED!not-for-mail
Newsgroups: news.software.nntp
Organization: Organised? Me? Nah!
Lines: 42
Reply-To: tony@darkstorm.co.uk
NNTP-Posting-Host: 2MhtC4TZt9eOTJuS6JTz0L6ifsf94myEPLymqbaqD2k=
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: matrix.darkstorm.co.uk jxjJmzBFee1M0RYjIEhTdKID64SAHEj9/OnMmJX1MH4==
X-Complaints-To: abuse@matrix.darkstorm.co.uk
NNTP-Posting-Date: Mon, 3 Jun 2013 22:24:23 +0000 (UTC)
X-User-ID: 57ZC41n64AdrXhgSwnQLra71yFH4SeZus1z16mntJtw=
X-Newsreader: Forte Agent 6.00/32.1186
X-Original-Bytes: 2287