1

Is it possible to obtain the current running config for dhcpd? I inadvertently wiped dhcpd.conf but have not yet restarted the service. It is currently assigning the correct IPs to my test computers so it must have the correct config in memory.

Unfortunately I don't have a backup (I know, I know) from which I can restore but I'm hoping I can somehow dump the config from memory.

I have already checked the leases file but it only contains a small fraction of what I'm looking to obtain.

Any help would be much appreciated.

Edit 1: (for Michal)

[root@router2 log]# ll /proc/26125/fd/ total 0 lrwx------. 1 root root 64 Jun 17 20:13 0 -> /dev/null lrwx------. 1 root root 64 Jun 17 20:13 1 -> /dev/null lrwx------. 1 root root 64 Jun 17 20:13 2 -> /dev/null lrwx------. 1 root root 64 Jun 17 20:13 3 -> socket:[100465655] lrwx------. 1 root root 64 Jun 17 20:13 4 -> socket:[100465662] lrwx------. 1 root root 64 Jun 17 20:13 5 -> socket:[100465666] l-wx------. 1 root root 64 Jun 17 20:13 6 -> /var/lib/dhcpd/dhcpd.leases lrwx------. 1 root root 64 Jun 17 20:13 7 -> socket:[100465667]

and

[root@router2 log]# cp /proc/26125/fd/3 /dhcpd3.txt cp: cannot open '/proc/26125/fd/3' for reading: No such device or address

SenorAmor
  • 121
  • 2
  • 6
  • I've made test with memory dump of my dhcpd (using this:http://serverfault.com/a/408929/259376), unfortunately dhcpd config is in unreadable format. It seems that dhcpd also closes the config file after startup, so (1) won't work here. – Michal Sokolowski Jun 18 '15 at 01:41

1 Answers1

1
  1. cp /proc/PID/fd/3 /tmp/recovered_file Source: https://superuser.com/questions/283102/how-to-recover-deleted-file-if-it-is-still-opened-by-some-process

  2. If you have had dhcpd.conf file at Ext3/Ext4 filesystem you can try: extundelete --restore-file /path/name.conf /dev/sdXY Source: https://unix.stackexchange.com/a/122323/99517

  3. Memory dump: gcore $pid

Michal Sokolowski
  • 1,461
  • 1
  • 11
  • 24
  • Formatting in comments doesn't work so nice. Please see edit to original post. Thanks for your ideas but they didn't work for me. – SenorAmor Jun 18 '15 at 01:24