Gentoo Archives: gentoo-user

From: thelma@×××××××××××.com
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] apache 2.4 - deny access to directory
Date: Sun, 29 Nov 2020 18:22:14
Message-Id: 9e670f06-e0c3-a49a-e3c1-47f867a34701@sys-concept.com
In Reply to: Re: [gentoo-user] apache 2.4 - deny access to directory by Michael
1 Thelma
2 On 11/29/2020 03:22 AM, Michael wrote:
3 > On Sunday, 29 November 2020 07:30:16 GMT thelma@×××××××××××.com wrote:
4 >> I'm trying to deny access to all except specific IP address in a
5 >> directory, just testing it.
6 >>
7 >> In modules.d/00_default_settings.conf
8 >>
9 >> <Directory "/var/www/localhost/htdocs">
10 >> Options MultiViews
11 >> AllowOverride All
12 >> Require all granted
13 >> </Directory>
14 >>
15 >> in admin/.htaccess
16 >>
17 >> <RequireAll>
18 >> Require all denied
19 >> Require ip 10.0.0.100
20 >> </RequireAll>
21 >>
22 >> My IP is 10.0.0.112 and I can still access the server /admin directory
23 >>
24 >> What am I missing?
25 >
26 > In apache 2.4 the access control syntax has changed. The RequireAll directive
27 > means *all* authorisation directives within it must succeed.
28 >
29 > https://httpd.apache.org/docs/2.4/mod/mod_authz_core.html#requireall
30 >
31 > What happens if you just remove the first line, "Require all denied"?
32
33 As you suggested I have:
34 in admin/.htaccess
35
36 <RequireAll>
37 Require ip 10.0.0.100
38 </RequireAll>
39
40 My IP is: 10.0.0.112 and it still allow me to access it. I know apache
41 2.4 is reading the file as the the below direcive works.
42
43 AuthName "restricted stuff"
44 AuthType Basic
45 AuthUserFile "/etc/apache2/users"
46 require user webmaster
47
48 I've tried adding
49 RewriteEngine on
50
51 With it, I can not login at all (access denied) regardless of IP.

Replies

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