summaryrefslogtreecommitdiff
path: root/scripts/snmp
diff options
context:
space:
mode:
authorJames Davidson <james.davidson@vyatta.com>2013-05-16 09:29:53 -0700
committerJames Davidson <james.davidson@vyatta.com>2013-05-16 10:17:43 -0700
commit55f3c16fbdcad6616495cc02205999ae0307ffeb (patch)
treecb4d6d6f50076b3bf67c82a79b966e21a040ae15 /scripts/snmp
parent2ce614b5b76309c2257e8d11bea929278c96f428 (diff)
downloadvyatta-cfg-system-55f3c16fbdcad6616495cc02205999ae0307ffeb.tar.gz
vyatta-cfg-system-55f3c16fbdcad6616495cc02205999ae0307ffeb.zip
SNMP sync up
Minor fixes. Refactoring. Add seclevel property to SNMPv3 group.
Diffstat (limited to 'scripts/snmp')
-rwxr-xr-xscripts/snmp/vyatta-snmp-v3.pl15
1 files changed, 9 insertions, 6 deletions
diff --git a/scripts/snmp/vyatta-snmp-v3.pl b/scripts/snmp/vyatta-snmp-v3.pl
index 5391a85f..ca648477 100755
--- a/scripts/snmp/vyatta-snmp-v3.pl
+++ b/scripts/snmp/vyatta-snmp-v3.pl
@@ -191,7 +191,8 @@ sub set_views {
my $config = get_snmp_config();
foreach my $view ( $config->listNodes("view") ) {
foreach my $oid ( $config->listNodes("view $view oid") ) {
- my $mask = $config->returnValue("view $view oid $oid mask");
+ my $mask = '';
+ $mask = $config->returnValue("view $view oid $oid mask") if $config->exists("view $view oid $oid mask");
if ( $config->exists("view $view oid $oid exclude") ) {
print "view $view excluded .$oid $mask\n";
}
@@ -210,13 +211,14 @@ sub set_groups {
foreach my $group ( $config->listNodes("group") ) {
my $mode = $config->returnValue("group $group mode");
my $view = $config->returnValue("group $group view");
+ my $secLevel = $config->returnValue("group $group seclevel");
if ( $mode eq "ro" ) {
- print "access $group \"\" usm auth exact $view none none\n";
- print "access $group \"\" tsm auth exact $view none none\n";
+ print "access $group \"\" usm $secLevel exact $view none none\n";
+ print "access $group \"\" tsm $secLevel exact $view none none\n";
}
else {
- print "access $group \"\" usm auth exact $view $view none\n";
- print "access $group \"\" tsm auth exact $view $view none\n";
+ print "access $group \"\" usm $secLevel exact $view $view none\n";
+ print "access $group \"\" tsm $secLevel exact $view $view none\n";
}
}
print "\n";
@@ -272,7 +274,8 @@ sub set_users_to_other {
if ( $config->exists("auth") ) {
if ( $config->exists("auth plaintext-key") ) {
my $auth_key = $config->returnValue("auth plaintext-key");
- my $priv_key = $config->returnValue("privacy plaintext-key");
+ my $priv_key = '';
+ $priv_key = $config->returnValue("privacy plaintext-key") if $config->exists("privacy plaintext-key");
print $var_conf
"createUser $user \U$auth_type\E $auth_key \U$priv_type\E $priv_key\n";
}