Книга: Linux Network Administrator Guide, Second Edition

The control.ctl file

The control.ctl file

The control.ctl file is fairly simple in structure. The syntax rules for this file are much the same as for the other INN configuration files. Lines beginning with # are ignored, lines may be continued using /, and fields are delimited by:.

When a control message is received, it is tested against each rule in turn. The last rule in the file that matches the message is the rule that will be used, so you should put any generic rules at the start of the file and more specific rules at the end of the file. The general syntax of the file is:

message:from:newsgroups:action

The meanings of each of the fields are:

message

This is the name of the control message. Typical control messages are described later.

from

This is a shell-style pattern matching the email address of the person sending the message. The email address is converted to lowercase before comparison.

newsgroups

If the control message is newgroup or rmgroup, this field is a shell-style pattern matching the newsgroup created or removed.

action

This field specifies what action to take for any message matching the rule. There are quite a number of actions we can take; they are described in the next list.

The message field of each line can have one of the following values:

checkgroups

This message requests that news administrators resynchonrize their active newsgroups database against the list of newsgroups supplied in the control message.

newgroup

This message requests the creation of a new newsgroup. The body of the control message should contain a short description of the purpose of the newsgroup to be created.

rmgroup

requests that a newsgroup be removed.

sendsys

This message requests that the sys file of this news server be transmitted by mail to the originator of the control message. RFC-1036 states that it is a requirement of Usenet membership that this information be publicly available because it is used to keep the map of Usenet up to date.

version

This message requests that the hostname and version of news server software be returned to the originator of the control message.

all

This is a special coding that will match any control message.

The message field may include the following actions:

doit

The requested command is performed. In many cases, a mail message will be sent to the administrator to advise them that the action has taken place.

doit=file

This is the same as the doit action except that a log message will be written to the file log file. If the specified file is mail, the log entry is sent by email. If the specified file is the null string, the log message is written to /dev/null and is equivalent to using the unqualified doit action. If the file name begins with a / character, the name is taken to be an absolute filename for the logfile; otherwise, the specified name is translated to /var/log/news/file.log.

doifarg

The requested command is performed if the command has an argument. If the command has no argument, the control message is ignored.

drop

The requested command is ignored.

log

A log message is sent to the stderr output of the innd process. This is normally directed out to the /var/log/news/errlog file.

log=file

This is the same as a log action, except the logfile is specified as per the rules given for the doit =file action.

mail

An email message is sent to the news administrator containing the requested command details. No other action takes place.

verify-*

If an action begins with the string " verify- ", then the control message is authenticated using PGP (or GPG).[139]

So that you can see what a control.ctl file would look like in practice, here is a very short illustrative sample:

## Sample /etc/news/control.ctl
##
## Warning: You should not use this file, it is illustrative only.
## Control Message Handling
all:*:*:mail
checkgroups:*:*:mail
ihave:*:*:drop
sendme:*:*:drop
sendsys:*:*:log=sendsys
senduuname:*:*:log=senduuname
version:*:*:log=version
newgroup:*:*:mail rmgroup:*:*:mail
## Handle control messages for the eight most important news heirarchies
## COMP, HUMANITIES, MISC, NEWS, REC, SCI, SOC, TALK
checkgroups:*:comp.*|humanities.*|misc.*|news.*|rec.*|sci.*|soc.*|talk.*:drop
newgroup:*:comp.*|humanities.*|misc.*|news.*|rec.*|sci.*|soc.*|talk.*:drop
rmgroup:*:comp.*|humanities.*|misc.*|news.*|rec.*|sci.*|soc.*|talk.*:drop
checkgroups:[email protected]:*:verify-news.announce.newgroups
newgroup:[email protected]:comp.*|misc.*|news.*:verify-news.announce.newgroups
newgroup:[email protected]:rec.*|sci.*|soc.*:verify-news.announce.newgroups
newgroup:[email protected]:talk.*|humanities.*:verify-news.announce.newgroups
rmgroup:[email protected]:comp.*|misc.*|news.*:verify-news.announce.newgroups
rmgroup:[email protected]:rec.*|sci.*|soc.*:verify-news.announce.newgroups
rmgroup:[email protected]:talk.*|humanities.*:verify-news.announce.newgroups
## GNU (Free Software Foundation)
newgroup:[email protected]:gnu.*:doit
newgroup:news@*ai.mit.edu:gnu.*:doit
rmgroup:[email protected]:gnu.*:doit
rmgroup:news@*ai.mit.edu:gnu.*:doit
## LINUX (Newsfeed from news.lameter.com)
checkgroups:[email protected]:linux.*:doit
newgroup:[email protected]:linux.*:doit
rmgroup:[email protected]:linux.*:doit

Оглавление книги

Оглавление статьи/книги

Генерация: 1.434. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз