728x90

기존 CentOS7을 설치하면, iptables 서비스는 없다고 뜬다.   

--> Fail2Ban은 기존 firewalld 방화벽 대신 iptables 를 사용 한다고 한다 (참고 : asterisk-pbx.ru/wiki/artikle/fail2ban)

(캡쳐하려 했는데, 미리 진행하고 #iptables -nvL  치는 바람에 화면이 넘어가버려 못함 ;;; )

1. #systemctl stop firewalld   -> CentOS7은 firewalld 라는 방화벽 서비스를 사용한다. 

2.#yum install iptables-services  

# systemctl enable iptables  /  # systemctl start iptables / #systemctl status iptables

2. fail2ban 설치 # yum install -y fail2ban whois

3. /etc/fail2ban/jail.conf 설정

4. fail2ban 시작 및 상태 확인

* 참고 사이트 : blog.onesconsultants.com/2018/08/how-to-secure-sip-servers-with-fail2ban.html

 

How to secure SIP Servers with Fail2Ban in Centos 7?

A blog about VoIP applications and related technologies.

blog.onesconsultants.com

 

5. ssh fail2ban 설정 - /etc/fail2ban/jail.d/sshd.local

필자는 이미 알려진 ssh port 22를 사용하지 않고, 다른 포트번호를 사용하게 설정하였다.

port = ssh, 다른 포트번호 식으로 설정하면 된다.

 

* # iptables -nvL | grep sshd 또는 # iptables -nvL | grep sshd 로 확인할 경우 적용 직후에 iptables에 보이지 않는다.

필자는 이 부분에 대해서 보이게끔 하려고 여기저기 뒤져보고 적용하고, 재시작도 해보고 했으나 되지 않았다.

혹시나 해서, 갤럭시 탭으로 LTE 외부 IP를 잡고 ssh로 강제 로그인을 시도했더니.......  두둥.... 보인다ㅡㅡ;;;;;

fail2ban 적용 하신 후 아무리 재 시작해도 iptables에서 f2b chain 항목이 안보이신다면....  해당 정책에 위배되는 테스트를 진행 하신 후 확인 해보시면 보일 겁니다.    결론은 Chain-f2b-jailname 은 등록이 되어야지만 보인다 입니다.

 

* fail2ban 에 적용된 ip 정보를 해제시에는 # fail2ban-client set asterisk unbanip 110.70.59.242 (해제 ip)

iptables 의 f2b-SSH에서도 삭제되고, /var/log/fail2ban.log 를 보더라도 해당 아이피가 더이상 banned 안된다고 메세지가 확인 된다.

--> Aseterisk 부분은 확인 후 추가해서 올리겠습니다.

'IT > Asterisk' 카테고리의 다른 글

libmyodbc8w.so 가 없다고 뜰 경우  (0) 2020.12.22
RealTime DB 설정  (0) 2020.12.21
CentOS7 - MySql 5.6 설치  (0) 2020.12.17
No application 'Macro' for extension....  (0) 2020.12.17
기본적인 Fail2Ban 설정  (0) 2020.12.17

+ Recent posts