Gentoo Archives: gentoo-user

From: Michael <confabulate@××××××××.com>
To: gentoo-user@l.g.o
Cc: thelma@×××××××××××.com
Subject: Re: [gentoo-user] apache 2.4 - deny access to directory
Date: Tue, 01 Dec 2020 23:06:51
Message-Id: 3524121.MHq7AAxBmi@lenovo.localdomain
In Reply to: Re: [gentoo-user] apache 2.4 - deny access to directory by thelma@sys-concept.com
1 On Tuesday, 1 December 2020 19:34:54 GMT thelma@×××××××××××.com wrote:
2 > On 12/01/2020 07:18 AM, Michael wrote:
3 > > On Monday, 30 November 2020 22:52:05 GMT thelma@×××××××××××.com wrote:
4 > >> Access based on IP address works from .htaccess with Files directive:
5 > >>
6 > >> <Files *>
7 > >>
8 > >> Require ip 10.0.0.109
9 > >>
10 > >> </Files>
11 > >>
12 > >> But it doesn't read AuthType Basic, it doesn't ask me for any password.
13 > >>
14 > >> AuthName "restricted stuff"
15 > >> AuthType Basic
16 > >> AuthUserFile "/etc/apache2/users"
17 > >> require user webmaster
18 > >>
19 > >> It seems to me Apache 2.4 is very limited what can, and can not go into
20 > >> .htaccess.
21 > >
22 > > OK, probably Authentication takes precedence from Authorization on apache
23 > > 2.4.
24 > >
25 > > Since you prefer to use .htaccess rather than a central apache config,
26 > > let's check if this works in your /admin/.htaccess:
27 > >
28 > > ===========================
29 > > AuthName "restricted stuff"
30 > > AuthType Basic
31 > > AuthUserFile "/etc/apache2/users"
32 > > <RequireAll>
33 > >
34 > > Require ip 10.0.0.100
35 > > Require user webmaster
36 > >
37 > > </RequireAll>
38 > > ==========================
39 > >
40 > > It should allow you to connect and then request username and passwd from
41 > > IP
42 > > 10.0.0.100, but return '403 Forbidden' for clients connecting from any
43 > > other IP address, without requesting authentication.
44 >
45 > WOW! it worked, it worked!
46 > Thank you Michael!
47 > IP works and AuthType Basic works too.
48 >
49 > Why? It seems to me Apache 2.4 is very picky where/and order directives
50 > are. So much more to learn. For basic operation I prefer .htaccess
51 > files, it is much simpler and easier to block spammers, no need to
52 > restart the main server, just update .htaccess file.
53 >
54 > Thank you again!
55
56 You're welcome. I'm glad you got it going. There were a number of changes
57 with apache 2.4. Have a look down this page for the specifics:
58
59 https://httpd.apache.org/docs/trunk/upgrading.html

Attachments

File name MIME type
signature.asc application/pgp-signature