unifi firewall
About 4706 words
Manage the zone-based firewall.
Aliases: fw
Manage the zone-based firewall, as found under Settings > Policy Engine.
Zones group networks; policies allow or block traffic from one zone to another. Groups are the address and port groups of the legacy firewall, which older rules and port forwards still refer to.
Commands
unifi firewall groups: Manage legacy firewall address and port groupsunifi firewall groups create: Create a firewall groupunifi firewall groups delete: Delete one or more firewall groupsunifi firewall groups describe: Show every field of one firewall groupunifi firewall groups edit: Edit a firewall group in your editorunifi firewall groups get: List the firewall groups, or show oneunifi firewall groups set: Change fields of a firewall groupunifi firewall policies: Manage zone-based firewall policiesunifi firewall policies create: Create a firewall policyunifi firewall policies delete: Delete one or more firewall policiesunifi firewall policies describe: Show every field of one firewall policyunifi firewall policies disable: Disable a firewall policyunifi firewall policies edit: Edit a firewall policy in your editorunifi firewall policies enable: Enable a firewall policyunifi firewall policies get: List the firewall policies, or show oneunifi firewall policies set: Change fields of a firewall policyunifi firewall zones: Manage firewall zonesunifi firewall zones create: Create a firewall zoneunifi firewall zones delete: Delete one or more firewall zonesunifi firewall zones describe: Show every field of one firewall zoneunifi firewall zones edit: Edit a firewall zone in your editorunifi firewall zones get: List the firewall zones, or show oneunifi firewall zones set: Change fields of a firewall zone
unifi firewall groups
Manage legacy firewall address and port groups.
Aliases: group
Manage the address and port groups of the legacy firewall: named lists of addresses, subnets or ports that legacy rules and port forwards refer to.
This kind is served by the controller's internal API, whose shape can change between UniFi Network versions.
unifi firewall groups create
Create a firewall group.
Usage
unifi firewall groups create <name> [flags]Create a firewall group from flags, from a file, or from both.
--set path=value sets any field; address nested fields with dots. Values are read as YAML, so 20 is a number, true a boolean and [a,b] a list. -f reads a manifest or a bare spec (-f - reads standard input); flags are applied on top of it. With a manifest that carries metadata.name, the name argument can be left out.
The quickest way to a valid spec is an existing object: unifi firewall groups get <name> --output yaml.
Examples
unifi firewall groups create Cameras --type address-group --members 192.168.20.31,192.168.20.32
unifi firewall groups create Cameras --filename firewall-groups.yaml
unifi firewall groups create Cameras -f - < spec.yamlFlags
| Flag | Description |
|---|---|
-f, --filename <file> | read the object from a manifest or spec file; - reads standard input |
--force | send fields that no object of the kind on this site has, instead of refusing them as typos |
--members <strings> | addresses, subnets or ports in the group (comma-separated) |
--set <path=value> | set a field: path=value, repeatable; the value is read as YAML, so numbers, booleans and lists like [a,b] work |
--set-stdin <path> | set the field at this path to what arrives on standard input, for secrets; on a terminal it is asked for, masked |
--type <string> | what the group holds: address-group, ipv6-address-group, port-group |
-y, --yes | do not ask for confirmation |
unifi firewall groups delete
Delete one or more firewall groups.
Usage
unifi firewall groups delete <name>... [flags]Aliases: rm
Delete one or more firewall groups after confirmation.
Every name is checked before anything is deleted, so a typo deletes nothing. Pass --yes to skip the confirmation, as scripts must. When several objects share a name, --id picks the one to delete.
Examples
unifi firewall groups delete Cameras
unifi firewall groups delete Cameras --yesFlags
| Flag | Description |
|---|---|
--id <id> | pick the object by its id, for objects that share a name |
-y, --yes | do not ask for confirmation |
unifi firewall groups describe
Show every field of one firewall group.
Usage
unifi firewall groups describe <name> [flags]Show every field of one firewall group.
The kinds people look at most are laid out in words, with references shown by name; the others list their fields under the paths that unifi firewall groups set <name> --set <path>=<value> takes. --output yaml always prints the complete object as the controller spells it.
Secrets such as passphrases and keys read <redacted>. --show-secrets prints them in --output yaml and --output json, never in the text view. When several objects share the name, --id picks one.
Examples
unifi firewall groups describe Cameras
unifi firewall groups describe Cameras --output json
unifi firewall groups describe --id <id>Flags
| Flag | Description |
|---|---|
--id <id> | pick the object by its id, for objects that share a name |
--show-secrets | print secrets in yaml and json output instead of <redacted>; they end up in your terminal, its scrollback and any file you redirect to |
unifi firewall groups edit
Edit a firewall group in your editor.
Usage
unifi firewall groups edit <name> [flags]Open a firewall group as a YAML manifest in your editor and apply it on save.
The editor is taken from $VISUAL, then $EDITOR, then vi. What you save becomes the object's new state: removing a field removes it. Closing without changes, or emptying the file, cancels the edit.
Secrets such as passphrases and keys are shown as <redacted>. Leave that as it is to keep a secret, or type a new value over it to change it.
When the result is not a valid manifest or the controller rejects it, your edits are kept in a file whose path is printed, so nothing is lost.
Examples
unifi firewall groups edit Cameras
unifi firewall groups edit Cameras # with EDITOR="code --wait"Flags
| Flag | Description |
|---|---|
--force | send fields that no object of the kind on this site has, instead of refusing them as typos |
--id <id> | pick the object by its id, for objects that share a name |
-y, --yes | do not ask for confirmation |
unifi firewall groups get
List the firewall groups, or show one.
Usage
unifi firewall groups get [name] [flags]Aliases: list, ls
List the firewall groups of the site, or show the one named by the argument.
--output wide adds columns and the object IDs. --output yaml and --output json print manifests that unifi apply -f - accepts unchanged.
--show-secrets keeps passphrases, keys and other secrets in --output yaml and --output json; without it they read <redacted>, which unifi apply understands as "keep the current value". Tables never show secrets.
--filter takes a filter expression such as enabled && name contains "guest". Fields are the object's own, as shown by --output yaml, plus name and id. --sort takes a column: name, type, members, or any field path.
Examples
unifi firewall groups get
unifi firewall groups get --output wide
unifi firewall groups get Cameras --output yaml
unifi firewall groups get --filter 'group_type == "port-group"'
unifi firewall groups get --output yaml > firewall-groups.yamlFlags
| Flag | Description |
|---|---|
--filter <string> | filter expression, such as 'enabled && name contains "guest"' |
--id <id> | pick the object by its id, for objects that share a name |
--reverse | reverse the sort order |
--show-secrets | print secrets in yaml and json output instead of <redacted>; they end up in your terminal, its scrollback and any file you redirect to |
--sort <string> | sort by a column or field path: name, type, members |
unifi firewall groups set
Change fields of a firewall group.
Usage
unifi firewall groups set <name> [flags]Change fields of a firewall group and show what changed.
--set path=value sets any field; address nested fields with dots. Values are read as YAML, so 20 is a number, true a boolean and [a,b] a list (a list replaces the whole field). --unset path removes a field. --dry-run shows the change without making it.
Find the field paths with unifi firewall groups get <name> --output yaml.
Examples
unifi firewall groups set Cameras --members 192.168.20.31
unifi firewall groups set Cameras --set <path>=<value> --dry-run
unifi firewall groups set Cameras --unset <path>Flags
| Flag | Description |
|---|---|
--dry-run | show what would change without changing it |
--force | send fields that no object of the kind on this site has, instead of refusing them as typos |
--id <id> | pick the object by its id, for objects that share a name |
--members <strings> | addresses, subnets or ports in the group (comma-separated) |
--set <path=value> | set a field: path=value, repeatable; the value is read as YAML, so numbers, booleans and lists like [a,b] work |
--set-stdin <path> | set the field at this path to what arrives on standard input, for secrets; on a terminal it is asked for, masked |
--type <string> | what the group holds: address-group, ipv6-address-group, port-group |
--unset <path> | clear a field by its path, repeatable: the controller's internal API keeps the key and stores an empty value |
-y, --yes | do not ask for confirmation |
unifi firewall policies
Manage zone-based firewall policies.
Aliases: policy, rules
Manage firewall policies: each allows, blocks or rejects traffic from a source zone to a destination zone, optionally narrowed by a traffic filter.
--source and --destination take zone names from unifi firewall zones get. Filters on addresses, ports and protocols are nested objects; write them with edit, or in a manifest for unifi apply.
This kind is served by the official Network API.
unifi firewall policies create
Create a firewall policy.
Usage
unifi firewall policies create <name> [flags]Create a firewall policy from flags, from a file, or from both.
--set path=value sets any field; address nested fields with dots. Values are read as YAML, so 20 is a number, true a boolean and [a,b] a list. -f reads a manifest or a bare spec (-f - reads standard input); flags are applied on top of it. With a manifest that carries metadata.name, the name argument can be left out.
The quickest way to a valid spec is an existing object: unifi firewall policies get <name> --output yaml.
Examples
unifi firewall policies create "Block IoT to Internal" --action BLOCK --source IoT --destination Internal
unifi firewall policies create "Block IoT to Internal" --filename firewall-policies.yaml
unifi firewall policies create "Block IoT to Internal" -f - < spec.yamlFlags
| Flag | Description |
|---|---|
--action <string> | what happens to matching traffic: ALLOW, BLOCK, REJECT |
--description <string> | free-text description |
--destination <string> | zone the traffic goes to, by name |
--enabled | whether the policy is active; turn it off with --enabled=false |
-f, --filename <file> | read the object from a manifest or spec file; - reads standard input |
--force | send fields that no object of the kind on this site has, instead of refusing them as typos |
--logging | whether matches are logged; turn it off with --logging=false |
--set <path=value> | set a field: path=value, repeatable; the value is read as YAML, so numbers, booleans and lists like [a,b] work |
--set-stdin <path> | set the field at this path to what arrives on standard input, for secrets; on a terminal it is asked for, masked |
--source <string> | zone the traffic comes from, by name |
-y, --yes | do not ask for confirmation |
unifi firewall policies delete
Delete one or more firewall policies.
Usage
unifi firewall policies delete <name>... [flags]Aliases: rm
Delete one or more firewall policies after confirmation.
Every name is checked before anything is deleted, so a typo deletes nothing. Pass --yes to skip the confirmation, as scripts must. When several objects share a name, --id picks the one to delete.
Examples
unifi firewall policies delete "Block IoT to Internal"
unifi firewall policies delete "Block IoT to Internal" --yesFlags
| Flag | Description |
|---|---|
--destination <string> | pick the object by this field, for objects that share a name: zone the traffic goes to, by name |
--id <id> | pick the object by its id, for objects that share a name |
--source <string> | pick the object by this field, for objects that share a name: zone the traffic comes from, by name |
-y, --yes | do not ask for confirmation |
unifi firewall policies describe
Show every field of one firewall policy.
Usage
unifi firewall policies describe <name> [flags]Show every field of one firewall policy.
The kinds people look at most are laid out in words, with references shown by name; the others list their fields under the paths that unifi firewall policies set <name> --set <path>=<value> takes. --output yaml always prints the complete object as the controller spells it.
Secrets such as passphrases and keys read <redacted>. --show-secrets prints them in --output yaml and --output json, never in the text view. When several objects share the name, --id picks one.
Examples
unifi firewall policies describe "Block IoT to Internal"
unifi firewall policies describe "Block IoT to Internal" --output json
unifi firewall policies describe --id <id>Flags
| Flag | Description |
|---|---|
--destination <string> | pick the object by this field, for objects that share a name: zone the traffic goes to, by name |
--id <id> | pick the object by its id, for objects that share a name |
--show-secrets | print secrets in yaml and json output instead of <redacted>; they end up in your terminal, its scrollback and any file you redirect to |
--source <string> | pick the object by this field, for objects that share a name: zone the traffic comes from, by name |
unifi firewall policies disable
Disable a firewall policy.
Usage
unifi firewall policies disable <name> [flags]Disable a firewall policy. It is a shortcut for unifi firewall policies set <name> --set enabled=false.
Examples
unifi firewall policies disable "Block IoT to Internal"Flags
| Flag | Description |
|---|---|
--destination <string> | pick the object by this field, for objects that share a name: zone the traffic goes to, by name |
--id <id> | pick the object by its id, for objects that share a name |
--source <string> | pick the object by this field, for objects that share a name: zone the traffic comes from, by name |
-y, --yes | do not ask for confirmation |
unifi firewall policies edit
Edit a firewall policy in your editor.
Usage
unifi firewall policies edit <name> [flags]Open a firewall policy as a YAML manifest in your editor and apply it on save.
The editor is taken from $VISUAL, then $EDITOR, then vi. What you save becomes the object's new state: removing a field removes it. Closing without changes, or emptying the file, cancels the edit.
Secrets such as passphrases and keys are shown as <redacted>. Leave that as it is to keep a secret, or type a new value over it to change it.
When the result is not a valid manifest or the controller rejects it, your edits are kept in a file whose path is printed, so nothing is lost.
Examples
unifi firewall policies edit "Block IoT to Internal"
unifi firewall policies edit "Block IoT to Internal" # with EDITOR="code --wait"Flags
| Flag | Description |
|---|---|
--destination <string> | pick the object by this field, for objects that share a name: zone the traffic goes to, by name |
--force | send fields that no object of the kind on this site has, instead of refusing them as typos |
--id <id> | pick the object by its id, for objects that share a name |
--source <string> | pick the object by this field, for objects that share a name: zone the traffic comes from, by name |
-y, --yes | do not ask for confirmation |
unifi firewall policies enable
Enable a firewall policy.
Usage
unifi firewall policies enable <name> [flags]Enable a firewall policy. It is a shortcut for unifi firewall policies set <name> --set enabled=true.
Examples
unifi firewall policies enable "Block IoT to Internal"Flags
| Flag | Description |
|---|---|
--destination <string> | pick the object by this field, for objects that share a name: zone the traffic goes to, by name |
--id <id> | pick the object by its id, for objects that share a name |
--source <string> | pick the object by this field, for objects that share a name: zone the traffic comes from, by name |
-y, --yes | do not ask for confirmation |
unifi firewall policies get
List the firewall policies, or show one.
Usage
unifi firewall policies get [name] [flags]Aliases: list, ls
List the firewall policies of the site, or show the one named by the argument.
--output wide adds columns and the object IDs. --output yaml and --output json print manifests that unifi apply -f - accepts unchanged.
--show-secrets keeps passphrases, keys and other secrets in --output yaml and --output json; without it they read <redacted>, which unifi apply understands as "keep the current value". Tables never show secrets.
--filter takes a filter expression such as enabled && name contains "guest". Fields are the object's own, as shown by --output yaml, plus name and id. --sort takes a column: name, action, source, destination, enabled, logging, or any field path.
Examples
unifi firewall policies get
unifi firewall policies get --output wide
unifi firewall policies get "Block IoT to Internal" --output yaml
unifi firewall policies get --filter 'action.type == "BLOCK"'
unifi firewall policies get --output yaml > firewall-policies.yamlFlags
| Flag | Description |
|---|---|
--destination <string> | pick the object by this field, for objects that share a name: zone the traffic goes to, by name |
--filter <string> | filter expression, such as 'enabled && name contains "guest"' |
--id <id> | pick the object by its id, for objects that share a name |
--reverse | reverse the sort order |
--show-secrets | print secrets in yaml and json output instead of <redacted>; they end up in your terminal, its scrollback and any file you redirect to |
--sort <string> | sort by a column or field path: name, action, source, destination, enabled, logging |
--source <string> | pick the object by this field, for objects that share a name: zone the traffic comes from, by name |
unifi firewall policies set
Change fields of a firewall policy.
Usage
unifi firewall policies set <name> [flags]Change fields of a firewall policy and show what changed.
--set path=value sets any field; address nested fields with dots. Values are read as YAML, so 20 is a number, true a boolean and [a,b] a list (a list replaces the whole field). --unset path removes a field. --dry-run shows the change without making it.
Find the field paths with unifi firewall policies get <name> --output yaml.
Examples
unifi firewall policies set "Block IoT to Internal" --logging=true
unifi firewall policies set "Block IoT to Internal" --set <path>=<value> --dry-run
unifi firewall policies set "Block IoT to Internal" --unset <path>Flags
| Flag | Description |
|---|---|
--action <string> | what happens to matching traffic: ALLOW, BLOCK, REJECT |
--description <string> | free-text description |
--destination <string> | zone the traffic goes to, by name |
--dry-run | show what would change without changing it |
--enabled | whether the policy is active; turn it off with --enabled=false |
--force | send fields that no object of the kind on this site has, instead of refusing them as typos |
--id <id> | pick the object by its id, for objects that share a name |
--logging | whether matches are logged; turn it off with --logging=false |
--set <path=value> | set a field: path=value, repeatable; the value is read as YAML, so numbers, booleans and lists like [a,b] work |
--set-stdin <path> | set the field at this path to what arrives on standard input, for secrets; on a terminal it is asked for, masked |
--source <string> | zone the traffic comes from, by name |
--unset <path> | remove a field by its path, repeatable |
-y, --yes | do not ask for confirmation |
unifi firewall zones
Manage firewall zones.
Aliases: zone
Manage firewall zones: named groups of networks that firewall policies refer to as source and destination.
The zones Internal, External, Gateway, VPN, Hotspot and DMZ are defined by the system; their networks can be changed, but they cannot be deleted. --networks takes network names from unifi networks get.
This kind is served by the official Network API.
unifi firewall zones create
Create a firewall zone.
Usage
unifi firewall zones create <name> [flags]Create a firewall zone from flags, from a file, or from both.
--set path=value sets any field; address nested fields with dots. Values are read as YAML, so 20 is a number, true a boolean and [a,b] a list. -f reads a manifest or a bare spec (-f - reads standard input); flags are applied on top of it. With a manifest that carries metadata.name, the name argument can be left out.
The quickest way to a valid spec is an existing object: unifi firewall zones get <name> --output yaml.
Examples
unifi firewall zones create IoT --networks IoT,Cameras
unifi firewall zones create IoT --filename firewall-zones.yaml
unifi firewall zones create IoT -f - < spec.yamlFlags
| Flag | Description |
|---|---|
-f, --filename <file> | read the object from a manifest or spec file; - reads standard input |
--force | send fields that no object of the kind on this site has, instead of refusing them as typos |
--networks <strings> | networks that belong to the zone, by name (comma-separated) |
--set <path=value> | set a field: path=value, repeatable; the value is read as YAML, so numbers, booleans and lists like [a,b] work |
--set-stdin <path> | set the field at this path to what arrives on standard input, for secrets; on a terminal it is asked for, masked |
-y, --yes | do not ask for confirmation |
unifi firewall zones delete
Delete one or more firewall zones.
Usage
unifi firewall zones delete <name>... [flags]Aliases: rm
Delete one or more firewall zones after confirmation.
Every name is checked before anything is deleted, so a typo deletes nothing. Pass --yes to skip the confirmation, as scripts must. When several objects share a name, --id picks the one to delete.
Examples
unifi firewall zones delete IoT
unifi firewall zones delete IoT --yesFlags
| Flag | Description |
|---|---|
--id <id> | pick the object by its id, for objects that share a name |
-y, --yes | do not ask for confirmation |
unifi firewall zones describe
Show every field of one firewall zone.
Usage
unifi firewall zones describe <name> [flags]Show every field of one firewall zone.
The kinds people look at most are laid out in words, with references shown by name; the others list their fields under the paths that unifi firewall zones set <name> --set <path>=<value> takes. --output yaml always prints the complete object as the controller spells it.
Secrets such as passphrases and keys read <redacted>. --show-secrets prints them in --output yaml and --output json, never in the text view. When several objects share the name, --id picks one.
Examples
unifi firewall zones describe IoT
unifi firewall zones describe IoT --output json
unifi firewall zones describe --id <id>Flags
| Flag | Description |
|---|---|
--id <id> | pick the object by its id, for objects that share a name |
--show-secrets | print secrets in yaml and json output instead of <redacted>; they end up in your terminal, its scrollback and any file you redirect to |
unifi firewall zones edit
Edit a firewall zone in your editor.
Usage
unifi firewall zones edit <name> [flags]Open a firewall zone as a YAML manifest in your editor and apply it on save.
The editor is taken from $VISUAL, then $EDITOR, then vi. What you save becomes the object's new state: removing a field removes it. Closing without changes, or emptying the file, cancels the edit.
Secrets such as passphrases and keys are shown as <redacted>. Leave that as it is to keep a secret, or type a new value over it to change it.
When the result is not a valid manifest or the controller rejects it, your edits are kept in a file whose path is printed, so nothing is lost.
Examples
unifi firewall zones edit IoT
unifi firewall zones edit IoT # with EDITOR="code --wait"Flags
| Flag | Description |
|---|---|
--force | send fields that no object of the kind on this site has, instead of refusing them as typos |
--id <id> | pick the object by its id, for objects that share a name |
-y, --yes | do not ask for confirmation |
unifi firewall zones get
List the firewall zones, or show one.
Usage
unifi firewall zones get [name] [flags]Aliases: list, ls
List the firewall zones of the site, or show the one named by the argument.
--output wide adds columns and the object IDs. --output yaml and --output json print manifests that unifi apply -f - accepts unchanged.
--show-secrets keeps passphrases, keys and other secrets in --output yaml and --output json; without it they read <redacted>, which unifi apply understands as "keep the current value". Tables never show secrets.
--filter takes a filter expression such as enabled && name contains "guest". Fields are the object's own, as shown by --output yaml, plus name and id. --sort takes a column: name, networks, origin, or any field path.
Examples
unifi firewall zones get
unifi firewall zones get --output wide
unifi firewall zones get IoT --output yaml
unifi firewall zones get --filter 'name == "IoT"'
unifi firewall zones get --output yaml > firewall-zones.yamlFlags
| Flag | Description |
|---|---|
--filter <string> | filter expression, such as 'enabled && name contains "guest"' |
--id <id> | pick the object by its id, for objects that share a name |
--reverse | reverse the sort order |
--show-secrets | print secrets in yaml and json output instead of <redacted>; they end up in your terminal, its scrollback and any file you redirect to |
--sort <string> | sort by a column or field path: name, networks, origin |
unifi firewall zones set
Change fields of a firewall zone.
Usage
unifi firewall zones set <name> [flags]Change fields of a firewall zone and show what changed.
--set path=value sets any field; address nested fields with dots. Values are read as YAML, so 20 is a number, true a boolean and [a,b] a list (a list replaces the whole field). --unset path removes a field. --dry-run shows the change without making it.
Find the field paths with unifi firewall zones get <name> --output yaml.
Examples
unifi firewall zones set IoT --networks IoT
unifi firewall zones set IoT --set <path>=<value> --dry-run
unifi firewall zones set IoT --unset <path>Flags
| Flag | Description |
|---|---|
--dry-run | show what would change without changing it |
--force | send fields that no object of the kind on this site has, instead of refusing them as typos |
--id <id> | pick the object by its id, for objects that share a name |
--networks <strings> | networks that belong to the zone, by name (comma-separated) |
--set <path=value> | set a field: path=value, repeatable; the value is read as YAML, so numbers, booleans and lists like [a,b] work |
--set-stdin <path> | set the field at this path to what arrives on standard input, for secrets; on a terminal it is asked for, masked |
--unset <path> | remove a field by its path, repeatable |
-y, --yes | do not ask for confirmation |
Global flags
These flags are accepted by every command.
| Flag | Description |
|---|---|
--color-scheme <string> | color scheme: auto, dark or light |
--context <string> | context to use instead of the current one |
--no-cache | ask the controller for everything instead of using cached answers |
-o, --output <string> | output format: text, wide, json, yaml (table is another name for text) |
-s, --site <string> | site to act on instead of the context's default site |
--theme <string> | theme to render with instead of the configured one |
