Skip to content

Nacm default permissions - #1740

Closed
saba8814 wants to merge 5 commits into
mainfrom
nacm-default-permissions
Closed

saba8814 wants to merge 5 commits into
mainfrom
nacm-default-permissions

Conversation

@saba8814

Copy link
Copy Markdown
Collaborator

Description

Deny write and exec by default in the factory NACM config. Users in no
group could change almost everything before.

  • admin: everything
  • operator: network setup, hostname, contact, location, time zone, reboot
  • guest and users in no group: read-only

Existing systems keep their saved NACM settings.

Checklist

Tick relevant boxes, this PR is-a or has-a:

  • Bugfix
    • Regression tests
    • ChangeLog updates (for next release)
  • Feature
    • YANG model change => revision updated?
    • Regression tests added?
    • ChangeLog updates (for next release)
    • Documentation added?
  • Test changes
    • Checked in changed Readme.adoc (make test-spec)
    • Added new test to group Readme.adoc and yaml file
  • Code style update (formatting, renaming)
  • Refactoring (please detail in commit messages)
  • Build related changes
  • Documentation content changes
    • ChangeLog updated (for major changes)
  • Other (please describe):

@saba8814
saba8814 requested a review from mattiaswal October 27, 2026 10:09
@saba8814
saba8814 marked this pull request as draft October 27, 2026 10:16
@saba8814 saba8814 added the ci:skip Skip CI for this PR, started jobs are stopped. label Oct 27, 2026
@saba8814
saba8814 force-pushed the nacm-default-permissions branch from d32c280 to 9db4c9f Compare October 27, 2026 11:02
@saba8814 saba8814 added ci:main Build default defconfig, not minimal and removed ci:skip Skip CI for this PR, started jobs are stopped. labels Oct 27, 2026
@saba8814
saba8814 marked this pull request as ready for review October 27, 2026 19:49

@troglobit troglobit left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor fixes

... well mostly, read-only show commands now need exec

Several read-only lookups are YANG actions, and the rpc tool sets the NACM user, so they are now denied for operators, guests and users in no group:

  • show bridge fdb runs the bridge get-forwarding-database action.
  • show hardware <radio> scan and survey run the radio scan and channel-survey actions. The WebUI buttons for these do the same.
  • The active-route action in ietf-routing

A guest is documented as read-only but gets an error from show bridge fdb. Add these to the * permit rule-list next to get-schema.

Should fix

  • The guest deny lost exec. It had to go because guest-acl precedes the * permit list, so a guest exec deny would also block get-schema. Move the permit list up to right after admin-acl and keep exec in the guest deny. Then the doc sentence "guests stay read-only even if the defaults are changed" holds, which matters since the doc now shows permit-by-default as a pattern
  • Operators cannot save over NETCONF: copy-config is not permitted. Sysrepo still runs the NACM write check on the resulting diff, so permitting it is safe. The CLI and WebUI copy as a data write and are not affected
  • Operators can write the DHCP server and firewall subtrees but not their actions: statistics clear, address-set add/remove/flush. Decide whether that is intended and say so in the docs.
  • default-permit-read permits exec, not read. Name it for what it does.

Nits

  • ChangeLog bullet: one line runs past 72 columns and "but no longer the rest of the system" is awkward. Same overlong line in the operator bullet in doc/system.md
  • doc/nacm.md intro: "lets everyone read ... but nobody change anything" needs "lets nobody change"
  • Permissions table lists operator exec as "Reboot, shutdown" but the rule also covers setting the time
  • Trailer Resolves: #1658. The tree mostly uses Fixes #NNN

@saba8814
saba8814 force-pushed the nacm-default-permissions branch from 9db4c9f to 5fe8aaf Compare October 28, 2026 07:32
@saba8814
saba8814 marked this pull request as draft October 28, 2026 07:45
@saba8814
saba8814 force-pushed the nacm-default-permissions branch from 5fe8aaf to 5312a58 Compare October 28, 2026 08:04
@saba8814

Copy link
Copy Markdown
Collaborator Author

Minor fixes

... well mostly, read-only show commands now need exec

Several read-only lookups are YANG actions, and the rpc tool sets the NACM user, so they are now denied for operators, guests and users in no group:

  • show bridge fdb runs the bridge get-forwarding-database action.
  • show hardware <radio> scan and survey run the radio scan and channel-survey actions. The WebUI buttons for these do the same.
  • The active-route action in ietf-routing

A guest is documented as read-only but gets an error from show bridge fdb. Add these to the * permit rule-list next to get-schema.

Should fix

  • The guest deny lost exec. It had to go because guest-acl precedes the * permit list, so a guest exec deny would also block get-schema. Move the permit list up to right after admin-acl and keep exec in the guest deny. Then the doc sentence "guests stay read-only even if the defaults are changed" holds, which matters since the doc now shows permit-by-default as a pattern
  • Operators cannot save over NETCONF: copy-config is not permitted. Sysrepo still runs the NACM write check on the resulting diff, so permitting it is safe. The CLI and WebUI copy as a data write and are not affected
  • Operators can write the DHCP server and firewall subtrees but not their actions: statistics clear, address-set add/remove/flush. Decide whether that is intended and say so in the docs.
  • default-permit-read permits exec, not read. Name it for what it does.

Nits

  • ChangeLog bullet: one line runs past 72 columns and "but no longer the rest of the system" is awkward. Same overlong line in the operator bullet in doc/system.md
  • doc/nacm.md intro: "lets everyone read ... but nobody change anything" needs "lets nobody change"
  • Permissions table lists operator exec as "Reboot, shutdown" but the rule also covers setting the time
  • Trailer Resolves: Many default permissions are too wide in NACM #1658. The tree mostly uses Fixes #NNN

Thank you for Review @troglobit . now all the comments have been adressed. Exception being active-route, but we spoke about that one offline.

@saba8814
saba8814 marked this pull request as ready for review October 28, 2026 08:12
@saba8814
saba8814 requested a review from troglobit October 28, 2026 08:13
@troglobit

troglobit commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

This still fails in system upgrade test on two test systems. Postponing for v26.11 release. Quite possibly not cause by the changes on this branch, but I cannot tell for sure.

@saba8814
saba8814 force-pushed the nacm-default-permissions branch from 5312a58 to 6ea1a89 Compare November 2, 2026 07:58
With write and exec denied by default, the operator group only has
permit rules for parts of the tree.  show nacm listed it as denied,
and admin too.  Count permit rules as access, and let permit-all
override the defaults.

Signed-off-by: Ejub Sabic <ejub1946@outlook.com>
Same as in the CLI, count permit rules as access so the operator
group is not shown as denied.

Signed-off-by: Ejub Sabic <ejub1946@outlook.com>
Deny write and exec by default.  Operators may still change the
network setup, hostname, contact, location and time zone, and reboot.
Guests stay read-only.  Everyone may call get-schema and the actions
that only read, like the bridge FDB, so NETCONF clients and show
commands still work.

Existing systems keep the NACM settings in their startup config.

Fixes #1658

Signed-off-by: Ejub Sabic <ejub1946@outlook.com>
Describe the new factory rules and what each user level can do.

Signed-off-by: Ejub Sabic <ejub1946@outlook.com>
Same NACM rules as the generated factory config, see #1658.

Signed-off-by: Ejub Sabic <ejub1946@outlook.com>
@saba8814
saba8814 force-pushed the nacm-default-permissions branch from 6ea1a89 to 072f7d3 Compare November 2, 2026 12:42
@saba8814 saba8814 added ci:skip Skip CI for this PR, started jobs are stopped. and removed ci:main Build default defconfig, not minimal labels Nov 2, 2026
@saba8814

saba8814 commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator Author

Putting this one as draft until offline meeting FYI: @wkz @troglobit

@saba8814
saba8814 marked this pull request as draft November 3, 2026 08:23
@troglobit

Copy link
Copy Markdown
Contributor

We've had some AFK discussions about this and the consensus so far is clear -- we should split this work into two parts (we can still use this PR and the issue):

  1. Split the board duplication out first. The board files are complete static factory configs, which bypass generation. Only hardware, interfaces, DHCP server, firewall and meta are board-specific; NACM, services and LLDP are byte-identical to the defaults in every file. The gen-config script already supports a gen-ifs-custom interface generator and a 30-config overlay. Boards should ship those and lose the full copy. That is wkz's point, and it makes the NACM change a one-file diff.
  2. Pin down operator in one sentence and derive the rules. With write-default deny and no operator write rules, config stays closed forever with zero maintenance. Keep the NETCONF config RPCs out too. Exec stays deny by default with a short per-path permit list for the operational actions, since a missing exec rule fails safe.

We need to discuss how this affects an operator's (and guest users) abilities to read: interface counters, routes, etc. that with recent changes have become hidden behind new RPCs: get-statistics, get-routes, etc.

Keep the test as it is. It now reads the factory NACM from the target instead of carrying its own copy, which is the right direction for the rest too.

@mattiaswal

Copy link
Copy Markdown
Contributor

Don't forget to adapt the test that validates all custom factory-config.cfg. Unsure how, but we will be intrested if the resulting config still maps to the models.

@saba8814

Copy link
Copy Markdown
Collaborator Author

CCB: closing to split into 2 PRs.

@saba8814 saba8814 closed this Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:skip Skip CI for this PR, started jobs are stopped.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants