# Actions: Firewall

install4j BeanInfo catalog. Each entry below documents a bean class that can appear inside a `<serializedBean>` element in an install4j project file.

## Contents

- [Add a Windows firewall rule](#add-a-windows-firewall-rule) — `com.install4j.runtime.beans.actions.firewall.AddWindowsFirewallRuleAction`

---

### Add a Windows firewall rule
- **Class:** `com.install4j.runtime.beans.actions.firewall.AddWindowsFirewallRuleAction`
- **Category:** HTTP and network
- **Multiple instances:** yes

Add a Windows firewall rule. This action will be automatically reverted by the 'Uninstall files' action.

| Property | Type | Category | Visible when | Description |
|---|---|---|---|---|
| `direction` — Direction | [WindowsFirewallDirection](enums.md#windowsfirewalldirection) | General | — | If the rule should be created for incoming or outgoing traffic. |
| `launcherId` — Launcher | String [context=launcherOrOther] | General | — | The launcher that the rule will be created for. |
| `executablePath` — Executable path | String | General | `launcherId` (custom condition) | The executable path. |
| `ruleName` — Rule name | String | General | — | The name of the firewall rule. This is displayed in the Windows management console. |
| `description` — Description | String | General | — | An optional description of the rule. This is displayed in the Windows management console. |
| `group` — Group | String | General | — | An optional group name of the rule. This is displayed in the Windows management console. |
| `protocol` — Protocol | [WindowsFirewallProtocol](enums.md#windowsfirewallprotocol) | Ports and Addresses | — | The network protocol for the rule. |
| `localPorts` — Local Ports | String | Ports and Addresses | — | A list of port numbers or port ranges separated by commas.Example: 80, 8080, 5000-5100 |
| `localAddresses` — Local IP Addresses | String | Ports and Addresses | — | One or more comma-delimited tokens specifying the local addresses from which the application can listen for traffic. Valid tokens include:"*" indicates any local address. If present, this must be the only token included.A valid IPv4 or IPv6 address.A subnet can be specified using either the subnet mask or network prefix notation. If neither a subnet mask not a network prefix is specified, the subnet mask defaults to 255.255.255.255.An IPv4 or IPv6 address range in the format of "start address - end address" with no spaces included. |
| `remotePorts` — Remote Ports | String | Ports and Addresses | — | A list of port numbers or port ranges separated by commas.Example: 80, 8080, 5000-5100 |
| `remoteAddresses` — Remote IP Addresses | String | Ports and Addresses | — | One or more comma-delimited tokens specifying the remote addresses from which the application can listen for traffic. Valid tokens include:"*" indicates any remote address. If present, this must be the only token included.A valid IPv4 or IPv6 address.A subnet can be specified using either the subnet mask or network prefix notation. If neither a subnet mask not a network prefix is specified, the subnet mask defaults to 255.255.255.255.An IPv4 or IPv6 address range in the format of "start address - end address" with no spaces included."Defaultgateway""DHCP""DNS""WINS""LocalSubnet" indicates any local address on the local subnet. This token is not case-sensitive. |
| `domainProfile` — Domain Profile | boolean | Profiles | — | Add rule to the domain profile. The domain profile applies to networks where the host system can authenticate to a domain controller. |
| `privateProfile` — Private Profile | boolean | Profiles | — | Add rule to the private profile. The private profile is a user-assigned profile and is used to designate private or home networks. |
| `publicProfile` — Public Profile | boolean | Profiles | — | Add rule to the public profile. The public profile is used to designate public networks such as Wi-Fi hotspots at coffee shops, airports, and other locations. This is the default profile. |
| `avoidPublicProfile` — Avoid Public Profile | boolean | Profiles | `publicProfile`=true | Only add rule to the public profile if the public profile is the only currently active profile. |
| `onlyActiveProfiles` — Only Currently Active Profiles | boolean | Profiles | — | Only add rules to the currently active profiles. |

