1 .\" $NetBSD: hosts_access.3,v 1.7 2002/10/01 19:38:46 wiz Exp $
5 hosts_access, hosts_ctl, request_init, request_set \- access control library
10 extern int allow_severity;
11 extern int deny_severity;
13 struct request_info *request_init(request, key, value, ..., 0)
14 struct request_info *request;
16 struct request_info *request_set(request, key, value, ..., 0)
17 struct request_info *request;
19 int hosts_access(request)
20 struct request_info *request;
22 int hosts_ctl(daemon, client_name, client_addr, client_user)
29 The routines described in this document are part
30 of the \fIlibwrap.a\fR library.
31 They implement a rule-based access control language with
32 optional shell commands that are executed when a rule fires.
34 request_init() initializes a structure with
35 information about a client request.
36 request_set() updates an already initialized request structure.
37 Both functions take a variable-length list of key-value
38 pairs and return their first argument.
39 The argument lists are terminated with a zero key value.
40 All string-valued arguments are copied.
41 The expected keys (and corresponding value types) are:
43 The file descriptor associated with the request.
44 .IP "RQ_CLIENT_NAME (char *)"
46 .IP "RQ_CLIENT_ADDR (char *)"
47 A printable representation of the client network address.
48 .IP "RQ_CLIENT_SIN (struct sockaddr_in *)"
49 An internal representation of the client network address and port.
50 The contents of the structure are not copied.
51 .IP "RQ_SERVER_NAME (char *)"
52 The hostname associated with the server endpoint address.
53 .IP "RQ_SERVER_ADDR (char *)"
54 A printable representation of the server endpoint address.
55 .IP "RQ_SERVER_SIN (struct sockaddr_in *)"
56 An internal representation of the server endpoint address and port.
57 The contents of the structure are not copied.
58 .IP "RQ_DAEMON (char *)"
59 The name of the daemon process running on the server host.
60 .IP "RQ_USER (char *)"
61 The name of the user on whose behalf the client host makes the request.
63 hosts_access() consults the access control tables described in the
64 \fIhosts_access(5)\fR manual page.
65 When internal endpoint information is available, host names
66 and client user names are looked up on demand,
67 using the request structure as a cache.
68 hosts_access() returns zero if access should be denied.
70 hosts_ctl() is a wrapper around the request_init() and hosts_access()
71 routines with a perhaps more convenient interface (though it does not
72 pass on enough information to support automated client username lookups).
73 The client host address, client host name and username
74 arguments should contain valid data or STRING_UNKNOWN.
75 hosts_ctl() returns zero if access should be denied.
77 The \fIallow_severity\fR and \fIdeny_severity\fR variables determine
78 how accepted and rejected requests may be logged.
79 They must be provided by the caller and may be modified
80 by rules in the access control tables.
82 Problems are reported via the syslog daemon.
84 hosts_access(5), format of the access control tables.
85 hosts_options(5), optional extensions to the base language.
87 /etc/hosts.allow, /etc/hosts.deny, access control tables.
91 Wietse Venema (wietse@wzv.win.tue.nl)
92 Department of Mathematics and Computing Science
93 Eindhoven University of Technology
94 Den Dolech 2, P.O. Box 513,
95 5600 MB Eindhoven, The Netherlands
96 \" @(#) hosts_access.3 1.8 96/02/11 17:01:26