Monday, January 22, 2018

Re: popen from cgi program

On 2018/01/21 20:00, Jordon wrote:
>
> > Bingo! I copied all the necessary libs to corresponding usr/lib dirs and got the chrooted programs to run from a chroot command, but they would still not work from the cgi program. You pointing out that popen requires sh got me thinking. Sh was already in /var/www/bin but it had 000 for perms. I make it 111 and it works now! Thanks!
>
> Looks like I spoke too soon. The uname and all required libs that i copied into the chroot is working fine. The ping (that was already there) and my homemade program both work fine when manually executed in the chroot, but do nothing when run through popen(). How do you even debug this?

Tips:

- run it from the command line (chroot /var/www /cgi-bin/whatever), watch
for error messages in the output

- run it under ktrace (if this was running from slowcgi, something like
"ktrace -i -p `pgrep slowcgi`", then try to call it, then ktrace -C),
you may find some clue in the output from kdump

No comments:

Post a Comment