10a454ad |
1 | .\" -*-nroff-*- |
667fb920 |
2 | .\" |
96bc31ba |
3 | .\" $Id: fw.1,v 1.3 1999/07/30 06:49:00 mdw Exp $ |
667fb920 |
4 | .\" |
5 | .\" Manual page for fw |
6 | .\" |
7 | .\" (c) 1999 Straylight/Edgeware |
8 | .\" |
9 | . |
10 | .\"----- Licensing notice --------------------------------------------------- |
11 | .\" |
12 | .\" This file is part of the `fw' port forwarder. |
13 | .\" |
14 | .\" `fw' is free software; you can redistribute it and/or modify |
15 | .\" it under the terms of the GNU General Public License as published by |
16 | .\" the Free Software Foundation; either version 2 of the License, or |
17 | .\" (at your option) any later version. |
18 | .\" |
19 | .\" `fw' is distributed in the hope that it will be useful, |
20 | .\" but WITHOUT ANY WARRANTY; without even the implied warranty of |
21 | .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22 | .\" GNU General Public License for more details. |
23 | .\" |
24 | .\" You should have received a copy of the GNU General Public License |
25 | .\" along with `fw'; if not, write to the Free Software Foundation, |
26 | .\" Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
27 | . |
28 | .\" ---- Revision history --------------------------------------------------- |
29 | .\" |
30 | .\" $Log: fw.1,v $ |
96bc31ba |
31 | .\" Revision 1.3 1999/07/30 06:49:00 mdw |
32 | .\" Minor tidying and typo correction. |
33 | .\" |
667fb920 |
34 | .\" Revision 1.2 1999/07/26 23:31:04 mdw |
35 | .\" Document lots of new features and syntax. |
36 | .\" |
37 | . |
38 | .\"----- Various bits of fancy styling -------------------------------------- |
39 | . |
40 | .\" --- Indented paragraphs with right-aligned tags --- |
41 | . |
10a454ad |
42 | .de hP |
43 | .IP |
44 | \h'-\w'\fB\\$1\ \fP'u'\fB\\$1\ \fP\c |
45 | .. |
667fb920 |
46 | . |
47 | .\" --- Verbatim-oid typesetting --- |
48 | .de VS |
49 | .sp 1 |
50 | .RS |
51 | .nf |
52 | .ft B |
53 | .. |
54 | .de VE |
55 | .ft R |
56 | .fi |
57 | .RE |
58 | .sp 1 |
59 | .. |
60 | . |
61 | .\" --- Other bits of styling --- |
62 | . |
63 | .ie t \{\ |
64 | . ds o \(bu |
65 | . ds ss \s8\u |
66 | . ds se \d\s0 |
67 | . if \n(.g \{\ |
68 | . fam P |
69 | . \} |
70 | .\} |
71 | .el \{\ |
72 | . ds o o |
73 | . ds ss ^ |
74 | . ds se |
75 | .\} |
76 | . |
77 | .\"-------------------------------------------------------------------------- |
78 | . |
10a454ad |
79 | .TH fw 1 "1 July 1999" fw |
667fb920 |
80 | . |
81 | .\"-------------------------------------------------------------------------- |
10a454ad |
82 | .SH NAME |
667fb920 |
83 | . |
10a454ad |
84 | fw \- port forwarder |
667fb920 |
85 | . |
86 | .\"-------------------------------------------------------------------------- |
10a454ad |
87 | .SH SYNOPSIS |
667fb920 |
88 | . |
10a454ad |
89 | .B fw |
667fb920 |
90 | .RB [ \-dq ] |
10a454ad |
91 | .RB [ \-f |
92 | .IR file ] |
93 | .IR config-stmt ... |
667fb920 |
94 | . |
95 | .\"-------------------------------------------------------------------------- |
96 | .SH "DESCRIPTION" |
97 | . |
10a454ad |
98 | The |
99 | .B fw |
100 | program is a simple port forwarder. It supports a number of features |
101 | the author hasn't found in similar programs: |
102 | .TP |
103 | .I "Connection logging" |
104 | Each connection attempt to the forwarder is logged, giving the time of |
105 | the connection, the DNS-resolved hostname (if available), and the user |
106 | name resulting from an RFC931 lookup. These lookups are done |
107 | asynchronously to the main forwarder's operation. |
108 | .TP |
109 | .I "Access control" |
110 | Each forwarded port may have an access control list attached to it. |
111 | Only authorized hosts are allowed to connect. Access control checks are |
112 | performed by quick checks on the client's IP address. |
113 | .TP |
114 | .I "Nonblocking single-process design" |
115 | The internal structure of the server is completely nonblocking. The |
116 | connections don't block; the reading and writing don't block; the name |
117 | lookups don't block. This is all done in a single process, with the |
118 | single exception of the DNS resolver. |
667fb920 |
119 | .TP |
120 | .I "Support for Unix-domain sockets" |
121 | Connections from and to Unix-domain sockets can be handled just as |
96bc31ba |
122 | easily as more normal Internet sockets. Access control doesn't work on |
667fb920 |
123 | Unix domain sockets, though. (Yet.) |
10a454ad |
124 | .SS "Command line options" |
125 | The |
126 | .B fw |
127 | program understands a few simple command line options: |
128 | .TP |
129 | .B "\-h, \-\-help" |
130 | Displays a screen of help text on standard output and exits |
131 | successfully. |
132 | .TP |
133 | .B "\-v, \-\-version" |
134 | Writes the version number to standard output and exits successfully. |
135 | .TP |
136 | .B "\-u, \-\-usage" |
137 | Writes a terse usage summary to standard output and exits successfully. |
138 | .TP |
139 | .BI "\-f, \-\-file=" file |
140 | Read configuration information from |
141 | .IR file . |
667fb920 |
142 | Equivalent to an |
143 | .RB ` include |
144 | .IR file ' |
145 | configuration file statement. |
10a454ad |
146 | .TP |
667fb920 |
147 | .B "\-d, \-\-daemon, \-\-fork" |
10a454ad |
148 | Forks into the background after reading the configuration and |
149 | initializing properly. |
667fb920 |
150 | .TP |
151 | .B "-q, \-\-quiet" |
152 | Don't output any logging information. This option is not recommended |
153 | for normal use, although it can make system call traces clearer so I use |
154 | it when debugging. |
10a454ad |
155 | .PP |
156 | Any further command line arguments are interpreted as configuration |
157 | lines to be read. Configuration supplied in command line arguments has |
158 | precisely the same syntax as configuration in files. If there are no |
96bc31ba |
159 | configuration statements on the command line, and no |
10a454ad |
160 | .B \-f |
161 | options were supplied, configuration is read from standard input, if |
162 | stdin is not a terminal. |
667fb920 |
163 | . |
164 | .\"-------------------------------------------------------------------------- |
165 | .SH "CONFIGURATION LANGUAGE" |
166 | . |
167 | The |
168 | .B fw |
169 | program has a fairly sophisticated configuration language to let you |
170 | describe which things should be forwarded where and what special |
171 | features there should be. |
172 | .SS "Lexical structure" |
173 | There are four types of characters. |
174 | .TP |
175 | .I "word constituent characters" |
96bc31ba |
176 | Word constituent characters are gathered together into words. |
667fb920 |
177 | Depending on its surrounding context, a word might act as a keyword or a |
178 | string. All alphanumerics are word constituents, as is the hyphen |
179 | .RB ` \- '. |
180 | Other characters may change their status in future versions. |
181 | .TP |
182 | .I "self-delimiting characters" |
183 | Self-delimiting characters always stand alone. They act as punctuation, |
184 | shaping the sequence of words into more complex grammatical forms. The |
185 | characters |
186 | .RB ` { ', |
187 | .RB ` } ', |
188 | .RB ` [ ', |
189 | .RB ` ] ', |
190 | .RB ` / ', |
191 | .RB ` , ', |
192 | .RB ` = ', |
193 | .RB ` : ', |
194 | .RB ` ; ' |
195 | and |
196 | .RB ` . ' |
197 | are self-delimiting. Note that while some characters, e.g., |
198 | .RB ` [ ' |
199 | and |
200 | .RB ` ; ', |
201 | require escaping by the shell, they are strictly optional in the grammar |
202 | and can be omitted in quick hacks at the shell prompt. |
203 | .TP |
204 | .I "whitespace characters" |
205 | Whitespace characters separate words but are otherwise ignored. All |
206 | `normal' whitespace characters (e.g., space, tab and newline) are |
207 | considered to be whitespace for these purposes. |
208 | .TP |
209 | .I "special characters" |
210 | There are three special characters. The |
211 | .RB ` # ' |
212 | character, if it appears at the start of a word, introduces a |
213 | .I comment |
214 | which extends to the end of the current line or command-line argument. |
215 | Within a word, it behaves like a normal word-constituent character. The |
216 | backslash |
217 | .RB ` \e ' |
218 | escapes the following character causing it to be interpreted as a word |
219 | constituent regardless of its normal type. The double-quote |
220 | .RB ` """" ' |
221 | escapes all characters other than backslashes up to the next |
222 | double-quote and causes them to be regarded as word constituents. Note |
223 | that you don't have to quote a whole word. The backslash can escape a |
224 | quote character allowing you to insert it into a word if really |
225 | necessary. |
226 | . |
227 | .SS "Basic syntax" |
228 | The overall syntax looks a bit like this: |
10a454ad |
229 | .PP |
667fb920 |
230 | .I file |
10a454ad |
231 | ::= |
667fb920 |
232 | .I empty |
233 | | |
234 | .I file |
235 | .I stmt |
236 | .RB [ ; ] |
10a454ad |
237 | .br |
238 | .I stmt |
239 | ::= |
667fb920 |
240 | .I option-stmt |
241 | | |
242 | .I fw-stmt |
243 | .br |
244 | .I fw-stmt |
245 | ::= |
246 | .B fw |
247 | .I source |
248 | .I options |
249 | .RB [ to | \-> ] |
250 | .I target |
251 | .I options |
252 | .br |
253 | .I options |
254 | ::= |
255 | .B { |
256 | .I option-seq |
257 | .B } |
258 | .br |
259 | .I option-seq |
260 | ::= |
261 | .I empty |
262 | | |
263 | .I option-stmt |
264 | .RB [ ; ] |
265 | .I option-seq |
266 | .PP |
267 | If you prefer, the keyword |
268 | .RB ` fw ' |
269 | may be spelt |
270 | .RB ` forward ' |
271 | or |
272 | .RB ` from '. |
273 | All are equivalent. |
274 | . |
275 | .SS "Sources and targets" |
276 | Forwarding is set up by attaching |
277 | .I targets |
278 | to |
279 | .IR sources . |
280 | Sources are things which are capable of |
281 | .I initiating |
282 | one end of a data flow on their own, while targets are things which are |
283 | capable of setting up the other end on demand. In the case of a TCP |
284 | port forwarder, the part which listens for incoming client connections |
285 | is the source, while the part which sets up outgoing connections to the |
286 | destination server is the target. |
287 | .PP |
288 | Essentially, all |
289 | .B fw |
290 | does is set up a collection of sources and targets based on your |
291 | configuration file so that when a source decides to initiate a data |
292 | flow, it tells its target to set its end up, and then squirts data back |
293 | and forth between the two until there's no more. |
294 | .PP |
295 | Some sources are |
296 | .IR persistent : |
297 | they stay around indefinitely setting up multiple attachments to |
298 | targets. Others are |
299 | .IR transient : |
300 | they set up one connection and then disappear. If all the sources |
301 | defined are transient, then |
302 | .B fw |
303 | will quit when no more active sources remain and all connections have |
304 | terminated. |
305 | .PP |
306 | The |
307 | .B fw |
308 | program is fairly versatile. It allows you to attach any supported type |
309 | of source to any supported type of target. This will, I hope, be the |
310 | case in all future versions. |
311 | .PP |
312 | The syntax of a |
313 | .I source |
314 | or |
315 | .I target |
316 | depend on the source or target type, and are therefore described in the |
317 | sections specific to the various types. |
318 | . |
319 | .SS "Options structure" |
320 | Most of the objects that |
321 | .B fw |
322 | knows about (including sources and targets, but also other more specific |
323 | things such as socket address types) can have their behaviour modified |
324 | by |
325 | .IR options . |
326 | The options available at a particular point in the configuration depend |
327 | on the |
328 | .IR context . |
329 | A global option, outside of a |
330 | .I fw-stmt |
331 | has no context unless it is explicitly qualified, and affects global |
332 | behaviour. Local options, applied to a source or target in a |
333 | .I fw-stmt |
334 | has the context of the type of source or target to which it is applied, |
335 | and affects only that source or target. |
336 | .PP |
337 | Note that it's important to distinguish between an option's context |
338 | (which is affected by its qualification) and its local or global |
339 | status. No matter how qualified, a global option will always control |
340 | default options for objects, and a local option will only affect a |
341 | specific source or target. |
342 | .PP |
343 | The syntax for qualifying options is like this: |
344 | .PP |
345 | .I option-stmt |
346 | ::= |
347 | .I q-option |
348 | .br |
349 | .I q-option |
350 | ::= |
351 | .I option |
352 | .br |
353 | | |
354 | .I prefix |
355 | .B . |
356 | .I q-option |
357 | .br |
358 | | |
359 | .I prefix |
360 | .B { |
361 | .I option-seq |
362 | .B } |
363 | .br |
364 | .I prefix |
365 | ::= |
366 | .I word |
367 | .PP |
368 | Thus, you may qualify either an individual option or a sequence of |
369 | options. The two are equivalent; for example, |
370 | .VS |
371 | exec.rlimit { |
372 | core = 0; |
373 | cpu = 60; |
374 | } |
375 | .VE |
376 | is equivalent to |
377 | .VS |
378 | exec.rlimit.core = 0; |
379 | exec.rlimit.cpu = 0; |
380 | .VE |
381 | For each option, there is a sequence of prefixes which maximally qualify |
382 | that option. An option prefixed with this sequence is |
383 | .IR "fully qualified" . |
384 | In actual use, some or all of those prefixes may be omitted. However, |
385 | it's possible for the option to become |
386 | .I ambiguous |
387 | if you do this. For example, the option |
388 | .B fattr.owner |
389 | may refer either to |
390 | .B file.fattr.owner |
391 | or to |
392 | .BR socket.unix.fattr.owner . |
393 | In this case, the ambiguity is benign: a local option will have as its |
394 | context an appropriate source or target, and both global options |
395 | actually control the same default. However, the option |
396 | .B logging |
397 | may mean either |
398 | .B socket.logging |
399 | or |
400 | .BR exec.logging , |
401 | which have separate defaults, and which one you actually get depends on |
402 | the exact implementation of |
403 | .BR fw 's |
404 | option parser. (Currently this would resolve to |
405 | .BR exec.logging , |
406 | although this may change in a later version.) |
407 | .PP |
408 | In this manual, options are usually shown in their fully-qualified form. |
409 | . |
410 | .SS "The `file' source and target types" |
411 | The |
412 | .B file |
413 | source and target allow data to move to and from objects other |
414 | than sockets within the Unix filesystem. (Unix-domain sockets are |
415 | handled using the |
416 | .B socket |
417 | source and target.) |
418 | .PP |
419 | If a |
420 | .B file |
421 | is used as a source, it is set up immediately. |
422 | .PP |
423 | The syntax of |
424 | .B file |
425 | sources and targets is like this: |
426 | .PP |
427 | .I source |
428 | ::= |
429 | .I file |
430 | .br |
431 | .I target |
432 | ::= |
433 | .I file |
434 | .br |
435 | .I file |
436 | ::= |
437 | .B file |
438 | .RB [ . ] |
439 | .I fspec |
440 | .RB [ , |
441 | .IR fspec ] |
442 | .br |
443 | .I fspec |
444 | ::= |
445 | .I fd-spec |
446 | | |
447 | .I name-spec |
448 | | |
449 | .I null-spec |
450 | .br |
451 | .I fd-spec |
452 | ::= |
453 | .RB [[ : ] fd [ : ]] |
454 | .IR number \c |
455 | .RB | stdin | stdout |
456 | .br |
457 | .I name-spec |
458 | ::= |
459 | .RB [[ : ] file [ : ]] |
460 | .I file-name |
461 | .br |
462 | .I file-name |
463 | ::= |
464 | .I path-seq |
465 | | |
466 | .B [ |
467 | .I path-seq |
468 | .B ] |
469 | .br |
470 | .I path-seq |
471 | ::= |
472 | .I path-elt |
473 | | |
474 | .I path-seq |
475 | .I path-elt |
476 | .br |
477 | .I path-elt |
478 | ::= |
479 | .B / |
480 | | |
481 | .I word |
482 | .br |
483 | .I null-spec |
484 | ::= |
485 | .RB [[ : ] null [ : ]] |
486 | .PP |
487 | The |
488 | .I file |
489 | specification describes two files, the first to be used as input, the |
490 | second to be used as output, each described by an |
491 | .IR fspec . |
492 | .PP |
493 | If none of the keywords |
494 | .RB ` fd ', |
495 | .RB ` name ' |
496 | or |
497 | .RB ` null ' |
498 | are given, the type of an |
499 | .I fspec |
500 | is deduced from its nature: if it matches one of the strings |
501 | .RB ` stdin ' |
502 | or |
503 | .RB ` stdout ', |
504 | or begins with a digit, it's considered to be a file descriptor; |
505 | otherwise it's interpreted as a filename. |
506 | .PP |
507 | A |
508 | .RB ` name ' |
509 | spec describes a file by its name within the filesystem. It is opened |
510 | when needed and closed again after use. For output files, the precise |
511 | behaviour is controlled by options described below. |
512 | .PP |
513 | A |
514 | .RB ` null ' |
515 | spec attaches the input or output of the source or target to |
516 | .BR /dev/null . |
517 | .PP |
518 | An |
519 | .RB ` fd ' |
520 | spec uses an existing open file descriptor, given either by number or a |
521 | symbolic name. The name |
522 | .RB ` stdin ' |
523 | refers to standard input (file descriptor 0 on normal systems) and |
524 | .RB ` stdout ' |
525 | refers to standard output (file descriptor 1). The names work in |
526 | exactly the same way as the equivalent file descriptor numbers. |
527 | .PP |
528 | If the output |
529 | .I fspec |
530 | is omitted, the input |
531 | .I fspec |
532 | is used for both input and output. Exception: if the input refers to |
533 | standard input then the output will refer to standard output instead. |
534 | .PP |
535 | All |
536 | .B file |
537 | options apply equally to sources and targets. The options are as |
538 | follows: |
539 | .PP |
540 | .B file.create |
541 | .RB [ = ] |
542 | .BR yes | no |
543 | .RS |
544 | Whether to create the output file if it doesn't exist. If |
545 | .B no |
546 | (the default), an error is reported if the file doesn't exist. If |
547 | .BR yes , |
548 | the file is created if it doesn't exist. |
549 | .RE |
550 | .PP |
551 | .B file.open |
552 | .RB [ = ] |
553 | .BR no | truncate | append |
554 | .RS |
555 | Controls the behaviour if the output file already exists. If |
556 | .BR no , |
557 | an error is reported. If |
558 | .B truncate |
559 | (the default), the existing file is replaced by the new data. If |
560 | .BR append , |
561 | the new data is appended to the file. |
562 | .RE |
563 | .PP |
564 | Under no circumstances will |
565 | .B fw |
566 | create a file through a `dangling' symbolic link. |
567 | .PP |
568 | The |
569 | .B file |
570 | source and target also accept |
571 | .B fattr |
572 | options for controlling the attributes of the created file. The prefix |
573 | for setting file attributes is |
574 | .BR file.fattr . |
575 | . |
576 | .SS "File attributes for created files `fattr'" |
577 | Both the |
578 | .B file |
579 | and |
580 | .B socket |
581 | sources and targets can create new filesystem objects. The |
582 | .B fattr |
583 | options allow control over the attributes of the newly-created objects. |
584 | Both |
585 | .B file |
586 | and |
587 | .B socket |
588 | use the same set of defaults, so a prefix of |
589 | .B fattr |
590 | is good enough for setting global options, and the implicit context |
591 | disambiguates local options. |
592 | .PP |
593 | The following file attribute options are supported: |
594 | .PP |
595 | .IB prefix .fattr.mode |
596 | .RB [ = ] |
597 | .I mode |
598 | .RS |
599 | Sets the permissions mode for a new file. The |
600 | .I mode |
601 | argument may be either an octal number or a |
602 | .BR chmod (1)-style |
603 | string which acts on the default permissions established by the |
604 | prevailing |
605 | .BR umask (2) |
606 | setting. Note that |
607 | .BR chmod -style |
608 | strings may contain |
609 | .RB ` = ' |
610 | and |
611 | .RB ` , ' |
612 | characters that will need to be escaped or quoted. |
613 | .RE |
614 | .PP |
615 | .IB prefix .fattr.owner |
616 | .RB [ = ] |
617 | .I user |
618 | .RS |
619 | Sets the owner for newly created files. On non-broken systems you will |
620 | need to be the superuser to set the owner on a file. The |
621 | .I user |
622 | may either be a numeric uid or a username. The default is not to change |
623 | the owner of the file once it's created. The synonyms |
624 | .B uid |
625 | and |
626 | .B user |
627 | are accepted in place of |
628 | .BR owner . |
629 | .RE |
630 | .PP |
631 | .IB prefix .fattr.group |
632 | .RB [ = ] |
633 | .I group |
634 | .RS |
635 | Sets the group for newly created files. You will usually need to be a |
636 | member of the group in question order to set the group of a file. The |
637 | .I group |
638 | may either be a numeric gid or a group name. The default is not to |
639 | change the group of the file once it's created. The synonym |
640 | .B gid |
641 | is accepted in place of |
642 | .BR group . |
643 | .RE |
644 | . |
645 | .SS "The `exec' source and target types" |
646 | The |
647 | .B exec |
648 | source and target execute programs and allow access to their standard |
649 | input and output streams. Both source and target have the same syntax, |
650 | which is as follows: |
651 | .PP |
652 | .I source |
653 | ::= |
654 | .I exec |
655 | .br |
656 | .I target |
657 | ::= |
658 | exec |
659 | .br |
660 | .I exec |
661 | ::= |
662 | .BR exec |
663 | .RB [ . ] |
664 | .I cmd-spec |
665 | .br |
666 | .I cmd-spec |
667 | ::= |
668 | .I shell-cmd |
10a454ad |
669 | | |
667fb920 |
670 | .RI [ prog-name ] |
671 | .B [ |
672 | .I argv0 |
673 | .I arg-seq |
674 | .B ] |
675 | .br |
676 | .I arg-seq |
677 | ::= |
678 | .I word |
679 | | |
680 | .I arg-seq |
681 | .I word |
682 | .br |
683 | .I shell-cmd |
684 | ::= |
685 | .I word |
686 | .br |
687 | .I argv0 |
688 | ::= |
689 | .I word |
690 | .PP |
691 | If a single word is given, it is a |
692 | .I shell-cmd |
693 | and will be passed to the Bourne shell for execution. If a |
694 | bracket-enclosed sequence of words is given, it is considered to be a |
695 | list of arguments to pass to the program: if a |
696 | .I prog-name |
697 | is also supplied, it names the file containing the program to execute; |
698 | otherwise the file named by the first argument |
699 | .RI ( argv0 ) |
700 | is used. |
701 | .PP |
702 | The standard input and output of the program are forwarded to the other |
703 | end of the connection. The standard error stream is caught by |
704 | .B fw |
705 | and logged. |
706 | .PP |
707 | The |
708 | .B exec |
709 | source and target both understand the same set of options. The list of |
710 | options supported is as follows: |
711 | .PP |
712 | .B exec.logging |
713 | .RB [ = ] |
714 | .BR yes | no |
715 | .RS |
716 | Whether to log the start and end of executed programs. If |
717 | .B yes |
718 | (the default), a log message is emitted when the program is started |
719 | listing its process id, and another is emitted when the program finishes |
720 | giving its process id and exit status. If |
721 | .BR no , |
722 | these messages are not emitted. However the standard error stream is |
723 | still logged. The |
724 | .B log |
725 | abbreviation is accepted as a synonym for |
726 | .BR logging . |
727 | .RE |
728 | .PP |
729 | .B exec.dir |
730 | .RB [ = ] |
731 | .I file-name |
732 | .RS |
733 | Sets the current directory from which the the program should be run. |
734 | The default is not to change directory. The synonyms |
735 | .BR cd , |
736 | .B chdir |
737 | and |
738 | .B cwd |
739 | are accepted in place of |
740 | .BR dir . |
741 | .RE |
742 | .PP |
743 | .B exec.root |
744 | .RB [ = ] |
745 | .I file-name |
746 | .RS |
747 | Sets the root directory for the program, using the |
748 | .BR chroot (2) |
749 | system call. You must be the superuser for this option to work. The |
750 | default is not to set a root directory. The synonyms |
751 | .BR cd , |
752 | .B chdir |
753 | and |
754 | .B cwd |
755 | are accepted in place of |
756 | .B dir . |
757 | .RE |
758 | .PP |
759 | .B exec.user |
760 | .RB [ = ] |
761 | .I user |
762 | .RS |
763 | Sets the user (real and effective uid) to run the program as. This will |
764 | usually require superuser privileges to work. The default is not to |
765 | change uid. The synonym |
766 | .B uid |
767 | is accepted in place of |
768 | .BR user . |
769 | .RE |
770 | .PP |
771 | .B exec.group |
772 | .RB [ = ] |
773 | .I group |
774 | .RS |
775 | Sets the group (real and effective gid) to run the program as. If |
776 | running with superuser privileges, the supplementary groups list is |
777 | cleared at the same time. The default is not to change gid (or clear |
778 | the supplementary groups list). The synonym |
779 | .B gid |
780 | is accepted in place of |
781 | .BR group . |
782 | .RE |
783 | .PP |
784 | .BI exec.rlimit. limit \c |
785 | .RB [ .hard | .soft ] |
786 | .RB [ = ] |
787 | .I value |
788 | .RS |
789 | Set resource limits for the program. The |
790 | .I limit |
791 | may be one of the resource limit names described in |
792 | .BR setrlimit (2), |
793 | in lower-case and without the |
794 | .B RLIMIT_ |
795 | prefix; for example, |
796 | .B RLIMIT_CORE |
797 | becomes simply |
798 | .BR core . |
799 | The |
800 | .I value |
801 | is a number, followed optionally by |
802 | .B k |
803 | to multiply by 1024 (2\*(ss10\*(se), |
804 | .B m |
805 | to multiply by 1048576 (2\*(ss20\*(se), or |
806 | .B g |
807 | to multiply by 1073741824 (2\*(ss30\*(se); purists can use upper-case |
808 | versions of these if they want. If |
809 | .B .hard |
810 | or |
811 | .B .soft |
812 | was specified, only the hard or soft limit is set; otherwise both are |
813 | set to the same value. Only the superuser can raise the hard limit. |
814 | The soft limit cannot be set above the hard limit. |
815 | .RE |
816 | .PP |
817 | .B exec.env.clear |
818 | .RS |
819 | Clears the program's environment. |
820 | .RE |
821 | .PP |
822 | .B exec.env.unset |
823 | .I var |
824 | .RS |
825 | Removes |
826 | .I var |
827 | from the program's environment. It is not an error if no variable named |
828 | .I var |
829 | exists. |
830 | .RE |
831 | .PP |
832 | .BR exec.env. [ set ] |
833 | .I var |
834 | .RB [ = ] |
835 | .I value |
836 | .RS |
96bc31ba |
837 | Assigns the variable |
667fb920 |
838 | .I var |
839 | the value |
840 | .I value |
841 | in the program's environment, possibly replacing the existing value. |
842 | The |
843 | .B set |
844 | may be omitted if the |
845 | .B env |
846 | qualifier is present. |
847 | .RE |
848 | .PP |
849 | Note that environment variable modifications are performed in order, |
850 | global modifications before local ones. |
851 | . |
852 | .SS "The `socket' source and target types" |
853 | The |
854 | .B socket |
855 | source and target provide access to network services. Support is |
856 | currently provided for TCP/IP and Unix-domain sockets, although other |
857 | address types can be added with reasonable ease. |
858 | .PP |
859 | The syntax for socket sources and targets is: |
860 | .PP |
861 | .ll +8i |
862 | .I source |
863 | ::= |
864 | .I socket-source |
10a454ad |
865 | .br |
667fb920 |
866 | .I target |
867 | ::= |
868 | .I socket-target |
869 | .br |
870 | .I socket-source |
871 | ::= |
872 | .RB [ socket [ . ]] |
873 | .RB [[ : ] \c |
874 | .IR addr-type \c |
875 | .RB [ : ]] |
876 | .I source-addr |
877 | .br |
878 | .I socket-target |
879 | ::= |
880 | .RB [ socket [ . ]] |
881 | .RB [[ : ] \c |
882 | .IR addr-type \c |
883 | .RB [ : ]] |
884 | .I target-addr |
885 | .ll -8i |
886 | .PP |
887 | The syntax of the source and target addresses depend on the address |
888 | types, which are described below. The default address type, if no |
889 | .I addr-type |
890 | is given, is |
891 | .BR inet . |
892 | .PP |
893 | Socket sources support options; socket targets do not. The source |
894 | options provided are: |
895 | .PP |
896 | .B socket.conn |
897 | .RB [ = ] |
898 | .I number |
899 | .RS |
900 | Limits the number of simultaneous connections to this socket to the |
901 | .I number |
902 | given. The default is 256. |
903 | .RE |
904 | .PP |
905 | .B socket.logging |
906 | .RB [ = ] |
907 | .BR yes | no |
908 | .RS |
909 | Whether to log incoming connections. If |
910 | .B yes |
911 | (the default) incoming connections are logged, together with information |
912 | about the client (where available) and whether the connection was |
913 | accepted or refused. If |
914 | .BR no , |
915 | log messages are not generated. |
916 | .RE |
917 | .PP |
918 | Address types also provide their own options. |
919 | . |
920 | .SS "The `inet' socket address type" |
921 | The |
922 | .B inet |
923 | address type provides access to TCP ports. The |
924 | .B inet |
925 | source and target addresses have the following syntax: |
926 | .PP |
927 | .I inet-source-addr |
10a454ad |
928 | ::= |
10a454ad |
929 | .RB [ port ] |
930 | .I port |
667fb920 |
931 | .br |
932 | .I inet-target-addr |
933 | ::= |
934 | .I address |
10a454ad |
935 | .RB [ : ] |
936 | .I port |
10a454ad |
937 | .br |
667fb920 |
938 | .I address |
10a454ad |
939 | ::= |
667fb920 |
940 | .I addr-elt |
941 | | |
942 | .I address |
943 | .I addr-elt |
10a454ad |
944 | .br |
667fb920 |
945 | .I addr-elt |
10a454ad |
946 | ::= |
667fb920 |
947 | .B . |
10a454ad |
948 | | |
667fb920 |
949 | .I word |
950 | .PP |
951 | A |
952 | .I port |
953 | may be given as a port number or a service name from the |
954 | .B /etc/services |
955 | file (or YP map if you do that sort of thing). A |
956 | .B hostname |
957 | may be a textual hostname or a numerical IP address. |
958 | .PP |
959 | The |
960 | .B inet |
961 | source address accepts the following options: |
962 | .PP |
963 | .BR socket.inet. [ allow | deny ] |
10a454ad |
964 | .RB [ from ] |
667fb920 |
965 | .I address |
10a454ad |
966 | .RB [ / |
667fb920 |
967 | .IR address ] |
968 | .RS |
969 | Adds an entry to the source's access control list. If only one |
970 | .I address |
971 | is given, the entry applies only to that address; if two are given, the |
972 | first is a network address and the second is a netmask either in |
973 | dotted-quad format or a simple number of bits (e.g., |
974 | .B /255.255.255.192 |
975 | and |
976 | .B /26 |
977 | mean the same), and the entry applies to any address which, when masked |
978 | by the netmask, is equal to the masked network address. |
10a454ad |
979 | .PP |
667fb920 |
980 | The access |
981 | control rules are examined in the order: local entries first, then |
982 | global ones, each in the order given in the configuration file. The |
983 | first matching entry is used. If no entries match, the behaviour is the |
984 | .I opposite |
985 | of the last entry tried. If there are no entries defined, the default |
986 | is to allow all clients. |
987 | .RE |
988 | . |
989 | .SS "The `unix' socket address type" |
10a454ad |
990 | The |
667fb920 |
991 | .B unix |
992 | address type allows access to Unix-domain sockets. The syntax for |
993 | .B unix |
994 | source and target addresses is like this: |
995 | .PP |
996 | .I source-addr |
997 | ::= |
998 | .I unix-addr |
999 | .br |
1000 | .I target-addr |
1001 | ::= |
1002 | .I unix-addr |
1003 | .br |
1004 | .I unix-addr |
1005 | ::= |
1006 | .I file-name |
1007 | .PP |
1008 | The |
1009 | .B unix |
1010 | source address accepts |
1011 | .B fattr |
1012 | options to control the attributes of the socket file created. Sockets |
1013 | are removed if |
10a454ad |
1014 | .B fw |
667fb920 |
1015 | exits normally (which it will do if it runs out of sources or |
1016 | connections, or if killed by SIGINT or SIGTERM). |
1017 | .SH "EXAMPLES" |
1018 | To forward the local port 25 to a main mail server: |
1019 | .VS |
1020 | from 25 to mailserv:25 |
1021 | .VE |
1022 | To attach a fortune server to a Unix-domain socket: |
1023 | .VS |
1024 | from unix:/tmp/fortunes |
1025 | to exec [/usr/games/fortune] { user nobody } |
1026 | .VE |
1027 | To fetch a fortune from the server: |
1028 | .VS |
1029 | from file stdin, stdout to unix:/tmp/fortunes |
1030 | .VE |
1031 | To emulate |
1032 | .BR cat (1): |
1033 | .VS |
1034 | from stdin, null to null, stdout |
1035 | .VE |
1036 | . |
1037 | .\"-------------------------------------------------------------------------- |
10a454ad |
1038 | .SH "BUGS" |
667fb920 |
1039 | . |
1040 | The syntax for IP addresses and filenames is nasty. The requirement |
1041 | that textual permissions strings be quoted is probably nastier. |
10a454ad |
1042 | .PP |
667fb920 |
1043 | IPv6 is not supported yet. It's probably not a major piece of work to |
1044 | add. |
10a454ad |
1045 | .PP |
667fb920 |
1046 | Please inform me of any security problems you think you've identified in |
1047 | this program. I take security very seriously, and I will fix security |
1048 | holes as a matter of priority when I find out about them. I will be |
1049 | annoyed if I have to read about problems on Bugtraq because they weren't |
1050 | mailed to me first. |
1051 | . |
1052 | .\"-------------------------------------------------------------------------- |
10a454ad |
1053 | .SH "AUTHOR" |
667fb920 |
1054 | . |
10a454ad |
1055 | Mark Wooding, <mdw@nsict.org> |
667fb920 |
1056 | . |
1057 | .\"----- That's all, folks -------------------------------------------------- |