shh
Anonymous
139 x views • 5 years ago
#! /bin/bash
echo "--> Updating CentOS System, then install snmp"
yum -y update
yum install net-snmp net-snmp-utils -y
systemctl enable snmpd
systemctl restart snmpd
sudo yum install firewalld
sudo systemctl enable firewalld
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig
systemctl restart firewalld
firewall-cmd --permanent --add-port=161/udp
firewall-cmd --reload
firewall-cmd --list-all
echo -e "# sec.name source community\ncom2sec notConfigUser default @lawangs18\n
####\n# Second, map the security name into a group name:\n
# groupName securityModel securityName\ngroup notConfigGroup v1 notConfigUser\ngroup notConfigGroup v2c notConfigUser\n
####\n# Third, create a view for us to let the group have rights to:\n# Make at least snmpwalk -v 1 localhost -c public system fast again.\n
# name incl/excl subtree mask(optional)\n#view systemview included .1.3.6.1.2.1.1\n#view systemview included .1.3.6.1.2.1.25.1.1\n
view all included .1\n
####\n# Finally, grant the group read-only access to the systemview view.\n# group context sec.model sec.level prefix read write notif\n
access notConfigGroup "" any noauth exact all none none\n
# It is also possible to set the sysContact and sysLocation system\n# variables through the snmpd.conf file:\nsyslocation Jakarta\nsyscontact [email protected]\n
# We do not want annoying "Connection from UDP: " messages in syslog.\n# If the following option is commented out, snmpd will print each incoming\n
# connection, which can be useful for debugging.\ndontLogTCPWrappersConnects yes" > /etc/snmp/snmpd.conf
echo "--> Updating CentOS System, then install snmp"
yum -y update
yum install net-snmp net-snmp-utils -y
systemctl enable snmpd
systemctl restart snmpd
sudo yum install firewalld
sudo systemctl enable firewalld
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig
systemctl restart firewalld
firewall-cmd --permanent --add-port=161/udp
firewall-cmd --reload
firewall-cmd --list-all
echo -e "# sec.name source community\ncom2sec notConfigUser default @lawangs18\n
####\n# Second, map the security name into a group name:\n
# groupName securityModel securityName\ngroup notConfigGroup v1 notConfigUser\ngroup notConfigGroup v2c notConfigUser\n
####\n# Third, create a view for us to let the group have rights to:\n# Make at least snmpwalk -v 1 localhost -c public system fast again.\n
# name incl/excl subtree mask(optional)\n#view systemview included .1.3.6.1.2.1.1\n#view systemview included .1.3.6.1.2.1.25.1.1\n
view all included .1\n
####\n# Finally, grant the group read-only access to the systemview view.\n# group context sec.model sec.level prefix read write notif\n
access notConfigGroup "" any noauth exact all none none\n
# It is also possible to set the sysContact and sysLocation system\n# variables through the snmpd.conf file:\nsyslocation Jakarta\nsyscontact [email protected]\n
# We do not want annoying "Connection from UDP: " messages in syslog.\n# If the following option is commented out, snmpd will print each incoming\n
# connection, which can be useful for debugging.\ndontLogTCPWrappersConnects yes" > /etc/snmp/snmpd.conf