Skip to content

Commit

Permalink
snmp: T7180: Fixed verification of engineid in snmpv3 (#4366)
Browse files Browse the repository at this point in the history
* snmp: T7180: Fixed verification of engineid in snmpv3

EngineID must be configured if snmpv3 user is configured.
Fixed engineid help string.
  • Loading branch information
aapostoliuk authored Feb 25, 2025
1 parent 9468dbf commit 5f75ad8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 0 additions & 1 deletion interface-definitions/service_snmp.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@
</constraint>
<constraintErrorMessage>ID must contain an even number (from 2 to 36) of hex digits</constraintErrorMessage>
</properties>
<defaultValue></defaultValue>
</leafNode>
<tagNode name="group">
<properties>
Expand Down
5 changes: 4 additions & 1 deletion src/conf_mode/service_snmp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
# Copyright (C) 2018-2024 VyOS maintainers and contributors
# Copyright (C) 2018-2025 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
Expand Down Expand Up @@ -147,6 +147,9 @@ def verify(snmp):
return None

if 'user' in snmp['v3']:
if 'engineid' not in snmp['v3']:
raise ConfigError(f'EngineID must be configured for SNMPv3!')

for user, user_config in snmp['v3']['user'].items():
if 'group' not in user_config:
raise ConfigError(f'Group membership required for user "{user}"!')
Expand Down

0 comments on commit 5f75ad8

Please sign in to comment.