NNTP for Virgins

A little screed on getting an NNTP server working with NOS. While intended for those using TNOS developed by Brian Lantz, it may be of help to other NOS users as well.
Contents:

NNTP stands for "Network News Transfer Protocol". It's a good way to shove "broadcast" items like bulletins, news, and pleas for help etc. around the system. You may wish to run NNTP if there is a source of NNTP bulletins available to you from another host, or if you wish to create your own "bulletins" or "gateway" items from SMTP or the AX25 BBS network to NNTP for collection by others.

Documentation for newcomers to NNTP is rather thin on the ground, especially as most 'off the shelf' executables do not have nntp compiled in. Even 'top shelf' executables may contain only an NNTP client. This has been written only for those who have TNOS 2.10 or later with nntp server compiled in, although it *might* be handy for JNOS 1.10l fiends with the same. Throughout this document, I'll be assuming that you've had a bit of experience with xNOS, and at least know how to drive the command and session screens.


Does your NOS have an NNTP Server ?

This might sound silly, but a lot of "My xNOS won't" queries are caused by bits missing from your executable.

1) Make sure your TNOS has NNTP server compiled in. From the command screen type: version (JNOS users type: info)

Near the top you'll see "TCP Servers". Check that "NNTP" is listed amongst them. If not, try and get hold of a xNOS that has, or if you are able to compile your own, do so with #define NNTPS


What Files should be present ?

If all is well, we'll check you have the right files in your nntp directory. NOS's tend to complain bitterly if their NNTP control files are not present "Error in NNTP file system" is the giveaway.

TNOS users: change directory to your NOS root and then cd spool/nnews
JNOS users: as above, but cd spool/news

Directories will now be referred to relative to your NOS root directory e.g. /tnos c:\nos etc.

Files present should be:

1) access

This file can be empty if you have no qualms about who may get or post NNTP traffic from or to you, but if you have concerns, here's a documented example. If nntp access is 'off' then this file is not consulted (but still needs to be present)

# Example file /spool/news/access in jnos
# /spool/nnews/access in tnos
#
# Only first match is counts
#
# host:permissions:
# After the first colon R means Read, P means Post permission
#
# For some reason we don't want this host here
notwanted.ampr.org::
#
# All other ampr.org hosts can read and post
*.ampr.org:RP:
#
# Host foobar.com can only read
foobar.com:R:
#
# If 'nntp access' is on, all other hosts will be refused access
# should 'nntp access' be off, any host can access.

~~~~~~

2) active

This file may be empty too to start with, it's best to let your NOS create the entries. A typical entry might be:

ampr.bbs.tcpip 00087 00001 y

ampr.bbs.tcpip is the name of the newsgroup
00087 the highest "article number" stored on your system
00001 the lowest

y indicates "posting allowed" to this group. If 'n' - posting is not allowed, and should it be 'm' the group is moderated - a practice where articles are mailed to a moderator, who approves the item, and then posts it to the newsgroup if it is approved.

Don't worry too much about the entries (or lack of them just yet).

~~~~~~

3) fwd.seq

This file contains a number. If you're starting out in NNTP, make sure that it contains: 1 (in ASCII !) When an incoming article arrives, its newsgroup is looked for in the 'active' file. Should that newsgroup not be represented, your NOS will chuck the article in spool/nnews/forward (spool/news/forward in JNOS) and increment the number. The number is the next filename to use for an article doomed to enter the 'forward' dungeon.

~~~~~~

4) history

Just like a good contest operator, we like to avoid duplicates. The history file maintains a record of "Message ID's" so that your NOS can check whether it already has an NNTP article, and if luck is on our side, refuse those items it already has. The history file also contains a record of where it has put the article.

This is another file that can be empty to start with, but's let's have a look at a sample entry.

<53664_GB7HSN@hamradio> 960211 235945 ampr.bbs.dcc/11

<53664_GB7HSN@hamradio> Is a hopefully unique identification that will travel everywhere with the message. It is used as an "article number" when the message is to be retrieved from a server.

960211 represents the date of posting - 11th Feb 96
235945 the time - fifteen seconds before midnight.
ampr.bbs.dcc is the newsgroup it has been stored under, and the
/11 the name of the file it's within the newsgroup directory.

N.B. Lines in TNOS history files may additionally carry timezone ID - e.g. GMT, and additional newsgroup and filenames

If we wished to inspect the item manually, we might go looking at spool/nnews/ampr/bbs/dcc/11 (jnos users should have the gist by now - replace nnews with news) ... unless the pointer file has a nasty surprise !

~~~~~~

5) pointer

Yawn ... another empty file when starting out !

Let your NOS do the work with this - It contains the list of newsgroup to news directory mappings, and the date/time the newsgroup was created on your system.

ampr.bbs.tcpip spool/nnews/ampr/bbs/tcpip 960211 235138

ampr.bbs.tcpip Newsgroup name
spool/nnews/ampr/bbs/tcpip The directory articles are stored in
960211 - Created on your box on the 11th February 96
235138 - at 23:51:38

~~~~~~

6) Poll

Used to maintain a record of when a server was last polled for news. Can (again) be empty to start with. This is a useful file to "fiddle" if you have been away on holiday, and don't want two weeks of news clogging up a ropey 1200 baud link. By adjusting the date and time to be say, five days ago, you'll only get the last five days news when you next kick nntp.

In this example:

gb7bbc.ampr.org 951122 134431

gb7bbc.ampr.org The name of the server
951122 Last polled on the 22nd November 95
134431 Just before 2 o'clock

~~~~~~

Well, that's the files dealt with. You may also find sub-directories of spool/nnews where the news is kept. If all is well, and you have a newsgroup on your system called ampr.ip.tnos, the text of the articles themselves will lurk (with respect to your NOS root) in the directory spool/nnews/ampr/ip/tnos


Finding sources of NNTP bulletins:

You can ask around whether anyone has an nntp server up and running that you could draw news from, or examine your trace screen to see whether TCP frames are passing "over the air".

This trace frame is a dead giveaway

AX25: GB7CIP-5->GB7BBC-5 UI pid=IP
IP: len 77 44.131.244.1->44.131.178.10 ihl 20 ttl 63 prot TCP
TCP: 119->1749 Seq xf756f34e Ack x23060a33 PSH ACK Wnd 432

Notice the occurence of '119' in the TCP line ? - 44.131.244.1 is an nntp server. If the line read 1749->119 for example, then 44.131.178.10 is a server.

You can also use our old friend "Telnet" to seek out victims, by telnetting to port 119 of a suspected nntp server.

e.g.: telnet 44.131.178.10 119

An abrupt reset would mean that no server is fitted at that host, whilst a line such as:

200 gb7bbc.ampr.org NNTP version KO4KS-TNOS/Unix v2.02 ready at Tue Feb 20 15:35:48 1996 (posting ok)

Is sweetness to behold.

Sometimes you may get:

502 ariel.gb7bbc NNTP server can't talk to you. Goodbye.

Which isn't a good sign.

Assuming you have a co-operative server, you might now like to see what newsgroups are available at that server.

Type (in capitals): LIST

You'll receive a list of newsgroups carried, followed by some numbers - they come from the servers 'active' file, which is explained in the section on files above. The higher the first number, the more traffic there is likely to be carried on that group.

After the fullstop on its own, type: QUIT to bow out gracefully. If you wish to collect news from another server, it is only polite to ask the sysop there first. If you want your own news to escape out onto the network, sysops of other nntp servers will have to add you to their lists of servers that they poll.


Tackling the Autoexec:

Basic setup:

I usually place nntp commands near the end of autoexec, and here's some examples from mine. These should be enough to at least get you started, and if you want to be more adventurous, consult the command reference later on.

First the nntp profile commands.

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

nntp profile fullname "Gareth Rowlands"
nntp profile host g4hip.ampr.org
nntp profile organ "Amateur Radio"
nntp profile reply g4hip@gb7bbc.ampr.org
nntp profile user g4hip

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You really ought to set nntp profile host to your callsign.ampr.org, as this will appear in the path list of servers an item has passed through. Yes, you could set it to 'how.do.I.get.an.address....' but this might make you unpopular, especially with the local "network nazi".

The job of the rest of the profile commands are to set you up for when you make a posting via the 'nntp post' command, but they do assume that only yourself is going to be making postings. If you frequently hold parties for the local tcp/ip brigade, and six-packs, bottles of "Jack Daniels" plus an orgy of NNTP postings are the rule, you might leave these unfilled so that other users of your keyboard can fill in the details when you make postings ... NOS will prompt you for the items.

nntp profile fullname : Your name / nickname etc.
nntp profile host : Host / Host + Domain name of your box
nntp profile organ : Organisation e.g. "Amateur Radio", "Terror of TCPIP"
nntp profile reply : Your reply address for mail
nntp profile user : Callsign

Some more commands to add:

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# autocreate does not work in JNOS
# JNOS may prefer nntp lzw off
nntp access off
nntp autocreate on
nntp firstpoll 5
nntp ihave 0
nntp lzw on
nntp quiet 2

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

nntp access : When on, only hosts in the access file may connect.
nntp autocreate : Enables automatic creation of newsgroups (NOT JNOS)
nntp firstpoll : Days worth of news to get from a previously
unused server on first connect
nntp ihave : Use 'ihave' "pusher" method of article distribution
best left at 0 for now
nntp lzw : LZW compression. JNOS may exhibit memory leak if
this is enabled
nntp quiet : How much to display of nntp session progress (0-2)

If you are going to grab NNTP items from another server, you'll need to tell your NOS the following:

1) The name (or IP address) of the server
<nntpserver_host> e.g. gb7cip.ampr.org or 44.131.244.1

2) How often to collect news in seconds
<interval> e.g. 3600 to collect every hour

3) <Optional> Limits on the time of day when it can grab news
[<range>] 01:00-08:30 will only collect news between 1am and 8.30am

4) What newsgroups you require.
[<groups>]

* means all groups, and is recommended for those who are going to supply news to others. ! means NOT

If you don't wish to take all newsgroups available from a server (remember you can find out what's available by using telnet and LIST described in finding sources .... above) you may specify the groups you want. Either as a list e.g.

ampr.bbs.ip, ampr.bbs.wnos, ampr.ip.general

By blanket terms:

ampr.bbs*, ampr.ip* ampr.mailbox*
(These mean all articles in newsgroups which start ampr.bbs ampr.ip etc. e.g. ampr.bbs.dcc ampr.mailbox.tcpip will arrive)

and using the not ! command

ampr* !ampr.bbs.debate

Will get all ampr groups except ampr.bbs.debate

You can configure several servers to grab news from if you wish.

For each server add to your autoexec a line in the form

nntp add <nntpserver_host> <interval> [<range>] [<groups>]

e.g. in your autoexec

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nntp add gb7cip.ampr.org 3600 *

# (get everything from gb7cip, every hour on the hour)

nntp add gb7bbc.ampr.org 7200 22:00-06:00 ampr* !ampr.bbs.debate

# (get all newsgroups that start 'ampr.' every two hours overnight, but
# not ampr.bbs.debate)

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

There is a command 'nntp kick <server>' e.g. nntp kick gb7cip.ampr.org to force an instant nntp grabbing session regardless of how long the interval timer has to run, but if you have specified a range of hours over which news can be got - nntp kick will not work outside of those hours !

If you want others to be able to get nntp news from you whether or not you have chosen to use the nntp access facilities, there is another line to add to your autoexec.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

start nntp

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

** Important **

You may create newsgroups manually on your box using: 'nntp create <newsgroup>' (This would not be an item for the autoexec) If you do not have 'nntp autocreate' enabled (and you can't on JNOS) then you should manually create those groups you feel are likely to pass your way using nntp create.

Every now and again, examine any items that have turned up in spool/nnews/forward, (or spool/news/forward), look for their newsgroup in the header, and do them a favour by using 'nntp create <newsgroup>' for any future arrivals. e.g: nntp create ampr.ip.news

Where autocreate is not in use, when any items arrive for a newsgroup that has not been first 'created' on your box, they will be consigned to the scrapheap of the forward directory


Expiry:

Expiry of news items in JNOS. To get rid of old articles, and stop them cluttering up and festering on your hard disk, add a line for each newsgroup you wish to expire in the to the file expire.dat in the form:

!<newsgroup name> <life in days>

e.g.

!ampr.bbs.sysop 14
!ampr.ip.wnos 7
!forward 28

Will expire the sysop articles older than two weeks, and wnos bits older than a week whenever the 'expire' command is activated in JNOS

Items in the "oubliette" of forward get chucked out every 28 days by the above

In TNOS, the system is a little simpler in that no expire.dat file exists, and all newsgroups are treated equally by the expire mechanism. Set 'nntp expire articles' to the number of days you wish the articles to last, and 'nntp expire bids' to those number of days you wish to have protection against articles coming back to haunt your system. You shouldn't have the bid expiry time set less than that for articles.

To carry out the deed, use 'nntp expire now'


Reading:

There is an inbuilt nntp newsreader. Bring it to life with a command in the form 'nntp read <newsgroup>' from the command screen

e.g. nntp read ampr.rec.landy

After each article you will be asked whether you wish to view the next or previous item, or if you wish to quit.

If you want your NOS to keep track of the last item you have read, place an empty file called 'news.rc' in your nntp newsgroup directories e.g. for the above, make an empty file inside spool/nnews/ampr/rec/landy


Posting:

Should you ever feel confident enough to post to a newsgroup, use 'nntp post' The NOS will prompt you for the newsgroup name, and any items you left out when you configured nntp profile in your autoexec

End your item with a full stop on its own at the start of the line - you will be asked whether you really want to send the item.


Gatewaying:

If you have a feed of bulletins from an AX25 BBS, or a local public area on your bbs you wish to distribute more widely, you can gateway these to nntp.

In this example, we will gateway incoming "TCPIP" bulletins from the ax25 network to both our public area 'tcpip', and the nntp newsgroup 'ampr.mailbox.tcpip'

JNOS Users, and TNOS pre-2.20

In our rewrite file (etc/rewrite for TNOS users) we would place the line

tcpip@* tcpip

at a suitable juncture, whilst our alias file (etc/alias) would contain the line:

tcpip tcpip !ampr.mailbox.tcpip

This means send stuff for tcpip to both our area tcpip, and the newsgroup ampr.mailbox.tcpip - the exclamation mark means "what follows is an nntp newsgroup"

TNOS users 2.20+

These later TNOS's contain a specific gateway mechanism, and a dedicated ax25 topic <-> newsgroup mapping file. This file lives in Tnos's etc directory and is called news2mail. Format of the entry is:

<nntp group name> <mail group name> [<distribution (optional) >]

e.g.

# Example file etc/news2mail
# nntp group name mail group name [distribution]
#
ampr.bbs.tnos tnos -
ampr.bbs.ukhams ukhams bbs.uk
ampr.mailbox.tcpip tcpip
ampr.prop.solar solar -
ampr.prop.vhf vhf -
ampr.rsgb.dcc dcc -
ampr.rsgb.dccinf dccinf -
#
# End

The optional distribution entry enables the default distribution selected by 'nntp defaultdist' to be overridden. If the distribution is a hyphen '-', this is used to indicate that the distribution should be 'bbs.' followed by the 'host' the message was sent to (e.g. bbs.www, bbs.allus).

The two commands associated with nntp <-> mail gatewaying are:
nntp nntp2pbbs < on | off >
nntp pbbs2nntp < on | off >

The former needs to be enabled to convert news derived from nntp into mail areas in the pbbs, whilst the latter does the deed converting incoming bulletins ( and sometimes personal mail) to nntp !

pbbs2nntp:

If active, incoming bulletins are gated to nntp if the mail group name appears in the news2mail file (this can be used to gate personal mail as well - the mail group name is made the same as the personal mailbox to be gated). The newsgroup name used is that indicated in news2mail. Incoming bulletins will also be gated if they do not appear in news2mail, but they will be sent to the newsgroup ampr.bbs.<to_field>, e.g. a message sent to 'all@www' will appear in ampr.bbs.all

nntp2pbbs:

If active, messages are gated to pbbs mail areas if the nntp group name appears in the news2mail file. The corresponding mail group name is that indicated in news2mail. Items in newsgroups starting 'ampr.bbs' will also be gated to an area indicated by the name of the newsgroup after 'ampr.bbs.' e.g. ampr.bbs.landy will be gated to area 'landy'.

** Note for PBBS <-> NNTP gateways **

Be wary of transferring AX25 BBS messages to NNTP in areas where there are already nntp servers active. This is because many uk servers frig the bulletin ID's to be compatible with UKNOS, and your unmodified nntp "gateway" may pass duplicate messages onto the local network.

UKNOS BIDs normally take the form: 53664_GB7HSN@hamradio - notice the capital letters, and the @hamradio An unmodified NOS would produce a bid in the form 53664_gb7hsn@gb7hsn.bbs

TNOS 2.20 produces UKNOS compatible BIDS (forward biduknos on). Earlier TNOS, and JNOS source code can be modified to generate UKNOS friendly BIDs - seek specialist advice from your local guru.

NNTP server command reference:

Most of this section has been unashamedly poached from works by James Dugal K5KNX, Ian Wade G3NRW, OH2BNS, and others.

nntp access <on | off>

This can be toggled with 'nntp access on|off'. File spool/nnews/access is read and connected host is given read, post or no access according to it.

nntp active

Display list of configured newsgroups, together with the range of articles presently stored

nntp add <nntpserver_host> <interval> [<range>] [<groups>]

Add an NNTP news server to query every <interval> seconds for new articles in the specified <groups>.

<range> specifies the time-of-day limits when the queries will be made.

Multiple 'nntp add' commands may be used to concatenate groups (up to a maximum of 512 bytes).

Example: nntp add ns9nws 600 22:00-23:00 rec.ham-radio*

nntp autocreate <on | off> (TNOS only)

Enable automatic creation of newsgroups by posting or by incoming articles. If nntp autocreate is not on, then incoming articles destined for a newsgroup which has not been created will be consigned to the 'forward' directory

nntp create <newsgroup>

Usage is 'nntp create <newsgroup> [y|n]' where 'y' means that you can post to this group. Manually makes newsgroups on your system

nntp defaultdist <distribution>

Defines the default nntp distribution for items gated from the pbbs to nntp and where 'automatic' detection is not selected in the etc/news2mail file, or it is not possible to do so.

nntp drop <nntpserver_host>

Drop the specified NNTP server. e.g. nntp drop ns9nws

nntp dump <newsgroup> <mailbox>

Transfers the entire contents of a newsgroup 'en bloc' to a specified mailbox within the BBS. No checking for duplicates, etc. is carried out

nntp expire <articles | bids | now> [<days>]

For both articles and bids, the number of days you wish such items to remain cluttering your disk. 'nntp expire now' kicks the expire mechanism into action.

nntp firstpoll <days>

Determines how many days of news are requested by the initial poll to a new server.

nntp ihave <0 | 1 | 2>

Engages 'ihave' "pusher" mechanism. ihave is a system where after polling for news, your server will offer news to the server it's just pulled from. A value of '0' ignores incoming ihave, and never offers news to other servers using ihave. '1' enables incoming news offered with ihave, and '2' additionally will make your server offer news to other sites using ihave.

nntp kick <nntpserver_host>

Kick the local NNTP client to get in touch with the named server. e.g. nntp kick gb7cip.ampr.org.

N.B. If time range was specified when adding the server, nntp kick will not operate on that server outside of those times

nntp list

List the currently defined servers.

nntp lzw <on | off>

Enable / Disable LZW compression.
N.B. JNOS users having memory loss problems whilst using nntp are advised to turn this one off

nntp maxusers <number>

Determines the maximum number of clients which may be connected to the nntp server.

nntp nntp2pbbs < on | off >

Enables gatewaying of items from nntp to bulletin or mail areas within the pbbs.

nntp pbbs2nntp < on | off >

Enables gatewaying of items from bulletin or mail areas to nntp.

nntp post

Make your own NNTP article to let loose on the unsuspecting

nntp profile <subcommand>

nntp quiet <0 | 1 | 2>

Regulates the verbosity of NNTP when reporting "happenings" to the command screen

nntp read <newsgroup> [<number>]

Activates an NNTP newsreader to read the specified newsgroup. If the <optional> number is given, reading is started from that article

nntp rline < on | off >

Determines whether R: lines are preserved when moving PBBS messages to NNTP. When off, R: lines passing through the pbbs->nntp gateway are stripped of their R: Lines, and the BBS callsigns are added to the Path: line.

When on: R: lines are left in place, and BBS calls are not added to Path.

nntp trace < on | off >

When on, used to display (and debug) the progress of the nntp client or server.


That's it !

This little compendium was put together by Gareth Rowlands, who drew upon the works of, and would like to say thank-you to: G3NRW, K2MF, K5KNX, KO4KS, OH2BNS, WG7J and Jeffery R. Comstock

73,
Gareth.

amprnet : g4hip@gb7bbc.ampr.org
internet : gareth@lightfox.demon.co.uk

Back to the document menu