I have the following httpd.conf file which I am using to test X-Forwarded-For
header IP whitelisting. Note that the conf.d
directory is empty:
Include conf.modules.d/*.conf
ServerRoot "/etc/httpd"
Listen 80
Listen 443
User dev
Group dev
ServerAdmin root@localhost
ServerName my-httpd-server
<Directory />
AllowOverride none
Require all denied
</Directory>
<Files ".ht*">
Require all denied
</Files>
<IfModule mime_module>
TypesConfig /etc/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>
AddDefaultCharset UTF-8
<IfModule mime_magic_module>
MIMEMagicFile conf/magic
</IfModule>
EnableSendfile on
DocumentRoot "/var/www/html"
<Directory "/var/www">
AllowOverride None
Require all granted
</Directory>
<Directory "/var/www/html">
Options -Indexes +FollowSymLinks
AllowOverride None
LogLevel debug
Order deny,allow
Deny from all
#Satisfy any
SetEnvIf X-Forwarded-For ^171.159.192.10 letmein
Allow from env=letmein
Satisfy any
</Directory>
IncludeOptional conf.d/*.conf
When I cURL to get the local page with this server, it works regardless of the XFF header:
curl -H 'X-Forwarded-For: 8.8.8.8' http://localhost
curl http://localhost
These work, but print the following in the error log (These requests should not work):
[Mon Dec 17 10:24:53.346021 2018] [access_compat:error] [pid 12] [client 172.17.0.1:49010] AH01797: client denied by server configuration: /var/www/html/
[Mon Dec 17 10:24:53.346614 2018] [authz_core:debug] [pid 12] mod_authz_core.c(809): [client 172.17.0.1:49010] AH01626: authorization result of Require all granted: granted
[Mon Dec 17 10:24:53.347603 2018] [authz_core:debug] [pid 12] mod_authz_core.c(809): [client 172.17.0.1:49010] AH01626: authorization result of <RequireAny>: granted
The following request from the whitelisted IP works but without the logging noise:
curl -H 'X-Forwarded-For: 171.159.192.10' http://localhost:8181/
What is causing the requests that should fail to return the web page? I get the message that it should be denied based on the config?