You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jan Hoskens <ja...@gmail.com> on 2009/01/15 14:51:57 UTC

[users@httpd] Satisfy any & Basic authorization

Hi all,

After some digging in the Apache docs I managed to come up with the
following configuration snippet to secure my whole server excluding one
directory:

<Location /proxyserver>
  Order deny,allow
  Allow from all
  Satisfy any
  ProxyPass http://someproxyserver.com
  ProxyPassReverse http://someproxyserver.com
</Location>

<Location />
  AuthType Basic
  AuthName "myserver"
  AuthUserFile /path/to/userfile
  AuthGroupFile /path/to/groupfile
  Require group mygroup
</Location>

Now for some reason the "/proxyserver" location still asks for a
user/password, but allows entry nonetheless. I get a pop-up three times
which I can just cancel and then I can access the page.

Any idea how to avoid this? I need to access that location
programmatically and I get confronted with an authorization which I
don't want to handle in my code... 

Kind Regards,
Jan


---------------------------------------------------------------------
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] Satisfy any & Basic authorization

Posted by Brian Mearns <me...@gmail.com>.
On Thu, Jan 15, 2009 at 9:18 AM, Jan Hoskens <ja...@gmail.com> wrote:
> Thanks for the suggestion, but switching the order of the location tags
> didn't work either...
>
> Kind Regards,
> Jan
>
> On Thu, 2009-01-15 at 09:09 -0500, Brian Mearns wrote:
>> On Thu, Jan 15, 2009 at 8:51 AM, Jan Hoskens <ja...@gmail.com> wrote:
>> > Hi all,
>> >
>> > After some digging in the Apache docs I managed to come up with the
>> > following configuration snippet to secure my whole server excluding one
>> > directory:
>> >
>> > <Location /proxyserver>
>> >  Order deny,allow
>> >  Allow from all
>> >  Satisfy any
>> >  ProxyPass http://someproxyserver.com
>> >  ProxyPassReverse http://someproxyserver.com
>> > </Location>
>> >
>> > <Location />
>> >  AuthType Basic
>> >  AuthName "myserver"
>> >  AuthUserFile /path/to/userfile
>> >  AuthGroupFile /path/to/groupfile
>> >  Require group mygroup
>> > </Location>
>> >
>> > Now for some reason the "/proxyserver" location still asks for a
>> > user/password, but allows entry nonetheless. I get a pop-up three times
>> > which I can just cancel and then I can access the page.
>> >
>> > Any idea how to avoid this? I need to access that location
>> > programmatically and I get confronted with an authorization which I
>> > don't want to handle in my code...
>> >
>> > Kind Regards,
>> > Jan
>> >
>>
>> The only thing I can think of is reversing the orders of the Location
>> tags, i.e., have the more global one come first.
>>
>> -Brian
>>

Bummer. You're set up is shown almost exactly in the docs
(http://httpd.apache.org/docs/2.2/mod/core.html#require) under
"Removing controls in subdirectories". the only real difference I can
see is they're using directories, not locations, though I can't see
why that would matter, and I don't think it would work in your case,
anyway (because of the proxy?)

Best of luck with it

-- 
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


Re: [users@httpd] Satisfy any & Basic authorization

Posted by Jan Hoskens <ja...@gmail.com>.
Thanks for the suggestion, but switching the order of the location tags
didn't work either...

Kind Regards,
Jan

On Thu, 2009-01-15 at 09:09 -0500, Brian Mearns wrote:
> On Thu, Jan 15, 2009 at 8:51 AM, Jan Hoskens <ja...@gmail.com> wrote:
> > Hi all,
> >
> > After some digging in the Apache docs I managed to come up with the
> > following configuration snippet to secure my whole server excluding one
> > directory:
> >
> > <Location /proxyserver>
> >  Order deny,allow
> >  Allow from all
> >  Satisfy any
> >  ProxyPass http://someproxyserver.com
> >  ProxyPassReverse http://someproxyserver.com
> > </Location>
> >
> > <Location />
> >  AuthType Basic
> >  AuthName "myserver"
> >  AuthUserFile /path/to/userfile
> >  AuthGroupFile /path/to/groupfile
> >  Require group mygroup
> > </Location>
> >
> > Now for some reason the "/proxyserver" location still asks for a
> > user/password, but allows entry nonetheless. I get a pop-up three times
> > which I can just cancel and then I can access the page.
> >
> > Any idea how to avoid this? I need to access that location
> > programmatically and I get confronted with an authorization which I
> > don't want to handle in my code...
> >
> > Kind Regards,
> > Jan
> >
> 
> The only thing I can think of is reversing the orders of the Location
> tags, i.e., have the more global one come first.
> 
> -Brian
> 


---------------------------------------------------------------------
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] Satisfy any & Basic authorization

Posted by André Warnier <aw...@ice-sa.com>.
Eric Covener wrote:
> On Thu, Jan 15, 2009 at 9:09 AM, Brian Mearns <me...@gmail.com> wrote:
>> The only thing I can think of is reversing the orders of the Location
>> tags, i.e., have the more global one come first.
> 
> I know OP reported that this failed, but I think this is the route to pursue.
> 
Did you try "AuthType none" in the sub-location ?

I think I remember having this same kind of issue before, and to have 
found that the problem is that an authentication method is always 
"inherited" from the parent dir/location, unless specifically overridden 
by a new one.

I can think of a rather clumsy way of overcoming this, roughly as 
follows (not tried, but maybe worth a try).

Say you currently have something like this :

directory structure :
   /var/www/docs/* (must stay protected)
   /var/www/docs/unp/... (stuff to unprotect)

DocumentRoot /var/www/docs
<Location />
   (protected)
</location>
<Location /unp>
   (would like to unprotect, but currently does not work)
</Location>

Then you could change this as follows :

directory structure :
   /var/www/docs/unp/* (stuff to unprotect)
   /var/www/docs/prot/* (everything else, must stay protected)
   and nothing in /var/www/docs itself apart from the above.

DocumentRoot /var/www/docs
RewriteCond %{REQUEST_URI} !^/unp/
RewriteRule ^/(.*)$ /prot/$1 [PT]

<Directory /prot>
   AuthType Basic
   ....
</Directory>
<Directory /unp>
   (no auth)
</Directory>

The idea would be to catch all requests not starting with "/unp/", and 
re-writing these to "/prot/*".  They would then fall under the later 
Auth, while the /unp/ ones would not.



---------------------------------------------------------------------
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] Satisfy any & Basic authorization

Posted by Eric Covener <co...@gmail.com>.
On Thu, Jan 15, 2009 at 9:09 AM, Brian Mearns <me...@gmail.com> wrote:
>
> The only thing I can think of is reversing the orders of the Location
> tags, i.e., have the more global one come first.

I know OP reported that this failed, but I think this is the route to pursue.

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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] Satisfy any & Basic authorization

Posted by Brian Mearns <me...@gmail.com>.
On Thu, Jan 15, 2009 at 8:51 AM, Jan Hoskens <ja...@gmail.com> wrote:
> Hi all,
>
> After some digging in the Apache docs I managed to come up with the
> following configuration snippet to secure my whole server excluding one
> directory:
>
> <Location /proxyserver>
>  Order deny,allow
>  Allow from all
>  Satisfy any
>  ProxyPass http://someproxyserver.com
>  ProxyPassReverse http://someproxyserver.com
> </Location>
>
> <Location />
>  AuthType Basic
>  AuthName "myserver"
>  AuthUserFile /path/to/userfile
>  AuthGroupFile /path/to/groupfile
>  Require group mygroup
> </Location>
>
> Now for some reason the "/proxyserver" location still asks for a
> user/password, but allows entry nonetheless. I get a pop-up three times
> which I can just cancel and then I can access the page.
>
> Any idea how to avoid this? I need to access that location
> programmatically and I get confronted with an authorization which I
> don't want to handle in my code...
>
> Kind Regards,
> Jan
>

The only thing I can think of is reversing the orders of the Location
tags, i.e., have the more global one come first.

-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