On Monday 27 January 2003 03:10 pm, Ben Siders wrote:
> John Baker wrote:
> >On Mon, 27 Jan 2003, Ben Siders wrote:
> >>Date: Mon, 27 Jan 2003 08:48:58 -0600
> >>From: Ben Siders <[EMAIL PROTECTED]>
> >>To: [EMAIL PROTECTED]
> >>Subject: Perl in OpenBSD Apache
> >>
> >>I installed OpenBSD's Apache but the default configuration is that
> >> httpd runs chroot'd to /var/www for security.  This is fine, except
> >> that for the life of me, I cannot get my Perl CGI scripts to run. 
> >> I've tried linking /usr/bin/perl into /var/www but that doesn't work
> >> because of the chroot, I tried making a copy of the Perl interpretter
> >> and changing my scripts to reference them, and that didn't work.  How
> >> the heck are we supposed to run any CGI then?
> >

> >
> >Port 80
> >ServerName xxx.net
> >DocumentRoot "/path/to/htdocs"
> >ErrorLog /path/to/apache/logs/error_log
> >
> >and this is crucial:
> >    ScriptAlias /cgi-bin/ "/path/to/apache/cgi-bin/"
>
> Yep, I took care of all of this stuff.  When I run httpd with the -u
> flag, to run un-chroot'd, it works fine.  But when I remove that flag to
> run "properly", I'm seeking a workaround for the chroot so that my
> scripts can see the interpretter.  Links don't work.  I tried putting a
> copy of the Perl interp. into /var/www/bin, since it runs chroot'd to
> /var/www, and then putting #!/var/www/bin/perl in my scripts, but it
> still doesn't find the interpretter (premature end of script headers).


Be careful with those paths, as the httpd chroot implies chopping off the 
/var/www/ depending on whether the path is accessed after the chroot or 
not.  I believe since httpd is running the scripts it's seeing the path to 
executable from within the chroot as well...so you should be using 
#!/bin/perl if you'd copied to /var/www/bin/perl.  It sounds like you're 
looking to do the same thing I did, just copy the files into the chroot, 
here's the gist of it:

I tried to mimic normal paths within /var/www to create less surprises... so 
copy /usr/bin/perl* /var/www/usr/bin/.  Also, I made a full copy of the 
perl base in /var/www/usr/libdata/perl5....  from /usr/libdata/perl5.  
You'll also need /var/www/usr/libexec/ld.so.  After that watching your 
apache error_log should give clues as to what else needs to be copied.  
Here's a list that may save you some time:

$ lt /var/www/usr/lib
total 5632
   1 drwxr-xr-x  4 root  bin         512 Jul 30 16:04 apache/
1128 -r--r--r--  1 root  daemon  1143288 Aug  2 23:33 libperl_pic.a
1056 -r--r--r--  1 root  daemon  1067138 Aug  2 23:33 libperl_p.a
 816 -r--r--r--  1 root  daemon   820851 Aug  2 23:33 libperl.so.6.1
1024 -r--r--r--  1 root  daemon  1033830 Aug  2 23:33 libperl.a
  84 -r--r--r--  1 root  daemon    85720 Aug  2 23:43 libm.so.0.1
 120 -r--r--r--  1 root  daemon   112380 Aug  2 23:43 libm.a
 600 -r--r--r--  1 root  daemon   598777 Aug  2 23:44 libc.so.28.5
 728 -r--r--r--  1 root  daemon   732880 Aug  2 23:44 libc.a
  38 -r--r--r--  1 root  daemon    38246 Aug  2 23:44 libutil.so.7.1
  37 -r--r--r--  1 root  daemon    37454 Aug  2 23:44 libutil.a

Basically, you should be able to get this from watching the apache error log 
while you try test scripts.  I did this about 6 months ago so depending on 
your OS install the library versions may be different.

Christopher

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to