某些客户端被服务器配置拒绝,但其他客户端没有被拒绝

某些客户端被服务器配置拒绝,但其他客户端没有被拒绝

我看到很多“客户端被服务器配置拒绝“我的某个服务器的日志中出现错误,例如,

[Sun Mar 11 14:47:27.600091 2018] [:error] [pid 15375] [client 146.52.126.142:55685] script '/home/example/www/wp-login.php' not found or unable to stat
[Sun Mar 11 14:49:05.022447 2018] [authz_core:error] [pid 13727] [client 137.226.113.26:55086] AH01630: client denied by server configuration: /home/example/www/
[Sun Mar 11 14:58:22.853323 2018] [authz_core:error] [pid 14437] [client 163.172.226.46:58423] AH01630: client denied by server configuration: /home/example/www/downloader
[Sun Mar 11 14:58:59.747029 2018] [authz_core:error] [pid 13770] [client 163.172.226.46:50464] AH01630: client denied by server configuration: /home/example/www/downloader
[Sun Mar 11 14:58:59.812363 2018] [authz_core:error] [pid 16432] [client 163.172.226.46:56776] AH01630: client denied by server configuration: /home/example/www/downloader
[Sun Mar 11 14:59:00.599941 2018] [authz_core:error] [pid 15228] [client 207.46.13.65:11653] AH01630: client denied by server configuration: /home/example/www/

同时,在访问日志中,我看到其他客户端显然在同一时间得到了服务,没有任何问题(响应200代码与403代码):

146.52.126.142 - - [11/Mar/2018:14:47:27 -0400] "GET /wp-login.php HTTP/1.1" 404 4062 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1"
146.52.126.142 - - [11/Mar/2018:14:47:27 -0400] "GET / HTTP/1.1" 200 27838 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1"
137.226.113.26 - - [11/Mar/2018:14:49:05 -0400] "GET / HTTP/1.1" 403 209 "-" "Mozilla/5.0 zgrab/0.x (compatible; Researchscan/t13rl; +http://researchscan.comsys.rwth-aachen.de)"
163.172.226.46 - - [11/Mar/2018:14:58:22 -0400] "GET /downloader/ HTTP/1.1" 403 220 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0"
163.172.226.46 - - [11/Mar/2018:14:58:59 -0400] "GET /downloader/ HTTP/1.1" 403 220 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0"
163.172.226.46 - - [11/Mar/2018:14:58:59 -0400] "GET /downloader/ HTTP/1.1" 403 220 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0"
207.46.13.65 - - [11/Mar/2018:14:59:00 -0400] "GET / HTTP/1.1" 403 209 "-" "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)"

(我真正关心的是,例如,宾博以及属于 Google 的 IP 地址 - 如果搜索引擎很难从我的网站获取页面,那么我就会大的问题。)

我不知道为什么会发生“客户端拒绝”错误,因为我访问我的网站从来没有遇到任何问题:我无法重现失败。

我尝试添加<Location>按照接受的答案中的建议添加指令authz_core 一直拒绝访问,但(正如我所料)并没有什么区别:据我所知,服务器配置是正确的。

以下是服务器的配置:

# redirect all HTTP (port 80) requests to the HTTPS server
<VirtualHost *:80>
    ServerName secure.example.com
    Redirect permanent / https://secure.example.com/
</VirtualHost>
<VirtualHost *:80>
    ServerName www.example.com
    Redirect permanent / https://www.example.com/
</VirtualHost>
<VirtualHost *:80>
    ServerName example.com
    ServerAlias *.example.com
    Redirect permanent / https://example.com/
</VirtualHost>

# HTTPS server configuration
<VirtualHost *:443>
    ServerName secure.example.com
    ServerAlias example.com www.example.com
    ServerAdmin [email protected]
    SSLEngine on
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    SSLCertificateFile /path/to/example.com/fullchain.pem
    SSLCertificateKeyFile /path/to/live/example.com/privkey.pem
    DocumentRoot "/home/example/www"
    <Directory "/home/example/www">
        Options All MultiViews
        AllowOverride All
        Require all granted
    </Directory>
    <Location "/">
        Require all granted
    </Location>
    LogLevel debug
    ErrorDocument 404 /cgibin/badurl.php
    ErrorLog "|/usr/local/sbin/rotatelogs /home/example/logs/error_log 86400"
    CustomLog "|/usr/local/sbin/rotatelogs /home/example/logs/access_log 86400" combined
    CustomLog "|/usr/local/sbin/rotatelogs /home/example/logs/ssl_request_log 86400" ssl_request
    BrowserMatch "MSIE [2-5]" ssl-unclean-shutdown nokeepalive downgrade-1.0 force-response-1.0
    BrowserMatch "MSIE [6-9]" ssl-unclean-shutdown
    <Files ~ "\.(cgi|shtml|phtml|php4|php|pl)$">
        SSLOptions +StdEnvVars
    </Files>
    <Directory "/home/example/cgibin">
        SSLOptions +StdEnvVars
    </Directory>
    <IfModule mod_alias.c>
        ScriptAlias /cgibin/ "/home/example/cgibin/"
        <Directory "/home/example/cgibin">
            AllowOverride None
            Options FollowSymlinks
            Require all granted
        </Directory>
    </IfModule>
</VirtualHost>

.htaccess目录中没有文件,所以我不知道是什么导致了这个问题,即使LogLevel设置为debug,我在错误日志中得到的只是“客户端被拒绝”消息。

这些错误是否表示恶意客户端试图将我的服务器用作代理?如果是这样,我该如何让它们停止攻击?……还是有其他问题?

有没有什么方法可以将更多的调试信息写入日志,以便我了解失败的原因?

Server version: Apache/2.4.29 (FreeBSD)
Server built:   unknown
FreeBSD Dreamer 11.1-RELEASE-p4 FreeBSD 11.1-RELEASE-p4 #0: Tue Nov 14 06:12:40 UTC 2017     [email protected]:/usr/obj/usr/src/sys/GENERIC  amd64

相关内容