Skip to content

Commit 2dede80

Browse files
netpickermailsanjayhere
authored andcommitted
adding 5_snmp (#73)
* removing ruleset files * adding 3_interface rules and refs * Revert "adding 3_interface rules and refs" This reverts commit 6ec630d. * added 3_interfaces rules and refs again * added 4_protocols tests * restrctured 3_interfaces folder * added 6_services * 5_snmp --------- Co-authored-by: mailsanjayhere <mailsanjayhere@gmail.com>
1 parent 3c7f292 commit 2dede80

18 files changed

+249
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from comfy.compliance import medium
2+
3+
4+
@medium(
5+
name='rule_5_1_ensure_common_snmp_community_strings_are_not_used',
6+
platform=['juniper'],
7+
commands=dict(chk_cmd='')
8+
)
9+
def rule_5_1_ensure_common_snmp_community_strings_are_not_used(commands, ref):
10+
assert '' in commands.chk_cmd, ref
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.rule_5_1_ensure_common_snmp_community_strings_are_not_used
2+
3+
Reference: Security Agency (NSA)
4+
Requirement 8.2.1 and 8.5
5+
6+
Remediation: If you have deployed SNMPv1 or SNMPv2c on your router using one of these strings,
7+
rename the community using the following command under the [edit snmp] hierarchy;
8+
[edit snmp]
9+
user@host#rename community <old community> to community <new community>
10+
11+
.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from comfy.compliance import medium
2+
3+
4+
@medium(
5+
name='rule_5_2_ensure_snmpv1_2_are_set_to_read_only',
6+
platform=['juniper'],
7+
commands=dict(chk_cmd='')
8+
)
9+
def rule_5_2_ensure_snmpv1_2_are_set_to_read_only(commands, ref):
10+
assert '' in commands.chk_cmd, ref
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.rule_5_2_ensure_snmpv1_2_are_set_to_read_only
2+
3+
Reference: Security Agency (NSA)
4+
Requirement 8.2.1 and 8.5
5+
6+
Remediation: If you have deployed SNMP below Version 3 on your router with Read-Write access, delete
7+
the associated community using the following command under the [edit snmp] hierarchy;
8+
[edit snmp]
9+
user@host#delete community <community>
10+
11+
12+
13+
Alternatively you can set the communities authorization level to Read Only with the
14+
following command from the [edit snmp <community>] hierarchy;
15+
[edit snmp]
16+
user@host#set community <community> authorization read-only
17+
18+
.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from comfy.compliance import medium
2+
3+
4+
@medium(
5+
name='rule_5_3_ensure_a_client_list_is_set_for_snmpv1_v2_communities',
6+
platform=['juniper'],
7+
commands=dict(chk_cmd='')
8+
)
9+
def rule_5_3_ensure_a_client_list_is_set_for_snmpv1_v2_communities(commands, ref):
10+
assert '' in commands.chk_cmd, ref
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.rule_5_3_ensure_a_client_list_is_set_for_snmpv1_v2_communities
2+
3+
Reference: Configuration Guide, Juniper Networks
4+
(http://www.juniper.net/techpubs/software/junos/junos92/swconfig-net-
5+
mgmt/configuring-the-snmp-community-string.html#id-10428981)
6+
7+
Remediation: To configure a client list issue the following command under the [edit snmp] hierarchy;
8+
[edit snmp]
9+
user@host#edit client-list <client list name>
10+
11+
[edit snmp client-list <client list name>]
12+
user@host#set default restrict
13+
user@host#set <ip address/range>
14+
user@host#set <ip address> restrict #optionally add exceptions
15+
user@host#up 1
16+
17+
[edit snmp]
18+
user@host#edit community <community name>
19+
20+
[edit snmp community <community name>]
21+
user@host#set client-list-name <community name>
22+
23+
24+
25+
The set default restrict is covered in detail in the next recommendation.
26+
Additional IP Addresses may be permitted by repeating the set <ip address/range>
27+
command as needed.
28+
Optionally, addresses that you wish to deny from within a permitted range previously set
29+
can be configured with the set <ip address> restrict command.
30+
Note - Client-lists may also be defined directly under the [edit snmp community <community
31+
name> clients] hierarchy for use within the specified community with the same effect, but
32+
for ease of management and audit, the first method is preferred.
33+
34+
.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from comfy.compliance import medium
2+
3+
4+
@medium(
5+
name='rule_5_4_ensure_default_restrict_is_set_in_all_client_lists',
6+
platform=['juniper'],
7+
commands=dict(chk_cmd='')
8+
)
9+
def rule_5_4_ensure_default_restrict_is_set_in_all_client_lists(commands, ref):
10+
assert '' in commands.chk_cmd, ref
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.rule_5_4_ensure_default_restrict_is_set_in_all_client_lists
2+
3+
Reference: Configuration Guide, Juniper Networks
4+
(http://www.juniper.net/techpubs/software/junos/junos92/swconfig-net-
5+
mgmt/configuring-the-snmp-community-string.html#id-10428981)
6+
7+
Remediation: To configure a client list issue the following command under the [edit snmp client-list
8+
<client list name>] hierarchy;
9+
[edit snmp client-list <client list name>]
10+
user@host#set default restrict
11+
Note - Client-lists may also be defined directly under the [edit snmp community <community
12+
name> clients] hierarchy for use within the specified community with the same effect, but
13+
for ease of management and audit, the first method is preferred.
14+
15+
16+
17+
18+
19+
.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from comfy.compliance import low
2+
3+
4+
@low(
5+
name='rule_5_5_ensure_snmp_write_access_is_not_set',
6+
platform=['juniper'],
7+
commands=dict(chk_cmd='')
8+
)
9+
def rule_5_5_ensure_snmp_write_access_is_not_set(commands, ref):
10+
assert '' in commands.chk_cmd, ref
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.rule_5_5_ensure_snmp_write_access_is_not_set
2+
3+
Reference: Security Agency (NSA)
4+
Requirement 8.1.6 and 8.2.1
5+
6+
Remediation: If you have deployed SNMP below Version 3 on your router with Read-Write access, delete
7+
the associated community using the following command under the [edit snmp] hierarchy;
8+
[edit snmp]
9+
user@host#delete community <community>
10+
Alternatively you can set the communities authorization level to Read Only with the
11+
following command from the [edit snmp <community>] hierarchy;
12+
13+
14+
15+
[edit snmp]
16+
user@host#set community <community> authorization read-only
17+
If you have deployed SNMP Version 3 on your router with Write access, delete the write
18+
view using the following command under the [edit snmp v3 vacm access] hierarchy;
19+
[edit snmp v3 vacm access]
20+
user@host#delete group <group name> default-context-prefix security-model
21+
<security model> security-level <security level> write-view
22+
Complete the sections in <> with the details configured for your group/s. This command
23+
will leave any read or notify views for the group in place. If only a write-view is configured,
24+
the group can be deleted instead.
25+
26+
.

0 commit comments

Comments
 (0)