I have a PHP page the sole purpose of which is to spawn a bash script to run some background code (10-15 seconds run time), and then forward to a second page. The second page waits for the background code to run and displays the output.
Obviously, this set up is fertile ground for a DoS attack. Can anyone comment on the best practices to prevent such an attack in this situation? To prevent a non-distributed DoS attack I've considered keeping a log of IP addresses and times for each request and checking each new request against that list. If <30 seconds from last request, it'll kick out the request. A distributed DoS attack could be prevented by looking at the number of active spawned processes and kicking out new ones giving a "Server Busy" message, or setting up a queue.
Does this sound reasonable?