Article View: news.software.nntp
Article #85530Re: X-Trace Header Hashing?
From: Steve Crook
Date: Tue, 04 Jun 2013 09:26
Date: Tue, 04 Jun 2013 09:26
37 lines
2118 bytes
2118 bytes
On Mon, 03 Jun 2013 23:24:50 +0100, Tony wrote in
Message-Id: <koj52n$i2d$1@matrix.darkstorm.co.uk>:
> 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;
Your example looks fine to me.
> The while loop is required to pad the hashed entry to the right length (for
> base64).
True, if you ever wanted to convert it back from base64 but normally it's
just used to provide a unique identifer.
> 200 perl experts can now step in and condense it to one line, but I tend to
> build things incrementally.
I'm no Perl expert but there are a couple of examples on the Cleanfeed
FAQ page:-
http://mixmin.net/cleanfeed/faq.html#hashhost
--
What shall we use
To fill the empty spaces
Where we used to talk?
Technical Details
Message-ID:
<slrnkqrclv.ceu.steve@snorky.mixmin.net>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!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!goblin2!goblin.stu.neva.ru!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!news.mixmin.net!.POSTED.2a01:4f8:100:5243::4!not-for-mailReferences:
<koisur$usg$1@nnrp.blueworldhosting.com> <koj52n$i2d$1@matrix.darkstorm.co.uk>Show Full Headers
Complete Article Headers
Message-ID: <slrnkqrclv.ceu.steve@snorky.mixmin.net> Subject: Re: X-Trace Header Hashing? Date: Tue, 04 Jun 2013 09:26:23 +0000 From: Steve Crook <steve@mixmin.net> References: <koisur$usg$1@nnrp.blueworldhosting.com> <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!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!goblin2!goblin.stu.neva.ru!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!news.mixmin.net!.POSTED.2a01:4f8:100:5243::4!not-for-mail Newsgroups: news.software.nntp Organization: Mixmin Injection-Date: Tue, 4 Jun 2013 09:26:23 +0000 (UTC) Injection-Info: news.mixmin.net; posting-host="2a01:4f8:100:5243::4"; logging-data="29114"; mail-complaints-to="abuse@mixmin.net" User-Agent: slrn/pre1.0.2-8 (Linux) Lines: 36 X-Original-Bytes: 1848