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
+15-13Lines changed: 15 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -101,11 +101,12 @@ The most basic use involves two resources, `firewall` and `firewall_rule`. The
101
101
typical usage scenario is as follows:
102
102
103
103
* declare the `firewall` resource named `'default'`, which installs appropriate packages and configures services to start on boot and starts them.
104
-
* run the `:create` action on every `firewall_rule` resource, which routes to the selected backend resource. How the rules are implemented depends on the firewall backend:
105
-
***firewalld**: `firewall_rule` creates firewalld [rich rules](https://firewalld.org/documentation/man-pages/firewalld.richlanguage.html) in the system's default zone.
104
+
* run the `:create` action on every `firewall_rule` resource, which routes to the selected backend rule resource. How the rules are implemented depends on the firewall backend:
105
+
***firewalld**: `firewall_rule`routes to `firewalld_rule`, which creates firewalld [rich rules](https://firewalld.org/documentation/man-pages/firewalld.richlanguage.html) in the system's default zone.
106
106
***nftables**: `firewall_rule` routes to `nftables_rule`.
107
-
***iptables, ufw, windows**: `firewall_rule` routes to the matching backend rule resource, which automatically sends a delayed notification to the `firewall['default']` resource to run the `:restart` action.
108
-
* when the delayed `:restart` notification on the `firewall` resource fires, if any rules are different than the last run, the provider will update the current state of the firewall rules to match the expected rules.
107
+
***iptables, ufw, windows**: `firewall_rule` routes to the matching backend rule resource.
108
+
* backend rule resources notify their matching backend resource, such as `iptables['default']`, `ufw['default']`, `nftables['default']`, or `windows_firewall['default']`, to rebuild delayed.
109
+
* when the delayed backend rebuild fires, if any rules are different than the last run, the backend resource updates the current firewall rules to match the expected rules.
109
110
110
111
There is a fundamental mismatch between the idea of a Chef action and the action that should be taken on a firewall
111
112
rule. For this reason, the Chef action for a `firewall_rule` may be `:create` (the rule should be present in the
@@ -159,9 +160,10 @@ Please read the documentation for the
159
160
## firewalld
160
161
161
162
For most rules it's sufficient to simply use the `firewall_rule` resource which is a platform-agnostic way to add
162
-
firewall rules. On firewalld systems it adds rules to the default zone as firewalld [rich
163
-
rules](https://firewalld.org/documentation/man-pages/firewalld.richlanguage.html). See the
164
-
[`firewall_rule`](#firewall_rule) section for examples.
163
+
firewall rules. On firewalld systems it routes to `firewalld_rule`, which adds rules to the default zone as firewalld
164
+
[rich rules](https://firewalld.org/documentation/man-pages/firewalld.richlanguage.html). Use `firewalld_rule`
165
+
directly when you want the portable firewalld rule interface, and use `firewalld_rich_rule` when you want to pass
166
+
native rich-rule properties.
165
167
166
168
See the [`firewalld` resources](documentation/README.md) documentation for advanced firewalld configuration.
167
169
@@ -178,7 +180,7 @@ recipe and attribute API.
178
180
Declare this resource before adding your desired `firewall_rule` resources. See
179
181
the [`firewall_rule`](#firewall_rule) section for examples.
180
182
181
-
***NB***: The name 'default' of this resource is important as it is used for firewall_rule providers to locate the firewall resource. If you change it, you must also supply the same value to any firewall_rule resources using the `firewall_name` parameter.
183
+
***NB***: The name 'default' of this resource is important as it is used for `firewall_rule`to locate the matching backend resource. If you change it, you must also supply the same value to any `firewall_rule` resources using the `firewall_name` parameter.
182
184
183
185
#### Actions
184
186
@@ -220,7 +222,7 @@ end
220
222
221
223
#### Actions
222
224
223
-
*`:create`: Create the firewall rule and notify the firewall to reload after the rule has been saved. On firewalld systems, the rules are added to the default zone as firewalld [rich rules](https://firewalld.org/documentation/man-pages/firewalld.richlanguage.html).
225
+
*`:create`: Create the firewall rule through the selected backend rule resource. On firewalld systems, rules are routed through `firewalld_rule` and added to the default zone as firewalld [rich rules](https://firewalld.org/documentation/man-pages/firewalld.richlanguage.html).
notify_firewall true, false#Notify selected backend to apply rules. Default: true
251
253
program String# Firewall: windows
252
254
service String# Firewall: windows
253
255
end
254
256
```
255
257
256
258
Firewall-agnostic properties that can be used with `firewall_rule` on any firewall system:
257
259
258
-
*`firewall_name`: the matching firewallresource that this rule applies to. Default value: `default`
260
+
*`firewall_name`: the matching `firewall` facade and backend resource name that this rule applies to. Default value: `default`
259
261
*`description` (*default: same as rule name*): Used to provide a comment that will be included when adding the firewall rule.
260
262
*`command`: What action to take on a particular packet
261
263
*`:allow` (*default action*): the rule should allow matching packets
@@ -287,8 +289,8 @@ Additional properties for advanced firewall rules that are tied to specific fire
287
289
*`raw` (*iptables, nftables, ufw*): Used to pass an entire rule as a string, omitting all other parameters. This line will be directly loaded by `iptables-restore`, included in the nftables ruleset, or fed directly into `ufw` on the command line.
288
290
*`direction` (*iptables, nftables, ufw, windows*): Direction of the rule. Valid values are: `:in` (*default*), `:out`, `:pre`,
289
291
`:post`.
290
-
*`notify_firewall` (*iptables, nftables, ufw, windows*): Notify the firewall to recalculate (and potentially reapply) the
291
-
`firewall_rule`(s) it finds. Default: `true`
292
+
*`notify_firewall` (*iptables, nftables, ufw, windows*): Notify the selected backend resource to recalculate (and
293
+
potentially reapply) the `firewall_rule`(s) it finds. Default: `true`
0 commit comments