3 servxcheck \- Internet service access check
7 #define _MINIX_SOURCE 1
8 #include </net/gen/netdb.h>
10 int servxcheck(ipaddr_t \fIpeer\fP, const char *\fIservice\fP,
11 void (*\fIlogf\fP)(int \fIpass\fP, const char *\fIname\fP));
12 char *servxfile(const char *\fIfile\fP);
17 is used by programs like
19 to perform an access check on the host connected to the other end of the TCP
20 channel that has IP address
24 translates the IP address to the
25 associated host name if necessary, and checks if the host is granted access
27 .BR /etc/serv.access .
30 The service name used to search the access file is passed by the caller as
32 These names should be the same as the service names in
35 The caller should use the NWIOGTCPCONF ioctl() call to find out what the
36 IP address of the remote end is. It is wise to bypass the
38 call if the remote end happens to be the local machine (remaddr == locaddr),
39 so that local connections aren't impeded by slow checks.
41 will itself allow connections from 127.0.0.1/8 immediately, so you
42 don't have to check for that. Example of use:
47 if (ioctl(fd, NWIOGTCPCONF, &tcpconf) < 0
48 || tcpconf.nwtc_remaddr == tcpconf.nwtc_locaddr
49 || servxcheck(tcpconf.nwtc_remaddr, service_name, NULL)
56 An attempt to connect to a service is logged if the access is denied. You
57 can use the special checkword "\fBlog\fP" to also log if access is granted.
58 Logging will be done with
63 A syntax error in the access file may be logged under the
68 to set the appropriate logging facility. One may do one's own logging by
71 function that will be called by
73 with a first argument that is true if access is granted, false if
74 denied, and a second argument that is the name of the remote host whose
75 access has been checked.
77 The default is to fail the check unless the access file says otherwise.
78 Strange errors make the check succeed. (We do not want
79 remote access to fail because of some system error.) Note that this
80 function is not meant to check access to the system, that's what
81 passwords and such are for, but only to limit access to those who are
82 allowed to use the services the system offers.
84 Connections from a machine to itself are accepted immediately. No further
88 may be used to specify a file other than the default
89 .BR /etc/serv.access .
90 This is useful for programs started from
92 that want to handle the access check themselves, using a private access file.
95 is the pathname of the old access file. Only a pointer to the new path is
96 saved, the caller must keep the string it points to intact.
100 Default access check file.
108 returns 0 if the access is denied, 1 if granted.
110 Typical syslog message:
113 Jan 10 20:27:20 flotsam inetd[174]: service 'shell' granted to jetsam.cs.vu.nl
116 IP and DNS based access checks will stop most crackers, but not the really
117 determined ones. Luckily MINIX 3 is sufficiently strange to thwart the well
118 known cracking schemes. But don't ever allow yourself to feel secure.
120 Kees J. Bot <kjb@cs.vu.nl>