2013-10-03 1 views
1

많은 사람들 (제 생각에는) 아파치 로그에서 내 웹 서버에 액세스하려는 많은 권한없는 로그를 발견했습니다. 발견 된 URL 패턴 중에는 항상 "/ phpmyadmin"과 같은 것이 있습니다. 내 서버에서 찾을 수없는 무언가를위한 shure이기 때문에 내가하고 싶은 것은 "누군가가 phpMyAdmin에 액세스하려고 시도하고 IP를 차단하고 더 이상 나를 괴롭히지 않습니다"라고 말합니다. 누군가가 Apache에서이를 수행하는 방법을 알고 있습니까? 아니면 다른 소프트웨어일까요? 고맙습니다!특정 패턴을 요구하는 블랙리스트 ip

답변

1

이 경우 도움이 될 수 있습니다.

1)이 감옥

banaction = iptables-multiport 

action_mwl = %(banaction)s[name=%(__name__)s, port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"] 
      %(mta)s-whois-lines[name=%(__name__)s, dest="%(destemail)s", logpath=%(logpath)s, chain="%(chain)s", sendername="%(sendername)s"] 

[apachejail] 
enabled = true 
port  = http,https 
filter = myapachejail 
logpath = /var/log/apache2/other_vhosts_access.log #<=== THIS MUST BE YOUR LOG FILE 
maxretry = 1 # 1: Paranoid mode, 2: Heavy filter, 5: Ban any scanner 
action = %(action_mwl) 
을 포함하여 갱신)하여 /etc/fail2ban/jail.local를 /etc/fail2ban/filter.d/myapachejail.conf

[INCLUDES] 
before = common.conf 

[Definition] 
failregex = ^.* <HOST> -.*"(:?GET|POST|HEAD) \/(?:\/|)(?:w00tw00t\.at.*|phpMyAdmin.*|whatever.*|anotherone.*\..*)".* 

ignoreregex = 

2 필터를 만듭니다 필터 정규 표현식은 로그 항목 중 하나를 일치하는 경우

3) 확인

sudo fail2ban-regex /var/log/apache2/other_vhosts_access.log /etc/fail2ban/filter.d/myapachejail.conf 

Result: 
Lines: 6160 lines, 0 ignored, 108 matched, 6052 missed 

4) /etc/fail2ban/action.d/iptables을 찾을 확인 -multiport.conf

5) 다시 시작 fail2ban 서비스

sudo service fail2ban restart 

6) 새로운 감옥 확인은 실행 :

sudo fail2ban-client status 

Status 
|- Number of jail: 5 
`- Jail list:  myapachejail,xxxxx,xxx,xxxxx,xxxx 

7) 로그 fail2ban 확인

sudo vim /var/log/fail2ban.log 

2014- 07-07 07 : 32 : 20,926 fail2ban.actions : 경고 [myapachejail] 금지 198.20.69.74 2014-07-07 08:45:36 , 153 fail2ban.actions : [myapachejail] 반 116.10.191.223

7) 당신의 iptables을 확인 경고하는 것은 금지 :

sudo iptables -L -n 

REJECT  all -- 198.20.69.74  0.0.0.0/0   reject-with icmp-port-unreachable 
REJECT  all -- 116.10.191.223  0.0.0.0/0   reject-with icmp-port-unreachable 
0

가능한 답변은 특정 구성의 Fail2ban 인 것 같습니다. 자세한 내용을 설명하는 게시물을 발견했습니다 : How to protect Apache with Fail2ban. 누군가 다른 흥미로운 해결책이 있다면 알려 주시기 바랍니다.