-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from jordiprats/master
0.2.2
- Loading branch information
Showing
4 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
# CHANGELOG | ||
|
||
## 0.2.2 | ||
|
||
* added auto ACL mode | ||
|
||
## 0.2.1 | ||
|
||
* millora check snmpv3 user | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class { 'snmpd': | ||
add_default_acls => false, | ||
} | ||
|
||
class { 'snmpd::loadavg': } | ||
|
||
# snmpwalk -v3 -l authPriv -u v3testuser -a SHA -A "1234567890" -x AES -X "1234567890" 127.0.0.1 system | ||
|
||
snmpd::acl { 'demo': | ||
community => $::eyp_snmpd_acls['demo']['community'], | ||
allowed_hosts => $::eyp_snmpd_acls['demo']['hosts'], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
snmp_users = Facter::Util::Resolution.exec('bash -c \'grep com2sec /etc/snmp/snmpd.conf | awk "{ print \$2 }" | sort | uniq\'').to_s | ||
|
||
unless snmp_users.nil? or snmp_users.empty? | ||
# Facter.add('eyp_snmpd_acls') do | ||
# setcode do | ||
# snmp_users.split("\n") | ||
# end | ||
# end | ||
|
||
snmp_acls = {} | ||
|
||
for snmp_user in snmp_users.split("\n") | ||
snmp_user_hosts = Facter::Util::Resolution.exec("bash -c 'grep com2sec /etc/snmp/snmpd.conf | grep #{snmp_user} | awk \"{ print \\$3 }\" | sort | uniq'").to_s.split("\n") | ||
snmp_user_community = Facter::Util::Resolution.exec("bash -c 'grep com2sec /etc/snmp/snmpd.conf | grep #{snmp_user} | awk \"{ print \\$4 }\" | sort | head -n1'").to_s | ||
|
||
snmp_acls[snmp_user] = { 'hosts' => snmp_user_hosts, 'community' => snmp_user_community } | ||
end | ||
|
||
Facter.add('eyp_snmpd_acls') do | ||
setcode do | ||
snmp_acls | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters