FreeBSD + INN + suck + mail2news Howto

Tilman Keskinöz
<tilman+innhowto@arved.at>

2003-12-06

1  Introduction

1.1  Copyright

The copyright of this document is retained by the author. Permission is granted to distribute the document by electronic means and on CDs, as long as it is kept entirely in its original format. Permission is also granted to print a copy of this document for personal use.

The republishing of this document in part or in whole without the permission of the copyright holder by any means other than as noted above is prohibited.

The latest version of this document is available at http://www.arved.de/.

1.2  Disclaimer

As I started to setup my local Newsserver, I noticed that the most Howtos for INN were not up to date. I am not INN expert. This Howto's purpose is to remind me what I did to get INN running in case I have to do it again.

You may use this Howto with different Operating Systems. Only the paths may be different, but I recommend using FreeBSD.

If you have Comments about this HowTo, feel free to send an Email to me mailto:tilman+innhowto@arved.at.

1.3  Requirements and Versions

This Howto requires a running FreeBSD Box, an Internet Connectio, some space on your Harddisk and basic Unix and Usenet skills. You can get FreeBSD at http://www.freebsd.org. The machine I used for this Howto is running 4-STABLE.

The version of INN used is 2.4.0. You can get INN at http://www.isc.org. In this Howto I installed the INN via the famous ports-collection.

The version of suck used ist 4.3.0. You can get suck at http://www.sucknews.org.

1.4  Other Newsservers

I have chosen INN because it has the most Features and is highly customizable. And of course because it's free.

But there are other Servers which do a good Job. Some Examles:

2  INN

2.1  Installation

Got to /usr/ports/news/inn and type make install. Make sure you have an user "news" on your system.

2.2  Configuration

Be sure you do all maintenance Work as User "news", becaus INN will throw strange Errormessages at you if it doesn't like the permissions.

2.2.1  storage.conf

First you need to set up a storage method. Read storage.conf(5) and edit /usr/local/news/etc/storage.conf. I have chosen timehash, because it's better than traditional spool and not so complicated as CNFS. (Well and it was the fist example in storage.conf :).
method timehash {
        newsgroups: *
        class: 0
}
After one and a half year my filesystem ran out of inodes, so i decided to migrate to CNFS. My storage.conf now looks like this:
method cnfs {
        newsgroups: *
        class: 0
        options: BIGAREA
}
BIGAREA is a virtual storage. It is mapped to real file names in cycbuff.conf. In my example I have mapped it to two files one and two both 150MBytes large.
cycbuff:ONE:/usr/local/news/spool/articles/cycbuffs/one:151200
cycbuff:TWO:/usr/local/news/spool/articles/cycbuffs/two:151200

metacycbuff:BIGAREA:ONE,TWO
Now you have to initialize the buffer files: dd if=/dev/zero of=one bs=1k count=151200

2.2.2  readers.conf

If you want users on other machines to read from your Newsserver you may have to edit /usr/local/news/readers.conf. Read man readers.conf.

I have allowed some machines on my local net to acess all newsgroups. This looks like this:
auth "local" {
    hosts: "192.168.2.4,192.168.2.3, 192.168.1.2"
    default: "<local>@arved.de"
}
access "local" {
        users: "<local>@arved.de"
        newsgroups: "*"
}

2.2.3  inn.conf

I have set doinnwatch: false because innwatch displayed a strange errormessage on my Console and I didn't really need innwatch.

2.2.4  expire.ctl

You may define different expiretimes. This File is quite self-explanatory and you probably won't need to change it.

2.2.5  newsfeeds

Well this Configurationfile is very difficult to read. Read the Manpage for detailed Configuration issues.

For a Configuration with suck you may use an Entry like this:
uni-berlin.de:*,!junk*,!control*,!local*:Tf,Wnm:news.cis.dfn.de
The First is the Pathexclude. Enter here all names your upstream Newsserver writes to the Path-header. This is necessary, so that articles which had come from the Upstreamserver are not posted back to the Upstream.

After the colon is an expression which newsgroups were feeded to this Newsserver. This expression means "Feed all, but the ones that begin with junk, control or local". The Tf, Wnm sequence defines the Feed. Tf stands for "Type File", Wnm defines which Information is put into the file, n is a Token and m the Message-Id.

The last item is the Filename which you can find in /usr/local/news/spool/outgoing.

2.3  Cronjob

INN needs a Cronjob which looks for expired articles. Add something like this to your /etc/crontab
0  3  *  *  *  news  /usr/local/news/bin/news.daily expireover lowmark

2.4  syslog.conf

You may not want all INN Logmessages in /var/log/messages. Add lines like this to /etc/syslogd.conf
news.crit                                       /var/log/news/news.crit
news.err                                        /var/log/news/news.err
news.notice                                     /var/log/news/news.notice
Be sure this files do exist before restarting syslogd

2.5  Starting up

Before starting up, you now eventually need to recreate the history:

cd /usr/local/news/db; ../bin/makedbz -i

../bin/makehistory -r -i

Just type /usr/local/etc/rc.d/innd start.

I now suggest you read the manpage of ctlinnd. This program is used to do all maintenance work.

2.6  Adding Newsgroups

Try adding a group with the following Command:
/usr/local/news/bin/ctlinnd newgroup local.test

3  suck

3.1  Starting the feeds

Before we start with suck, we have to start the feeds, we defined prior.

/usr/local/news/bin/ctlinnd begin news.cis.dfn.de

3.2  Installing suck

Just like all BSD Installations.... cd /usr/ports/news/suck && make install

3.3  Configuring suck

I suggest to create a Directory /usr/local/news/suck, where you store your suck configuration.

First create a file named "active-ignore". Do add here all groups you don't want to feed upstream, e.g local groups and the control groups.

Next create a file called "sucknewsrc". Here add all groups you want to feed upstream. Add a 1 behind each line.

Next Create a script similar to the get.news.inn Script, which you can find under /usr/local/share/examples/suck/ . If you have defined timehash as your storage method, use /usr/local/news/bin/sm to get your articles from the spool.

You can find my scripts on http://www.arved.de/bsd/inn/news.filter and http://www.arved.de/bsd/inn/get.news.inn.

Test your script, if it works, install it as a cron job or if you connect to the Internet via ppp put it into your ppp-startscript.

4  mail2news

4.1  Obtaining mail2news.pl

You can get this perlscript from http://www.arved.de/bsd/inn/mail2news.pl.bz2. Install this perlscript into /usr/local/news/bin. Do a chmod u+x mail2news.pl to make it group executable.

4.2  Add the local group

Next You need to add the group which should contain your mailinglist. It needs to be moderated:

ctlinnd newgroup local.mailinglist m

The m tells innd that this group is moderated. In /usr/local/news/etc/moderators you add the mailinglist address:

local.mailinglist:mailinglist@some.site

4.3  Adding the mail alias

This description is for sendmail, which is the standard MTA for FreeBSD. If you think you are so cool that you must run a different MTA like qmail or postfix...well, than you probably know how to install a mail alias in that software.

Open /etc/mail/aliases and add a line like this:

local-mailinglist: "| /usr/local/news/bin/mail2news.pl local.maillinglist"

This adds a mail adress local-mailinglist@server. All Email to this address is piped to the script. Subscribe with this Emailadress to the mailinglist you want to gate.

Now you have to add the user "mailnull" to the group "news". This needs to be done, that the user mailnull can execute the mail2news script.

You can also use only one single mailadress and feed the newsgroups via procmail. A sample entry looks like this:
:0:
* ^Sender: darwinports-bounces@opendarwin.org
| /usr/local/news/bin/mail2news.pl arved.darwinports
Remember to put the user that executes the mail2news skript into the "news" group.

4.4  Links


This document was translated from LATEX by HEVEA.