diff options
author | peter <peter@FreeBSD.org> | 2000-02-10 03:17:51 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2000-02-10 03:17:51 +0000 |
commit | cf9ed6d8c95a64abfd95e56a3325ed36e030ebd6 (patch) | |
tree | 4ca6f882645735894b392933cb539998c8e05326 /contrib/ipfilter/man | |
parent | 681d6b5c31759a5f92f206cdc05e9b377807239a (diff) | |
download | FreeBSD-src-cf9ed6d8c95a64abfd95e56a3325ed36e030ebd6.zip FreeBSD-src-cf9ed6d8c95a64abfd95e56a3325ed36e030ebd6.tar.gz |
Not in this commit: Many spammed deltas have been removed to restore
back to the vendor branch.
Re-merge changes from the vendor branch.
Undo the local spammed changes that I could find. There are probably
more local fixes that were clobbered that I've missed.
Diffstat (limited to 'contrib/ipfilter/man')
-rw-r--r-- | contrib/ipfilter/man/ipf.4 | 79 | ||||
-rw-r--r-- | contrib/ipfilter/man/ipf.5 | 87 | ||||
-rw-r--r-- | contrib/ipfilter/man/ipf.8 | 14 | ||||
-rw-r--r-- | contrib/ipfilter/man/ipfilter.5 | 6 | ||||
-rw-r--r-- | contrib/ipfilter/man/ipfstat.8 | 6 | ||||
-rw-r--r-- | contrib/ipfilter/man/ipmon.8 | 54 | ||||
-rw-r--r-- | contrib/ipfilter/man/ipnat.4 | 3 |
7 files changed, 204 insertions, 45 deletions
diff --git a/contrib/ipfilter/man/ipf.4 b/contrib/ipfilter/man/ipf.4 index 303f146..b281c36 100644 --- a/contrib/ipfilter/man/ipf.4 +++ b/contrib/ipfilter/man/ipf.4 @@ -1,3 +1,4 @@ +.\" $FreeBSD$ .TH IPF 4 .SH NAME ipf \- packet filtering kernel interface @@ -25,7 +26,19 @@ However, the full complement is as follows: ioctl(fd, SIOCRMIFR, struct frentry *) ioctl(fd, SIOCINAFR, struct frentry *) ioctl(fd, SIOCINIFR, struct frentry *) + ioctl(fd, SIOCSETFF, u_int *) + ioctl(fd, SIOGGETFF, u_int *) + ioctl(fd, SIOCGETFS, struct friostat *) ioctl(fd, SIOCIPFFL, int *) + ioctl(fd, SIOCIPFFB, int *) + ioctl(fd, SIOCSWAPA, u_int *) + ioctl(fd, SIOCFRENB, u_int *) + ioctl(fd, SIOCFRSYN, u_int *) + ioctl(fd, SIOCFRZST, struct friostat *) + ioctl(fd, SIOCZRLST, struct frentry *) + ioctl(fd, SIOCAUTHW, struct fr_info *) + ioctl(fd, SIOCAUTHR, struct fr_info *) + ioctl(fd, SIOCATHST, struct fr_authstat *) .fi .PP The variations, SIOCADAFR vs. SIOCADIFR, allow operation on the two lists, @@ -44,21 +57,24 @@ which it is inserted is stored in the "fr_hits" field, below. typedef struct frentry { struct frentry *fr_next; u_short fr_group; /* group to which this rule belongs */ - u_short fr_head; /* group # which this rule starts */ + u_short fr_grhead; /* group # which this rule starts */ struct frentry *fr_grp; int fr_ref; /* reference count - for grouping */ - struct ifnet *fr_ifa; + void *fr_ifa; +#if BSD >= 199306 + void *fr_oifa; +#endif /* * These are only incremented when a packet matches this rule and * it is the last match */ - U_QUAD_T fr_hits; - U_QUAD_T fr_bytes; + U_QUAD_T fr_hits; + U_QUAD_T fr_bytes; /* * Fields after this may not change whilst in the kernel. */ struct fr_ip fr_ip; - struct fr_ip fr_mip; + struct fr_ip fr_mip; /* mask structure */ u_char fr_tcpfm; /* tcp flags mask */ u_char fr_tcpf; /* tcp flags */ @@ -67,16 +83,20 @@ typedef struct frentry { u_short fr_icmp; u_char fr_scmp; /* data for port comparisons */ - u_char fr_dcmp; + u_char fr_dcmp; u_short fr_dport; u_short fr_sport; - u_short fr_stop; /* top port for <> and >< */ + u_short fr_stop; /* top port for <> and >< */ u_short fr_dtop; /* top port for <> and >< */ - u_long fr_flags; /* per-rule flags && options (see below) */ - int fr_skip; /* # of rules to skip */ - int (*fr_func)(); /* call this function */ + u_32_t fr_flags; /* per-rule flags && options (see below) */ + u_short fr_skip; /* # of rules to skip */ + u_short fr_loglevel; /* syslog log facility + priority */ + int (*fr_func) __P((int, ip_t *, fr_info_t *)); char fr_icode; /* return ICMP code */ char fr_ifname[IFNAMSIZ]; +#if BSD > 199306 + char fr_oifname[IFNAMSIZ]; +#endif struct frdest fr_tif; /* "to" interface */ struct frdest fr_dif; /* duplicate packet interfaces */ } frentry_t; @@ -96,12 +116,13 @@ Flags which are recognised in fr_pass: FR_OUTQUE 0x000004 /* outgoing packets */ FR_INQUE 0x000008 /* ingoing packets */ FR_LOG 0x000010 /* Log */ - FR_LOGP 0x000011 /* Log-pass */ - FR_LOGB 0x000012 /* Log-fail */ + FR_LOGB 0x000011 /* Log-fail */ + FR_LOGP 0x000012 /* Log-pass */ FR_LOGBODY 0x000020 /* log the body of packets too */ FR_LOGFIRST 0x000040 /* log only the first packet to match */ FR_RETRST 0x000080 /* return a TCP RST packet if blocked */ - FR__RETICMP 0x000100 /* return an ICMP packet if blocked */ + FR_RETICMP 0x000100 /* return an ICMP packet if blocked */ + FR_FAKEICMP 0x00180 /* Return ICMP unreachable with fake source */ FR_NOMATCH 0x000200 /* no match occured */ FR_ACCOUNT 0x000400 /* count packet bytes */ FR_KEEPFRAG 0x000800 /* keep fragment information */ @@ -137,9 +158,11 @@ comparisons) : The third ioctl, SIOCIPFFL, flushes either the input filter list, the output filter list or both and it returns the number of filters removed from the list(s). The values which it will take and recognise are FR_INQUE -and FR_OUTQUE (see above). +and FR_OUTQUE (see above). This ioctl is also implemented for +\fB/dev/ipstate\fP and will flush all state tables entries if passed 0 +or just all those which are not established if passed 1. -\fBGeneral Logging Flags\fP +.IP "\fBGeneral Logging Flags\fP" 0 There are two flags which can be set to log packets independently of the rules used. These allow for packets which are either passed or blocked to be logged. To set (and clear)/get these flags, two ioctls are @@ -157,8 +180,7 @@ those provided (clearing/setting all in one). .IP SIOCGETFF 16 Takes a pointer to an unsigned integer as the parameter. A copy of the flags currently in used is copied to user space. -.LP -\fBFilter statistics\fP +.IP "\fBFilter statistics\fP" 0 Statistics on the various operations performed by this package on packets is kept inside the kernel. These statistics apply to packets traversing through the kernel. To retrieve this structure, use this ioctl: @@ -173,7 +195,12 @@ struct friostat { struct frentry *f_acctin[2]; struct frentry *f_acctout[2]; struct frentry *f_auth; - int f_active; + u_long f_froute[2]; + int f_active; /* 1 or 0 - active rule set */ + int f_defpass; /* default pass - from fr_pass */ + int f_running; /* 1 if running, else 0 */ + int f_logging; /* 1 if enabled, else 0 */ + char f_version[32]; /* version string */ }; struct filterstats { @@ -195,12 +222,28 @@ struct filterstats { u_long fr_chit; /* cached hit */ u_long fr_pull[2]; /* good and bad pullup attempts */ #if SOLARIS + u_long fr_notdata; /* PROTO/PCPROTO that have no data */ + u_long fr_nodata; /* mblks that have no data */ u_long fr_bad; /* bad IP packets to the filter */ u_long fr_notip; /* packets passed through no on ip queue */ u_long fr_drop; /* packets dropped - no info for them! */ #endif }; .fi +If we wanted to retrieve all the statistics and reset the counters back to +0, then the ioctl() call would be made to SIOCFRZST rather than SIOCGETFS. +In addition to the statistics above, each rule keeps a hit count, counting +both number of packets and bytes. To reset these counters for a rule, +load the various rule information into a frentry structure and call +SIOCZRLST. +.IP "Swapping Active lists" 0 +IP Filter supports two lists of rules for filtering and accounting: an +active list and an inactive list. This allows for large scale rule base +changes to be put in place atomically with otherwise minimal interruption. +Which of the two is active can be changed using the SIOCSWAPA ioctl. It +is important to note that no passed argument is recognised and that the +value returned is that of the list which is now inactive. +.br .SH FILES /dev/ipauth .br diff --git a/contrib/ipfilter/man/ipf.5 b/contrib/ipfilter/man/ipf.5 index a186193..d9e9992 100644 --- a/contrib/ipfilter/man/ipf.5 +++ b/contrib/ipfilter/man/ipf.5 @@ -1,3 +1,4 @@ +.\" $FreeBSD$ .TH IPF 5 .SH NAME ipf, ipf.conf \- IP packet filter rule syntax @@ -31,17 +32,18 @@ proto = "proto" protocol . ip = srcdst [ flags ] [ with withopt ] [ icmp ] [ keep ] . group = [ "head" decnumber ] [ "group" decnumber ] . -block = "block" [ "return-icmp"[return-code] | "return-rst" ] . +block = "block" [ icmp[return-code] | "return-rst" ] . auth = "auth" | "preauth" . -log = "log" [ "body" ] [ "first" ] [ "or-block" ] . +log = "log" [ "body" ] [ "first" ] [ "or-block" ] [ "level" loglevel ] . call = "call" [ "now" ] function-name . skip = "skip" decnumber . dup = "dup-to" interface-name[":"ipaddr] . froute = "fastroute" | "to" interface-name . protocol = "tcp/udp" | "udp" | "tcp" | "icmp" | decnumber . srcdst = "all" | fromto . -fromto = "from" object "to" object . +fromto = "from" [ "!" ] object "to" [ "!" ] object . +icmp = "return-icmp" | "return-icmp-as-dest" . object = addr [ port-comp | port-range ] . addr = "any" | nummask | host-name [ "mask" ipaddr | "mask" hexnumber ] . port-comp = "port" compare port-num . @@ -51,6 +53,7 @@ with = "with" | "and" . icmp = "icmp-type" icmp-type [ "code" decnumber ] . return-code = "("icmp-code")" . keep = "keep" "state" | "keep" "frags" . +loglevel = facility"."priority | priority . nummask = host-name [ "/" decnumber ] . host-name = ipaddr | hostname | "any" . @@ -70,10 +73,17 @@ icmp-type = "unreach" | "echo" | "echorep" | "squench" | "redir" | "inforep" | "maskreq" | "maskrep" | decnumber . icmp-code = decumber | "net-unr" | "host-unr" | "proto-unr" | "port-unr" | "needfrag" | "srcfail" | "net-unk" | "host-unk" | "isolate" | - "net-prohib" | "host-prohib" | "net-tos" | "host-tos" . + "net-prohib" | "host-prohib" | "net-tos" | "host-tos" | + "filter-prohib" | "host-preced" | "cutoff-preced" . optlist = "nop" | "rr" | "zsu" | "mtup" | "mtur" | "encode" | "ts" | "tr" | "sec" | "lsrr" | "e-sec" | "cipso" | "satid" | "ssrr" | "addext" | "visa" | "imitd" | "eip" | "finn" . +facility = "kern" | "user" | "mail" | "daemon" | "auth" | "syslog" | + "lpr" | "news" | "uucp" | "cron" | "ftp" | "authpriv" | + "audit" | "logalert" | "local0" | "local1" | "local2" | + "local3" | "local4" | "local5" | "local6" | "local7" . +priority = "emerg" | "alert" | "crit" | "err" | "warn" | "notice" | + "info" | "debug" . hexnumber = "0" "x" hexstring . hexstring = hexdigit [ hexstring ] . @@ -118,11 +128,23 @@ actions are recognised: .B block indicates that the packet should be flagged to be dropped. In response to blocking a packet, the filter may be instructed to send a reply -packet, either an ICMP packet (\fBreturn-icmp\fP) or a TCP "reset" -(\fBreturn-rst\fP). An ICMP packet may be generated in response to -any IP packet, and its type may optionally be specified, but a TCP -reset may only be used with a rule which is being applied to TCP -packets. +packet, either an ICMP packet (\fBreturn-icmp\fP), an ICMP packet +masquerading as being from the original packet's destination +(\fBreturn-icmp-as-dest\fP), or a TCP "reset" (\fBreturn-rst\fP). An +ICMP packet may be generated in response to any IP packet, and its +type may optionally be specified, but a TCP reset may only be used +with a rule which is being applied to TCP packets. When using +\fBreturn-icmp\fP or \fBreturn-icmp-as-dest\fP, it is possible to specify +the actual unreachable `type'. That is, whether it is a network +unreachable, port unreachable or even administratively +prohibitied. This is done by enclosing the ICMP code associated with +it in parenthesis directly following \fBreturn-icmp\fP or +\fBreturn-icmp-as-dest\fP as follows: +.nf + block return-icmp(11) ... +.fi +.PP +Would return a Type-Of-Service (TOS) ICMP unreachable error. .TP .B pass will flag the packet to be let through the filter. @@ -145,10 +167,27 @@ feature is for use by knowledgeable hackers, and is not currently documented. .TP .B "skip <n>" +causes the filter to skip over the next \fIn\fP filter rules. If a rule is +inserted or deleted inside the region being skipped over, then the value of +\fIn\fP is adjusted appropriately. .TP .B auth +this allows authentication to be performed by a user-space program running +and waiting for packet information to validate. The packet is held for a +period of time in an internal buffer whilst it waits for the program to return +to the kernel the \fIreal\fP flags for whether it should be allowed through +or not. Such a program might look at the source address and request some sort +of authentication from the user (such as a password) before allowing the +packet through or telling the kernel to drop it if from an unrecognised source. .TP .B preauth +tells the filter that for packets of this class, it should look in the +pre-authenticated list for further clarification. If no further matching +rule is found, the packet will be dropped (the FR_PREAUTH is not the same +as FR_PASS). If a further matching rule is found, the result from that is +used in its instead. This might be used in a situation where a person +\fIlogs in\fP to the firewall and it sets up some temporary rules defining +the access for that person. .PP The next word must be either \fBin\fP or \fBout\fP. Each packet moving through the kernel is either inbound (just been received on an @@ -195,7 +234,10 @@ which the specified source address would be expected, others may be logged and/or dropped. .TP .B dup-to -causes the packet to be copied, and the duplicate packet to be sent outbound on the specified interface, optionally with the destination IP address changed to that specified. This is useful for off-host logging, using a network sniffer. +causes the packet to be copied, and the duplicate packet to be sent +outbound on the specified interface, optionally with the destination +IP address changed to that specified. This is useful for off-host +logging, using a network sniffer. .TP .B to causes the packet to be moved to the outbound queue on the @@ -394,10 +436,19 @@ indicates that the first 128 bytes of the packet contents will be logged after the headers. .TP .B first -?? +If log is being used in conjunction with a "keep" option, it is recommended +that this option is also applied so that only the triggering packet is logged +and not every packet which thereafter matches state information. .TP .B or-block -indicates that, if for some reason the filter is unable to log the packet (such as the log reader being too slow) then the rule should be interpreted as if the action was \fBblock\fP for this packet. +indicates that, if for some reason the filter is unable to log the +packet (such as the log reader being too slow) then the rule should be +interpreted as if the action was \fBblock\fP for this packet. +.TP +.B "level <loglevel>" +indicates what logging facility and priority, or just priority with +the default facility being used, will be used to log information about +this packet using ipmon's -s option. .PP See ipl(4) for the format of records written to this device. The ipmon(8) program can be used to read and format @@ -419,7 +470,7 @@ The "fall-through" rule parsing allows for effects such as this: .nf block in from any to any port < 6000 pass in from any to any port >= 6000 - block in from any to port > 6003 + block in from any to any port > 6003 .fi .PP which sets up the range 6000-6003 as being permitted and all others being @@ -441,14 +492,14 @@ rule such as: .fi .PP would be needed before the first block. To create a new group for -processing all inbould packets on le0/le1/lo0, with the default being to block +processing all inbound packets on le0/le1/lo0, with the default being to block all inbound packets, we would do something like: .LP .nf block in all - block in on le0 quick all head 100 - block in on le1 quick all head 200 - block in on lo0 quick all head 300 + block in quick on le0 all head 100 + block in quick on le1 all head 200 + block in quick on lo0 all head 300 .fi .PP @@ -487,4 +538,4 @@ qualifies all service/port names with the protocol specified. .br /etc/services .SH SEE ALSO -ipftest(1), iptest(1), ipf(4), ipnat(5), ipf(8), ipfstat(8) +ipftest(1), iptest(1), mkfilters(1), ipf(4), ipnat(5), ipf(8), ipfstat(8) diff --git a/contrib/ipfilter/man/ipf.8 b/contrib/ipfilter/man/ipf.8 index 16edfad..9aa4536 100644 --- a/contrib/ipfilter/man/ipf.8 +++ b/contrib/ipfilter/man/ipf.8 @@ -1,10 +1,11 @@ +.\" $FreeBSD$ .TH IPF 8 .SH NAME ipf \- alters packet filtering lists for IP packet input and output .SH SYNOPSIS .B ipf [ -.B \-AdDEInorsUvyzZ +.B \-AdDEInoPrsUvVyzZ ] [ .B \-l <block|pass|nomatch> @@ -81,6 +82,9 @@ calls or doing anything which would alter the currently running kernel. Force rules by default to be added/deleted to/from the output list, rather than the (default) input list. .TP +.B \-P +Add rules as temporary entries in the authentication rule table. +.TP .B \-r Remove matching filter rules rather than add them to the internal lists .TP @@ -94,6 +98,12 @@ recognised as IP packets. They will be printed out on the console. .B \-v Turn verbose mode on. Displays information relating to rule processing. .TP +.B \-V +Show version information. This will display the version information compiled +into the ipf binary and retrieve it from the kernel code (if running/present). +If it is present in the kernel, information about its current state will be +displayed (whether logging is active, default filtering, etc). +.TP .B \-y Manually resync the in-kernel interface list maintained by IP Filter with the current interface status list. @@ -113,7 +123,7 @@ affect fragment or state statistics). .br /dev/ipstate .SH SEE ALSO -ipftest(1), ipf(4), ipl(4), ipf(5), ipfstat(8), ipmon(8), ipnat(8) +ipftest(1), mkfilters(1), ipf(4), ipl(4), ipf(5), ipfstat(8), ipmon(8), ipnat(8) .SH DIAGNOSTICS .PP Needs to be run as root for the packet filtering lists to actually diff --git a/contrib/ipfilter/man/ipfilter.5 b/contrib/ipfilter/man/ipfilter.5 index 44f3130..ac45146 100644 --- a/contrib/ipfilter/man/ipfilter.5 +++ b/contrib/ipfilter/man/ipfilter.5 @@ -1,7 +1,11 @@ +.\" $FreeBSD$ .TH IPFILTER 1 .SH NAME IP FIlter .SH DESCRIPTION .PP +IP Filter is a package providing packet filtering capabilities for a variety +of operating systems. On a properly setup system, it can be used to build a +firewall. .SH SEE ALSO -ipf(8), ipf(1), ipf(5), ipnat(1), ipnat(5) +ipf(8), ipf(1), ipf(5), ipnat(1), ipnat(5), mkfilters(1) diff --git a/contrib/ipfilter/man/ipfstat.8 b/contrib/ipfilter/man/ipfstat.8 index eff21d3..89adb85 100644 --- a/contrib/ipfilter/man/ipfstat.8 +++ b/contrib/ipfilter/man/ipfstat.8 @@ -1,10 +1,11 @@ +.\" $FreeBSD$ .TH ipfstat 8 .SH NAME ipfstat \- reports on packet filter statistics and filter list .SH SYNOPSIS .B ipfstat [ -.B \-aAfhIinosv +.B \-aAfghIinosv ] [ .B \-d <device> @@ -34,6 +35,9 @@ Use a device other than \fB/dev/ipl\fP for interfacing with the kernel. Show fragment state information (statistics) and held state information (in the kernel) if any is present. .TP +.B \-g +Show groups currently configured (both active and inactive). +.TP .B \-h Show per-rule the number of times each one scores a "hit". For use in combination with \fB\-i\fP. diff --git a/contrib/ipfilter/man/ipmon.8 b/contrib/ipfilter/man/ipmon.8 index 82898e1..b8b42a3 100644 --- a/contrib/ipfilter/man/ipmon.8 +++ b/contrib/ipfilter/man/ipmon.8 @@ -1,3 +1,4 @@ +.\" $FreeBSD$ .TH ipmon 8 .SH NAME ipmon \- monitors /dev/ipl for logged packets @@ -28,6 +29,46 @@ default or a filename, if given on the command line. Should the \fB\-s\fP option be used, output is instead sent to \fBsyslogd(8)\fP. Messages sent via syslog have the day, month and year removed from the message, but the time (including microseconds), as recorded in the log, is still included. +.LP +Messages generated by ipmon consist of whitespace separated fields. +Fields common to all messages are: +.LP +1. The date of packet receipt. This is suppressed when the message is +sent to syslog. +.LP +2. The time of packet receipt. This is in the form HH:MM:SS.F, for hours, +minutes seconds, and fractions of a second (which can be several digits +long). +.LP +3. The name of the interface the packet was processed on, e.g., \fBwe1\fP. +.LP +4. The group and rule number of the rule, e.g., \fB@0:17\fP. These can be +viewed with \fBipfstat -n\fP. +.LP +5. The action: \fBp\fP for passed or \fBb\fP for blocked. +.LP +6. The addresses. +This is actually three fields: the source address and port +(separted by a comma), the \fB->\fP symbol, and the destination address +and port. E.g.: \fB209.53.17.22,80 -> 198.73.220.17,1722\fP. +.LP +7. \fBPR\fP followed by the protocol name or number, e.g., \fBPR tcp\fP. +.LP +8. \fBlen\fP followed by the header length and total length of the packet, +e.g., \fBlen 20 40\fP. +.LP +If the packet is a TCP packet, there will be an additional field starting +with a hyphen followed by letters corresponding to any flags that were set. +See the ipf.conf manual page for a list of letters and their flags. +.LP +If the packet is an ICMP packet, there will be two fields at the end, +the first always being `icmp', and the next being the ICMP message and +submessage type, separated by a slash, e.g., \fBicmp 3/3\fP for a port +unreachable message. +.LP +In order for \fBipmon\fP to properly work, the kernel option +\fBIPFILTER_LOG\fP must be turned on in your kernel. Please see +\fBoptions(4)\fP for more details. .SH OPTIONS .TP .B \-a @@ -61,7 +102,12 @@ as for \fB-o\fP. .TP .B \-s Packet information read in will be sent through syslogd rather than -saved to a file. The following levels are used: +saved to a file. The default facility when compiled and installed is +\fBlocal0\fP. The following levels are used: +.TP +.B "\-S <device>" +Set the logfile to be opened for reading state log records from to <device>. +.TP .IP .B LOG_INFO \- packets logged using the "log" keyword as the action rather @@ -77,12 +123,12 @@ than pass or block. \- packets which have been logged and which can be considered "short". .TP -.B "\-S <device>" -Set the logfile to be opened for reading state log records from to <device>. -.TP .B \-t read the input file/device in a manner akin to tail(1). .TP +.B \-v +show tcp window, ack and sequence fields. +.TP .B \-x show the packet data in hex. .TP diff --git a/contrib/ipfilter/man/ipnat.4 b/contrib/ipfilter/man/ipnat.4 index 646c339..cde2639 100644 --- a/contrib/ipfilter/man/ipnat.4 +++ b/contrib/ipfilter/man/ipnat.4 @@ -1,3 +1,4 @@ +.\" $FreeBSD$ .TH IPNAT 4 .SH NAME ipnat \- Network Address Translation kernel interface @@ -65,7 +66,7 @@ Recognised values for in_redir: .PP .LP \fBNAT statistics\fP -Statistics on the the number of packets mapped, going in and out are kept, +Statistics on the number of packets mapped, going in and out are kept, the number of times a new entry is added and deleted (through expiration) to the NAT table and the current usage level of the NAT table. .PP |