aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/snmp/src/agent/snmp_framework_mib.erl12
-rw-r--r--lib/snmp/src/agent/snmp_user_based_sm_mib.erl55
-rw-r--r--lib/snmp/src/agent/snmp_view_based_acm_mib.erl4
-rw-r--r--lib/snmp/src/agent/snmpa.erl22
-rw-r--r--lib/snmp/test/test_config/.gitignore1
-rw-r--r--lib/snmp/test/test_config/Makefile26
-rw-r--r--lib/snmp/test/test_config/agent/agent.conf.src2
-rw-r--r--lib/snmp/test/test_config/agent/usm.conf.src17
-rw-r--r--lib/snmp/test/test_config/manager/manager.conf.src2
-rw-r--r--lib/snmp/test/test_config/manager/usm.conf.src1
-rw-r--r--lib/snmp/test/test_config/modules.mk1
-rw-r--r--lib/snmp/test/test_config/sys-agent.config.src2
-rw-r--r--lib/snmp/test/test_config/sys.config.src4
13 files changed, 138 insertions, 11 deletions
diff --git a/lib/snmp/src/agent/snmp_framework_mib.erl b/lib/snmp/src/agent/snmp_framework_mib.erl
index d9bf7e8551..0d7866d94d 100644
--- a/lib/snmp/src/agent/snmp_framework_mib.erl
+++ b/lib/snmp/src/agent/snmp_framework_mib.erl
@@ -373,15 +373,27 @@ intAgentUDPPort(Op) ->
intAgentIpAddress(Op) ->
snmp_generic:variable_func(Op, db(intAgentIpAddress)).
+snmpEngineID(print) ->
+ VarAndValue = [{snmpEngineID, snmpEngineID(get)}],
+ snmpa_mib_lib:print_variables(VarAndValue);
snmpEngineID(Op) ->
snmp_generic:variable_func(Op, db(snmpEngineID)).
+snmpEngineMaxMessageSize(print) ->
+ VarAndValue = [{snmpEngineMaxMessageSize, snmpEngineMaxMessageSize(get)}],
+ snmpa_mib_lib:print_variables(VarAndValue);
snmpEngineMaxMessageSize(Op) ->
snmp_generic:variable_func(Op, db(snmpEngineMaxMessageSize)).
+snmpEngineBoots(print) ->
+ VarAndValue = [{snmpEngineBoots, snmpEngineBoots(get)}],
+ snmpa_mib_lib:print_variables(VarAndValue);
snmpEngineBoots(Op) ->
snmp_generic:variable_func(Op, db(snmpEngineBoots)).
+snmpEngineTime(print) ->
+ VarAndValue = [{snmpEngineTime, snmpEngineTime(get)}],
+ snmpa_mib_lib:print_variables(VarAndValue);
snmpEngineTime(get) ->
{value, get_engine_time()}.
diff --git a/lib/snmp/src/agent/snmp_user_based_sm_mib.erl b/lib/snmp/src/agent/snmp_user_based_sm_mib.erl
index 4c3f27c4ef..69cebc858b 100644
--- a/lib/snmp/src/agent/snmp_user_based_sm_mib.erl
+++ b/lib/snmp/src/agent/snmp_user_based_sm_mib.erl
@@ -26,6 +26,12 @@
table_next/2,
is_engine_id_known/1, get_user/2, get_user_from_security_name/2,
mk_key_change/3, mk_key_change/5, extract_new_key/3, mk_random/1]).
+-export([usmStatsUnsupportedSecLevels/1,
+ usmStatsNotInTimeWindows/1,
+ usmStatsUnknownUserNames/1,
+ usmStatsUnknownEngineIDs/1,
+ usmStatsWrongDigests/1,
+ usmStatsDecryptionErrors/1]).
-export([add_user/1, add_user/13, delete_user/1]).
%% Internal
@@ -303,6 +309,54 @@ gc_tabs() ->
%%-----------------------------------------------------------------
%% Counter functions
%%-----------------------------------------------------------------
+
+usmStatsUnsupportedSecLevels(print) ->
+ VarAndValue = [{usmStatsUnsupportedSecLevels,
+ usmStatsUnsupportedSecLevels(get)}],
+ snmpa_mib_lib:print_variables(VarAndValue);
+usmStatsUnsupportedSecLevels(get) ->
+ get_counter(usmStatsUnsupportedSecLevels).
+
+usmStatsNotInTimeWindows(print) ->
+ VarAndValue = [{usmStatsNotInTimeWindows, usmStatsNotInTimeWindows(get)}],
+ snmpa_mib_lib:print_variables(VarAndValue);
+usmStatsNotInTimeWindows(get) ->
+ get_counter(usmStatsNotInTimeWindows).
+
+usmStatsUnknownUserNames(print) ->
+ VarAndValue = [{usmStatsUnknownUserNames, usmStatsUnknownUserNames(get)}],
+ snmpa_mib_lib:print_variables(VarAndValue);
+usmStatsUnknownUserNames(get) ->
+ get_counter(usmStatsUnknownUserNames).
+
+usmStatsUnknownEngineIDs(print) ->
+ VarAndValue = [{usmStatsUnknownEngineIDs, usmStatsUnknownEngineIDs(get)}],
+ snmpa_mib_lib:print_variables(VarAndValue);
+usmStatsUnknownEngineIDs(get) ->
+ get_counter(usmStatsUnknownEngineIDs).
+
+usmStatsWrongDigests(print) ->
+ VarAndValue = [{usmStatsWrongDigests, usmStatsWrongDigests(get)}],
+ snmpa_mib_lib:print_variables(VarAndValue);
+usmStatsWrongDigests(get) ->
+ get_counter(usmStatsWrongDigests).
+
+usmStatsDecryptionErrors(print) ->
+ VarAndValue = [{usmStatsDecryptionErrors, usmStatsDecryptionErrors(get)}],
+ snmpa_mib_lib:print_variables(VarAndValue);
+usmStatsDecryptionErrors(get) ->
+ get_counter(usmStatsDecryptionErrors).
+
+
+get_counter(Name) ->
+ case (catch ets:lookup(snmp_agent_table, Name)) of
+ [{_, Val}] ->
+ {value, Val};
+ _ ->
+ genErr
+ end.
+
+
init_vars() -> lists:map(fun maybe_create_var/1, vars()).
maybe_create_var(Var) ->
@@ -323,6 +377,7 @@ vars() ->
usmStatsDecryptionErrors
].
+
%%-----------------------------------------------------------------
%% API functions
%%-----------------------------------------------------------------
diff --git a/lib/snmp/src/agent/snmp_view_based_acm_mib.erl b/lib/snmp/src/agent/snmp_view_based_acm_mib.erl
index 659babaf94..74acda2f21 100644
--- a/lib/snmp/src/agent/snmp_view_based_acm_mib.erl
+++ b/lib/snmp/src/agent/snmp_view_based_acm_mib.erl
@@ -749,6 +749,7 @@ do_get_next(RowIndex, Cols) ->
end
end.
+
%%-----------------------------------------------------------------
%% Functions to manipulate vacmAccessRows.
%%-----------------------------------------------------------------
@@ -939,6 +940,9 @@ do_get_vacmAccessTable(Key0, Acc) ->
end.
+%%-----------------------------------------------------------------
+%% Wrappers
+%%-----------------------------------------------------------------
db(X) -> snmpa_agent:db(X).
volatile_db(X) -> {X, volatile}.
diff --git a/lib/snmp/src/agent/snmpa.erl b/lib/snmp/src/agent/snmpa.erl
index 3c214874fe..22fbd33add 100644
--- a/lib/snmp/src/agent/snmpa.erl
+++ b/lib/snmp/src/agent/snmpa.erl
@@ -327,6 +327,16 @@ mibs_info() ->
snmpOutTraps
]
},
+ {snmp_framework_mib,
+ [
+ ],
+ [
+ snmpEngineID,
+ snmpEngineBoots,
+ snmpEngineTime,
+ snmpEngineMaxMessageSize
+ ]
+ },
{snmp_view_based_acm_mib,
[
vacmAccessTable,
@@ -362,7 +372,13 @@ mibs_info() ->
usmUserTable
],
[
- usmUserSpinLock
+ usmUserSpinLock,
+ usmStatsUnsupportedSecLevels,
+ usmStatsNotInTimeWindows,
+ usmStatsUnknownUserNames,
+ usmStatsUnknownEngineIDs,
+ usmStatsWrongDigests,
+ usmStatsDecryptionErrors
]
}
].
@@ -441,8 +457,8 @@ make_pretty_mib(snmp_notification_mib) ->
"SNMP-NOTIFICATION-MIB";
make_pretty_mib(snmp_user_based_sm_mib) ->
"SNMP-USER-BASED-SM-MIB";
-make_pretty_mib(snmp_standard_mib) ->
- "STANDARD-MIB";
+make_pretty_mib(snmp_framework_mib) ->
+ "SNMP-FRAMEWORK-MIB";
make_pretty_mib(Mod) ->
atom_to_list(Mod).
diff --git a/lib/snmp/test/test_config/.gitignore b/lib/snmp/test/test_config/.gitignore
index 60d564fe4d..fc2d5dbadf 100644
--- a/lib/snmp/test/test_config/.gitignore
+++ b/lib/snmp/test/test_config/.gitignore
@@ -11,6 +11,7 @@
/agent/standard.conf
/agent/target_addr.conf
/agent/target_params.conf
+/agent/usm.conf
/agent/vacm.conf
# Manager config files (Generated)
diff --git a/lib/snmp/test/test_config/Makefile b/lib/snmp/test/test_config/Makefile
index c02bb5c601..4953de7fe8 100644
--- a/lib/snmp/test/test_config/Makefile
+++ b/lib/snmp/test/test_config/Makefile
@@ -94,6 +94,22 @@ ifeq ($(SYS_NAME),)
SYS_NAME = FOO
endif
+ifeq ($(AGENT_ENGINE_ID),)
+AGENT_ENGINE_ID = Agent engine of $(USER)
+endif
+
+ifeq ($(AGENT_USM_ENGINE_ID),)
+AGENT_USM_ENGINE_ID = $(AGENT_ENGINE_ID)
+endif
+
+ifeq ($(MANAGER_ENGINE_ID),)
+MANAGER_ENGINE_ID = Manager engine of $(USER)
+endif
+
+ifeq ($(MANAGER_USM_ENGINE_ID),)
+MANAGER_USM_ENGINE_ID = $(MANAGER_ENGINE_ID)
+endif
+
# ----------------------------------------------------
@@ -119,11 +135,15 @@ agent/%.conf: agent/%.conf.src
-e 's?%SYS_CONTACT%?$(SYS_CONTACT)? ' \
-e 's?%SYS_LOCATION%?$(SYS_LOCATION)? ' \
-e 's?%SYS_NAME%?$(SYS_NAME)? ' \
- -e 's?%TARGET_NAME_PRE%?$(TARGET_NAME_PRE)? ' < $< > $@
+ -e 's?%TARGET_NAME_PRE%?$(TARGET_NAME_PRE)? ' \
+ -e 's?%ENGINE_ID%?\"$(AGENT_ENGINE_ID)\"? ' \
+ -e 's?%USM_ENGINE_ID%?\"$(AGENT_USM_ENGINE_ID)\"? ' < $< > $@
manager/%.conf: manager/%.conf.src
@echo "$< -> $@"
- $(PERL) -p -e 's?%ADDR%?$(ADDR)? ' < $< > $@
+ sed -e 's?%ADDR%?$(ADDR)? ' \
+ -e 's?%ENGINE_ID%?\"$(MANAGER_ENGINE_ID)\"? ' \
+ -e 's?%USM_ENGINE_ID%?\"$(MANAGER_USM_ENGINE_ID)\"? ' < $< > $@
# ----------------------------------------------------
@@ -133,7 +153,7 @@ include $(ERL_TOP)/make/otp_release_targets.mk
release_spec:
-release_tests_spec: opt
+release_tests_spec: clean opt
$(INSTALL_DIR) $(RELSYSDIR)
chmod -f -R u+w $(RELSYSDIR)
$(INSTALL_DIR) $(RELSYSDIR)/agent
diff --git a/lib/snmp/test/test_config/agent/agent.conf.src b/lib/snmp/test/test_config/agent/agent.conf.src
index 2977cd49f8..1fe95cc72d 100644
--- a/lib/snmp/test/test_config/agent/agent.conf.src
+++ b/lib/snmp/test/test_config/agent/agent.conf.src
@@ -15,5 +15,5 @@
{intAgentUDPPort, 4000}.
{intAgentIpAddress, %ADDR%}.
-{snmpEngineID, "foo"}.
+{snmpEngineID, %ENGINE_ID%}.
{snmpEngineMaxMessageSize, 484}.
diff --git a/lib/snmp/test/test_config/agent/usm.conf.src b/lib/snmp/test/test_config/agent/usm.conf.src
new file mode 100644
index 0000000000..0409084048
--- /dev/null
+++ b/lib/snmp/test/test_config/agent/usm.conf.src
@@ -0,0 +1,17 @@
+%% This file defines the security parameters for the user-based
+%% security model.
+%% The data is inserted into the usmUserTable defined
+%% in SNMP-USER-BASED-SM-MIB.
+%% Each row is a 13-tuple:
+%% {EngineID, UserName, SecName, Clone, AuthP, AuthKeyC, OwnAuthKeyC,
+%% PrivP, PrivKeyC, OwnPrivKeyC, Public, AuthKey, PrivKey}.
+%% For example
+%% {"agentEngine", "initial", "initial", zeroDotZero,
+%% usmNoAuthProtocol, "", "", usmNoPrivProtocol, "", "", "",
+%% "", ""}.
+%%
+
+
+{%USM_ENGINE_ID%, "initial", "initial", zeroDotZero, usmHMACMD5AuthProtocol, "", "", usmNoPrivProtocol, "", "", "", [160,66,33,136,178,59,246,214,102,63,131,131,54,14,221,177], ""}.
+{%USM_ENGINE_ID%, "templateMD5", "templateMD5", zeroDotZero, usmHMACMD5AuthProtocol, "", "", usmNoPrivProtocol, "", "", "", [160,66,33,136,178,59,246,214,102,63,131,131,54,14,221,177], ""}.
+{%USM_ENGINE_ID%, "templateSHA", "templateSHA", zeroDotZero, usmHMACSHAAuthProtocol, "", "", usmNoPrivProtocol, "", "", "", [199,94,239,13,229,135,141,77,124,129,65,189,230,240,115,163,239,15,13,242], ""}.
diff --git a/lib/snmp/test/test_config/manager/manager.conf.src b/lib/snmp/test/test_config/manager/manager.conf.src
index 7d4104ded2..c38a61b13c 100644
--- a/lib/snmp/test/test_config/manager/manager.conf.src
+++ b/lib/snmp/test/test_config/manager/manager.conf.src
@@ -12,5 +12,5 @@
{port, 5000}.
{address, %ADDR%}.
-{engine_id, "foo"}.
+{engine_id, %ENGINE_ID%}.
{max_message_size, 484}.
diff --git a/lib/snmp/test/test_config/manager/usm.conf.src b/lib/snmp/test/test_config/manager/usm.conf.src
index 39122cab5c..a558c86710 100644
--- a/lib/snmp/test/test_config/manager/usm.conf.src
+++ b/lib/snmp/test/test_config/manager/usm.conf.src
@@ -5,4 +5,5 @@
%% {EngineID, UserName, SecName, AuthP, AuthKey, PrivP, PrivKey}
%%
+{%USM_ENGINE_ID%, "initial", usmNoAuthProtocol, "", usmNoPrivProtocol, ""}.
diff --git a/lib/snmp/test/test_config/modules.mk b/lib/snmp/test/test_config/modules.mk
index ee8b68d4eb..3d084cef01 100644
--- a/lib/snmp/test/test_config/modules.mk
+++ b/lib/snmp/test/test_config/modules.mk
@@ -30,6 +30,7 @@ AGENT_CONFIG_FILES = \
agent/standard.conf \
agent/target_addr.conf \
agent/target_params.conf \
+ agent/usm.conf \
agent/vacm.conf
MANAGER_CONFIG_FILES = \
diff --git a/lib/snmp/test/test_config/sys-agent.config.src b/lib/snmp/test/test_config/sys-agent.config.src
index eb6b0916ff..46a458203d 100644
--- a/lib/snmp/test/test_config/sys-agent.config.src
+++ b/lib/snmp/test/test_config/sys-agent.config.src
@@ -5,7 +5,7 @@
{agent,
[
{priority, normal},
- {versions, [v2]},
+ {versions, [v1,v2,v3]},
{db_dir, "%DIR%/agent/db"},
{mib_storage, ets},
%% {agent_mib_storage, volatile},
diff --git a/lib/snmp/test/test_config/sys.config.src b/lib/snmp/test/test_config/sys.config.src
index 7e4e3b0acd..b2cd399883 100644
--- a/lib/snmp/test/test_config/sys.config.src
+++ b/lib/snmp/test/test_config/sys.config.src
@@ -5,7 +5,7 @@
{agent,
[
{priority, normal},
- {versions, [v2]},
+ {versions, [v1,v2,v3]},
{db_dir, "%DIR%/agent/db"},
{mib_storage, ets},
{agent_mib_storage, volatile},
@@ -38,7 +38,7 @@
{manager,
[
{priority, normal},
- {versions, [v2]},
+ {versions, [v1,v2,v3]},
{config, [{dir, "%DIR%/manager/conf"},
{verbosity, silence},
{db_dir, "%DIR%/manager/db"},