You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -272,10 +272,13 @@ class profile::apache {
272
272
273
273
### Rule inversion
274
274
275
-
Firewall rules may be inverted by prefixing the value of a parameter by "! ". If the value is an array, then the first value of the array must be prefixed in order to invert them all.
275
+
Firewall rules may be inverted by prefixing the value of a parameter by "! ".
276
276
277
277
Parameters that understand inversion are: connmark, ctstate, destination, dport, dst\_range, dst\_type, iniface, outiface, port, proto, source, sport, src\_range and src\_type.
278
278
279
+
If the value is an array, then either the first value of the array, or all of its values must be prefixed in order to invert them all.
280
+
For most array attributes it is not possible to invert only one passed value.
281
+
279
282
Examples:
280
283
281
284
```puppet
@@ -295,7 +298,7 @@ firewall { '002 drop NEW external website packets with FIN/RST/ACK set and SYN u
295
298
}
296
299
```
297
300
298
-
There are exceptions to this however, with attributes such as src\_type, dst\_type and ipset allowing the user to negate any passed values seperately.
301
+
There are exceptions to this however, with attributes such as src\_type, dst\_type and ipset allowing the user to negate each passed values seperately.
# `stat_mode` must be set to `random` for `stat_probability` to be set
763
760
raiseArgumentError,'`stat_mode` must be set to `random` for `stat_probability` to be set.'ifshould[:stat_probability] && should[:stat_mode] != 'random'
764
761
765
-
# Verify that if dport/sport/state/ctstate/ctstatus is passed as an array, that only the first value is negated
762
+
# Verify that if dport/sport/state/ctstate/ctstatus is passed as an array, that any negation includes either the first value or al values
raiseArgumentError,"Only the first value in a `#{key}` array must be negated in order to negate the combined values."ifindex >= 1&&value.to_s.match(%r{^!})
765
+
negated_values=0
766
+
should[key].eachdo |value|
767
+
negated_values += 1ifvalue.to_s.match(%r{^!\s})
771
768
end
769
+
raiseArgumentError,"When negating a `#{key}` array, you must negate either the first given value only or all the given values."if(negated_values == 1 && !should[key][0].to_s.match(%r{^!\s})) ||
raiseArgumentError,'Value `any` is not valid. This behaviour should be achieved by omitting or undefining the ICMP parameter.'ifshould[:icmp] && should[:icmp] == 'any'
774
773
raiseArgumentError,'`burst` cannot be set without `limit`.'ifshould[:burst] && !(should[:limit])
0 commit comments