Gentoo Archives: gentoo-user

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

Replies

Subject Author
Re: [gentoo-user] apache 2.4 - deny access to directory Michael <confabulate@××××××××.com>