0

I'm setting up net-snmp on CentOS and I'm getting an issue setting up non-default port. Basically, if I set it up as 161 or port 32768 or greater, it works fine, but it doesn't work for anything between 10000 and 32767.

Any ideas what might be causing this? It's particular to one server only, and it's working fine on other similarly configured servers.

Here are the logs in /var/log/messages:

May  3 11:15:27 oninfra01 snmpd[27709]: Error opening specified endpoint "5161"
May  3 11:15:27 oninfra01 kernel: type=1400 audit(1336058127.584:57070): avc:  denied  { name_bind } for  pid=27709 comm="snmpd" src=5161 scontext=unconfined_u:system_r:snmpd_t:s0 tcontext=system_u:object_r:port_t:s0 tclass=udp_socket
May  3 11:15:27 oninfra01 kernel: type=1400 audit(1336058127.584:57071): avc:  denied  { name_bind } for  pid=27709 comm="snmpd" src=5161 scontext=unconfined_u:system_r:snmpd_t:s0 tcontext=system_u:object_r:port_t:s0 tclass=udp_socket
May  3 11:15:27 oninfra01 snmpd[27709]: Server Exiting with code 1
Kenny Rasschaert
  • 9,045
  • 3
  • 42
  • 58
ashvagan
  • 23
  • 1
  • 7

2 Answers2

1

SELINUX strikes again.

Add a rule allowing it or disable selinux.

#getenforce

#setenforce permissive

This might work as far as creating a new rule for selinux, but better to disable it if you don't understand it, it will bite again.

# grep snmp /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp
foocorpluser
  • 448
  • 3
  • 7
1

One way to allow more ports for snmp in SELinux is

semanage port -a -t snmp_port_t -p tcp 10000-32767
semanage port -a -t snmp_port_t -p udp 10000-32767

(commands might take a while to run, that's normal because SELinux compiles its rulesets)

Check if it went OK:

semanage port -l | grep snmp
Janne Pikkarainen
  • 31,852
  • 4
  • 58
  • 81