{"id":4486,"date":"2022-06-23T12:30:00","date_gmt":"2022-06-23T17:30:00","guid":{"rendered":"https:\/\/www.incredigeek.com\/home\/?p=4486"},"modified":"2022-06-23T12:05:15","modified_gmt":"2022-06-23T17:05:15","slug":"hardening-snmp-on-centos-redhat-fedora-etc","status":"publish","type":"post","link":"https:\/\/www.incredigeek.com\/home\/hardening-snmp-on-centos-redhat-fedora-etc\/","title":{"rendered":"Hardening SNMP on CentOS\/RedHat\/Fedora Etc."},"content":{"rendered":"\n<p>These steps should be similar across Red Hat type distros.<\/p>\n\n\n\n<p>Before we proceed, lets stop SNMP<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl stop snmpd<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Disable SNMP Versions 1 and 2c<\/h2>\n\n\n\n<p>First we are going to disable SNMP v1 and v2c<\/p>\n\n\n\n<p>You can manually edit the \/etc\/snmp\/snmpd.conf file and comment out or delete every line starting with com2sec, group, access.  Or you can run the following sed commands to change it for you.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo sed -i 's\/^com2sec\/# com2sec\/g' \/etc\/snmp\/snmpd.conf<br>sudo sed -i 's\/^group\/# group\/g' \/etc\/snmp\/snmpd.conf<br>sudo sed -i 's\/^access\/# access\/g' \/etc\/snmp\/snmpd.conf<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><a href=\"https:\/\/serverfault.com\/questions\/376688\/how-to-disable-version-1-and-version-2c-in-snmpd\">https:\/\/serverfault.com\/questions\/376688\/how-to-disable-version-1-and-version-2c-in-snmpd<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Create SNMP Version 3 User<\/h2>\n\n\n\n<p>Follow the prompts to create a SNMP v3 user.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo net-snmp-create-v3-user -ro -a SHA -x AES<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>Start SNMP<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl start snmpd<\/pre>\n\n\n\n<p>You should be good to go. <\/p>\n\n\n\n<p>If you are running a firewall, you will need to allow an exception for SNMP, UDP port 161.  You may also need to allow an SELinux exception.  Check out the last portion of both these articles.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-incredigeek wp-block-embed-incredigeek\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"cEOZYHgW0E\"><a href=\"https:\/\/www.incredigeek.com\/home\/setting-up-snmp-v3-on-centos\/\">Setting up SNMP V3 on CentOS<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Setting up SNMP V3 on CentOS&#8221; &#8212; Incredigeek\" src=\"https:\/\/www.incredigeek.com\/home\/setting-up-snmp-v3-on-centos\/embed\/#?secret=qc8kutbaqe#?secret=cEOZYHgW0E\" data-secret=\"cEOZYHgW0E\" width=\"584\" height=\"329\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><figcaption>Allowing SNMP Through Firewall<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-incredigeek wp-block-embed-incredigeek\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"VCIsE1OJGG\"><a href=\"https:\/\/www.incredigeek.com\/home\/semanage-allow-and-delete-ports-in-centos\/\">semanage Allow and Delete ports in CentOS<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;semanage Allow and Delete ports in CentOS&#8221; &#8212; Incredigeek\" src=\"https:\/\/www.incredigeek.com\/home\/semanage-allow-and-delete-ports-in-centos\/embed\/#?secret=C9IWngqibO#?secret=VCIsE1OJGG\" data-secret=\"VCIsE1OJGG\" width=\"584\" height=\"329\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>These steps should be similar across Red Hat type distros. Before we proceed, lets stop SNMP sudo systemctl stop snmpd Disable SNMP Versions 1 and 2c First we are going to disable SNMP v1 and v2c You can manually edit &hellip; <a href=\"https:\/\/www.incredigeek.com\/home\/hardening-snmp-on-centos-redhat-fedora-etc\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[130],"tags":[17,19,1309,538,133,360,1308],"class_list":["post-4486","post","type-post","status-publish","format-standard","hentry","category-snmp","tag-centos","tag-fedora","tag-hardening","tag-rhel","tag-snmp-2","tag-snmpv3","tag-v3"],"_links":{"self":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/4486","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/comments?post=4486"}],"version-history":[{"count":1,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/4486\/revisions"}],"predecessor-version":[{"id":4489,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/4486\/revisions\/4489"}],"wp:attachment":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/media?parent=4486"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/categories?post=4486"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/tags?post=4486"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}