Linux网络管理员手册(20)
翻译:赵炯
[email protected]
附录A
PLIP空打印机电缆
为了制作一根用于PLIP连接的空打印机电缆,你需要两个25针的连接器(称为DB-25)和一些具有11根导线的电缆。这根电缆最长不得超过15米。
如果你细看连接器,你应该能够看到在每个引脚根部的小数字,左上角的引脚是1(如果你将宽的一边朝上的话)右下角的引脚是25。对空打印机电缆,你必须按下面的引脚将两个连接器连起来:
D0 2---15 ERROR
D1 3---13 SLCT
D2 4---12 PAPOUT
D3 5---10 ACK
D4 6---11 BUSY
GROUND 25---25 GROUND
ERROR 15--- 2 D0
SLCT 13--- 3 D1
PAPOUT 12--- 4 D2
ACK 10--- 5 D3
BUSY 11--- 6 D4
所有其它的引脚保持为未连接状态。如果这根电缆是带屏蔽的,那么屏蔽层应该只与一端的DB-25的金属外壳相连接。
附录B
smail样本配置文件
本节示出了局域网上一个UUCP末端站点的样本配置文件。它们是基于smail-3.1.28发行版源程序中包括的样本文件的。尽管我对这些文件是如何工作的作了简单的解释,建议你还是去阅读非常精美的smail(8)手册,其中详细讨论了这些文件。一但你已理解了smail配置后面的基本原理,它们是值得一读的。这是很容易的!
示出的第一个文件是routers,它描述了smail的一族路由器。当smail必须将一个消息投递到一给定地址时,它就将该地址依次送到所有路由器去,直到其中一个与之匹配。这里所谓的匹配是指这个路由器在它的数据库中,即它的paths文件、/etc/hosts、或路由器接口的任何路由选择机制中找到了目的主机。
在smail配置文件中的条目总是以一个唯一的名字开始,这个名字确定了相应的路由器、传输方式或导向器。它们后跟定义它们行为的属性列表。这个列表清单由一族全局属性组成,比如象所用的驱动程序(driver),以及只有相应驱动程序能够理解的专用的属性。属性是用逗号分开的,而全局和专用属性族是用分号来分开的。
为了使这些区别更明显,假设你要维护两个独立的路径别名文件;一个含有你的域的路由选择信息,另一个含有含有全局路由选择信息,很可能是从UUCP映射生成的。使用smail,你现在可以在router文件中指定两个路由器,它们都使用路径别名(pathalias)驱动程序。这个驱动程序在一个路径别名数据库中查找主机名。它期望能够在一个私有属性中给予它文件的名称:
#
# pathalias database for intra-domain routing
domain_paths:
driver=pathalias, # look up host in a paths file
transport=uux; # if matched, deliver over UUCP
file=paths/domain, # file is /usr/lib/smail/paths/domain
proto=lsearch, # file is unsorted (linear search)
optional, # ignore if the file does not exist
required=vbrew.com, # look up only *.vbrew.com hosts
#
# pathalias database for routing to hosts outside our domain
world_paths:
driver=pathalias, # look up host in a paths file
transport=uux; # if matched, deliver over UUCP
file=paths/world, # file is /usr/lib/smail/paths/world
proto=bsearch, # file is sorted with sort(1)
optional, # ignore if the file does not exist
-required, # no required domains
domain=uucp, # strip ending “.uucp” before searching
上面在两个routers条目中给出的第二个全局属性定义了当路由器与地址匹配时所用的传输方式。在我们的情况中,消息将使用uux传输来投递。传输方式在transports文件中定义,这将在下面解释。
如果你指定了一个方法文件而不是transports属性,你就可以微调使用哪个传输方式来投递一个消息。方法文件提供了从目标主机到传输方式的映射。这里我们不对此进行讨论。
下面的routers文件定义了一个局域网的要查询解析器库的路由器。然而,在一个Internet主机上,你可能会使用一个处理MX记录的路由器。因此,你应该打开被注释掉的另外一个使用smail内建BIND驱动程序的inet_bind路由器。
在一个混合使用UUCP和TCP/IP的环境中,你可能会遇到这样的问题,在/etc/hosts文件中有你偶尔用SLIP或PPP连接的主机。通常,你仍然想要通过UUCP来为它们发送任何邮件。为了避免inet_hosts驱动程序与这些主机的匹配,你必须将它们放入paths/force文件中。这是另一个路径别名形式的数据库,并在smail查询解析器之前被查询。
# A sample /usr/lib/smail/routers file
#
# force – force UUCP delivery to certain hosts, even when
# they are in our /etc/hosts
force:
driver=pathalias, # look up host in a paths file
transport=uux; # if matched, deliver over UUCP
file=paths/force, # file is /usr/lib/smail/paths/force
optional, # ignore if the file does not exist
proto=lsearch, # file is unsorted (linear search)
-required, # no required domains
domain=uucp, # strip ending “.uucp” before searching
# inet_addrs – match domain literals containing literal
#IP addresses, such as in janet@[191.72.2.1]
inet_addrs:
driver=gethostbyaddr, # driver to match IP domain literals
transport=smtp; # deliver using SMTP over TCP/IP
fail_if_error, # fail if address is malformed
check_for_local, # deliver directly if host is ourself
# inet_hosts – match hostnames with gethostbyname(3N)
# Comment this out if you wish to use the BIND version instead.
Inet_hosts:
Driver=gethostbyname, # match hosts with the library function
Transport=smtp; # use default SMTP
-required, # no required domains
-domain, # no defined domain suffixes
-only_local_domain, # don’t restrict to defined domains
# inet_hosts – alternate version using BIND to access the DNS
#inet_hosts:
#driver=bind, # use built-in BIND driver
#transport=smtp; # use TCP/IP SMTP for delivery
#
#defnames, # use standard domain searching
#defer_no_connect, # try again if the nameserver is down
#-local_mx_okay, # fail (don’t pass through) an MX
# # to the local host
#
# pathalias database for intra-domain routing
domain_paths:
driver=pathalias, # look up host in a paths file
transport=uux; # if matched, deliver over UUCP
file=paths/domain, # file is /usr/lib/smail/paths/domain
proto=lsearch, # file is unsorted (linear search)
optional, # ignore if the file does not exist
required=vbrew.com, # look up only *.vbrew.com hosts
#
# pathalias database for routing to hosts outside our domain
world_paths:
driver=pathalias, # look up host in a paths file
transport=uux; # if matched, deliver over UUCP
file=paths/world, # file is /usr/lib/smail/paths/world
proto=bsearch, # file is sorted with sort(1)
optional, # ignore if the file does not exist
-required, # no required domains
domain=uucp, # strip ending “.uucp” before searching
# smart_host – a partically specified smarthost director
# If the smart_path attribute is not defined in
# /usr/lib/smail/config, this router is ignored.
# The transport attribute is overridden by the global
# smart_transport variable
smart_host:
driver=smarthost, # special-case driver
transport=uux; # by default deliver over UUCP
-path, # use smart_path config file variable
对于本地地址的邮件的处理是在directors文件中配置的。该文件的组成与routers文件相似,其中有一系列的定义每个导向器的条目。导向器并不投递消息,它们仅仅执行一些可能的重定向(例如通过别名)、邮件转发等等。
当将邮件投递到一个本地地址去时,比如是janet,smail依次将用户名送至各个导向器。如果有一个匹配,那么它或者指定一个该消息投递要用的传输方式(例如,到用户的邮件箱文件),或者生成一个新的地址(例如,在评估了一个别名以后)。
由于所包括的安全问题,导向器通常会做很多的检查,看看它们所使用的文件是否是有损安全的。以有些可疑的方法获取的地址(例如,从一个可写的aliases文件中)被标上是不安全的。某些传输驱动程序将会拒绝这样的地址,比如将消息投递到一个文件的传输。
除了这以外,smail也将用户与每个地址相关联。任何读写操作是作为用户来执行的。比如对于投递到janet的邮件箱,地址当然是与janet相关联的。其它的地址,比如那些从aliases文件中获得的地址,是与其他用户相关联的,比如nobody用户。
有关这些特性的详细内容,请参考smail(8)手册页。
# A sample /usr/lib/smail/directors file
# aliasinclude - expand \":include:filename\" addresses produced
# by alias files
aliasinclude:
driver=aliasinclude, # use this special-case driver
nobody; # access file as nobody user if unsecure
copysecure, # get permissions from alias director
copyowners, # get owners from alias director
# forwardinclude - expand \":include:filename\" addrs produced
# by forward files
forwardinclude:
driver=forwardinclude, # use this special-case driver
nobody; # access file as nobody user if unsecure
checkpath, # check path accessibility
copysecure, # get perms from forwarding director
copyowners, # get owners from forwarding director
# aliases - search for alias expansions stored in a database
aliases:
driver=aliasfile, # general-purpose aliasing director
-nobody, # all addresses are associated
# with nobody by default anyway
sender_okay, # don\"t remove sender from expansions
owner=owner-$user; # problems go to an owner address
file=/usr/lib/aliases, # default: sendmail compatible
modemask=002, # should not be globally writable
optional, # ignore if file does not exist
proto=lsearch, # unsorted ASCII file
# dotforward - expand .forward files in user home directories
dotforward:
driver=forwardfile, # general-purpose forwarding director
owner=real-$user, # problems go to the user\"s mailbox
nobody, # use nobody user, if unsecure
sender_okay; # sender never removed from expansion
file=~/.forward, # .forward file in home directories
checkowner, # the user can own this file
owners=root, # or root can own the file
modemask=002, # it should not be globally writable
caution=0-10:uucp:daemon, # don\"t run things as root or daemons
# be extra careful of remotely accessible home directories
unsecure=\"~ftp:~uucp:~nuucp:/tmp:/usr/tmp\",
# forwardto - expand a \"Forward to \" line at the top of
# the user\"s mailbox file
forwardto:
driver=forwardfile,
owner=Postmaster, # errors go to Postmaster
nobody, # use nobody user, if unsecure
sender_okay; # don\"t remove sender from expansion
file=/var/spool/mail/${lc:user}, # location of user\"s mailbox
forwardto, # enable \"Forward to \" check
checkowner, # the user can own this file
owners=root, # or root can own the file
modemask=0002, # under System V, group mail can write
caution=0-10:uucp:daemon, # don\"t run things as root or daemons
# user - match users on the local host with delivery to their mailboxes
user: driver=user; # driver to match usernames
transport=local, # local transport goes to mailboxes
# real_user - match usernames when prefixed with the string \"real-\"
real_user:
driver=user; # driver to match usernames
transport=local, # local transport goes to mailboxes
prefix=\"real-\", # for example, match real-root
# lists - expand mailing lists stored below /usr/lib/smail/lists
lists: driver=forwardfile,
caution, # flag all addresses with caution
nobody, # and then associate the nobody user
sender_okay, # do NOT remove the sender
owner=owner-$user; # the list owner
# map the name of the mailing list to lower case
file=lists/${lc:user},
在成功地进行了路由选择或重定向一个消息以后,smail将消息传给与地址匹配的路由器或导向器指定的传输方式。这些传输方式是在transporst文件中定义的。再一次,一个传输方式是由一族全局和私有选项定义的。
每个条目定义的最为重要的选项是处理传输的驱动程序,例如,pipe驱动程序,它调用在cmd属性中指定的命令。除了这以外,传输方式还可以用许多的全局属性,它在消息头以及很可能在消息体上执行各种变换。例如return_path属性使得传输在消息头中插入一个return_path字段。unix_from_hack属性使得它在以From开始的每行的的前面加上一个>符号。
# A sample /usr/lib/smail/transports file
# local - deliver mail to local users
local: driver=appendfile, # append message to a file
return_path, # include a Return-Path: field
from, # supply a From_ envelope line
unix_from_hack, # insert > before From in body
local; # use local forms for delivery
file=/var/spool/mail/${lc:user}, # location of mailbox files
group=mail, # group to own file for System V
mode=0660, # group mail can access
suffix=\"\\n\", # append an extra newline
# pipe - deliver mail to shell commands
pipe: driver=pipe, # pipe message to another program
return_path, # include a Return-Path: field
from, # supply a From_ envelope line
unix_from_hack, # insert > before From in body
local; # use local forms for delivery
cmd=\"/bin/sh -c $user\", # send address to the Bourne Shell
parent_env, # environment info from parent addr
pipe_as_user, # use user-id associated with address
ignore_status, # ignore a non-zero exit status
ignore_write_errors, # ignore write errors, i.e., broken pipe
umask=0022, # umask for child process
-log_output, # do not log stdout/stderr
# file - deliver mail to files
file: driver=appendfile,
return_path, # include a Return-Path: field
from, # supply a From_ envelope line
unix_from_hack, # insert > before From in body
local; # use local forms for delivery
file=$user, # file is taken from address
append_as_user, # use user-id associated with address
expand_user, # expand ~ and $ within address
suffix=\"\\n\", # append an extra newline
mode=0600, # set permissions to 600
# uux - deliver to the rmail program on a remote UUCP site
uux: driver=pipe,
uucp, # use UUCP-style addressing forms
from, # supply a From_ envelope line
max_addrs=5, # at most 5 addresses per invocation
max_chars=200; # at most 200 chars of addresses
cmd=\"/usr/bin/uux - -r -a$sender -g$grade $host!rmail $(($user)$)\",
pipe_as_sender, # have uucp logs contain caller
log_output, # save error output for bounce messages
# defer_child_errors, # retry if uux returns an error
# demand - deliver to a remote rmail program, polling immediately
demand: driver=pipe,
uucp, # use UUCP-style addressing forms
from, # supply a From_ envelope line
max_addrs=5, # at most 5 addresses per invocation
max_chars=200; # at most 200 chars of addresses
cmd=\"/usr/bin/uux - -a$sender -g$grade $host!rmail $(($user)$)\",
pipe_as_sender, # have uucp logs contain caller
log_output, # save error output for bounce messages
# defer_child_errors, # retry if uux returns an error
# hbsmtp - half-baked BSMTP. The output files must
# be processed regularly and sent out via UUCP.
hbsmtp: driver=appendfile,
inet, # use RFC 822-addressing
hbsmtp, # batched SMTP w/o HELO and QUIT
-max_addrs, -max_chars; # no limit on number of addresses
file=\"/var/spool/smail/hbsmtp/$host\",
user=root, # file is owned by root
mode=0600, # only read-/writable by root.
# smtp - deliver using SMTP over TCP/IP
smtp: driver=tcpsmtp,
inet,
-max_addrs, -max_chars; # no limit on number of addresses
short_timeout=5m, # timeout for short operations
long_timeout=2h, # timeout for longer SMTP operations
service=smtp, # connect to this service port
# For internet use: uncomment the below 4 lines
# use_bind, # resolve MX and multiple A records
# defnames, # use standard domain searching
# defer_no_connect, # try again if the nameserver is down
# -local_mx_okay, # fail an MX to the local host
发布人:netbull 来自:Linux自由鸽