разрешить домен в правиле блокировки файла httpd.conf

У меня есть «правило» в httpd. conf , чтобы открыть всплывающее окно, если кто-то попытается получить доступ к разделу wp-admin любого домена, где установлен wordpress. С помощью этого правила я предотвращаю загрузку для доступа к папке wp-admin и останавливаю атаки методом перебора.

# BEGIN BLOCK-WP-ADMIN-ATTACK

<Files wp-login.php>
AuthType basic
AuthName "EN: Human Check - U: human P: letmein"
AuthBasicProvider file
AuthUserFile /home/wp-admin-attack-htpasswd-file
Require valid-user
ErrorDocument 401 "<center><h1>Warning!</h1>You failed to authenticate.<p><br />Extra security has been temporarily enabled due to an ongoing attack against Wordpress logins on this server.<br /> <b>If you are a real user, please refresh the page and enter the username and password that are provided on the pop-up.</b><p>If you are still having troubles, please contact your hosting provider.</center>"
</Files>

# END BLOCK-WP-ADMIN-ATTACK #

Это правило работает так, как должно, но теперь я хочу «разрешить» домен, поэтому это правило не будет применяться для этого домена.

# BEGIN BLOCK-WP-ADMIN-ATTACK

<Files wp-login.php>
AuthType basic
AuthName "EN: Human Check - U: human P: letmein"
AuthBasicProvider file
AuthUserFile /home/wp-admin-attack-htpasswd-file
Require valid-user
ErrorDocument 401 "<center><h1>Warning!</h1>You failed to authenticate.<p><br />Extra security has been temporarily enabled due to an ongoing attack against Wordpress logins on this server.<br /> <b>If you are a real user, please refresh the page and enter the username and password that are provided on the pop-up.</b><p>If you are still having troubles, please contact your hosting provider.</center>"
</Files>

# END BLOCK-WP-ADMIN-ATTACK #

1166777]

0
задан 5 November 2015 в 13:11
3 ответа

I думаю, у вас должна быть возможность использовать SetEnvIf для этого. Это не проверено, но может указать вам правильное направление:

# set env ALLOWED if hostname is either example.com or
# the client ip is 192.168.0.1
SetEnvIf Host example\.com ALLOWED
SetEnvIf Remote_Addr 192.168.0.1 ALLOWED

# if ALLOWED is not set display the password prompt
<IfDefine !ALLOWED>
  <Files wp-login.php>
    AuthType basic
    AuthName "EN: Human Check - U: human P: letmein"
    AuthBasicProvider file
    AuthUserFile /home/wp-admin-attack-htpasswd-file
    Require valid-user
    ErrorDocument 401 "<center><h1>Warning!</h1>You failed to authenticate.<p><br />Extra security has been temporarily enabled due to an ongoing attack against Wordpress logins on this server.<br /> <b>If you are a real user, please refresh the page and enter the username and password that are provided on the pop-up.</b><p>If you are still having troubles, please contact your hosting provider.</center>"
  </Files>
</IfDefine>
1
ответ дан 4 December 2019 в 16:46

I будет придерживаться , удовлетворить любой . Это рабочее доказательство концепции:

<Files wp-login.php>
            Satisfy Any

            Order deny,allow
            Deny from all
            Allow from example.org

            AuthType basic
            AuthName "EN: Human Check - U: human P: letmein"
            AuthBasicProvider file
            AuthUserFile /home/wp-admin-attack-htpasswd-file
            Require valid-user
            #ErrorDocument here
</Files>
0
ответ дан 4 December 2019 в 16:46

, вы можете использовать для выполнения любой инструкции

<VirtualHost *:80>
# [ Server Domain ]
ServerName the.domaine.allowed
# [ Server Root ]
DocumentRoot /var/www/
# [ Pass Through Auth]
<Files wp-login.php>
satisfy any
</Files>    
<VirtualHost>
0
ответ дан 4 December 2019 в 16:46

Теги

Похожие вопросы