HOSTS_ACCESS(3) HOSTS_ACCESS(3) 名前 hosts_access, hosts_ctl, request_init, request_set - アクセスコントロー ルライブラリ 書式 #include "tcpd.h" extern int allow_severity; extern int deny_severity; struct request_info *request_init(request, key, value, ..., 0) struct request_info *request; struct request_info *request_set(request, key, value, ..., 0) struct request_info *request; int hosts_access(request) struct request_info *request; int hosts_ctl(daemon, client_name, client_addr, client_user) char *daemon; char *client_name; char *client_addr; char *client_user; 説明 このドキュメントで説明されるルーチンは libwrap.a ライブラリの一部である 。 このライブラリは、特定のルールに従うアクセスコントロール書式を提供す る。このアクセスコントロールには、ルールに合致した場合、シェルコマン ド が実行できるというオプション機能も含まれている。 request_init() は、クライアントのリクエストについての情報のストラクチャ を初期化する。request_set() は、すでに初期化されているリクエストのス ト ラ ク チャを更新するためにつかう。どちらの関数も key-value という 変数- 値(variable-length) のペアによるリストを得て 、 最 初 の 引 き 数(first argument) を返す。引き数のリストはゼロの値を持つ key で終る。すべての文 字列の値を持つ引き数(argument)はコピーされる。有効な key (そして対応 す る値のタイプ) は以下のとおり: RQ_FILE (int) リクエストと関連付けされるファイルディスクリプタ RQ_CLIENT_NAME (char *) クライアントホスト名 RQ_CLIENT_ADDR (char *) クライアントのネットワークアドレスの名称(a printable representa- tion) RQ_CLIENT_SIN (struct sockaddr_in *) クライアントのネットワークアドレス内 部 で の 名 称(an internal printable representation)とポート番号。ストラクチャの中身はコピ ーされない。 RQ_SERVER_NAME (char *) エンドポイントにあるサーバのホスト名 RQ_SERVER_ADDR (char *) エンドポイントにあるサーバアドレスの名称(a printable representa- tion) RQ_SERVER_SIN (struct sockaddr_in *) エ ンドポイントにあるサーバのネットワークアドレス内部での名称(an internal printable representation)とポート番号。ストラクチャの中 身はコピーされない。 RQ_DAEMON (char *) サーバホストで動作するデーモンの名前 RQ_USER (char *) リクエストを発行したユーザのクライアントホストにおける名称 hosts_access() は hosts_access(5) のマニュアルページで解説されている、 アクセスコントロールテーブルを参照する。内部のエンドポイント情報が有 効 で あった場合、要求に応じてホスト名とクライアントユーザ名の探査が行われ 、リクエスト・ストラクチャをキャッシュする。もしアクセスが拒否された 場 合、hosts_access() はゼロを返す。 hosts_ctl() は request_init() と hosts_access() をさらに使いやすいイン ターフェースによって包むラッパーである (自動的にクライアントのユーザ 名 を探査するには、充分な機能とはいえないけれども)。クライアントホストアド レス、クライアントホスト名、そしてユーザ名に対する引き数は、有効なデ ー タ ま た は STRING_UNKNOWN を利用すること。もしアクセスが拒否された場合 、hosts_ctl() はゼロを返す。 変数 allow_severity と deny_severity は受諾または拒否するリクエストをど の ように記録するかを指示するものである。これらは呼び出す側によって規定 されるべきものであり、アクセスコントロールテーブルに示されるルールに よ っては変更される可能性がある。 返り値 問題があれば syslog デーモンを通じて報告される。 関連項目 hosts_access(5), ホ ス ト ア ク セ ス コ ン ト ロ ー ルファイルの書式 hosts_options(5), ホストアクセスコントロールの拡張書式 ファイル /etc/hosts.allow, /etc/hosts.deny, アクセスコントロールテーブル バグ hosts_access() は strtok() ライブラリ関数を使っている。これにより、str- tok() をあてにしている他のコードと干渉がおきるかもしれない。 著者 Wietse Venema (wietse@wzv.win.tue.nl) Department of Mathematics and Computing Science Eindhoven University of Technology Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands HOSTS_ACCESS(3)
HOSTS_ACCESS(5) HOSTS_ACCESS(5)
NAME
hosts_access - format of host access control files
DESCRIPTION
This manual page describes a simple access control language that is
based on client (host name/address, user name), and server (process
name, host name/address) patterns. Examples are given at the end. The
impatient reader is encouraged to skip to the EXAMPLES section for a
quick introduction.
An extended version of the access control language is described in the
hosts_options(5) document. The extensions are turned on at program
build time by building with -DPROCESS_OPTIONS.
In the following text, daemon is the the process name of a network dae-
mon process, and client is the name and/or address of a host requesting
service. Network daemon process names are specified in the inetd con-
figuration file.
ACCESS CONTROL FILES
The access control software consults two files. The search stops at the
first match:
· Access will be granted when a (daemon,client) pair matches an
entry in the /etc/hosts.allow file.
· Otherwise, access will be denied when a (daemon,client) pair
matches an entry in the /etc/hosts.deny file.
· Otherwise, access will be granted.
A non-existing access control file is treated as if it were an empty
file. Thus, access control can be turned off by providing no access
control files.
ACCESS CONTROL RULES
Each access control file consists of zero or more lines of text. These
lines are processed in order of appearance. The search terminates when
a match is found.
· A newline character is ignored when it is preceded by a back-
slash character. This permits you to break up long lines so that
they are easier to edit.
· Blank lines or lines that begin with a ‘#´ character are
ignored. This permits you to insert comments and whitespace so
that the tables are easier to read.
· All other lines should satisfy the following format, things
between [] being optional:
daemon_list : client_list [ : shell_command ]
daemon_list is a list of one or more daemon process names (argv[0] val-
ues) or wildcards (see below).
client_list is a list of one or more host names, host addresses, pat-
terns or wildcards (see below) that will be matched against the client
host name or address.
The more complex forms daemon@host and user@host are explained in the
sections on server endpoint patterns and on client username lookups,
respectively.
List elements should be separated by blanks and/or commas.
With the exception of NIS (YP) netgroup lookups, all access control
checks are case insensitive.
PATTERNS
The access control language implements the following patterns:
· A string that begins with a ‘.´ character. A host name is
matched if the last components of its name match the specified
pattern. For example, the pattern ‘.tue.nl´ matches the host
name ‘wzv.win.tue.nl´.
· A string that ends with a ‘.´ character. A host address is
matched if its first numeric fields match the given string. For
example, the pattern ‘131.155.´ matches the address of (almost)
every host on the Eindhoven University network (131.155.x.x).
· A string that begins with an ‘@´ character is treated as an NIS
(formerly YP) netgroup name. A host name is matched if it is a
host member of the specified netgroup. Netgroup matches are not
supported for daemon process names or for client user names.
· An expression of the form ‘n.n.n.n/m.m.m.m´ is interpreted as a
‘net/mask´ pair. An IPv4 host address is matched if ‘net´ is
equal to the bitwise AND of the address and the ‘mask´. For
example, the net/mask pattern ‘131.155.72.0/255.255.254.0´
matches every address in the range ‘131.155.72.0´ through
‘131.155.73.255´.
· An expression of the form ‘[n:n:n:n:n:n:n:n]/m´ is interpreted
as a ‘[net]/prefixlen´ pair. An IPv6 host address is matched if
‘prefixlen´ bits of ‘net´ is equal to the ‘prefixlen´ bits of
the address. For example, the [net]/prefixlen pattern
‘[3ffe:505:2:1::]/64´ matches every address in the range
‘3ffe:505:2:1::´ through ‘3ffe:505:2:1:ffff:ffff:ffff:ffff´.
· A string that begins with a ‘/´ character is treated as a file
name. A host name or address is matched if it matches any host
name or address pattern listed in the named file. The file for-
mat is zero or more lines with zero or more host name or address
patterns separated by whitespace. A file name pattern can be
used anywhere a host name or address pattern can be used.
· Wildcards ‘*´ and ‘?´ can be used to match hostnames or IP
addresses. This method of matching cannot be used in conjunc-
tion with ‘net/mask´ matching, hostname matching beginning with
‘.´ or IP address matching ending with ‘.´.
WILDCARDS
The access control language supports explicit wildcards:
ALL The universal wildcard, always matches.
LOCAL Matches any host whose name does not contain a dot character.
UNKNOWN
Matches any user whose name is unknown, and matches any host
whose name or address are unknown. This pattern should be used
with care: host names may be unavailable due to temporary name
server problems. A network address will be unavailable when the
software cannot figure out what type of network it is talking
to.
KNOWN Matches any user whose name is known, and matches any host whose
name and address are known. This pattern should be used with
care: host names may be unavailable due to temporary name server
problems. A network address will be unavailable when the soft-
ware cannot figure out what type of network it is talking to.
PARANOID
Matches any host whose name does not match its address. When
tcpd is built with -DPARANOID (default mode), it drops requests
from such clients even before looking at the access control
tables. Build without -DPARANOID when you want more control
over such requests.
OPERATORS
EXCEPT Intended use is of the form: ‘list_1 EXCEPT list_2´; this con-
struct matches anything that matches list_1 unless it matches
list_2. The EXCEPT operator can be used in daemon_lists and in
client_lists. The EXCEPT operator can be nested: if the control
language would permit the use of parentheses, ‘a EXCEPT b EXCEPT
c´ would parse as ‘(a EXCEPT (b EXCEPT c))´.
SHELL COMMANDS
If the first-matched access control rule contains a shell command, that
command is subjected to %
Copyright(C) linux-cmd.com All Rights Reserved. Author Takayuki Yukawa