Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snmp: T7180: Fixed verification of engineid in snmpv3 #4366

Merged
merged 2 commits into from
Feb 25, 2025

Conversation

aapostoliuk
Copy link
Contributor

Change summary

EngineID must be configured if snmpv3 user is configured.
Fixed engineid help string.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

Related PR(s)

How to test / Smoketest result

Configuration:

set service snmp listen-address 192.168.5.100
set service snmp v3 view snmpview1 oid 1.2.3.4.5.6.7
set service snmp v3 group group1 mode ro
set service snmp v3 group group1 seclevel priv
set service snmp v3 group group1 view snmpview1
set service snmp v3 user user1 auth plaintext-password Password1
set service snmp v3 user user1 auth type sha
set service snmp v3 user user1 group group1
set service snmp v3 user user1 privacy plaintext-password Password1
set service snmp v3 user user1 privacy type aes

Before

commit
[ service snmp ]
Traceback (most recent call last):
  File "/usr/libexec/vyos/services/vyos-configd", line 145, in run_script
    script.generate(c)
  File "/usr/libexec/vyos//conf_mode/service_snmp.py", line 221, in generate
    tmp = hash(dict_search('auth.plaintext_password', user_config),
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/vyos/snmpv3_hashgen.py", line 48, in plaintext_to_sha1
    engine = bytearray.fromhex(engine)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: fromhex() argument must be str, not None

[[service snmp]] failed
Commit failed
[edit]

After:

vyos@vyos# commit
[ service snmp ]
EngineID must be configured for snmpv3!
[[service snmp]] failed
Commit failed
[edit]

Smoketests:

---
WARNING: This VyOS system is not a stable long-term support version and
         is not intended for production use.
vyos@vyos:~$ /usr/libexec/vyos/tests/smoke/cli/test_service_snmp.py
test_snmp_basic (__main__.TestSNMPService.test_snmp_basic) ... ok
test_snmp_script_extensions (__main__.TestSNMPService.test_snmp_script_extensions) ... ok
test_snmpv3_md5 (__main__.TestSNMPService.test_snmpv3_md5) ... ok
test_snmpv3_sha (__main__.TestSNMPService.test_snmpv3_sha) ... ok
test_snmpv3_view_exclude (__main__.TestSNMPService.test_snmpv3_view_exclude) ... ok

----------------------------------------------------------------------
Ran 5 tests in 23.672s

OK

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

EngineID must be configured if snmpv3 user is configured.
Fixed engineid help string.
Copy link

github-actions bot commented Feb 25, 2025


PR title does not match the required format

@dmbaturin dmbaturin added bp/sagitta Create automatic backport for sagitta LTS version bp/circinus Create automatic backport for circinus labels Feb 25, 2025
@dmbaturin dmbaturin merged commit 5f75ad8 into vyos:current Feb 25, 2025
10 of 12 checks passed
Copy link

CI integration ❌ failed!

Details

CI logs

  • CLI Smoketests (no interfaces) ❌ failed
  • CLI Smoketests (interfaces only) ❌ failed
  • Config tests 👍 passed
  • RAID1 tests 👍 passed
  • TPM tests 👍 passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bp/circinus Create automatic backport for circinus bp/sagitta Create automatic backport for sagitta LTS version current
Development

Successfully merging this pull request may close these issues.

3 participants