1

I have configured httpd (apache2.4.6) cgi to run /bin/bash scripts. I would like to trace httpd calls of /bin/bash and see the actual command that is run. So far I have tried to use strace -p but for some reason, I only see: wait4(-1, 0x7ffeef137dfc, WNOHANG|WSTOPPED, NULL) = 0 select(0, NULL, NULL, NULL, {1, 0}) = 0 (Timeout)

And no specific output when loading an URI that provides a cgi output. Do you have any recommendations how to trace this actions of httpd?

Yon
  • 13
  • 2

1 Answers1

1

Looks like you're tracing the wrong process, or at least the wrong thread. You'll need to specify all the httpd / apache2 process IDs with -p (eg strace -p 12345 -p 4321 -p 9876 <etc>) in order to be sure of getting the right one.

However, that isn't sufficient, because in order to run an external script, Apache will fork before it execs the script. You'll need to add the -f option to your strace invocation in order to follow newly spawned processes. I'd also recommend increasing the maximum string length (with -o 10000) to ensure you don't get truncated process arguments.

womble
  • 96,255
  • 29
  • 175
  • 230