-
Notifications
You must be signed in to change notification settings - Fork 0
/
Carbon_FirewallRule.html
263 lines (238 loc) · 10.6 KB
/
Carbon_FirewallRule.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>PowerShell - Carbon_FirewallRule - Carbon</title>
<link href="silk.css" type="text/css" rel="stylesheet" />
<link href="styles.css" type="text/css" rel="stylesheet" />
</head>
<body>
<ul id="SiteNav">
<li><a href="index.html">Get-Carbon</a></li>
<li><a href="about_Carbon_Installation.html">-Install</a></li>
<li><a href="documentation.html">-Documentation</a></li>
<li><a href="about_Carbon_Support.html">-Support</a></li>
<li><a href="releasenotes.html">-ReleaseNotes</a></li>
<li><a href="http://pshdo.com">-Blog</a></li>
<li><a href="https://github.com/webmd-health-services/Carbon/">-Project</a></li>
</ul>
<h1>Carbon_FirewallRule</h1>
<div class="Synopsis">
<p>DSC resource for managing firewall rules.</p>
</div>
<h2>Syntax</h2>
<pre class="Syntax"><code>Carbon_FirewallRule [String] #ResourceName
{
Name = [string]
[Action = [string]{ Allow | Block | Bypass }]
[DependsOn = [string[]]]
[Description = [string]]
[Direction = [string]{ In | Out }]
[EdgeTraversalPolicy = [string]{ DeferApp | DeferUser | No | Yes }]
[Enabled = [bool]]
[Ensure = [string]{ Absent | Present }]
[InterfaceType = [string]{ Any | LAN | RAS | Wireless }]
[LocalIPAddress = [string]]
[LocalPort = [string]]
[Profile = [string[]]]
[Program = [string]]
[Protocol = [string]]
[PsDscRunAsCredential = [PSCredential]]
[RemoteIPAddress = [string]]
[RemotePort = [string]]
[Security = [string]{ AuthDynEnc | AuthEnc | Authenticate | AuthNoEncap | NotRequired }]
[Service = [string]]
}
</code></pre>
<h2>Description</h2>
<div class="Description">
<p>The <code>Carbon_FirewallRule</code> resource manages firewall rules. It uses the <code>netsh advfirewall firewall</code> command. Please see <a href="http://technet.microsoft.com/en-us/library/dd734783.aspx">Netsh AdvFirewall Firewall Commands</a> or run <code>netsh advfirewall firewall set rule</code> for documentation on how to configure the firewall.</p>
<p>When modifying existing rules, only properties you pass are updated/changed. All other properties are left as-is.</p>
<p><code>Carbon_FirewallRule</code> is new in Carbon 2.0.</p>
</div>
<h2>Related Commands</h2>
<ul class="RelatedCommands">
<li><a href="Get-FirewallRule.html">Get-FirewallRule</a></li>
<li><a href="http://technet.microsoft.com/en-us/library/dd734783.aspx">http://technet.microsoft.com/en-us/library/dd734783.aspx</a></li>
</ul>
<h2> Parameters </h2>
<table id="Parameters">
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Required?</th>
<th>Pipeline Input</th>
<th>Default Value</th>
</tr>
<tr valign='top'>
<td>Name</td>
<td><a href="http://msdn.microsoft.com/en-us/library/system.string.aspx">String</a></td>
<td class="ParamDescription"><p>The name of the rule.</p></td>
<td>true</td>
<td>false</td>
<td></td>
</tr>
<tr valign='top'>
<td>Enabled</td>
<td><a href="http://msdn.microsoft.com/en-us/library/system.boolean.aspx">Boolean</a></td>
<td class="ParamDescription"><p>If <code>$true</code>, the rule is enabled. If <code>$false</code>, the rule is disabled.</p></td>
<td>false</td>
<td>false</td>
<td>True</td>
</tr>
<tr valign='top'>
<td>Direction</td>
<td><a href="http://msdn.microsoft.com/en-us/library/system.string.aspx">String</a></td>
<td class="ParamDescription"><p>If set to <code>In</code>, the rule applies to inbound network traffic. If set to <code>Out</code>, the rule applies to outbound traffic.</p></td>
<td>false</td>
<td>false</td>
<td></td>
</tr>
<tr valign='top'>
<td>Profile</td>
<td><a href="http://msdn.microsoft.com/en-us/library/system.string.aspx">String[]</a></td>
<td class="ParamDescription"><p>Specifies the profile(s) to which the firewall rule is assigned. The rule is active on the local computer only when the specified profile is currently active. Valid values are <code>Any</code>, <code>Domain</code>, <code>Public</code>, and <code>Private</code>.</p></td>
<td>false</td>
<td>false</td>
<td></td>
</tr>
<tr valign='top'>
<td>LocalIPAddress</td>
<td><a href="http://msdn.microsoft.com/en-us/library/system.string.aspx">String</a></td>
<td class="ParamDescription"><p>The local IP addresses the rule applies to. Valid values are <code>any</code>, an exact IPv4 or IPv6 address, a subnet mask (e.g. 192.168.0.0/24), or a range. Separate each value with a comma; no spaces.</p></td>
<td>false</td>
<td>false</td>
<td></td>
</tr>
<tr valign='top'>
<td>LocalPort</td>
<td><a href="http://msdn.microsoft.com/en-us/library/system.string.aspx">String</a></td>
<td class="ParamDescription"><p>The local port the rule applies to. Valid values are a specific port number, a range of port numbers (e.g. <code>5000-5010</code>), a comma-separate list of numbers and ranges, <code>any</code>, <code>rpc</code>, <code>rpc-epmap</code>, <code>Teredo</code>, and <code>iphttps</code>.</p></td>
<td>false</td>
<td>false</td>
<td></td>
</tr>
<tr valign='top'>
<td>RemoteIPAddress</td>
<td><a href="http://msdn.microsoft.com/en-us/library/system.string.aspx">String</a></td>
<td class="ParamDescription"><p>The remote IP addresses the rules applies to. Valid values are <code>any</code>, an exact IPv4 or IPv6 address, a subnet mask (e.g. 192.168.0.0/24), or a range. Separate each value with a comma; no spaces.</p></td>
<td>false</td>
<td>false</td>
<td></td>
</tr>
<tr valign='top'>
<td>RemotePort</td>
<td><a href="http://msdn.microsoft.com/en-us/library/system.string.aspx">String</a></td>
<td class="ParamDescription"><p>The remote port the rule applies to. Valid values are a specific port number, a range of port numbers (e.g. <code>5000-5010</code>), a comma-separate list of numbers and ranges, <code>any</code>, <code>rpc</code>, <code>rpc-epmap</code>, <code>Teredo</code>, and <code>iphttps</code>.</p></td>
<td>false</td>
<td>false</td>
<td></td>
</tr>
<tr valign='top'>
<td>Protocol</td>
<td><a href="http://msdn.microsoft.com/en-us/library/system.string.aspx">String</a></td>
<td class="ParamDescription"><p>The protocol the rule applies to. Valid values are <code>any</code>, the protocol number, <code>icmpv4</code>, <code>icmpv6',</code>icmpv4:type,code<code>,</code>icmpv6:type,code<code>,</code>tcp<code>, or</code>udp`. Separate multiple values with a comma; no spaces.</p></td>
<td>false</td>
<td>false</td>
<td></td>
</tr>
<tr valign='top'>
<td>EdgeTraversalPolicy</td>
<td><a href="http://msdn.microsoft.com/en-us/library/system.string.aspx">String</a></td>
<td class="ParamDescription"><p>For inbound rules, specifies that traffic that traverses an edge device, such as a Network Address Translation (NAT) enabled router, between the local and remote computer matches this rule. Valid values are <code>any</code>, <code>deferapp</code>, <code>deferuse</code>, or <code>no</code>.</p></td>
<td>false</td>
<td>false</td>
<td></td>
</tr>
<tr valign='top'>
<td>Action</td>
<td><a href="http://msdn.microsoft.com/en-us/library/system.string.aspx">String</a></td>
<td class="ParamDescription"><p>Specifies what to do when packets match the rule. Valid values are <code>Allow</code>, <code>Block</code>, or <code>Bypass</code>.</p></td>
<td>false</td>
<td>false</td>
<td></td>
</tr>
<tr valign='top'>
<td>InterfaceType</td>
<td><a href="http://msdn.microsoft.com/en-us/library/system.string.aspx">String</a></td>
<td class="ParamDescription"><p>Specifies that only network packets passing through the indicated interface types match this rule. Valid values are <code>Any</code>, <code>Wireless</code>, <code>LAN</code>, or <code>RAS</code>.</p></td>
<td>false</td>
<td>false</td>
<td></td>
</tr>
<tr valign='top'>
<td>Security</td>
<td><a href="http://msdn.microsoft.com/en-us/library/system.string.aspx">String</a></td>
<td class="ParamDescription"><p>Specifies that only network packets protected with the specified type of IPsec options match this rule. Valid values are <code>NotRequired</code>, <code>Authenticate</code>, <code>AuthEnc</code>, <code>AuthDynEnc</code>, or <code>AuthNoEncap</code>.</p></td>
<td>false</td>
<td>false</td>
<td></td>
</tr>
<tr valign='top'>
<td>Description</td>
<td><a href="http://msdn.microsoft.com/en-us/library/system.string.aspx">String</a></td>
<td class="ParamDescription"><p>A description of the rule.</p></td>
<td>false</td>
<td>false</td>
<td></td>
</tr>
<tr valign='top'>
<td>Program</td>
<td><a href="http://msdn.microsoft.com/en-us/library/system.string.aspx">String</a></td>
<td class="ParamDescription"><p>Specifies that network traffic generated by the identified executable program matches this rule.</p></td>
<td>false</td>
<td>false</td>
<td></td>
</tr>
<tr valign='top'>
<td>Service</td>
<td><a href="http://msdn.microsoft.com/en-us/library/system.string.aspx">String</a></td>
<td class="ParamDescription"><p>Specifies that traffic generated by the identified service matches this rule. The ServiceShortName for a service can be found in Services MMC snap-in, by right-clicking the service, selecting Properties, and examining Service Name.</p></td>
<td>false</td>
<td>false</td>
<td></td>
</tr>
<tr valign='top'>
<td>Ensure</td>
<td><a href="http://msdn.microsoft.com/en-us/library/system.string.aspx">String</a></td>
<td class="ParamDescription"><p>Set to <code>Present</code> to create the fireall rule. Set to <code>Absent</code> to delete it.</p></td>
<td>false</td>
<td>false</td>
<td>Present</td>
</tr>
</table>
<h2>EXAMPLE 1</h2>
<p>Demonstrates how to enable a firewall rule.</p>
<pre><code>Carbon_FirewallRule EnableHttpIn
{
Name = 'World Wide Web Services (HTTP Traffic-In)'
Enabled = $true;
Ensure = 'Present'
}
</code></pre>
<h2>EXAMPLE 2</h2>
<p>Demonstrates how to delete a firewall rule.</p>
<pre><code>Carbon_FirewallRule DeleteMyRule
{
Name = 'MyCustomRule';
Ensure = 'Absent';
}
</code></pre>
<p>There may be multiple rules with the same name, so we recommend disabling rules instead.</p>
<h2>EXAMPLE 3</h2>
<p>Demonstrates how to create/modify an incoming firewall rule.</p>
<pre><code>Carbon_FirewallRule MyAppPorts
{
Name = 'My App Ports';
Action = 'Allow';
Direction = 'In';
Protocol = 'tcp';
LocalPort = '8080,8180';
Ensure = 'Present';
}
</code></pre>
<div class="Footer">
Copyright 2012 - 2018 <a href="http://pshdo.com">Aaron Jensen</a>.
</div>
</body>
</html>