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