You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -4,6 +4,8 @@ import {Note} from "@/components/mdx";
4
4
5
5
NetBird provides SSH access to peers through its built-in SSH server. Unlike traditional SSH setups that require exposing port 22 to the internet, NetBird SSH operates entirely over your private network. You can connect using either the `netbird ssh` command or native OpenSSH clients.
6
6
7
+
NetBird SSH supports fine-grained access control, allowing you to specify which NetBird users can access which local OS users on target machines.
8
+
7
9
<Note>
8
10
SSH Access is disabled by default and must be enabled both on the target
9
11
peer and in the NetBird Dashboard.
@@ -19,7 +21,7 @@ Management may automatically ensure the mesh access policy permits 22022 for a p
19
21
20
22
### Authentication Methods
21
23
22
-
-**JWT Authentication (default)**: Maps SSH sessions to user identities via your configured Identity Provider (OIDC). Each new session will require completing the OIDC flow to mint the JWT used for SSH authentication (unless JWT caching is enabled, in which case JWT tokens are cached for a configurable duration).
24
+
-**JWT Authentication (default)**: Maps SSH sessions to user identities via your configured Identity Provider (OIDC). Each new session will require completing the OIDC flow to mint the JWT used for SSH authentication (unless JWT caching is enabled, in which case JWT tokens are cached for a configurable duration). Combined with fine-grained access control, this allows you to control exactly which authenticated users can access which local OS users on the target machine.
23
25
-**Machine Identity (`--disable-ssh-auth`)**: When SSH auth is disabled, SSH access is governed by NetBird network ACLs (machine-level access) rather than per-user JWT identity.
24
26
25
27
### OpenSSH Integration
@@ -42,11 +44,10 @@ The management server does not edit your host OS firewall or perform OS-level po
42
44
43
45
To use SSH access through NetBird, you need:
44
46
45
-
1.**NetBird v0.60.0 or later** on peers that should support native SSH (dev/development versions are treated as supporting native SSH).
47
+
1.**NetBird v0.61.0 or later** on all peers using SSH (both clients and servers). For fine-grained access control features, v0.61.0 is required.
46
48
2.**SSH enabled on target peer** - the peer must run with `--allow-server-ssh`.
47
-
3.**SSH enabled in Dashboard** - SSH access must be enabled for the peer and ServerSSHAllowed set in the peer meta.
48
-
4.**Access Control Policy** - an ACL rule allowing TCP port 22 for the peer (management will auto-add 22022 behind the scenes for modern peers).
49
-
5.**(Optional)** For JWT authentication: an Identity Provider configured in NetBird.
49
+
3.**Access Control Policy** - A `NetBird SSH` policy configured in the dashboard
50
+
4.**(Optional)** For JWT authentication: an Identity Provider configured in NetBird.
50
51
51
52
<Note>
52
53
Management distributes NetBird access-policy objects (FirewallRule) - it does
@@ -107,22 +108,12 @@ Create an ACL policy to allow SSH access:
107
108
3. Create a new policy:
108
109
-**Source**: Select the peers or groups that will connect via SSH
109
110
-**Destination**: Select the peers or groups running the SSH server
110
-
-**Protocol**: TCP
111
-
-**Ports**: 22
112
-
-**Action**: Accept
111
+
-**Protocol**: Select `NetBird SSH` for SSH-specific policies with fine-grained access control, or use `TCP` with port 22 for basic network-level SSH access
112
+
-**Authorized Groups** (when using NetBird SSH protocol): Configure which user groups can access which local OS users on the destination machines
@@ -204,13 +195,7 @@ For SSH access directly from your web browser without installing any software, r
204
195
205
196
By default, NetBird SSH uses JWT-based authentication with the configured Identity Provider. This provides user identity verification instead of machine identity.
206
197
207
-
<Note>
208
-
Currently, SSH access is controlled by ACL policies and the
209
-
`--enable-ssh-root` flag. Users connect as either root (if enabled) or
210
-
admin-equivalent users on Windows. In the future, NetBird will support more
211
-
granular user mapping, allowing OIDC user X to connect to specific local
212
-
users (PAM/local) on the target system.
213
-
</Note>
198
+
NetBird supports fine-grained user mapping, allowing you to specify which OIDC users or groups can connect to which local OS users on the target system. See [Fine-Grained Access Control](#fine-grained-access-control) for details.
214
199
215
200
<Notetype="warning">
216
201
**Time synchronization required**: The SSH server's system clock must be
@@ -279,6 +264,75 @@ netbird up --allow-server-ssh --disable-ssh-auth
279
264
restrictive.
280
265
</Note>
281
266
267
+
## Fine-Grained Access Control
268
+
269
+
NetBird SSH allows you to configure granular access control that maps NetBird users to specific local OS users on target machines. This provides precise control over who can access what on your infrastructure.
270
+
271
+
### How It Works
272
+
273
+
When you create an SSH policy with the `NetBird SSH` protocol, you can configure **Authorized Groups** that define:
274
+
275
+
1.**Source User Groups**: Which NetBird user groups are allowed to connect
276
+
2.**Local User Mapping**: Which local OS users each group can access on the destination machines
277
+
278
+
For example, you can configure:
279
+
- Members of the "Developers" group can SSH as `developer` or `deploy` users
280
+
- Members of the "DBAs" group can SSH as `postgres` user
281
+
- Members of the "SysAdmins" group can SSH as `root` user
282
+
283
+
### Configuring Fine-Grained Access Control
284
+
285
+
When creating or editing an SSH policy in the Dashboard:
286
+
287
+
1. Navigate to **Access Control** and click **Create Policy**
288
+
2. Select **NetBird SSH** as the protocol
289
+
3. Configure the **Source** - select the user groups that will connect via SSH
290
+
4. Configure the **Destination** - select the peers or groups running the SSH server
291
+
5. Under **SSH Access**, choose the access level:
292
+
-**Full Access**: Allow SSH as any local user on the destination machines
293
+
-**Limited Access**: Specify which local users each source group can access
294
+
6. If you selected **Limited Access**, configure the user mappings:
295
+
- For each source group, specify which local OS users they are allowed to SSH as
296
+
- Add multiple local users per group as needed (e.g., `ashley`, `root`)
297
+
7. Enable the policy and click **Continue**
298
+
299
+
<p>
300
+
<imgsrc="/docs-static/img/manage/peers/ssh/ssh-fine-grained-access-policy.png"alt="netbird ssh fine grained access policy"className="imagewrapper"/>
301
+
</p>
302
+
303
+
**Example configuration:**
304
+
305
+
| Source Group | Allowed Local Users |
306
+
|--------------|---------------------|
307
+
| Developers | developer, deploy |
308
+
| DBAs | postgres |
309
+
| SysAdmins | root, admin |
310
+
311
+
<Note>
312
+
When **Full Access** is selected, users in the source groups can SSH as any local user on the destination machines. Use **Limited Access** to enforce the principle of least privilege.
313
+
</Note>
314
+
315
+
### Authorization Flow
316
+
317
+
When a user attempts to SSH into a peer:
318
+
319
+
1. The user authenticates via OIDC to obtain a JWT token
320
+
2. The JWT contains the user's identity (user ID from the `sub` claim by default)
321
+
3. NetBird checks if the user's ID is in the list of authorized users for this peer
322
+
4. NetBird verifies the user is allowed to access the requested local OS user based on the policy's authorized groups configuration
323
+
5. If authorized, the SSH session is established as the specified local user
324
+
325
+
<Note>
326
+
Fine-grained access control requires JWT authentication to be enabled (the default). It is not available when using `--disable-ssh-auth`.
327
+
</Note>
328
+
329
+
### Security Considerations
330
+
331
+
-**Fail-closed**: If no mapping exists for an OS user, access is denied by default
332
+
-**User identity verification**: Access decisions are based on the authenticated OIDC user identity
333
+
-**Audit trail**: All SSH access attempts are logged with the authenticated user's identity
334
+
-**Least privilege**: Configure the minimum necessary local user access for each group
335
+
282
336
## Advanced Features
283
337
284
338
### Port Forwarding
@@ -398,12 +452,12 @@ Port forwarding has the following limitations:
398
452
399
453
### User Mapping
400
454
401
-
-**Current behavior**: SSH sessions connect as either:
402
-
- The `root` user on Linux/Unix (if `--enable-ssh-root` is enabled)
403
-
- Administrator-equivalent users on Windows
404
-
- The SSH server's service account (if user switching is unavailable)
405
-
-**Future enhancement**: Planned support for granular user mapping (OIDC user → specific local user)
406
-
-**PAM integration**: Linux/Unix PAM integration is planned for more flexible authentication
455
+
NetBird now supports fine-grained user mapping through the `NetBird SSH` protocol and Authorized Groups configuration. See [Fine-Grained Access Control](#fine-grained-access-control) for details.
456
+
457
+
**Requirements for user switching:**
458
+
- The NetBird SSH server must run with root/administrator privileges to switch between local users
459
+
-Non-root NetBird installations (e.g., rootless containers) will run all sessions under the NetBird process account
460
+
-On Windows, sessions connect as Administrator-equivalent users
407
461
408
462
### Feature Availability
409
463
@@ -420,9 +474,9 @@ Some features require specific flags to be enabled on the SSH server:
420
474
421
475
SSH access is controlled by multiple layers:
422
476
423
-
1.**Network ACL policies**: Control which peers can access SSH over the mesh. Management will auto-add the mesh-native endpoint (22022) for a peer when the policy explicitly allows port 22 (or a range containing 22) and the peer advertises native SSH support (NetBird v0.60.0+).
424
-
2.**SSH enabled in dashboard**: Per-peer SSH access toggle
425
-
3.**JWT authentication** (if enabled): User identity verification via IdP
477
+
1.**Network ACL policies**: Control which peers can access SSH with dedicated 'NetBird SSH' protocol policies
478
+
2.**JWT authentication** (if enabled): User identity verification via IdP
479
+
3.**Fine-grained access control** (when using NetBird SSH protocol): Controls which authenticated users can access which local OS users on the target machine
426
480
427
481
## Troubleshooting
428
482
@@ -444,7 +498,7 @@ SSH access is controlled by multiple layers:
444
498
445
499
**"Connection timeout"**
446
500
447
-
- Verify ACL policy allows TCP port 22
501
+
- Verify ACL policy allows SSH access
448
502
- Check if peers are connected to each other: `netbird status -d`
449
503
- Test basic connectivity: `ping <peer-ip>`
450
504
@@ -472,75 +526,120 @@ SSH access is controlled by multiple layers:
472
526
- Check file system permissions on the target peer
473
527
- Verify you're connecting with the correct user
474
528
529
+
### Fine-Grained Access Control Issues
530
+
531
+
**"User is not authorized to access this peer"**
532
+
533
+
- Verify the user's group is included in the SSH policy's source groups
534
+
- Check that the policy uses the `NetBird SSH` protocol
535
+
- Ensure the user has authenticated via OIDC
536
+
537
+
**"User is not authorized to login as OS user"**
538
+
539
+
- Check the Authorized Groups configuration in the SSH policy
540
+
- Verify the user's group is mapped to the requested local OS user
541
+
- Ensure the local OS user exists on the target machine
542
+
543
+
**"No authorization mapping for OS user"**
544
+
545
+
- The requested local OS user is not configured in any Authorized Groups mapping
546
+
- Add the local OS user to the appropriate group's allowed users list in the policy
547
+
475
548
## CLI Reference
476
549
477
550
For complete CLI command reference, including all SSH-related commands and flags, see the [CLI documentation](/get-started/cli#ssh).
478
551
479
-
## Migrating from v0.59.x and Earlier
552
+
## Version History
480
553
481
-
<Note>
482
-
This section is only relevant if you're upgrading from NetBird v0.59.x or
483
-
earlier. New installations can skip this section.
554
+
### v0.61.0
555
+
556
+
Version 0.61.0 introduces fine-grained SSH access control.
557
+
558
+
<Notetype="warning">
559
+
**Breaking change**: Management server v0.61.0 will break NetBird SSH for all peers running versions older than v0.61.0. You must update all peers that use SSH to v0.61.0 or later before upgrading the management server/dashboard.
484
560
</Note>
485
561
486
-
### What Changed in v0.60.0
562
+
#### New Capabilities
563
+
564
+
-**NetBird SSH protocol**: New protocol type in policies specifically for SSH access control
565
+
-**Fine-grained user mapping**: Map NetBird user groups to specific local OS users
566
+
-**Authorized Groups**: Configure which users can access which local accounts per policy
567
+
-**Full Access vs Limited Access**: Choose between unrestricted local user access or granular per-group mappings
568
+
-**Enhanced security**: Fail-closed authorization model with granular audit trail
569
+
570
+
#### Breaking Changes
571
+
572
+
- Peers running versions older than v0.61.0 will lose SSH functionality when the management server is upgraded to v0.61.0
0 commit comments