⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shorewall-rules.5

📁 sharewall is very good
💻 5
📖 第 1 页 / 共 3 页
字号:
The name of a macro defined in a file named macro\&.\fImacro\fR\&. If the macro accepts an action parameter (Look at the macro source to see if it has PARAM in the TARGET column) then the\fImacro\fRname is followed by the parenthesized\fItarget\fR(\fBACCEPT\fR,\fBDROP\fR,\fBREJECT\fR, \&.\&.\&.) to be substituted for the parameter\&..spExample: FTP(ACCEPT)\&..spThe older syntax where the macro name and the target are separated by a slash (e\&.g\&. FTP/ACCEPT) is still allowed but is deprecated\&..spThe\fBACTION\fRmay optionally be followed by ":" and a syslog log level (e\&.g, REJECT:info or DNAT:debug)\&. This causes the packet to be logged at the specified level\&. Note that if the\fBACTION\fRinvolves destination network address translation (DNAT, REDIRECT, SAME, etc\&.) then the packet is logged\fBbefore\fRthe destination address is rewritten\&..spIf the\fBACTION\fRnames an\fIaction\fRdeclared in\m[blue]\fBshorewall\-actions\fR\m[]\&\s-2\u[5]\d\s+2(5) or in /usr/share/shorewall/actions\&.std then:.sp.RS 4.ie n \{\\h'-04'\(bu\h'+03'\c.\}.el \{\.sp -1.IP \(bu 2.3.\}If the log level is followed by "!\' then all rules in the action are logged at the log level\&..RE.sp.RS 4.ie n \{\\h'-04'\(bu\h'+03'\c.\}.el \{\.sp -1.IP \(bu 2.3.\}If the log level is not followed by "!" then only those rules in the action that do not specify logging are logged at the specified level\&..RE.sp.RS 4.ie n \{\\h'-04'\(bu\h'+03'\c.\}.el \{\.sp -1.IP \(bu 2.3.\}The special log level\fBnone!\fRsuppresses logging by the action\&..RE.RS 4You may also specify\fBULOG\fRor\fBNFLOG\fR(must be in upper case) as a log level\&.This will log to the ULOG or NFLOG target for routing to a separate log through use of ulogd (\m[blue]\fBhttp://www\&.netfilter\&.org/projects/ulogd/index\&.html\fR\m[])\&..spActions specifying logging may be followed by a log tag (a string of alphanumeric characters) which is appended to the string generated by the LOGPREFIX (in\m[blue]\fBshorewall\&.conf\fR\m[]\&\s-2\u[2]\d\s+2(5))\&..spExample: ACCEPT:info:ftp would include \'ftp \' at the end of the log prefix generated by the LOGPREFIX setting\&..RE.RE.PP\fBSOURCE\fR \- {\fIzone\fR|\fBall\fR[\fB+\fR][\fB\-\fR]}\fB[:\fR\fIinterface\fR][\fB:\fR{\fIaddress\-or\-range\fR[,\fIaddress\-or\-range\fR]\&.\&.\&.[\fIexclusion\fR]|\fIexclusion\fR|\fB+\fR\fIipset\fR}.RS 4Source hosts to which the rule applies\&. May be a zone declared in /etc/shorewall/zones,\fB$FW\fRto indicate the firewall itself,\fBall\fR,\fBall+\fR,\fBall\-\fR,\fBall+\-\fRor\fBnone\fR\&..spWhen\fBnone\fRis used either in the\fBSOURCE\fRor\fBDEST\fRcolumn, the rule is ignored\&..sp\fBall\fRmeans "All Zones", including the firewall itself\&.\fBall\-\fRmeans "All Zones, except the firewall itself"\&. When\fBall\fR[\fB\-\fR] is used either in the\fBSOURCE\fRor\fBDEST\fRcolumn intra\-zone traffic is not affected\&. When\fBall+\fR[\fB\-\fR] is "used, intra\-zone traffic is affected\&..spExcept when\fBall\fR[\fB+\fR][\fB\-\fR] is specified, clients may be further restricted to a list of networks and/or hosts by appending ":" and a comma\-separated list of network and/or host addresses\&. Hosts may be specified by IP or MAC address; mac addresses must begin with "~" and must use "\-" as a separator\&..spHosts may also be specified as an IP address range using the syntax\fIlowaddress\fR\-\fIhighaddress\fR\&. This requires that your kernel and iptables contain iprange match support\&. If your kernel and iptables have ipset match support then you may give the name of an ipset prefaced by "+"\&. The ipset name may be optionally followed by a number from 1 to 6 enclosed in square brackets ([]) to indicate the number of levels of source bindings to be matched\&..spYou may exclude certain hosts from the set already defined through use of an\fIexclusion\fR(see\m[blue]\fBshorewall\-exclusion\fR\m[]\&\s-2\u[6]\d\s+2(5))\&..spExamples:.PPdmz:192\&.168\&.2\&.2.RS 4Host 192\&.168\&.2\&.2 in the DMZ.RE.PPnet:155\&.186\&.235\&.0/24.RS 4Subnet 155\&.186\&.235\&.0/24 on the Internet.RE.PPloc:192\&.168\&.1\&.1,192\&.168\&.1\&.2.RS 4Hosts 192\&.168\&.1\&.1 and 192\&.168\&.1\&.2 in the local zone\&..RE.PPloc:~00\-A0\-C9\-15\-39\-78.RS 4Host in the local zone with MAC address 00:A0:C9:15:39:78\&..RE.PPnet:192\&.0\&.2\&.11\-192\&.0\&.2\&.17.RS 4Hosts 192\&.0\&.2\&.11\-192\&.0\&.2\&.17 in the net zone\&..RE.PPnet:!192\&.0\&.2\&.11\-192\&.0\&.2\&.17.RS 4All hosts in the net zone except for 192\&.0\&.2\&.11\-192\&.0\&.2\&.17\&..RE.PPnet:155\&.186\&.235\&.0/24!155\&.186\&.235\&.16/28.RS 4Subnet 155\&.186\&.235\&.0/24 on the Internet except for 155\&.186\&.235\&.16/28.RE.spAlternatively, clients may be specified by interface by appending ":" to the zone name followed by the interface name\&. For example,\fBloc:eth1\fRspecifies a client that communicates with the firewall system through eth1\&. This may be optionally followed by another colon (":") and an IP/MAC/subnet address as described above (e\&.g\&.,\fBloc:eth1:192\&.168\&.1\&.5\fR)\&..spIt is important to note that when\fBusing Shorewall\-shell\fRand specifying an address list that will be split (i\&.e\&., a comma separated list), there is a subtle behavior which has the potential to cause confusion\&. Consider the two examples below:Examples:.PPloc:eth1:192\&.168\&.1\&.3,192\&.168\&.1\&.5.RS 4Hosts 192\&.168\&.1\&.3 and 192\&.168\&.1\&.5 in the Local zone, with 192\&.168\&.1\&.3 coming from eth1 and 192\&.168\&.1\&.5 originating from any interface in the zone\&..RE.PPloc:eth1:192\&.168\&.1\&.3,eth1:192\&.168\&.1\&.5.RS 4Hosts 192\&.168\&.1\&.3 and 192\&.168\&.1\&.5 in the Local zone, with\fBboth\fRoriginating from eth1\&..RE.spThat is, the interface name must be explicitly stated for each member of the comma separated list\&. Again, this distinction in behavior only occurs when\fBusing Shorewall\-shell\fR\&..RE.PP\fBDEST\fR \- {\fIzone\fR|\fBall\fR[\fB+\fR][\fB\-\fR]}\fB[:{\fR\fIinterface\fR|\fIaddress\-or\-range\fR[,\fIaddress\-or\-range\fR]\&.\&.\&.[\fIexclusion\fR]|\fIexclusion\fR|\fB+\fR\fIipset\fR}][\fB:\fR\fIport\fR[:\fBrandom\fR]].RS 4Location of Server\&. May be a zone declared in\m[blue]\fBshorewall\-zones\fR\m[]\&\s-2\u[3]\d\s+2(5), $\fBFW\fRto indicate the firewall itself,\fBall\fR\&.\fBall+\fRor\fBnone\fR\&..spWhen\fBnone\fRis used either in the\fBSOURCE\fRor\fBDEST\fRcolumn, the rule is ignored\&..spWhen\fBall\fRis used either in the\fBSOURCE\fRor\fBDEST\fRcolumn intra\-zone traffic is not affected\&. When\fBall+\fRis used, intra\-zone traffic is affected\&..spBeginning with Shorewall 4\&.1\&.4, the\fIzone\fRshould be omitted in DNAT\-, REDIRECT\- and NONAT rules\&..spIf the DEST\fIzone\fRis a bport zone, then either:.sp.RS 4.ie n \{\\h'-04' 1.\h'+01'\c.\}.el \{\.sp -1.IP "  1." 4.2.\}the SOURCE must be\fBall[+][\-]\fR, or.RE.sp.RS 4.ie n \{\\h'-04' 2.\h'+01'\c.\}.el \{\.sp -1.IP "  2." 4.2.\}the SOURCE\fIzone\fRmust be another bport zone associated with the same bridge, or.RE.sp.RS 4.ie n \{\\h'-04' 3.\h'+01'\c.\}.el \{\.sp -1.IP "  3." 4.2.\}the SOURCE\fIzone\fRmust be an ipv4 zone that is associated with only the same bridge\&..RE.RS 4.spExcept when\fBall\fR[\fB+]|[\-\fR] is specified, the server may be further restricted to a particular network, host or interface by appending ":" and the network, host or interface\&. See\fBSOURCE\fRabove\&..spYou may exclude certain hosts from the set already defined through use of an\fIexclusion\fR(see\m[blue]\fBshorewall\-exclusion\fR\m[]\&\s-2\u[6]\d\s+2(5))\&..spRestrictions:.sp1\&. MAC addresses are not allowed (this is a Netfilter restriction)\&..sp2\&.Prior to Shorewall 4\&.1\&.4, only IP addresses are allowed in\fBDNAT\fRrules; no DNS names are permitted\&. In no case may a network be specified as the server\&..sp3\&. You may not specify both an interface and an address\&..spLike in the\fBSOURCE\fRcolumn, you may specify a range of IP addresses using the syntax\fIlowaddress\fR\-\fIhighaddress\fR\&. When the\fBACTION\fRis\fBDNAT\fRor\fBDNAT\-\fR, the connections will be assigned to addresses in the range in a round\-robin fashion\&..spIf you kernel and iptables have ipset match support then you may give the name of an ipset prefaced by "+"\&. The ipset name may be optionally followed by a number from 1 to 6 enclosed in square brackets ([]) to indicate the number of levels of destination bindings to be matched\&. Only one of the\fBSOURCE\fRand\fBDEST\fRcolumns may specify an ipset name\&..spThe\fIport\fRthat the server is listening on may be included and separated from the server\'s IP address by ":"\&. If omitted, the firewall will not modifiy the destination port\&. A destination port may only be included if the\fBACTION\fRis\fBDNAT\fRor\fBREDIRECT\fR\&..PPExample:.RS 4\fBloc:192\&.168\&.1\&.3:3128\fRspecifies a local server at IP address 192\&.168\&.1\&.3 and listening on port 3128\&..RE.spIf you are using Shorewall\-shell or Shorewall\-perl before version 4\&.0\&.5, then the port number MUST be specified as an integer and not as a name from services(5)\&. Shorewall\-perl 4\&.0\&.5 and later permit the\fIport\fRto be specified as a service name\&. Additionally, Shorewall\-perl 4\&.0\&.5 and later permit specifying a port range in the form\fIlowport\-highport\fRto cause connections to be assigned to ports in the range in round\-robin fashion\&. When a port range is specified,\fIlowport\fRand\fIhighport\fRmust be given as integers; service names are not permitted\&. Beginning with Shorewall 4\&.0\&.6, the port range may be optionally followed by\fB:random\fRwhich causes assignment to ports in the list to be random\&..spIf the\fBACTION\fRis\fBREDIRECT\fRor\fBREDIRECT\-\fR, this column needs only to contain the port number on the firewall that the request should be redirected to\&. That is equivalent to specifying\fB$FW\fR::\fIport\fR\&..RE.PP\fBPROTO\fR (Optional) \- {\fB\-\fR|\fBtcp:syn\fR|\fBipp2p\fR|\fBipp2p:udp\fR|\fBipp2p:all\fR|\fIprotocol\-number\fR|\fIprotocol\-name\fR|\fBall}\fR.RS 4Protocol \-\fBipp2p\fR* requires ipp2p match support in your kernel and iptables\&.\fBtcp:syn\fRimplies\fBtcp\fRplus the SYN flag must be set and the RST,ACK and FIN flags must be reset\&..RE.PP\fBDEST PORT(S) \fR(Optional) \- {\fB\-\fR|\fIport\-name\-number\-or\-range\fR[\fB,\fR\fIport\-name\-number\-or\-range\fR]\&.\&.\&.}.RS 4Destination Ports\&. A comma\-separated list of Port names (from services(5)), port numbers or port ranges; if the protocol is\fBicmp\fR, this column is interpreted as the destination icmp\-type(s)\&..spIf the protocol is\fBipp2p\fR, this column is interpreted as an ipp2p option without the leading "\-\-" (example\fBbit\fRfor bit\-torrent)\&. If no port is given,\fBipp2p\fRis assumed\&..spA port range is expressed as\fIlowport\fR:\fIhighport\fR\&..spThis column is ignored if\fBPROTO\fR=\fBall\fRbut must be entered if any of the following columns are supplied\&. In that case, it is suggested that this field contain a dash (\fB\-\fR)\&..spIf your kernel contains multi\-port match support, then only a single Netfilter rule will be generated if in this list and the\fBCLIENT PORT(S)\fRlist below:.sp1\&. There are 15 or less ports listed\&..sp2\&. No port ranges are included or your kernel and iptables contain extended multiport match support\&..spOtherwise, unless you are using\m[blue]\fBShorewall\-perl\fR\m[]\&\s-2\u[7]\d\s+2, a separate rule will be generated for each port\&. Shorewall\-perl does not automatically break up lists into individual rules\&..RE.PP\fBSOURCE PORT(S)\fR (Optional) \- {\fB\-\fR|\fIport\-name\-number\-or\-range\fR[\fB,\fR\fIport\-name\-number\-or\-range\fR]\&.\&.\&.}.RS 4Port(s) used by the client\&. If omitted, any source port is acceptable\&. Specified as a comma\- separated list of port names, port numbers or port ranges\&..if n \{\.sp.\}.RS 4.BM yellow.it 1 an-trap.nr an-no-space-flag 1.nr an-break-flag 1.br.ps +1\fBWarning\fR.ps -1.brUnless you really understand IP, you should leave this column empty or place a dash (\fB\-\fR) in the column\&. Most people who try to use this column get it wrong\&..sp .5v.EM yellow.REIf you don\'t want to restrict client ports but need to specify an\fBORIGINAL DEST\fRin the next column, then place "\-" in this column\&..spIf your kernel contains multi\-port match support, then only a single Netfilter rule will be generated if in this list and the\fBDEST PORT(S)\fRlist above:.sp1\&. There are 15 or less ports listed\&..sp2\&. No port ranges are included or your kernel and iptables contain extended multiport match support\&..spOtherwise, unless you are using\m[blue]\fBShorewall\-perl\fR\m[]\&\s-2\u[7]\d\s+2, a separate rule will be generated for each port\&. Shorewall\-perl does not automatically break up lists into individual rules\&..RE.PP\fBORIGINAL DEST\fR (Optional) \- [\fB\-\fR|\fIaddress\fR[,\fIaddress\fR]\&.\&.\&.[\fIexclusion\fR]|\fIexclusion\fR].RS 4If ACTION is\fBDNAT\fR[\fB\-\fR] or\fBREDIRECT\fR[\fB\-\fR] then if this column is included and is different from the IP address given in the\fBSERVER\fRcolumn, then connections destined for that address will be forwarded to the IP and port specified in the\fBDEST\fRcolumn\&..spA comma\-separated list of addresses may also be used\&. This is most useful with the\fBREDIRECT\fRtarget where you want to redirect traffic destined for particular set of hosts\&. Finally, if the list of addresses begins with "!" (\fIexclusion\fR) then the rule will be followed only if the original destination address in the connection request does not match any of the addresses listed\&..spFor other actions, this column may be included and may contain one or more addresses (host or network) separated by commas\&. Address ranges are not allowed\&. When this column is supplied, rules are generated that require that the original destination address matches one of the listed addresses\&. This feature is most useful when you want to generate a filter rule that corresponds to a\fBDNAT\-\fRor\fBREDIRECT\-\fRrule\&. In this usage, the list of addresses should not begin with "!"\&..spIt is also possible to specify a set of addresses then exclude part of those addresses\&. For example,\fB192\&.168\&.1\&.0/24!192\&.168\&.1\&.16/28\fRspecifies the addresses 192\&.168\&.1\&.0\-182\&.168\&.1\&.15 and 192\&.168\&.1\&.32\-192\&.168\&.1\&.255\&. See\m[blue]\fBshorewall\-exclusion\fR\m[]\&\s-2\u[6]\d\s+2(5)\&..spSee\m[blue]\fBhttp://shorewall\&.net/PortKnocking\&.html\fR\m[]\&\s-2\u[8]\d\s+2for an example of using an entry in this column with a user\-defined action rule\&..RE.PP\fBRATE LIMIT\fR (Optional) \- [\fB\-\fR|\fIrate\fR\fB/\fR{\fBsec\fR|\fBmin\fR}[:\fIburst\fR].RS 4You may rate\-limit the rule by placing a value in this column:.sp\fIrate\fRis the number of connections per interval (\fBsec\fRor\fBmin\fR) and\fIburst\fRis the largest burst permitted\&. If no\fIburst\fRis given, a value of 5 is assumed\&. There may be no no whitespace embedded in the specification\&..spExample:\fB10/sec:20\fR.RE.PP\fBUSER/GROUP\fR (Optional) \- [\fB!\fR][\fIuser\-name\-or\-number\fR][\fB:\fR\fIgroup\-name\-or\-number\fR][\fB+\fR\fIprogram\-name\fR].RS 4This column may only be non\-empty if the SOURCE is the firewall itself\&..spWhen this column is non\-empty, the rule applies only if the program generating the output is running under the effective\fIuser\fRand/or\fIgroup\fRspecified (or is NOT running under that id if "!" is given)\&..spExamples:.PPjoe.RS 4program must be run by joe.RE.PP:kids.RS 4program must be run by a member of the \'kids\' group.RE.PP!:kids.RS 4program must not be run by a member of the \'kids\' group.RE.PP+upnpd.RS 4#program named upnpd.if n \{\

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -