Policy file reference
Every field of the access policy document, including shadowing, exit-point and SSH rules: types, defaults, accepted values and the checks run when you save.
Updated · ·By Ivan Vyshniak
Nothing on this page changes with your selection.
The access policy is one JSON document per network. Edit it in Access → Advanced in the console, or with GET and PUT /v1/network/acl in the REST API. For how it is applied, see How access control works.
Top level
{
"rules": [ ],
"groups": { },
"tests": [ ],
"shadowing": [ ],
"exit_points": [ ],
"ssh": [ ]
}| Key | Type | Purpose |
|---|---|---|
rules | array of rules | Traffic rules, evaluated top to bottom. |
groups | object of groups | Named lists of people. |
tests | array of tests | Checks that must pass for a save to succeed. |
shadowing | array of shadowing rules | Who may view or control desktop sessions. |
exit_points | array of exit-point entries | Who may use each approved exit point. One entry per exit point you add; an exit point without one allows nobody. |
ssh | array of SSH rules | Who may log in to which devices over Peerlify SSH, and as which account. No rule allows nobody. |
- The document must be strict JSON: no comments, no trailing commas.
- Unknown keys are ignored without a warning. A section with the wrong type is also ignored, so a typo such as
"rule": [...]or"rules": {}saves a policy with no rules, which denies all traffic. - A bare array at the top level is accepted as the list of rules. Saving it stores an empty
groups,tests,shadowingandssh, deleting any you had. Exit-point entries are kept. - The same goes for a document that leaves a section out: saving a document without
ssh(orshadowing,groups,tests) deletes the rules that section held. Onlyexit_pointsis kept when its key is absent. - The
sshsection is the exception to "the wrong type is ignored": anything but an array there refuses the document. - Peerlify stores a normalized copy of what you save: keys in a fixed order, two-space indentation, and
allowed_sessions/consent_requiredspellings in shadowing rules.
Rule
{
"name": "App servers reach the database",
"description": "Postgres from the app tier",
"action": "accept",
"source": ["tag:app"],
"destination": ["tag:db"],
"ports": ["5432"],
"protocol": ["tcp"],
"enabled": true
}| Field | Type | Default | Accepted values |
|---|---|---|---|
name | string | "" | Any text. Shown in logs as unnamed when empty. |
description | string | "" | Any text. |
action | string | "accept" | accept or allow (in any case) admit the packet. Any other value denies it. When you save, Peerlify stores the action as accept or drop: allow becomes accept, and deny, other text and non-string values become drop. |
source | array of strings | [] | Selectors. An empty list matches nothing. |
destination | array of strings | [] | Selectors. An empty list matches nothing. |
ports | array of strings or integers | [] (any port) | "443", "8000-8999" (inclusive) or "*". Integers from 0 to 65535 are saved as strings (22 → "22"). Compared with the destination port of TCP, UDP and SCTP. Portless protocols only match "*". |
protocol | array of strings or integers | [] (any protocol) | tcp, udp, icmp, a protocol number "1"–"255" (SCTP is "132"), or "*". Integers from 1 to 255 are saved as strings. |
enabled | boolean | true | false keeps the rule but skips it. |
A missing, null or empty ports or protocol list means every port or protocol. Any other entry that isn't a non-empty string or an in-range integer refuses the whole document, for example Rule 'ssh': ports[1] must be a string or an integer, got True. A rule without a name is called #1, #2 and so on, by position.
Write source and destination entries as strings
In source and destination, only string entries are kept; other values are dropped without an error. An empty list there matches nothing.
Selectors
Used in source and destination of rules, shadowing rules and SSH rules.
| Selector | Matches |
|---|---|
* | Every device in the network. |
tag:<name> | Devices carrying the tag. |
email:<address> | Untagged devices with an active session for that person. |
group:<name> | Untagged devices of every person in the group. |
role:<role> | Untagged devices of every approved member with that role: owner, admin, it-admin, network-admin, billing-admin, auditor, member. |
client:<deviceId> | The device with that 9-digit device ID. |
ip:<address> | The device with that overlay IPv4 address. Exact match; CIDR ranges never match. |
a value containing @ | Same as email:. |
| any other value | Matched against a device's overlay IP, device ID or tag name. |
Matching is case-insensitive. See Tags, groups and roles.
Groups
"groups": {
"group:sre": ["alice@example.com", "bob@example.com"],
"group:platform": ["group:sre", "carol@example.com"]
}- Each key must start with
group:and have a name after it. - Each value is an array of email addresses or other
group:names. - Groups may nest. Every referenced group must exist, and cycles are rejected.
- The number of groups is limited by plan.
Test
{
"name": "web tier can't reach the database",
"src": "tag:web",
"proto": "tcp",
"accept": [],
"deny": ["tag:db:5432"]
}| Field | Type | Default | Meaning |
|---|---|---|---|
name | string | none | A label. |
src | string | "" | The source to test, written as a selector. A group: value also counts as each of its members. |
accept | array of strings | [] | Destinations that must be allowed. |
deny | array of strings | [] | Destinations that must be denied. |
proto | string | none | If set, a rule counts only when its protocol list contains this value, *, or nothing. |
Destinations are a selector, optionally followed by : and a port: tag:db:5432, ip:100.100.0.12:443. Without a port, any port matches. A port of * (tag:web:*) doesn't mean any port: it matches only rules whose ports include *.
Tests compare selectors as text. They don't know which devices carry a tag or who owns a device, so write tests with the same selectors your rules use. There are also differences from how devices evaluate rules:
- A rule with an empty
portslist does not match a test destination that names a port, although devices treat it as any port. - Protocols are compared as text, so
"6"and"tcp"are different. email:alice@example.comandalice@example.comare different values, androle:selectors are not expanded.
Shadowing rule
{
"name": "Helpdesk views staff desktops",
"description": "",
"source": ["group:helpdesk"],
"destination": ["tag:workstation"],
"allowed_sessions": ["group:Remote-Desktop-Users"],
"control": false,
"consent_required": true,
"enabled": true
}| Field | Type | Default | Meaning |
|---|---|---|---|
name | string | "" | A label. |
description | string | "" | Free text. |
source | array of strings | [] | Who may shadow (selectors). |
destination | array of strings | [] | Which devices may be shadowed (selectors). |
allowed_sessions | array of strings | [] | *, group:<local group>, or an account name on the target. Empty matches nothing. Also accepted as allowedSessions. |
control | boolean | false | true allows keyboard and mouse control. |
consent_required | boolean | false | true asks the person at the device first. Also accepted as consentRequired. |
enabled | boolean | true | false keeps the rule but skips it. |
See Shadowing rules.
Exit-point entry
{
"exit_point": "client:482915307",
"name": "office-gw",
"source": ["group:staff", "tag:laptops"]
}| Field | Type | Meaning |
|---|---|---|
exit_point | string | The exit point, as client:<device ID>. Must be an approved exit point of the network. |
name | string | The exit point's name in the network. A label only; Peerlify refreshes it when you save. |
source | array of strings | Who may use the exit point: selectors, * for every device. Empty means nobody. |
At most one entry per approved exit point. An approved exit point without an entry allows nobody:
- Approving a device as an exit point doesn't write the document. You add the entry (the console's Add exit-point rule, or a save that includes it) and remove it by saving without it. Revoking approval, or removing the device, deletes the entry.
- When the document you save has an
exit_pointskey, it decides which entries exist: an entry for an approved exit point is kept, an entry you leave out is deleted, and an entry for a device that isn't an approved exit point is dropped. Onlysourceis applied;nameis refreshed. - A document without
exit_pointschanges no entry. - The save response (console and REST API) lists
droppedExitPoints, the device IDs of entries it didn't accept, andremovedExitPoints, the device IDs of saved entries it took away (left out, or no longer an approved exit point). - A console save names the policy version it started from and is refused with
409if the policy changed since (reload and apply the change again). An API save doesn't: the last write wins. - Two entries for the same exit point, or an
exit_pointthat isn'tclient:<device ID>, refuse the save. - Tests don't check exit-point use, and rules don't grant or require it.
Devices a required exit point rule covers may use that exit point even when they aren't in source.
SSH rule
{
"name": "Admins to servers",
"description": "",
"source": ["group:admins"],
"destination": ["tag:servers"],
"users": ["root", "deploy"],
"enabled": true
}| Field | Type | Default | Meaning |
|---|---|---|---|
name | string | "" | A label. |
description | string | "" | Free text. |
source | array of strings | [] | Which devices may connect (selectors). Empty matches nothing. |
destination | array of strings | [] | Which devices they may log in to: selectors, or autogroup:self. Empty matches nothing. |
users | array of strings | required | The accounts on the destination they may log in as. At least one. |
enabled | boolean | true | false keeps the rule but skips it. |
autogroup:self in destination means a device owned by the same person as the connecting device: the login is allowed only when one person is signed in to Peerlify on both. A tagged device has no owner, so autogroup:self never matches it, as source or as destination. It can be combined with other destinations in one rule; the rule applies if any of them matches. It isn't accepted in source.
Each users entry is one of:
| Entry | Matches |
|---|---|
| an account name | That account on the destination. 1 to 64 characters: a letter or _ first, then letters, digits, _, - or ., optionally ending with $. |
autogroup:nonroot | Any account except root. |
* | Any account, root included. |
Account names are the destination's own accounts and are never looked up in Peerlify.
Unlike the other sections, an SSH rule is checked strictly, and anything wrong refuses the save, naming the rule and the entry:
sshthat isn't an array, or an entry in it that isn't an object;source,destinationorusersthat isn't an array, or holds a value that isn't a non-empty string;nameordescriptionthat isn't a string, orenabledthat isn'ttrueorfalse;- a missing or empty
users; - a
usersentry that isn't an account name,autogroup:nonrootor*, for exampleSSH rule 'Admins to servers': users entry 'bob smith' may contain only letters, digits, '_', '-' and '.', optionally ending with '$'.; - any
autogroup:value other thanautogroup:nonrootinusersandautogroup:selfindestination.
Entries are trimmed and duplicates removed when you save. A rule without a name is called #1, #2 and so on, by position.
An SSH rule opens no port: the rules must also allow TCP port 22 to the destination. Tests don't check SSH rules. See SSH to a device without keys.
Checks when you save
A save from the console runs these checks in order and stops at the first failure:
| Check | Error |
|---|---|
| You have the Owner, Admin or Network admin role | You don't have permission to edit access controls. |
| The document parses | Invalid JSON. or Top-level value must be an object or rule array. |
ports and protocol entries are strings or in-range integers | Rule '<name>': ports[<i>] must be … (see Rule) |
Group keys start with group: | Group name must start with 'group:' — got '<key>'. |
No shadowing rule has a network selector in allowed_sessions | Shadowing rule '<name>': allowed_sessions atom '<atom>' is a network selector. … |
| SSH rules are well formed | SSH rule '<name>': … (see SSH rule) |
| Groups resolve | Invalid groups., with details such as Group '<g>' references unknown group '<m>'. or Group cycle detected: … |
Exit-point entries name client:<device ID>, once each | Exit-point rule #<n>: 'exit_point' must be 'client:<device id>', got '<value>'. or Exit-point rule #<n>: exit point 'client:<id>' appears more than once; each exit point has exactly one rule. |
| The plan's group limit | <Plan> plan allows <N> ACL groups; this policy defines <count>. Upgrade for more. |
| You manage every tag the document newly refers to | You don't manage the tag: <tag>. … |
| Every test passes | <n> ACL test(s) failed. |
Not checked: the syntax of port and protocol strings (such as "22-" or "tcpp"), whether tags exist, whether rules refer to declared groups, and empty source or destination lists.
The last save wins. If two people edit at once, the later save replaces the earlier one.