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