Skip to content

Lock down snmp as read-only and sanitize input - #1656

Merged
troglobit merged 2 commits into
mainfrom
snmp-fixup
Sep 24, 2026
Merged

troglobit merged 2 commits into
mainfrom
snmp-fixup

Conversation

@troglobit

Copy link
Copy Markdown
Contributor

Description

With simple config file injection it was possible to enable write mode in SNMP. Lock it down with --enable-read-only, tighten the text field types in YANG, and sanitize all data before writing to snmpd.conf

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):

snmpd.conf is line oriented and confd writes these values verbatim, so
a newline in a community or security name appended directives of the
operator's choosing, granting write access to a read-only agent.

Restrict the leaves that reach the file, derived from the original
types so the RFC 7407 lengths still apply.  /system/contact and
/system/location are ietf-system free text, dropped at render instead.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
The agent is read-only by design.  Remove SET from the build so a
mistake in the generated VACM configuration cannot make it writable.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
@troglobit troglobit added the ci:main Build default defconfig, not minimal label Sep 24, 2026
@troglobit
troglobit merged commit dfb44b7 into main Sep 24, 2026
15 of 16 checks passed
@troglobit
troglobit deleted the snmp-fixup branch September 24, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:main Build default defconfig, not minimal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants