Linux Network Administrators Guide
Total Page:16
File Type:pdf, Size:1020Kb
Chapter 21. C News One of the most popular software packages for Netnews is C News. It was designed for sites that carry news over UUCP links. This chapter will discuss the central concepts of C News, basic installation, and maintenance tasks. C News stores its configuration files in /etc/news, and most of its binaries are kept below the /usr/lib/news/ directory. Articles are kept below /var/spool/news. You should make sure that virtually all files in these directories are owned by user news or group news. Most problems arise from files being inaccessible to C News. Use su to become the user news before you touch anything in the directory. The only exception is the setnewsids command, which is used to set the real user ID of some news programs. It must be owned by root and have the setuid bit set. In this chapter, we describe all C News configuration files in detail and show you what you have to do to keep your site running. Chapter 21. C News 402 21.1. Delivering News Articles can be fed to C News in several ways. When a local user posts an article, the newsreader usually hands it to the inews command, which completes the header information. News from remote sites, be it a single article or a whole batch, is given to the rnews command, which stores it in the /var/spool/news/in.coming directory, from where it will be picked up at a later time by newsrun. With any of these two techniques, however, the article will eventually be handed to the relaynews command. For each article, the relaynews command first checks if the article has already been seen at the local site by looking up the message ID in the history file. Duplicate articles are dropped. Then relaynews looks at the Newsgroups: header line to find out if the local site requests articles from any of these groups. If it does, and the newsgroup is listed in the active file, relaynews tries to store the article in the corresponding directory in the news spool area. If this directory does not exist, it is created. The article's message ID is then logged to the history file. Otherwise, relaynews drops the article. Sometimes relaynews fails to store an incoming article because a group to which it has been posted is not listed in your active file. In this case, the article is moved to the junk group.[124] relaynews also checks for stale or misdated articles and reject them. Incoming batches that fail for any other reason are moved to /var/spool/news/in.coming/bad, and an error message is logged. After this, the article is relayed to all other sites that request news from these groups, using the transport specified for each particular site. To make sure an article isn't sent to a site that has already seen it, each destination site is checked against the article's Path: header field, which contains the list of sites the article has traversed so far, written in the UUCP−style bang−path source−routing style described in Chapter 17. If the destination site's name does not appear in this list, the article is sent to it. C News is commonly used to relay news between UUCP sites, although it is also possible to use it in an NNTP environment. To deliver news to a remote UUCP site, either in single articles or whole batches, uux is used to execute the rnews command on the remote site and feed the article or batch to it on standard input. Refer to Chapter 16, for more information on UUCP. Batching is the term used to describe sending large bundles of individual articles all in one transmission. When batching is enabled for a given site, C News does not send any incoming article immediately; instead, it appends its path name to a file, usually called out.going/site/togo. Periodically, a program is executed from a crontab entry by the cron program, which reads this file and bundles all of the listed articles into one or more file, optionally compressing them and sending them to rnews at the remote site.[125] Figure 21−1 shows the news flow through relaynews. Articles may be relayed to the local site (denoted by ME), to a site named ponderosa via email, and a site named moria, for which batching is enabled. Figure 21−1. News flow through relaynews 21.1. Delivering News 403 Linux Network Administrators Guide 21.1. Delivering News 404 21.2. Installation C News should be available in a prepackaged format for any modern Linux distribution, so installation will be easy. If not, or if you want to install from the original source distribution, then of course you can.[126] No matter how you install it, you will need to edit the C News configuration files. Their formats are described in the following list: sys The sys file controls which newsgroups your site receives and forwards. We discuss it in detail in the following section. active Not usually edited by the administration; contains directions for handling articles in each newsgroup the site handles. organization This file should contain your organization's name, for example, Virtual Brewery, Inc. On your home machine, enter private site, or anything else you like. Most people will not consider your site properly configured if you haven't customized this file. newsgroups This file is a list of all newsgroups, with a one−line description of each one's purpose. These descriptions are frequently used by your newsreader when displaying the list of all groups to which you are subscribed. mailname Your site's mail name, e.g., vbrew.com. whoami Your site's name for news purposes. Quite often, the UUCP site name is used, e.g., vbrew. explist You should probably edit this file to reflect your preferred expiration times for special newsgroups. Disk space may play an important role in your choices. To create an initial hierarchy of newsgroups, obtain active and newsgroups files from the site that feeds you. Install them in /etc/news, making sure they are owned by news and have a mode of 644, using the chmod command. Remove all to.* groups from the active file, and add to.my−site, to.feed−site, junk, and control. The to.* groups are normally used for exchanging ihave/sendme messages, but you should list them regardless of whether you plan to use ihave/sendme or not. Next, replace all article numbers in the second and third field of active using the following commands: # cp active active.old 21.2. Installation 405 Linux Network Administrators Guide # sed 's/ [0−9]* [0−9]* / 0000000000 00001 /' active.old > active # rm active.old The second command invokes the sed stream editor. This invocation replaces two strings of digits with a string of zeroes and the string 000001, respectively. Finally, create the news spool directory and the subdirectories used for incoming and outgoing news: # cd /var/spool # mkdir news news/in.coming news/out.going news/out.master # chown −R news.news news # chmod −R 755 news If you're using precompiled newsreaders sourced from a different distribution to the C News server you have running, you may find that some expect the news spool in /usr/spool/news rather than /var/spool/news. If your newsreader doesn't seem to find any articles, create a symbolic link from /usr/spool/news to /var/spool/news like this: # ln −sf /usr/spool/news /var/spool/news Now you are ready to receive news. Note that you don't have to create the individual newsgroup spool directories. C News automatically creates spool directories for any newsgroup it receives an article for, if one doesn't already exist. In particular, this happens to all groups to which an article has been cross−posted. So, after a while, you will find your news spool cluttered with directories for newsgroups you have never subscribed to, like alt.lang.teco. You may prevent this by either removing all unwanted groups from active, or by regularly running a shell script that removes all empty directories below /var/spool/news (except out.going and in.coming, of course). C News needs a user to send error messages and status reports to. By default, this is usenet. If you use the default, you have to set up an alias for it that forwards all of its mail to one or more responsible person. You may also override this behavior by setting the environment variable NEWSMASTER to the appropriate name. You have to do so in news's crontab file, as well as every time you invoke an administrative tool manually, so installing an alias is probably easier. Mail aliases are described in Chapter 18, and Chapter 19. While you're hacking /etc/passwd, make sure that every user has her real name in the pw_gecos field of the password file (this is the fourth field). It is a question of Usenet netiquette that the sender's real name appears in the From: field of the article. Of course, you will want to do so anyway when you use mail. 21.2. Installation 406 21.3. The sys File The sys file, located in /etc/news, controls which hierarchies you receive and forward to other sites. Although there are maintenance tools named addfeed and delfeed, we think it's better to maintain this file by hand. The sys file contains entries for each site to which you forward news, as well as a description of the groups you will accept.