unifi acls
About 1567 words
Manage switch ACL rules.
Aliases: acl, acl-rules
Manage switch ACL rules: layer-2 and layer-3 filters enforced by the switches themselves, so they also apply between devices in the same VLAN where the gateway's firewall never sees the traffic.
Source and destination filters are nested objects; write them with edit, or in a manifest for unifi apply.
This kind is served by the official Network API.
Commands
unifi acls create: Create an ACL ruleunifi acls delete: Delete one or more ACL rulesunifi acls describe: Show every field of one ACL ruleunifi acls disable: Disable an ACL ruleunifi acls edit: Edit an ACL rule in your editorunifi acls enable: Enable an ACL ruleunifi acls get: List the ACL rules, or show oneunifi acls set: Change fields of an ACL rule
unifi acls create
Create an ACL rule.
Usage
unifi acls create <name> [flags]Create an ACL rule 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 acls get <name> --output yaml.
Examples
unifi acls create "Isolate cameras" --type IPV4 --action BLOCK
unifi acls create "Isolate cameras" --filename acl-rules.yaml
unifi acls create "Isolate cameras" -f - < spec.yamlFlags
| Flag | Description |
|---|---|
--action <string> | what happens to matching traffic: ALLOW, BLOCK |
--description <string> | free-text description |
--enabled | whether the rule 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 |
--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 rule matches on: IPV4, MAC |
-y, --yes | do not ask for confirmation |
unifi acls delete
Delete one or more ACL rules.
Usage
unifi acls delete <name>... [flags]Aliases: rm
Delete one or more ACL rules 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 acls delete "Isolate cameras"
unifi acls delete "Isolate 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 acls describe
Show every field of one ACL rule.
Usage
unifi acls describe <name> [flags]Show every field of one ACL rule.
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 acls 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 acls describe "Isolate cameras"
unifi acls describe "Isolate cameras" --output json
unifi acls 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 acls disable
Disable an ACL rule.
Usage
unifi acls disable <name> [flags]Disable an ACL rule. It is a shortcut for unifi acls set <name> --set enabled=false.
Examples
unifi acls disable "Isolate cameras"Flags
| Flag | Description |
|---|---|
--id <id> | pick the object by its id, for objects that share a name |
-y, --yes | do not ask for confirmation |
unifi acls edit
Edit an ACL rule in your editor.
Usage
unifi acls edit <name> [flags]Open an ACL rule 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 acls edit "Isolate cameras"
unifi acls edit "Isolate 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 acls enable
Enable an ACL rule.
Usage
unifi acls enable <name> [flags]Enable an ACL rule. It is a shortcut for unifi acls set <name> --set enabled=true.
Examples
unifi acls enable "Isolate cameras"Flags
| Flag | Description |
|---|---|
--id <id> | pick the object by its id, for objects that share a name |
-y, --yes | do not ask for confirmation |
unifi acls get
List the ACL rules, or show one.
Usage
unifi acls get [name] [flags]Aliases: list, ls
List the ACL rules 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, action, enabled, or any field path.
Examples
unifi acls get
unifi acls get --output wide
unifi acls get "Isolate cameras" --output yaml
unifi acls get --filter 'action == "BLOCK"'
unifi acls get --output yaml > acl-rules.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, action, enabled |
unifi acls set
Change fields of an ACL rule.
Usage
unifi acls set <name> [flags]Change fields of an ACL rule 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 acls get <name> --output yaml.
Examples
unifi acls set "Isolate cameras" --action ALLOW
unifi acls set "Isolate cameras" --set <path>=<value> --dry-run
unifi acls set "Isolate cameras" --unset <path>Flags
| Flag | Description |
|---|---|
--action <string> | what happens to matching traffic: ALLOW, BLOCK |
--description <string> | free-text description |
--dry-run | show what would change without changing it |
--enabled | whether the rule 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 |
--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 rule matches on: IPV4, MAC |
--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 |
