Probably the most widely used and most popular method of distributing news on Linux systems is C News, designed for UUCP connections (although you can use C News with NNTP, too). Configuring C News to transfer newsgroups between your machine and others is not too difficult, although it can be time-consuming. This chapter walks through the steps necessary to configure C News and explains most of the files that C News uses.
When news is transferred in from a remote newsfeed, the rnews program accepts it and stores it in a spooling directory (usually /usr/spool/news/in.coming or /var/spool/news/in.coming). From the spool directory, the news messages are picked up and processed by the newsrun program. Outgoing news (such as from a local user) is usually sent from the users' newsreader to the inews program, which completes all the header details and stores it ready for transfer in the directory /usr/spool/news/out.going (or /var/spool/news/out.going).
Both incoming and outgoing messages pass through the relaynews program, which is responsible for checking whether the message has already been seen on the local site. To do this, relaynews checks the message ID against the history file (which contains a list of all processed messages). If the message has already been accepted at the local site, it is discarded.
If the message is new, relaynews checks the Newsgroups heading of the message to verify that the local site accepts articles for that newsgroup. If the newsgroup is not supported, relaynews discards the message. If the newsgroup exists in the active file, relaynews moves the message into the proper newsgroup spool directory. If the newsgroup is not listed in the active file, the article is moved to a miscellaneous group (often called junk).
The relaynews program also checks the header information of messages to verify that they are not stale. If a stale article is found, it is discarded. If a message is not processed for any other reason (such as incomplete header, improper date, and so on), it is moved to the directory /usr/spool/news/in.coming/bad or /var/spool/news/in.coming.bad) and an error message logged. After all these checks, the message ID is logged to the history file.
Messages that are to be sent further on through a news network are checked against the Path field in the header to make sure they haven't already received the article. If they haven't, the message can be forwarded on using UUCP (or in rarer cases, NNTP).
If batching of news articles is in effect, incoming and new articles are not forwarded on to other news machines in the UUCP network immediately but are held until the batch is transferred as a whole. This is usually controlled through a crontab entry.
Configuring the C News system is a matter of verifying that necessary directories are accessible by C News, and that configuration files have valid values in them. Finally, all the file ownerships and permissions have to be checked. The configuration is best done in steps.
To begin the configuration process for C News, obtain copies of the active and newsgroup files from your newsfeed. You can usually obtain the files with a UUCP command or an e-mail message to the postmaster at that site. Place the active and newsgroup files in the news directory (usually /usr/lib/news), and change the ownership to the user news. Next, change the file permissions to mode 644. You can do both these steps with the following commands:
chown news /usr/lib/news/active /usr/lib/news/newsgroup chmod 644 /usr/lib/news/active /usr/lib/news/newsgroup
Edit the active file with any ASCII editor. Remove any line from the file that has the line "to.*". Add two lines that add your machine name and newsfeed site names, so that you have lines like this:
These lines assume that your local site is called merlin and your feed site is called brutus. The order of the entries doesn't matter. These entries are used with the news ihave/sendme message system, and they should exist in the active file even if you are not using the ihave/sendme system.
Next, add the following lines to the /usr/lib/news/active file:
These lines are used for handling unidentified newsgroup articles and other functions. Not all versions of C News let you access this file directly. Instead, two utilities called addgroup and rmgroup perform the same function. In this case, use the function addgroup to add the two lines.
Whenever you or C News create a new entry in the active file, an entry is made in the file /usr/lib/news/active.times that indicates the name of the newsgroup, when it was created, who created it, and how it was done. Newsreaders often use this file to detect new newsgroups, but it can also serve as a handy log of newsgroup creation for system administrators.
The /usr/lib/news/active file lists all groups that are known to exist (and are wanted) at your site, as well as the article numbers that are currently on the system. The format of each line in the active file is as follows:
newsgroup high low permission
In this format, newsgroup is the name of the newsgroup, high and low are the highest and lowest article numbers that are on your system, although C News doesn't update this field automatically. To update this field (which many newsreaders require to properly track article threads), you need to run the updatemin program that accompanies most recent versions of C News (older versions of C News have a program called upact instead). When the numbers are incorrect (high lower than low, or high missing), the default is to set high to low+1.
The permission field gives the access system users have for the group. The permission is one of the following values:
|This value marks the newsgroup as having an alias, followed by the name of the local alias. For example, the entry =naughty_stuff would post any articles sent to the newsgroup to a local newsgroup alias named naughty_stuff.
|This value indicates a moderated newsgroup. Articles posted to a moderated newsgroup are e-mailed to the moderator. The moderator's address is in the file /usr/lib/news/moderators.
|With this value, users are not allowed to post to the group, but they can read articles can be read.
|The value means that the group is disabled (no reading allowed), although articles can still be forwarded to other machines.
|This value means that users can post to the newsgroup.
Finally, you have to renumber all the article numbers in the second and third fields of the new /usr/lib/news/active files to 0 (starting article number) and 1 (ending article number), so that you will receive all the articles properly. This process requires a lot of manual editing, or you can perform the entire process with one sed command (which is best performed on a copy of the original active file):
cp active active.original sed 's/ [0-9]* [0-9]* / 0000000000 00001 /' active.original > active
Manually check the new active file to make sure that the format of the file is correct. The entire second column should be a set of zeros, and the third column should be the number one.
The newsgroups file is a list of all newsgroups with a one-line description of its purpose. The descriptions are used by many newsreader applications to display groups users subscribe to. You may have to update this file occasionally to ensure that it is accurate, especially as newsgroups change frequently. For an initial configuration, you can leave the file as it was sent from your news feed.
A number of configuration files are usually maintained in the C News directory, usually /usr/lib/news. Each file shown in the following list needs to be checked for the proper entries that work with your site. You can edit each file with any ASCII editor.
Check and modify the following C News configuration files:
|This file specifies expiration times of some newsgroups.
|This file is your machine's name as it should appear on outgoing mail, usually as your full domain name (such as tpci.com).
|This file is your organization's name used to identify the originating site on outgoing articles.
|For most installations, modify the ME line to contain all/all. The sys file is discussed in more detail in the section "The sys File" later in this chapter.
|This file is your machine's name in UUCP format (such as tpci).
After you have made these configuration changes, you should check that the necessary C News directories exist, or create them if they do not. The in.coming and out.going directories should exist below the spool directory, which may be /usr/spool or /var/spool depending on your directory structure. To create these two directories, issue the command (assuming /usr/spool is the spool directory):
mkdir /usr/spool/news/in.coming /usr/spool/news/out.going
If the /usr/spool/news directory doesn't already exist when you issue these commands, you may have to create it first. More recent versions of C News also require a directory called /usr/spool/news/out.master (or the /var equivalent). You don't need to create separate spool directories for each of the newsgroups you intend to receive because C News will create directories when necessary.
Once these directories have been created, or you have checked for their existence, you should also check their ownerships. For security reasons, the directories should all be owned by the user news in the group news. The file permissions should be set to mode 755. You can set the ownerships and permissions with the commands:
cd /usr/spool chown -R news.news news chmod -R 755 news
These commands assume that your versions of chown and chmod accept the recursive -R option (which most Linux versions do). If not, issue the chown and chmod commands for each directory mentioned above.
As mentioned earlier, the /usr/lib/news/sys file is one of the configuration files that needs to be tailored for your system. Because the sys file has several important aspects, this section looks at the file in more detail. The sys file controls the hierarchies of newsgroups that are downloaded to your site and forwarded on to other sites, depending on the configuration.
The sys file is composed of a set of entries for each site that you forward news to. It also lists the newsgroups that you will accept from other sites. The sys file uses a particular format for each entry, which follows this general syntax:
All of the parameters of the entry are optional except the sitename, although the colons must be left in place. The parameters have the following meaning:
When specifying remote machine names in the site field of a sys entry, make sure you account for possible variations in the Path header of articles. This usually means providing both the UUCP and full domain name formats for the site, as well as any aliases that may be used. Separate multiple entries in the site specification with a slash. For example, your entry for a machine called brutus may look like this:
The sys file entry for your own machine is important. Any newsgroups next to the ME name are handled as newsgroups you specifically want to keep track of, while all others are sent to the junk newsgroup.
You have to add a line for each site that connects to your machine for their news feed (if there are any). If you are at the end of a newsfeed, you can enter the name of your newsfeed (as all locally generated articles are sent back to that machine only).
The newsgroups that are to be transferred to and from the remote site are specified in the groups field. You can set this to transfer several specific newsgroups by separating them with commas. For example, the following entry transfers only the three newsgroups specified:
If you want to transfer all the newsgroups that are available, use the keyword all.
To specify a specific hierarchy to be transferred in the group field, use the prefix that you want followed by the keyword all (such as rec.audio.all to transfer all newsgroups starting with rec.audio).
To prevent a hierarchy from being transferred, precede the name with an exclamation mark. For example, !sci.biology rejects any newsgroups with the sci.biology prefix. You can use the formats interchangeably in the list, such as this entry:
This entry does not transfer any newsgroups starting with rec.audio except rec.audio.high-end. It also prevents all sci. newsgroups except those starting with sci.biology. In addition, all comp.os newsgroups are transferred.
You can use this field as a handy filter to suppress major hierarchies. For example, if you want to accept or transfer all newsgroups except those starting with alt (which can be the most amusing and controversial newsgroups on USENET), you would enter the following in the field:
This field is often used by sites to suppress not only the alt groups, but also all sex-oriented groups.
If you are forwarding newsgroups on to other machines, you can specify the newsgroups that are to be sent with the optional distribution list entry, which is separated from the groups list by a slash. Again, this is a command-separated list that uses the same format as the groups field. For example, this entry forwards all newsgroups to the remote machine except those starting with alt and those starting with tpci (which are local newsgroups specific to the tpci network):
The flags that are allowed in the flag field of the sys file can be any combination of the following (or none at all):
|Enables batching (functions almost the same as the F flag)
|Forces C News to produce an article list for use by ihave/sendme
|Transmits only articles posted in your machine (or when followed by a number, limits transfers to articles posted within that number of hops of your machine, based on the Path field in the article header)
|Batches only articles from moderated newsgroups
|Creates batch files for NNTP transfer clients
|Batches only articles from unmoderated newsgroups
The flags F, f, I, and n are mutually exclusive, meaning that you can only use one of them in a single entry.
The cmds field is usually used to force the transfer of the article to other machines in the news chain. The default value (if none other is specified) on non-batching news systems is as follows:
uux - -r -z remote_name!rnews
In this example, remote_name is the name of the machine the article is to be transferred to. The article is fed to rnews through standard input by this command. Several alternate commands are supplied with some C News versions in the directory /usr/lib/news/bin/batch, mostly starting with the filename via.
If batching is enabled (the flags field has one of F, f, I, or n), this field should specify a filename. The default value if none is specified is /usr/spool/news/out.going/remote_name/togo where remote_name is the name of the remote system. Any entry in this field that does not start with a slash is assumed to be relative to the directory /usr/spool/news/out.going (or the /var equivalent, depending on the Linux directory structure).
A few simple examples of sys files show their usage. If your machine is downloading only from a newssite, and uploading only articles generated at your site (you are a leaf node), then your sys file needs entries only for your machine and the news feed. For example, the following sys file sets up your site to receive all newsgroups from brutus and to send back to brutus all the newsgroups you get and new articles you generate:
# our site, accepting all newsgroups ME:all/all:: # newsfeed machine called brutus brutus/brutus.com:all/all::
This configuration does not impose batching, so connections are performed as required.
Suppose you have another machine on your news route to which you send the sci.biology newsgroups, using a batch routine. If the remote machine's name is chatton, you may have an entry like this in the sys file:
# send chatton the sci.biology groups by batch chatton:sci.biology/all:f:
Depending on how many machines you connect to, you may have many suc entries in your sys file.
If you want to use batching on your news system, you have to make some more changes to configuration files other than the batch indicators in the sys file. Each article in a news batch has a line that identifies the size of the file, such as:
#! rnews 3634
When compression is used, another line precedes this line to reflect the type of compression used to extract the article. The two schemes most often found use the UNIX compress utility and the GNU gzip utility (which is not supported by most versions of C News). The header lines look like this for each, respectively:
Occasionally an article has a heading like the following to indicate that the batch uses c7 encoding, which removes the eighth bit from data:
C News processes batches by executing the program /usr/lib/news/bin/batch/sendbatches. This uses the list of articles that are to be sent from /usr/lib/news/site/togo and packages them into one or more newsbatches. The size of the batches is determined by a variable in the file /usr/lib/news/batchparms. This file also gives the compression program to be used if the default is not desired, as well as the type of transport to use to connect to the remote site.
The format of each line in the batchparms file is as follows:
sitename size max batch_program muncher transport
In this format, sitename is the name of the remote site, size is the maximum size of a batch before compression (except when a single article is larger, in which case the article is processed as a batch by itself), and max is the maximum number of batches to be stored before this site is ignored (to prevent batches accumulating when a remote site doesn't connect). Also, batch_program is the command used for generating the batches (usually the default value of batcher is best), muncher is the compression system (the default value of compcun uses compress), and transport is the connection method (for UUCP it is often viauux). A sample entry in the batchparms file looks like this:
brutus 10000 20 batcher compcun viauux
You can have a default value for all sites except those specifically mentioned by embedding the word default in slashes:
/default/ 100000 20 batcher compcun viauux
This default line should come before the other site lines. Substitute whatever values you want for the sizes.
Usually, C News should use crontab to start the batch file transfers at regular intervals (depending on the frequency of posting to the newsgroups). You can instruct C News to process a batch at any time with the command:
news /usr/lib/news/bin/batch/sendbatches sitename
In this command, sitename is the name of the remote site you want to connect to. If you don't specify a remote site name, all sites are processed. Issue this command as root, or use su with the command.
Once all you have dealt with these configuration issues, you are ready to receive news. You should have your system poll your news site and wait for the results. The most common problem that occurs is a mistake in the configuration file information, which can usually be spotted by verifying each file in turn.
By default, C News sends error messages to the user "usenet," which may or may not exist on your system. It is useful to create an alias in the mail system that redirects C News error messages to a real system administrator's mailbox when a problem occurs. (An alternative to setting up a mail alias is to modify the C News; NEWSMASTER variable, but this must be done with every new session. The alias route is much easier.)
If a newsreader doesn't find any articles after you know a download has taken place, chances are that the newsreader is following the wrong path. Linux systems use /var/spool/news and /usr/spool/news, so your newsreader may be looking in the wrong place. Establish a symbolic link between the two directories with the following command:
ln -s /usr/spool/news /var/spool/news
See whether that corrects the problem.
The newsgroups' spool directories tend to get very large, especially newsgroups that appear even though you have not explicitly subscribed to them, as well as the junk newsgroup (or equivalent). On a regular basis, you should go into the spool directories and clean out unwanted newsgroup entries. You can erase the entire directory and contents with the -r option to rm (although you should be careful of this rather dangerous command!).
The C News system as found on most Linux distributions has a number of utility programs stored in the directory /usr/lib/news/bin/maint. The superuser can use these programs to control the behavior of the C News system. Some of these utilities and the files they operate on have already been mentioned. The usual utilities found with C News are the following:
addgroup local.stuff y
Most of the utilities are for use occasionally, except the newsdaily, which you can place in a crontab file. For extra safety regarding the news files, add the newswatch program to the crontab file , too.
This chapter has shown you how to get C News up and running for most installations. You should be able to use this information to start sending and receiving newsgroups from your newsfeed. This chapter didn't look at all the special files involved with C News in detail because most are seldom used. If you want more information on C News, check the documentation and help files that accompany most distributions.