Configuring and Starting the INN Server


Configuring and Starting the INN Server

So far, you have seen how to read news from an existing news server. Now, you can turn to the subject of setting up an INN server on your system. Much of the InterNetNews (INN) software, bundled with Red Hat Linux, is already set up for you. You need to understand the various components of INN, edit the configuration files, and start innd-the INN server. Sometimes I refer to the INN server as the news server.

Taking Stock of INN Components

INN includes several programs that perform specific newsgroup-delivery and -management tasks. It also includes a number of files that control how the INN programs work. The most important INN programs are the following:

  • innd-The news server. It runs as a daemon-a background process that keeps itself running to provide a specific service-and listens on the NNTP port (TCP port 119). The innd server accepts connections from other feed sites, as well as from local newsreader clients, but it hands off local connections to the nnrpd.

  • nnrpd-A special server invoked by innd to handle requests from local news-reader clients.

  • expire-Removes old articles based on the specifications in the text file /etc/news/expire.ctl.

  • nntpsend-Invokes the innxmit program to send news articles to a remote site by using NNTP. The configuration file /etc/news/nntpsend.ctl controls the nntpsend program.

  • ctlinnd-Enables you to control the innd server interactively. The ctlinnd program can send messages to the control channel of the innd server.

The next few sections describe how to set up some of the control files.

Understanding inn.conf

This file holds configuration data for all INN programs and, as such, is the most important file. Each line of the file has the value of a parameter in the following format:

parameter:     value

Depending on the parameter, the value is a string, a number, or true or false. As in many other configuration files, comment lines begin with a number or pound sign (#).

Most of the parameters in the default inn.conf file in the /etc/news directory should not require changes. You might want to edit one or more of the parameters shown in Table 16-2.

Table 16-2: Configuration Parameters in /etc/news/inn.conf

Parameter Name

Description

mta

Set this to the mail transfer agent that will be used by innd to transfer messages. The default is to use sendmail.

organization

Set this to the name of your organization in the way you want it to appear in the Organization: header of all news articles posted from your system. Users may override this by defining the ORGANIZATION environment variable.

ovmethod

Sets the type of overview storage method (the overview is an index of the news articles in the newsgroup). The default method is tradindexed, which is fast for reading news, but slow for storing news items.

pathhost

Set this to the name of your news server as you want it to appear in the Path header of all postings that go through your server. If pathhost is not defined, the fully qualified domain name of your system is used.

pathnews

Set this to the full pathname of the directory that contains INN binaries and libraries. In Red Hat Linux, pathnews is set to /usr/lib/news.

domain

Set this to the domain name for your server.

allownewnews

Set this to true if you want INN to support the NEWNEWS command from news readers. Because this command can drastically reduce your server's performance, INN documentation recommends that you set this to false.

storageapi

Set this to true if you want articles to be stored using the Storage Manager application programming interface (API). The default setting of false causes INN to use the traditional article storage method of storing one article per file. If you set this to true, you have to choose between the storage methods timehash and cnfs, and you have to create new spool and database files (type man storage.conf to read more about cnfs and timehash storage methods). For a small number of newsgroups, you can leave this option at its default value of false.

hiscachesize

Set this to the size in kilobytes that you want INN to use for caching recently used history file entries. The default setting of 0 disables history caching. Because history caching can greatly increase the number of articles your server can process per second, you may want to set a value of 256 (for 256KB).

innflags

Set this to any flags you want to pass to the INN server process when it starts up.

Understanding News Feeds

The newsfeeds file specifies how incoming news articles are redistributed to other servers and to INN processes. If you provide news feeds to other servers, you have to list these news feeds in this file. (You also must have an entry labeled ME, which serves a special purpose explained later in this section.)

The newsfeeds file contains a series of entries, one for each feed. Each feed entry has the following format:

site[/exclude,exclude...]\
      :pattern,pattern...[/distrib,distrib...]\
      :flag,flag...\
      :param 

Each entry has four fields separated by colons (:). Usually, the entries span multiple lines, and a backslash (\) at the end of the line is used to continue a line to the next. Following are the four fields in each entry in the newsfeeds file:

  1. The first field, site, is the name of the feed. Each name must be unique, and for feeds to other news servers, the name is set to the hostname of the remote server. Following the name is an optional slash and an exclude list (/exclude,exclude...) consisting of a list of names. If any of the names in this list appear in the Path line of an article, that article will not be forwarded to the feed. You can use an exclude list if you don't want to receive articles from a specific source.

  2. The second field consists of a comma-separated list of newsgroup patterns, such as *,@alt.binaries.warez.*,!control*,!local*, followed by an optional distribution list. The distribution list is a list of comma-separated keywords, with each keyword specifying a specific set of sites to which the articles are distributed. The newsgroup patterns essentially define a subscription list of sites that receive this news feed. An asterisk (*) matches all newsgroups. A pattern beginning with an @ causes newsgroups matching that pattern to be dropped. A pattern that begins with an exclamation mark (!) means the matching newsgroups are not sent. By the way, the simple pattern-matching syntax used in INN configuration files is referred to as a wildmat pattern.

  3. The third field is a comma-separated list of flags. These flags determine the feed-entry type and set certain parameters for the entry. There are numerous flags; you should type man newsfeeds and read the man page for more information about the flags.

  4. The fourth field is for parameters whose values depend on the settings in the third field. Typically, this field contains names of files or external programs that the INN server uses. You can learn more about this field from the newsfeeds man page.

Now that you know the layout of the /etc/news/newsfeeds file, you can study that file as an example. The default file contains many sample feed entries, but all but the following two are commented out:

  • ME is a special feed entry that's always required. It serves two purposes. First, the newsgroup patterns listed in this entry are preprended to all newsgroup patterns in all other entries. Second, the ME entry's distribution list determines what distributions your server accepts from remote sites.

  • The controlchan feed entry is used to set up INN so that an external program is used to handle control messages (these messages are used to create new newsgroups and remove groups). For example, the following controlchan entry specifies the external program /usr/bin/controlchan to handle all control messages, except cancel messages (meant for canceling an article):

    controlchan!\
            :!*,control,control.*,!control.cancel\
            :Tc,Wnsm:/usr/lib/news/bin/controlchan

In addition to these feed entries, you add entries for any actual sites to which your news server provides news feed. Such entries have the format

feedme.domain.com\
                :!junk,!control/!foo\
                :Tm:innfeed!

where feedme.domain.com is the fully qualified domain name of the site to which your system sends news articles.

Understanding incoming.conf

The incoming.conf file describes which hosts are allowed to connect to your host to feed articles (in versions of INN prior to 2.2.3, a file named hosts.nntp was used to specify remote hosts allowed to transfer articles to the local site). For a single feed, you can add an entry like

peer myfeed {
    hostname: myfeedsite.com
}

where myfeed is a label for the peer and myfeedsite.com identifies the peer-the site that feeds your site.

Insider Insight 

Keep in mind that simply adding a site's name in the incoming.conf file does not cause that remote site to start feeding your site news-it simply enables your server to accept news articles from the remote site. At the remote site, the server must be configured to send articles to your site.

Understanding readers.conf

This file specifies the hostnames or IP addresses from which newsreader clients (such as Mozilla) can retrieve newsgroups from your server. For example, the following readers .conf file allows read access and post access (meaning you can submit articles) from localhost and any from host in the network 192.168.0.0:

auth "localhost" {
    hosts: "localhost, 127.0.0.1, stdin"
    default: "<localhost>"
}
access "localhost" {
    users: "<localhost>"
    newsgroups: "*"
    access: RPA
}
auth "localnet" {
    hosts: 192.168.0.0/24
    default: "<localnet>"
}
access "localnet" {
    users: "<localnet>"
    newsgroups: "*"
    access: RPA
}

Starting INN

In addition to the configuration files, you also need to initiate cron jobs that perform periodic maintenance of the news server. In Red Hat Linux, these cron jobs are already set up. Therefore, you are now ready to start the INN server-innd.

Before you start innd, you must run makehistory and makedbz to initialize and rebuild the INN history database. Type man makehistory and man makedbz to learn more about these commands. You can use the following commands to create an initial history database and associated index:

/usr/lib/news/bin/makehistory -b -f history -O -l 30000 -I
cd /var/lib/news
/usr/lib/news/bin/makedbz -s `wc -l < history` -f history
chown news.news *
chown news.news /var/spool/news/overview/group.index
chmod 664 /var/spool/news/overview/group.index

As with any other standalone servers (these are servers that do not run under xinetd) in Red Hat Linux, you can set up innd to start at boot time by typing the following command:

chkconfig --level 35 innd on

To start innd right now, log in as root and type the following command:

service innd start

If you change any configuration file (such as inn.conf or newsfeeds), restart the innd server with the following command:

service innd restart

You can type ps ax to see if the innd process is up and running. If all goes well, you should see two processes such as the following listed in the output of the ps ax command:

23789 ?        S      0:00 /usr/lib/news/bin/innd -p4
23794 ?        S      0:00 /usr/bin/perl /usr/lib/news/bin/controlchan
Insider Insight 

The /var/log/spooler file contains all status and error messages from innd. Type the following command to see the last few messages in that file:

tail /var/log/spooler