<div dir="ltr"><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">Thank you, Otto. I have tried both options on a dummy server with exact same setup. <br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">I have attempted to comment out the line  <i>extend pdns-rec /usr/local/bin/pdns_stats </i>in snmpd.conf file and still gotten the same error, however changing permissions to the entire directory to rwx worked but like you mentioned this indeed brings about a security issue. <br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">This line is necessary in the snmpd.conf in order for us to poll statistics onto Cacti from the recursive DNS servers. <br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">This is working on other DNS servers with Ubuntu 16 except 2 servers and this has been mindboggling. <br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">I am running Apparmor (the default) and not SELinux on the servers.<br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif"><br clear="all"></div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><span style="font-family:trebuchet ms,sans-serif">Regards,<br></span></div><div><span style="font-family:trebuchet ms,sans-serif">Sharone</span><br></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 10 Jan 2020 at 12:56, Otto Moerbeek via Pdns-users <<a href="mailto:pdns-users@mailman.powerdns.com">pdns-users@mailman.powerdns.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">It looks like the rec_control line your snmpd.conf is triggering the<br>
problem. Likely the snmd subsystem starts rec_control as a user that<br>
does not have permission to write into /var/run/pdns-recursor.<br>
<br>
You can try disabling (by commenting it out) the<br>
<br>
extend pdns-rec /usr/local/bin/pdns_stats<br>
<br>
line or, if you really need it, change the permissions of the<br>
/var/run/pdns-recursor dir to include rwx for others.<br>
<br>
Not that the latter might have security implications on your system. You<br>
must decide if that is OK for you,<br>
<br>
        -Otto<br>
<br>
<br>
On 2020-01-09 06:24, Sharone wrote:<br>
> Hello Steve,<br>
> <br>
> I appreciate your response. Below is what is inside <br>
> /etc/snmp/snmpd.conf file<br>
> <br>
> /rocommunity public<br>
> syslocation "Data Center"<br>
> syscontact <a href="mailto:admin@techs.co.ug" target="_blank">admin@techs.co.ug</a> <mailto:<a href="mailto:admin@techs.co.ug" target="_blank">admin@techs.co.ug</a>><br>
> createUser admin SHA admin123! AES admin123!<br>
> rouser admin authPriv<br>
> extend pdns-rec /usr/local/bin/pdns_stats<br>
> agentAddress udp:161,udp6:[::1]:161/<br>
> /<br>
> /<br>
> //<br>
> /etc/default/snmpd<br>
> /<br>
> /<br>
> /# This file controls the activity of snmpd<br>
> <br>
> # Don't load any MIBs by default.<br>
> # You might comment this lines once you have the MIBs downloaded.<br>
> export MIBS=<br>
> <br>
> # snmpd control (yes means start daemon).<br>
> SNMPDRUN=yes<br>
> <br>
> # snmpd options (use syslog, close stdin/out/err).<br>
> SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I<br>
> -smux,mteTrigger,mteTriggerConf -p /run/snmpd.pid'/<br>
> /<br>
> /<br>
> snmp service status/<br>
> /<br>
> /<br>
> /<br>
> /# systemctl status snmpd.service<br>
> ● snmpd.service - LSB: SNMP agents<br>
>    Loaded: loaded (/etc/init.d/snmpd; bad; vendor preset: enabled)<br>
>    Active: active (running) since Thu 2020-01-09 08:24:04 EAT; 4s ago<br>
>      Docs: man:systemd-sysv-generator(8)<br>
>   Process: 694 ExecStop=/etc/init.d/snmpd stop (code=exited,<br>
> status=0/SUCCESS)<br>
>   Process: 703 ExecStart=/etc/init.d/snmpd start (code=exited,<br>
> status=0/SUCCESS)<br>
>     Tasks: 1<br>
>    Memory: 4.3M<br>
>       CPU: 66ms<br>
>    CGroup: /system.slice/snmpd.service<br>
>            └─710 /usr/sbin/snmpd -Lsd -Lf /dev/null -u snmp -g snmp -I<br>
> -smux mteTrigger mteTriggerConf -p /run/snmpd.pid<br>
> <br>
> Jan 09 08:24:04 vdns-50 systemd[1]: Starting LSB: SNMP agents...<br>
> Jan 09 08:24:04 vdns-50 snmpd[703]:  * Starting SNMP services:<br>
> Jan 09 08:24:04 vdns-50 systemd[1]: Started LSB: SNMP agents.<br>
> Jan 09 08:24:04 vdns-50 snmpd[710]: NET-SNMP version 5.7.3<br>
> /<br>
> <br>
> Regards,<br>
> Sharone<br>
> <br>
> <br>
> On Wed, 8 Jan 2020 at 22:35, Steve Shipway <<a href="mailto:steve.shipway@smxemail.com" target="_blank">steve.shipway@smxemail.com</a><br>
> <mailto:<a href="mailto:steve.shipway@smxemail.com" target="_blank">steve.shipway@smxemail.com</a>>> wrote:<br>
> <br>
>     On Wed, 2020-01-08 at 09:20 +0300, Sharone wrote:<br>
>>     /# snmpwalk -v2c -c public localhost .1.3.6.1.4.1.8072.1.3.2.4.1.2<br>
>>     iso.3.6.1.4.1.8072.1.3.2.4.1.2.8.112.100.110.115.45.114.101.99.1 =<br>
>>     STRING: "Fatal: Unable to generate local temporary file in<br>
>>     directory '/var/run/pdns-recursor': Permission denied"/<br>
> <br>
>     A couple of thoughts here .  Either<br>
>     - SElinux is doing its magic and blocking - this should be logged in<br>
>     the syslog if so, or<br>
>     - Your SNMP is running with chroot enabled and<br>
>     /var/run/pdns-recursor doesn't exist in the chroot environment<br>
>     -  rec_control is trying to generate a tmp file as the snmp user so<br>
>     doesn't have write permission.<br>
>     - Your SNMP daemon is using a temporary file for the rec_control<br>
>     output which it is trying to put in /var/run/pdns-recursor<br>
> <br>
>     Being able to see your snmp daemon configuration would probably help<br>
>     with diagnosing this, so please post it here if possible.<br>
> <br>
>     Steve<br>
> <br>
> <br>
>     -- <br>
>     *Steve Shipway | *Senior Email Systems Administrator <br>
>     *Phone:* +64 9 302 0515 *Fax:* +64 9 302 0518 <br>
>     *Freephone:* 0800 SMX SMX (769 769) <br>
>     *SMX Limited:* Level 10, 19 Victoria Street West, Auckland, New Zealand <br>
>     *Web:* <a href="http://smxemail.com" rel="noreferrer" target="_blank">http://smxemail.com</a> <<a href="http://smxemail.com/" rel="noreferrer" target="_blank">http://smxemail.com/</a>> <br>
> <br>
>     This email has been filtered by SMX. For more information<br>
>     visit <a href="http://smxemail.com" rel="noreferrer" target="_blank">smxemail.com</a> <<a href="http://smxemail.com/" rel="noreferrer" target="_blank">http://smxemail.com/</a>><br>
>     _______________________________________________<br>
>     Pdns-users mailing list<br>
>     <a href="mailto:Pdns-users@mailman.powerdns.com" target="_blank">Pdns-users@mailman.powerdns.com</a> <mailto:<a href="mailto:Pdns-users@mailman.powerdns.com" target="_blank">Pdns-users@mailman.powerdns.com</a>><br>
>     <a href="https://mailman.powerdns.com/mailman/listinfo/pdns-users" rel="noreferrer" target="_blank">https://mailman.powerdns.com/mailman/listinfo/pdns-users</a><br>
> <br>
> <br>
> _______________________________________________<br>
> Pdns-users mailing list<br>
> <a href="mailto:Pdns-users@mailman.powerdns.com" target="_blank">Pdns-users@mailman.powerdns.com</a><br>
> <a href="https://mailman.powerdns.com/mailman/listinfo/pdns-users" rel="noreferrer" target="_blank">https://mailman.powerdns.com/mailman/listinfo/pdns-users</a><br>
> <br>
<br>
-- <br>
kind regards,<br>
Otto Moerbeek<br>
PowerDNS Developer<br>
<br>
Email: <a href="mailto:otto.moerbeek@open-xchange.com" target="_blank">otto.moerbeek@open-xchange.com</a><br>
<br>
_______________________________________________<br>
Pdns-users mailing list<br>
<a href="mailto:Pdns-users@mailman.powerdns.com" target="_blank">Pdns-users@mailman.powerdns.com</a><br>
<a href="https://mailman.powerdns.com/mailman/listinfo/pdns-users" rel="noreferrer" target="_blank">https://mailman.powerdns.com/mailman/listinfo/pdns-users</a><br>
</blockquote></div>