[prev in list] [next in list] [prev in thread] [next in thread] 

List:       net-snmp-coders
Subject:    Configuration files are not resilient to power failure
From:       Josef Ridky <jridky () redhat ! com>
Date:       2018-01-15 9:18:57
Message-ID: 284454047.6665352.1516007937827.JavaMail.zimbra () redhat ! com
[Download RAW message or body]

Hi coders,

I have been requested to report following issue in net-snmp. 
I would like to kindly ask you for your suggestion/opinion to solve this issue.

Thanks in advance for your replies.

Issue description:
net-snmp's configuration files are not resilient to power failure.

following a power failure event users created with net-snmp-create-v3-user are \
missing from /etc/snmp/snmpd.conf and that /var/lib/net-snmp/snmpd.conf is empty.

Steps to Reproduce:

  [root@rhel73 ~]# cat /etc/fstab
  UUID=8c3e7419-f4b9-425a-b535-b6849a6e68bf / xfs defaults 0 0
  [root@rhel73 ~]# grep testuser /etc/snmp/snmpd.conf /var/lib/net-snmp/snmpd.conf
  [root@rhel73 ~]# ls -l /etc/snmp/snmpd.conf /var/lib/net-snmp/snmpd.conf
  -rw-------. 1 root root 18891 Dec  4 22:32 /etc/snmp/snmpd.conf
  -rw-------. 1 root root  1073 Dec  5 00:04 /var/lib/net-snmp/snmpd.conf

  [root@rhel73 ~]# systemctl stop snmpd
  [root@rhel73 ~]# /usr/bin/net-snmp-create-v3-user -A testpass testuser

  [root@rhel73 ~]# ls -l /etc/snmp/snmpd.conf /var/lib/net-snmp/snmpd.conf
  -rw-------. 1 root root 18877 Dec  5 00:09 /etc/snmp/snmpd.conf
  -rw-------. 1 root root  1112 Dec  5 00:09 /var/lib/net-snmp/snmpd.con
  [root@rhel73 ~]# grep testuser /etc/snmp/snmpd.conf /var/lib/net-snmp/snmpd.conf
  /etc/snmp/snmpd.conf:rwuser testuser
  /var/lib/net-snmp/snmpd.conf:createUser testuser MD5 "testpass" DES

  [root@rhel73 ~]# systemctl start snmpd

Force power off and reconnect.

  [root@rhel73 ~]#  grep testuser /etc/snmp/snmpd.conf /var/lib/net-snmp/snmpd.conf
  [root@rhel73 ~]#  ls -l /etc/snmp/snmpd.conf /var/lib/net-snmp/snmpd.conf
  -rw-------. 1 root root 18861 Dec  5 00:09 /etc/snmp/snmpd.conf
  -rw-------. 1 root root     0 Dec  5 00:09 /var/lib/net-snmp/snmpd.conf

Actual results:

  The added user has been lost from the configuration.
  The entire /var/lib/net-snmp/snmpd.conf has been lost.

Expected results:

  /etc/snmp/snmpd.conf contains the newly added user.
  /var/lib/net-snmp/snmpd.conf  is not destroyed.

Additional info:

  This was observed for XFS root filesystems, it may be that the default Ext's \
data=ordered mode  behaves differently. Running this under strace snmpd is doing a \
rename/rewrite of the file. But it never calls fsync,   so for the XFS case the dirty \
buffers are still in memory when the box is powered off, only the rename and create \
have hit the disk.

Josef Ridky
Associate Software Engineer
Core Services Team
Red Hat Czech, s.r.o.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic