fail2ban 설정에서 reject 대신에 drop 시키는 방법 > 개발

본문 바로가기
사이트 내 전체검색

개발

fail2ban 설정에서 reject 대신에 drop 시키는 방법

페이지 정보

profile_image
작성자 관리자 (61.♡.222.236)
댓글 0건 조회 2,395회 작성일 19-06-13 17:20

본문

ㅁ 설정파일 overriding 의 기본 개념

According to the Manual 8 0
"Every .conf file can be overridden with a file named .local. The .conf file is read first, then .local, with later settings overriding earlier ones. Thus, a .local file doesn't have to include everything in the corresponding .conf file, only those settings that you wish to override. Modifications should take place in the .local and not in the .conf. This avoids merging problem when upgrading. These files are well documented and detailed information should be available there."

이 설명에 따르면,
/etc/fail2ban/action.d/iptables-common.local 로 파일명을 만드는 것이 맞는 모양이다.
.conf 파일을 .local 파일로 복사한 다음,
.local 파일에서 변경할 설정값은 변경하고 필요없는 것들은 삭제하고 저장하면 된다.

[code]
[Init]
protocol = all
blocktype = DROP
[/code]

ㅇ protocol = all 을 추가한 이유는, tcp 만 차단하면 여전히 접속해 들어오는 것들이 있다.



ㅁ firewalld 를 사용하는 시스템인 경우

CentOS 7 이후의 시스템은 iptables 의 frontend 로 firewalld 를 사용한다.
이 경우에는 firewall 관련 설정을 변경해 주어야 한다.

해당 파일은 /etc/fail2ban/action.d/firewallcmd-common.conf  인데,
역시 /etc/fail2ban/action.d/firewallcmd-common.local 파일로 복사후 내용을 수정한다.
[code]
[Init]
blocktype = drop
rich-blocktype = drop
[/code]

특이점으로는 rich-blocktype 을 별도로 설정을 하고,
여기서도 protocol = all 을 추가할 수도 있다.




* 참고
https://vext.info/2017/09/27/configuring-fail2ban-to-drop-silently.html
https://gist.github.com/antoniocampos/1b8bc607d7b2d4a42e2a6e7df00645d0
https://serverfault.com/questions/639923/fail2ban-jail-local-vs-jail-conf
https://idchowto.com/?p=43787






==== Legacy ====


By default, fail2ban will send ICMP unreachable messages in response to any connections from hosts on its banned list. This was changed a number of years ago from the former default behavior of DROP.

If, like me, you prefer silent drops to the informative ICMP unreachable message, the behavior can be changed as follows:

Create the file /etc/fail2ban/action.d/iptables-blocktype.local
Enter the following code:
[code]
[Init]
protocol = all
blocktype = DROP
[/code]
Save the file and restart fail2ban.
# service fail2ban restart


ㅁ 설정파일 이름 관련

설정파일의 이름이 중요하다.
예를 들어, iptables-blocktype.conf 라는 파일이름으로 만들면 drop 되지 않고 여전히 reject 된다.
아마도, 설정파일들을 읽어 들이는 순서가 있는 모양이다.
*.conf 보다 *.local 을 나중에 불러 들이는 것 같은데, 이 순서는 명확하지 않다.

추천0

댓글목록

등록된 댓글이 없습니다.

Total 386건 9 페이지
  • RSS

검색


사이트 정보

Copyright © Baragi.Net. All rights reserved.