leafnode(8)

NAME
leafnode - NNTP server for small (dialup) sites

SYNOPSIS
leafnode

DESCRIPTION
Leafnode is a USENET package intended for small sites, where there are few users and little disk space, but where a large number of groups is desired.

The design of leafnode is intended to self-repair after problems, and to require no manual maintenance.

The leafnode program itself is the NNTP server. It is run from /etc/inetd.conf when someone wants to read news. The other parts of the package, fetchnews and texpire, are responsible for fetching new news from another server, and for deleting old news.

ACCESS CONTROL
No authentication or access control is supported. This is a deliberate omission: Implementing this is a job which should not be redone for each and every service.

I recommend that either firewalling or tcpd be used for access control.

FILES
All these files and directories must be writable by user "news".

/usr/local/lib/leafnode/groupinfo contains the information about each USENET group. In case of harm, it is rebuilt by fetchnews(8).

/usr/local/lib/leafnode/news-server-name contains the information about every USENET group on each news server. In case of harm, it is rebuilt by fetchnews(8).

/usr/local/lib/leafnode/news-server-name.active is an empty file created when fetchnews(8) get information about every USENET group on each news server.

/usr/local/lib/leafnode/config contains the configuration parameters for leafnode. See CONFIGURATION below.

/var/spool/news contains the news articles; e.g. /var/spool/news/alt/fan/agulbra contains the articles in the alt.fan.agulbra group. Each directory contains articles in numbered files (decimal numbers, monotonically increasing), and a special file called .overview which contains the "Subject", "From", "Date", "Message-ID", "References", "Bytes" and "Lines" headers for each article in the group.

Several subdirectories are special:

/var/spool/news/out.going contains local postings that fetchnews(8) is to pass to the upstream NNTP server.

/var/spool/news/failed.postings contains local postings that the upstream server rejected. fetchnews(8) will create files in this directory, but none of the leafnode programs will delete anything in it.

/var/spool/news/message.id contains hard links to each message; this is used in place of the dbz database typically used by bigger servers. (A directory such as this is probably more efficient for the small servers leafnode is designed for but scales very badly.)

/var/spool/news/interesting.groups contains one 0-byte file for each group an NNTP client has asked to read. leafnode will touch the the relevant file when a LISTGROUP, XOVER, XHDR, STAT, HEAD, BODY or ARTICLE command is issued immediately after a GROUP command is issued, and fetchnews(8) will retrieve all new articles in all groups whose files have been either

    - touched during the past timeout_short (see CONFIGURATION below) days, or

    - touched more than once, and at least once within the past timeout_long (see CONFIGURATION below) days.

/etc/inetd.conf contains the line which starts leafnode. It is strongly recommended to start leafnode as user news.

CONFIGURATION
All configuration is done using the file /usr/local/lib/leafnode/config. There is no GUI configuration tool yet.

The file is in the common UNIX format: One line per argument, white space allowed, # starts a comment which lasts until the end of the line. Here is an example which demonstrates all the bells and whistles:

server=news02.bigprovider.com
server=newspost.otherprovider.ne.jp
postable=1
port=128
username=username
password=password
newsgroups=alt.*
filteredngs=alt.*binaries.*
newsgroups=fj.*
server=nntp.throught.ssh
viahost=localhost
port=1234
preconnect = su ssh-local-user -c "ssh -f -C -L 1234:nntp.throught.ssh:119 -l ssh-remote-user ssh-server sleep 20 > /dev/null"
supplement=sex.and.warez.com
# avoidances to fetch articles
timeout_short=2 # some users read newsgroups only once unfortunately.
timeout_long=21 # some news groups don't have many article, so keep it long.
timeout_active=14 # each 14 day, check new newsgroups.
expire=7 # don't use much space.
groupexpire=local.* 21 # preserve local news.
groupexpire=*linux* 3 # don't use much space.
maxfetch=1000 # again, don't use much space.
initialfetch=3000 # again, don't use much space.
maxold=10 # again, don't use much space.
maxlines=1000 # again, don't use much space.
minlines=1 # don't use useless space.
maxbytes=100000 # don't use much space.
maxgroups=5 # hate too much cross-posting.
killsubject=test # skip testing messages
killsubjecti=money.*making # skip money messages
killfrom=[Aa]uto # skip all messages from auto-responder.
killfromaddress=gov # skip all messages from goverment.

"server" is used by fetchnews(8) to select what NNTP server to retrieve news from. You can specify several servers. And you can add and decrease servers. But at least one "server" is required.

"postable" is used by fetchnews(8) to decide whether this server is postable or not. The first server is marked as postable because of compatible reason. Others are marked as unpostable. So, if you want to allow fetchnews(8) to try to post articles to each server, please write "postable=1" in each server's entry.

"port" is used by fetchnews(8) to choose a port number to connect to the NNTP server.

"username" and "password" are used by fetchnews(8) to choose a user name and password to be authorized a NNTP connection by the NNTP server.

"newsgroups" entries are used by fetchnews(8) to decide whether those news groups will be fetched or not. If a system has fnmatch(), each name of news groups is compared by its function, so you can use shell-styled globbing rules like "fj.*.linux*". Otherwise, it is compared by strcmp() or strncmp(), so you can use only asterisks at the beginning and/or the end like "fj.*", "*.linux" or "*.comp.*".

"filteredngs" entries are used by fetchnews(8) to screen news groups. It is an opposite way of "newsgroups."

"viahost" is used by fetchnews(8) to choose a host to connect to the NNTP server. It is useful to use ssh forwading ability.

"preconnect" is executed by fetchnews(8) before making a connection to the NNTP server. It is used for using ssh forwading ability. Note: you shouldn't break a line in the string. You have to write as same as what you want to execute.

"supplement" is old leafnode's keyword. On this leafnode+, it is same as "server" so that use "server" entry instead of "supplement."

"timeout_short" is a number of days. Newsgroups which have not been read, or have been read only once, during the timeout period are marked as uninteresting. The default value is 2 days. If it is zero, newsgroups once started to read never mark as uninteresting.

"timeout_long" is also a number of days. Newsgroups which have not been read at all during the timeout period are marked as uninteresting. The default value is 7 days. If it is zero, newsgroups once started to read never mark as uninteresting.

"timeout_active" is again a number of days. The active database of each upstream server is checked after this number of days. The default value is 7 days.

"expire" is the number of days a thread should be kept around. This many days after it has last been read, a discussion thread will be deleted by texpire(8). This parameter is mandatory.

"groupexpire" is a set of one string and the number of days separated spaces. A thread in a newsgroup matched with the string should be kept around the number of days. If a system has fnmatch(), a string is compared by it, so you can use shell-styled globbing rules like "fj.*.linux*". Otherwise, it is compared by strcmp() or strncmp(), so you can use only asterisks at the beginning and/or the end like "fj.*", "*.linux" or "*.comp.*". This many days after it has last been read, a discussion thread will be deleted by texpire(8).

"maxfetch" specifies the maximum number of articles fetchnews(8) should fetch from the upstream server in each group. This limits the size of the backlog a reader of a group will see when first subscribing. By default there is no limit, so a new reader will see all of the available postings.

Warning: If you set maxfetch too low, regular readers of a group may not see all of the traffic in that group. I recommend setting it to at least 1000-1500. initialfetch=3000 #again, don't use much space

"initialfetch" specifies the maximum number of articles fetchnews(8) should fetch from the upstream server in each group at the first connection to the server. By default there is no limit, so a new reader will see all of the available postings.

"maxold" specifies the maximum dates of articles fetchnews(8) should fetch from the upstream server in each group. By default there is 10 days limit, so a new reader will see only new postings.

"maxlines" specifies the maximum number of lines of articles fetchnews(8) should fetch from the upstream server in each group. By default there is no limit, so a new reader will see all of the available postings.

"minlines" specifies the minimum number of lines of articles fetchnews(8) should fetch from the upstream server in each group. By default there is no limit, so a new reader will see all of the available postings.

"maxbytes" specifies the maximum size of articles fetchnews(8) should fetch from the upstream server in each group. By default there is no limit, so a new reader will see all of the available postings.

"maxgroups" specifies the maximum number of cross-posted news groups of articles fetchnews(8) should fetch from the upstream server in each group. By default there is no limit, so a new reader will see all of the available postings.

"killsubject" specifies the subject pattern of articles fetchnews(8) should NOT fetch from the upstream server in each group. By default there is no limit, so a new reader will see all of the available postings. This pattern is compared by using regular expression library for speed instead of fnmatch function, so this pattern must be written in the regular expression. For example, "money.*make" is needed instead of "money*make". However, if a system has no regular expression, every subject is compared by strstr(). In this case, please write "money make" instead.

"killsubjecti" specifies the killing subject pattern like "killsubject". However, this pattern ignores case distinction.

"killfrom" specifies the from pattern of articles fetchnews(8) should NOT fetch from the upstream server in each group. By default there is no limit, so a new reader will see all of the available postings. This pattern is compared by using regular expression library for speed instead of fnmatch function, so this pattern must be written in the regular expression.

"killfromaddress" specifies the killing from pattern like "killfrom". However, this pattern is compared with address field only.

In addition, "maxage" and "maxcrosspost" are also used as same as Cornelius's leafnode. They are added to increase compatibility.

PROTOCOL
Here are the NNTP commands supported by this server.

ARTICLE
    Return the headers and body text of an article. Leafnode supports this imperfectly; the message-id and article number of the article may not be reported in the reply line. This does not affect any tested NNTP clients.

BODY
    Return the body text of an article. See ARTICLE.

GROUP
    Sets the current USENET group and article pointer, and returns the status information about this group.

HEAD
    Return the headers of an article. See ARTICLE.

HELP
    Accepted but I'm afraid it is not very helpful.

IHAVE
    Known but rejected. See fetchnews(8).

LAST
    Moves the article pointer back by 1.

LIST
    Lists the available USENET groups.

LISTGROUP
    Lists the articles present in the current group, or the argument group if an argument is present.

MODE
    Accepted and blithely ignored.

NEWGROUPS
    Accepted but the reply is always empty. This command does not make sense for this server.

NEWNEWS
    Accepted but the reply is always empty. This command does not make sense for this server.

NEXT
    Moves the article pointer forward by 1.

POST
    Post a new article. Only scant syntax checking is performed. The article is sent to the upstream NNTP server by fetchnews(8).

QUIT
    Quit reading news.

SLAVE
    Accepted but ignored.

STAT
    Return the availability of an article. See ARTICLE.

XHDR
    Accepted, but supported only for the "Subject", "From", "Date", "Message-ID", "References", "Bytes" and "Lines" headers.

XOVER
    Returns the "Subject", "From", "Date", "Message-ID", "References", "Bytes" and "Lines" headers for the indicated article(s).

The rest of the commands given in the NNTP RFC or added in other servers are left out in order to keep the server simple and bug-free.

BUGS
None known.

AUTHOR AND LICENCE
Written by Arnt Gulbrandsen <agulbra@troll.no> and copyright 1995 Troll Tech AS, Postboks 6133 Etterstad, 0602 Oslo, Norway, fax +47 22646949.

Modified by Kazushi (Jam) Marukawa <jam@pobox.com>. Copyright of the modifications 1998,1999,2000.

Use, modification and distribution is allowed without limitation, warranty, or liability of any kind.

The development of leafnode has been paid for by Uninett AS (http://www.uninett.no/).

SEE ALSO
tcpd(8), hosts.allow(5), fetchnews(8), texpire(8), checkgroups(8), RFC 977