1 .\" Hey, Emacs! This is an -*- nroff -*- source file.
2 .\" Authors: Ian Jackson
4 .\" authbind is Copyright (C) 1998 Ian Jackson
6 .\" This program is free software; you can redistribute it and/or modify
7 .\" it under the terms of the GNU General Public License as published by
8 .\" the Free Software Foundation; either version 2, or (at your option)
11 .\" This program is distributed in the hope that it will be useful,
12 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
13 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 .\" GNU General Public License for more details.
16 .\" You should have received a copy of the GNU General Public License
17 .\" along with this program; if not, write to the Free Software Foundation,
18 .\" Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 .TH AUTHBIND 1 "30th August 1998" "Debian Project" "Debian Linux manual"
22 authbind \- bind sockets to privileged ports without root
25 .RI [ options "] " program " [" argument " ...]"
28 allows a program which does not or should not run as root to bind to
29 low-numbered ports in a controlled way.
31 You must invoke the program using
32 .BR authbind ". " authbind
33 will set up some environment variables, including an
35 which will allow the program (including any subprocesses it may run)
36 to bind to low-numbered (<512) ports if the system is configured to
43 arranges for only the program which it directly invokes to be affected
44 by its special version of
48 then all programs which that program invokes directly or indirectly
49 will be affected, so long as they do not unset the environment
56 to affect programs which are
58 deep in the calling graph. The default is
61 Access to low numbered ports is controlled by permissions and contents
62 of files in a configuration area,
66 .BI /etc/authbind/byport/ port
67 is tested. If this file is accessible for execution to the calling
70 then binding to the port is authorised. If the file can be seen not
71 to exist (the existence check returns
73 then further tests will be used to find authorisation; otherwise,
74 binding is not authorised, and the
76 call will return with the
82 .RI ( "Permission denied" ).
84 Secondly, if that test fails to resolve the matter,
85 .BI /etc/authbind/byaddr/ addr , port
86 (any protocol) or failing that
87 .BI /etc/authbind/byaddr/ addr : port
89 is tested, in the same manner as above. Here
95 is the (local) TCP or UDP port number, expressed as an unsigned
96 integer in the minimal non-zero number of digits.
98 Thirdly, for IPv6 only: since the textual representation from
100 is complicated to predict, a variant of
102 is also tested which does not use the double colon abbreviation:
103 each 16-byte chunk expressed in the minimal nonzero number
104 of hex digits (i.e. with leading zeroes removed), the chunks
105 being separated by colons as is conventional.
107 Fourthly, if the question is still unresolved, the file
108 .BI /etc/authbind/byuid/ uid
109 will be opened and read. If the file does not exist then the binding
110 is not authorised and
114 .RI ( "Operation not permitted" ", or " "Not owner" ).
115 If the file does exist it will be searched for a line of the form
117 .IR addrmin [\fB\-\fR addrmax ]\fB,\fR portmin [\fB\-\fR portmax ]
118 .IR addr [\fB/\fR length ]\fB,\fR portmin [\fB\-\fR portmax ]
119 .IB addr4 / length : portmin , portmax
121 matching the request.
122 The first form requires that the address lies in the
123 relevant range (inclusive at both ends).
124 The second and third forms require that the initial
128 match those in the proposed
130 call. The third form is only available for IPv4 since IPv6 addresses
132 Addresses in the byuid file can
133 be in any form acceptable to inet_pton. In all cases
134 the proposed port number must lie is in the inclusive range
135 specified. If such a line is found then the binding is authorised.
136 Otherwise it is not, and
140 .RI ( "No such file or directory" ).
142 So for example an attempt by uid 432
143 to bind to [2620:106:e002:f00f::21]:80
144 would result in authbind calling
148 .B /etc/authbind/byport/80
150 .B /etc/authbind/byaddr/2620:106:e002:f00f::21,80
152 .B /etc/authbind/byaddr/2620:106:e002:f00f:0:0:0:21,80
154 If none of these files exist, authbind will read
156 .B /etc/authbind/byuid/432
158 and search for a line to permit
159 the relevant access; examples of lines which would do so are:
161 .B 2620:106:e002:f00f::21,80
166 If a read error occurs, or the directory
168 cannot be accessed, then not only will
170 fail, but an error message will be printed to stderr. Unrecognised
172 .BI /etc/authbind/byuid/ uid
173 files are silently ignored (as are lines whose
175 has non-zero bits more than
177 from the top) or where some
182 Authorising binding to ports from 512 to 1023 inclusive is
183 not recommended. Some protocols (including some versions of NFS)
184 authorise clients by seeing that they are using a port number in this
185 range. So by authorising a program to be a server for such a port,
186 you are also authorising it to impersonate the whole host for those
187 protocols. To make sure that this isn't done by accident,
188 if the port number requested is in the range 512-1023, authbind
189 will expect the permission files to have an additional
191 at the start of their leafname.
193 The shared library loaded using
197 system call. When a program invoked via
201 to bind a socket to a low-numbered TCP/IP port, and if the program
202 doesn't already have an effective uid of 0, the version of
206 forks and executes a setuid-root helper program. For non-TCP/IP
207 sockets, high-numbered ports, or programs which are already root,
209 passes the call to the original
211 system call, which is found using
217 Usually the normal C error handling mechanisms apply. If
219 cannot find the program it has been asked to execute it will print a
220 message to stderr and exit with code 255.
222 The helper program usually reports back to the shared library with an
223 exit status containing an
225 value which encodes whether the
227 was permitted and successful. This will be returned to the calling
228 program in the usual way.
230 In the case of apparent configuration or other serious errors the
231 library and/or the helper program may cause messages to be printed to
232 the program's stderr, was well as returning -1 from
236 currently only supports IPv4 and IPv6 sockets.
237 Programs which open other kinds
238 of sockets will not benefit from
240 but it won't get in their way.
246 installation specific to a particular C library. This version is for
247 GNU/Linux libc6 (glibc2).
250 may not operate correctly with multithreaded programs. It is
251 inherently very difficult (if not impossible) to perform the kind of
252 trickery that authbind does while preventing all undesirable
253 interactions between authbind's activities and those of (say) a
254 threading runtime system.
256 It is quite possible that
258 and other programs and facilities which use
260 may interfere with each other, causing unpredictable behaviour or even
263 is known sometimes not to work correctly with
265 for example (even supposing it could be determined what `correctly'
266 means in this context).
269 is ineffective with setuid programs, because they do not honour
271 references outside the system directories, for security reasons. (In
272 fact, setuid programs should not honour
275 Of course a setuid-root program does not need
277 but it might be useful to apply it to program which are setuid to
278 another user or setgid. If the author or builder of such a programs
279 wishes it to use authbind they could have it load the
281 library explicitly rather than via
284 Some programs may have trouble because
286 spawns a child process `under their feet', causing (for example) a
290 signal to be delivered. Unfortunately the Unix API does not make
291 it possible to deal with this problem in a sane way.
293 The access control configuration scheme is somewhat strange.
294 .SH FILES AND ENVIRONMENT VARIABLES
296 .I /usr/lib/authbind/libauthbind.so.1.0
297 The shared library which
299 causes to be loaded using
301 and which actually implements the diversion of
303 to an external program.
306 The variable used by the dynamic linker when starting dynamically
307 linked programs and deciding which shared libraries to load and
310 program to allow it to override the usual meaning of
316 to use its value as the path to the shared library to put in
318 instead of the compiled-in value. In any case, unless
322 will set this variable to the name of the library actually added to
324 so that the library can find and remove the right entry.
327 This variable is set by
329 to the number of levels left from the
333 option, minus one. It is decremented during
335 by the library on each program call, and the library will remove
338 when it reaches zero. The special value
345 .BR authbind\-helper (8),
350 and this manpage were written by Ian Jackson. They are
351 Copyright (C)1998,2012
352 by him and released under the GNU General Public Licence; there is NO
354 .B /usr/doc/authbind/copyright
356 .B /usr/doc/copyright/GPL