You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Buck Golemon <bu...@amd.com> on 2009/01/23 02:16:18 UTC
[users@httpd] UserDir + SetHandler cgi-script broken? (Apache 2.0.52)
I've already posted this on alt.apache.configuration, but this forum seems much
more active. I'm sorry if this is double-posting. I'm not sure of the
etiquette...
---
I can't get "SetHandler cgi-script" to work from inside a UserDir. If
I try to access the exact same cgi script using an "Alias", it works
fine.
works just fine:
http://pdweb.ca.atitech.com/beg/foo.sh
doesn't work:
http://pdweb.ca.atitech.com/~bgolemon/foo.sh
Here's the relevant configuration. I plan on changing 'bgolemon' to * once I
get this working, so a ScriptAlias wouldn't work here. Please don't worry about
security just yet.
<IfModule mod_userdir.c>
UserDir public_html
UserDir disabled root
</IfModule>
Alias /beg/ "/user/bgolemon/public_html/"
<Directory "/user/bgolemon/public_html/">
Options ExecCGI
SetHandler cgi-script
AllowOverride None
Allow from all
Order allow,deny
</Directory>
Here is the error_log for when I try to access ~bgolemon/foo.sh:
[Thu Jan 22 14:04:34 2009] [error] [client 139.95.112.95] Premature end of
script headers: foo.sh
I also took a look at the ScriptLog. It looks like the script doesn't run at
all. The result is basically the same with all browsers:
%% [Thu Jan 22 13:55:32 2009] GET /~bgolemon/foo.py HTTP/1.1
%% 500 /user/bgolemon/public_html/foo.py
%request
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US)
AppleWebKit/525.19 (KHTML, like Gecko) Chrome/0.4.154.25 Safari/525.19
Accept: text/xml,application/xml,application/xhtml+xml,text/
html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Encoding: gzip,deflate,bzip2,sdch
X-SDCH: Chrome 0.4.154.25
Accept-Language: en-US,en
Accept-Charset: ISO-8859-1,*,utf-8
Host: pdweb.ca.atitech.com
Connection: Keep-Alive
%response
(end of file)
In case you want to know, here's the code for foo.sh:
#!/bin/bash
echo Content-Type: text/plain
echo
echo foo
Are there any known issues with this? How can I get this to work? This makes me
feel like either the cgi-script handler or the UserDir module is broken.
Thanks in advance,
--Buck
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
[users@httpd] Re: UserDir + SetHandler cgi-script broken? (Apache 2.0.52)
Posted by Buck Golemon <bu...@amd.com>.
Buck Golemon <buck.golemon <at> amd.com> writes:
>
> Matt McCutchen <matt <at> mattmccutchen.net> writes:
>
> >
> > On Sat, 2009-01-24 at 09:17 -0500, Brian Mearns wrote:
> > > On Fri, Jan 23, 2009 at 6:44 PM, Buck Golemon <buck.golemon <at>
> amd.com> wrote:
> > > > Thanks for the reply, but if I remove the SetHandler directive above,
it
> > > > displays the file in plaintext just fine. It means both that the
UserDir
> > > > functions ok by itself, and that the <Directory> section above is being
> applied
> > > > to my home dir.
> > >
> > > Hm. About the only other thing I can think of is a permissions issue.
> > > I assumed it would always execute scripts as the same user as apache,
> > > but maybe for userdirs, it's switching users?
> >
> > According to the docs, all CGI scripts in userdirs switch users using
> > suexec:
> >
> > http://httpd.apache.org/docs/2.0/suexec.html#usage
> >
> > Suexec is pretty picky about permissions, so check the suexec_log file
> > for any relevant errors.
> >
>
> Thanks! This could well be the issue. I saw all the caveats about suexec,
> but skimmed it because I thought I wasn't using it. I'll check it when I
> get back to work.
> --Buck
>
This was exactly the problem. Referring to the suexec documentation, it says to
not use it unless you want it, and to disable it by moving the binary. So I ran
'cd /usr/sbin/ && mv suexec suexec.disabled`, restarted apache, and everything
started working as expected.
I'd suggest improving the error message to mention suexec rather than just
'Premature end of script headers'.
Thanks everyone!
--Buck
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
[users@httpd] Re: UserDir + SetHandler cgi-script broken? (Apache 2.0.52)
Posted by Buck Golemon <bu...@amd.com>.
Matt McCutchen <matt <at> mattmccutchen.net> writes:
>
> On Sat, 2009-01-24 at 09:17 -0500, Brian Mearns wrote:
> > On Fri, Jan 23, 2009 at 6:44 PM, Buck Golemon <buck.golemon <at>
amd.com> wrote:
> > > Thanks for the reply, but if I remove the SetHandler directive above, it
> > > displays the file in plaintext just fine. It means both that the UserDir
> > > functions ok by itself, and that the <Directory> section above is being
applied
> > > to my home dir.
> >
> > Hm. About the only other thing I can think of is a permissions issue.
> > I assumed it would always execute scripts as the same user as apache,
> > but maybe for userdirs, it's switching users?
>
> According to the docs, all CGI scripts in userdirs switch users using
> suexec:
>
> http://httpd.apache.org/docs/2.0/suexec.html#usage
>
> Suexec is pretty picky about permissions, so check the suexec_log file
> for any relevant errors.
>
Thanks! This could well be the issue. I saw all the caveats about suexec,
but skimmed it because I thought I wasn't using it. I'll check it when I
get back to work.
--Buck
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Re: UserDir + SetHandler cgi-script broken?
(Apache 2.0.52)
Posted by Matt McCutchen <ma...@mattmccutchen.net>.
On Sat, 2009-01-24 at 09:17 -0500, Brian Mearns wrote:
> On Fri, Jan 23, 2009 at 6:44 PM, Buck Golemon <bu...@amd.com> wrote:
> > > Thanks for the reply, but if I remove the SetHandler directive above, it
> > displays the file in plaintext just fine. It means both that the UserDir
> > functions ok by itself, and that the <Directory> section above is being applied
> > to my home dir.
>
> Hm. About the only other thing I can think of is a permissions issue.
> I assumed it would always execute scripts as the same user as apache,
> but maybe for userdirs, it's switching users?
According to the docs, all CGI scripts in userdirs switch users using
suexec:
http://httpd.apache.org/docs/2.0/suexec.html#usage
Suexec is pretty picky about permissions, so check the suexec_log file
for any relevant errors.
--
Matt
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Re: UserDir + SetHandler cgi-script broken? (Apache
2.0.52)
Posted by Brian Mearns <me...@gmail.com>.
On Fri, Jan 23, 2009 at 6:44 PM, Buck Golemon <bu...@amd.com> wrote:
> Brian Mearns <mearns.b <at> gmail.com> writes:
>
>>
>> On Thu, Jan 22, 2009 at 8:16 PM, Buck Golemon <buck.golemon <at> amd.com>
> wrote:
>> > works just fine:
>> > http://pdweb.ca.atitech.com/beg/foo.sh
>> >
>> > doesn't work:
>> > http://pdweb.ca.atitech.com/~bgolemon/foo.sh
>> >
>> >
>> > Here's the relevant configuration.
>> > <IfModule mod_userdir.c>
>> > UserDir public_html
>> > UserDir disabled root
>> > </IfModule>
>> > Alias /beg/ "/user/bgolemon/public_html/"
>> > <Directory "/user/bgolemon/public_html/">
>> > Options ExecCGI
>> > SetHandler cgi-script
>> > AllowOverride None
>> > Allow from all
>> > Order allow,deny
>> > </Directory>
>> >
> ...
>> >
>> >
>> > Are there any known issues with this? How can I get this to work? This
> makes me
>> > feel like either the cgi-script handler or the UserDir module is broken.
>> >
>> > Thanks in advance,
>> > --Buck
>>
>> Are you able to access anything in your userdir?
>>
>> You might need another Directory tag for "~bgolemon".
>> -Brian
>>
>
> Thanks for the reply, but if I remove the SetHandler directive above, it
> displays the file in plaintext just fine. It means both that the UserDir
> functions ok by itself, and that the <Directory> section above is being applied
> to my home dir.
>
> --Buck
Hm. About the only other thing I can think of is a permissions issue.
I assumed it would always execute scripts as the same user as apache,
but maybe for userdirs, it's switching users? Sorry, can't think of
anything else that might cause this.
-Brian
--
Feel free to contact me using PGP Encryption:
Key Id: 0x3AA70848
Available from: http://pgp.mit.edu/
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
[users@httpd] Re: UserDir + SetHandler cgi-script broken? (Apache 2.0.52)
Posted by Buck Golemon <bu...@amd.com>.
Brian Mearns <mearns.b <at> gmail.com> writes:
>
> On Thu, Jan 22, 2009 at 8:16 PM, Buck Golemon <buck.golemon <at> amd.com>
wrote:
> > works just fine:
> > http://pdweb.ca.atitech.com/beg/foo.sh
> >
> > doesn't work:
> > http://pdweb.ca.atitech.com/~bgolemon/foo.sh
> >
> >
> > Here's the relevant configuration.
> > <IfModule mod_userdir.c>
> > UserDir public_html
> > UserDir disabled root
> > </IfModule>
> > Alias /beg/ "/user/bgolemon/public_html/"
> > <Directory "/user/bgolemon/public_html/">
> > Options ExecCGI
> > SetHandler cgi-script
> > AllowOverride None
> > Allow from all
> > Order allow,deny
> > </Directory>
> >
...
> >
> >
> > Are there any known issues with this? How can I get this to work? This
makes me
> > feel like either the cgi-script handler or the UserDir module is broken.
> >
> > Thanks in advance,
> > --Buck
>
> Are you able to access anything in your userdir?
>
> You might need another Directory tag for "~bgolemon".
> -Brian
>
Thanks for the reply, but if I remove the SetHandler directive above, it
displays the file in plaintext just fine. It means both that the UserDir
functions ok by itself, and that the <Directory> section above is being applied
to my home dir.
--Buck
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] UserDir + SetHandler cgi-script broken? (Apache
2.0.52)
Posted by Brian Mearns <me...@gmail.com>.
On Thu, Jan 22, 2009 at 8:16 PM, Buck Golemon <bu...@amd.com> wrote:
> I've already posted this on alt.apache.configuration, but this forum seems much
> more active. I'm sorry if this is double-posting. I'm not sure of the
> etiquette...
>
> ---
> I can't get "SetHandler cgi-script" to work from inside a UserDir. If
> I try to access the exact same cgi script using an "Alias", it works
> fine.
>
> works just fine:
> http://pdweb.ca.atitech.com/beg/foo.sh
>
> doesn't work:
> http://pdweb.ca.atitech.com/~bgolemon/foo.sh
>
>
> Here's the relevant configuration. I plan on changing 'bgolemon' to * once I
> get this working, so a ScriptAlias wouldn't work here. Please don't worry about
> security just yet.
> <IfModule mod_userdir.c>
> UserDir public_html
> UserDir disabled root
> </IfModule>
> Alias /beg/ "/user/bgolemon/public_html/"
> <Directory "/user/bgolemon/public_html/">
> Options ExecCGI
> SetHandler cgi-script
> AllowOverride None
> Allow from all
> Order allow,deny
> </Directory>
>
>
> Here is the error_log for when I try to access ~bgolemon/foo.sh:
> [Thu Jan 22 14:04:34 2009] [error] [client 139.95.112.95] Premature end of
> script headers: foo.sh
>
>
> I also took a look at the ScriptLog. It looks like the script doesn't run at
> all. The result is basically the same with all browsers:
> %% [Thu Jan 22 13:55:32 2009] GET /~bgolemon/foo.py HTTP/1.1
> %% 500 /user/bgolemon/public_html/foo.py
> %request
> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US)
> AppleWebKit/525.19 (KHTML, like Gecko) Chrome/0.4.154.25 Safari/525.19
> Accept: text/xml,application/xml,application/xhtml+xml,text/
> html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
> Accept-Encoding: gzip,deflate,bzip2,sdch
> X-SDCH: Chrome 0.4.154.25
> Accept-Language: en-US,en
> Accept-Charset: ISO-8859-1,*,utf-8
> Host: pdweb.ca.atitech.com
> Connection: Keep-Alive
> %response
> (end of file)
>
>
> In case you want to know, here's the code for foo.sh:
> #!/bin/bash
> echo Content-Type: text/plain
> echo
> echo foo
>
>
> Are there any known issues with this? How can I get this to work? This makes me
> feel like either the cgi-script handler or the UserDir module is broken.
>
> Thanks in advance,
> --Buck
Are you able to access anything in your userdir? Try just sticking a
plain text/html file there and accessing it at /~bgolemon/, just to
make sure user dir is properly configured.
I'm also wondering if perhaps Apache isn't resolving user dirs to
canonical paths. I.e., instead of resolving to
/user/bgolemon/public_html/, it might leave the directory path as
simply ~bgolemon. Afterall, a user's home directory could be in
different places on different systems, (e.g., /home/bgoleman), so it
may just leave it up to the OS to resolve it. If that is the case,
then you're Directory tag won't be applied, you would need another
Directory tag for "~bgolemon". I have no idea if this is the case or
not, but it's worth a try.
Hope that helps a little,
-Brian
--
Feel free to contact me using PGP Encryption:
Key Id: 0x3AA70848
Available from: http://pgp.mit.edu/
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org