You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Silvio Mazzaro <ma...@ieee.org> on 2006/08/11 13:15:51 UTC

Tracking CGI Exec Calls

Hi all,

I'm searching for a method to track calls to other programs by Perl 
Scripts (or other CGI) in a Virtual Host Environment.

For example I'd like to know what script is calling "sendmail" or other 
programs and where the 'calling script' is located (so I could 
understand what domain is calling it).

P.S.
Actually I've tried attaching (from GNU/Linux) 'strace' to a live Apache 
instance, but I'm having problems with output filtering (I'm managing 
Servers with high load), so I hope there's something better... ;-)

Thank you in advance,

Silvio Mazzaro



Re: Tracking CGI Exec Calls

Posted by Joshua Slive <jo...@slive.ca>.
On 8/11/06, Guy Hulbert <gw...@eol.ca> wrote:
> On Fri, 2006-11-08 at 09:47 -0400, Joshua Slive wrote:
> > On 8/11/06, Silvio Mazzaro <ma...@ieee.org> wrote:
> > > Guy Hulbert wrote:
> > >
> > > > What is the problem you are trying to solve ?
> > >
> > > I'd like to know who's using sendmail from the Web.
> > >
> <snip>
> > > Perhaps It is possible to track system calls from mod_perl, but I'm
> > > still studying it... I'll let you know if I find (or someone on this
> > > list) a better solution then 'strace'.
> >
> > I don't know of any way to do this from apache.  But you could simply
> > replace sendmail with a script that dumps the relevant info to a log
> > file before passing parameters on to the real sendmail.
>
> Actually, the sendmail log should give you that much but all the mail is
> sent by the user running apache so it would require virtual domains on
> the mail side which match the vhosts on the apache side to do much good.

The script would also have access to the CGI env variables, including
precise data on the URL called.

But anyway, this whole thread belongs on the users list.

Joshua.

Re: Tracking CGI Exec Calls

Posted by Guy Hulbert <gw...@eol.ca>.
On Fri, 2006-11-08 at 09:47 -0400, Joshua Slive wrote:
> On 8/11/06, Silvio Mazzaro <ma...@ieee.org> wrote:
> > Guy Hulbert wrote:
> >
> > > What is the problem you are trying to solve ?
> >
> > I'd like to know who's using sendmail from the Web.
> >
<snip>
> > Perhaps It is possible to track system calls from mod_perl, but I'm
> > still studying it... I'll let you know if I find (or someone on this
> > list) a better solution then 'strace'.
> 
> I don't know of any way to do this from apache.  But you could simply
> replace sendmail with a script that dumps the relevant info to a log
> file before passing parameters on to the real sendmail.

Actually, the sendmail log should give you that much but all the mail is
sent by the user running apache so it would require virtual domains on
the mail side which match the vhosts on the apache side to do much good.

> 
> Joshua.

-- 
--gh



Re: Tracking CGI Exec Calls

Posted by Joshua Slive <jo...@slive.ca>.
On 8/11/06, Silvio Mazzaro <ma...@ieee.org> wrote:
> Guy Hulbert wrote:
>
> > What is the problem you are trying to solve ?
>
> I'd like to know who's using sendmail from the Web.
>
> > This is a hint ... do you want to prevent CGI scripts from calling
> > sendmail ?
>
> No, It's important for my users to use sendmail from their applications,
> but I'd like to control it to avoid spamming problems.
>
> > I don't think there is anything better than 'strace' (except 'dtrace' on
> > solaris) but I have not tried using either.
>
> Perhaps It is possible to track system calls from mod_perl, but I'm
> still studying it... I'll let you know if I find (or someone on this
> list) a better solution then 'strace'.

I don't know of any way to do this from apache.  But you could simply
replace sendmail with a script that dumps the relevant info to a log
file before passing parameters on to the real sendmail.

Joshua.

Re: Tracking CGI Exec Calls

Posted by Silvio Mazzaro <ma...@ieee.org>.
Guy Hulbert wrote:

> What is the problem you are trying to solve ?

I'd like to know who's using sendmail from the Web.

> This is a hint ... do you want to prevent CGI scripts from calling
> sendmail ?

No, It's important for my users to use sendmail from their applications, 
but I'd like to control it to avoid spamming problems.

> I don't think there is anything better than 'strace' (except 'dtrace' on
> solaris) but I have not tried using either.

Perhaps It is possible to track system calls from mod_perl, but I'm 
still studying it... I'll let you know if I find (or someone on this 
list) a better solution then 'strace'.

Thank you,

Silvio Mazzaro




Re: Tracking CGI Exec Calls

Posted by Guy Hulbert <gw...@eol.ca>.
On Fri, 2006-11-08 at 13:15 +0200, Silvio Mazzaro wrote:
> Hi all,
> 
> I'm searching for a method to track calls to other programs by Perl 
> Scripts (or other CGI) in a Virtual Host Environment.

What is the problem you are trying to solve ?

> 
> For example I'd like to know what script is calling "sendmail" or other 
> programs and where the 'calling script' is located (so I could 
> understand what domain is calling it).

This is a hint ... do you want to prevent CGI scripts from calling
sendmail ?

> 
> P.S.
> Actually I've tried attaching (from GNU/Linux) 'strace' to a live Apache 
> instance, but I'm having problems with output filtering (I'm managing 
> Servers with high load), so I hope there's something better... ;-)

I don't think there is anything better than 'strace' (except 'dtrace' on
solaris) but I have not tried using either.  Perhaps it is possible to
dump the 'strace' output so you can look at it statically.  However,
that is likely to fill a disk quickly so you would need to either dump
to a non-critical partition, or run a very short trace to calculate the
rate at which it is dumping data to disk and then run a longish one to
get enough data to analyze.

> 
> Thank you in advance,
> 
> Silvio Mazzaro
> 
> 

-- 
--gh