Is there a command to get Apache to display its running config from memory?
This is how to recover Apache2 config from memory :
- grab the dump-all-memory-of-pid.sh script mentioned on this serverfault thread.
the Dump a linux process's memory to file
#!/bin/bash
grep rw-p /proc/$1/maps | sed -n 's/^\([0-9a-f]*\)-\([0-9a-f]*\) .*$/\1 \2/p' | while read start stop; do gdb --batch --pid $1 -ex "dump memory $1-$start-$stop.dump 0x$start 0x$stop"; done
- put this in a file (eg. "dump-all-memory-of-pid.sh") and make it executable
- usage:
./dump-all-memory-of-pid.sh [pid]
- The output is printed to files with the names:
pid-startaddress-stopaddress.dump
- Dependencies:
gdb
-
get the pid of your apache process
pgrep -uroot apache2
-
dump the process's memory
mkdir /tmp/apache_dump && cd /tmp/apache_dump sh /path/to/dump-all-memory-of-pid.sh <PID>
-
grep all of the dump files for something that you expect to be in the apache config file.
grep DocumentRoot *
-
open the matched dump file(s) in vim and search for the string.
vim 24374-7f159d56c000-7f159d72c000.dump
Search by typing "/", eg "/DocumentRoot", then simply copy out the text that you want.
source : http://forums.whirlpool.net.au/archive/2189742