Russ Allbery > Software > Scripts | nan-archive Changes > |
(Archive posts to news.announce.newgroups)
nan-archive [file ...]
Perl 5.6.0 or later and the Perl modules News::Article and PGP::Sign, both of which are available from CPAN.
nan-archive processes messages posted to news.announce.newgroups, verifying the article's PGPMoose signature and then archiving it according to its Archive-Name header. All actions are logged to a log file.
It expects to receive on standard input file names and message IDs, one pair of file name and message ID per line. The message ID is optional, but is used for logging until the message has been parsed and therefore omitting it may result in log messages that have no associated ID. The file is deleted when it has been successfully processed.
Optionally, instead, one or more files may be specified on the command line. In this case, they'll be processed as above, but they'll be noted as manually processed in the logs.
The Archive-Name header field must be in one of three formats: the name of
a newsgroup (for articles affecting that group); a path formed from a
directory, a slash, and a filename; or some other filename, which will be
stored in the other.articles
directory. If the Archive-Name header
field contains only a newsgroup name, it will be saved in a directory
named after the top-level hierarchy of that newsgroup name.
The archive area for all messages. The top level should just be
directories, and all messages will be archived in those directories
according to the naming scheme described above. The archived messages
will be stored in mbox format. The archive is locked against multiple
simultaneous writers by using fcntl locking on a file named .lock
at
the top level.
The keyring used to verify messages using the PGPMoose protocol. All messages must be signed by a key stored in this keyring with a key ID matching the one configured at the top of this script.
Where actions are logged. %Y is replaced by the current four-digit year and %m by the current two digit month.
nan-archive should be run for each message posted to news.announce.newgroups. Its input format is designed to work with the tinyleaf server that will come with INN 2.5 and later and is available from INN's Subversion repository, but it should also work as a channel feed from pre-storage-API versions of INN (1.x). It will not work without modification via a channel feed from a current version of INN, since it doesn't understand the storage API and doesn't know how to retrieve articles by tokens.
To run nan-archive with tinyleaf, create archive
, logs
, and
spool
directories and the GnuPG keyring as described above. Then, run
tinyleaf on some port, configuring it to use the spool
directory and
run nan-archive. A typical tinyleaf command line would be:
tinyleaf /srv/nan-archive/spool /srv/nan-archive/scripts/nan-archive
I run tinyleaf using tcpserver (from the ucspi-tcp package), but inetd should work equally well.
Then, set up a feed of news.announce.newgroups to the system running tinyleaf.
inetd(8), tcpserver(1), tinyleaf(8)
<http://www.eyrie.org/~eagle/software/scripts/> will have the latest version of this script.
Russ Allbery <eagle@eyrie.org>
Copyright 2003, 2008 Russ Allbery <eagle@eyrie.org>
This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.
Russ Allbery > Software > Scripts | nan-archive Changes > |