내용으로 건너뛰기
FreeBSD-iary
사용자 도구
로그인
사이트 도구
검색
도구
문서 보기
이전 판
Cite current page
Fold/unfold all
역링크
최근 바뀜
미디어 관리자
사이트맵
로그인
>
최근 바뀜
미디어 관리자
사이트맵
추적:
freebsd:py-fail2ban
이 문서는 읽기 전용입니다. 원본을 볼 수는 있지만 바꿀 수는 없습니다. 문제가 있다고 생각하면 관리자에게 문의하세요.
====== py-fail2ban 0.11 설치 ====== cd /usr/ports/security/py-fail2ban make config make all install clean ++++ 설치한 다음에 나오는 중요한 정보| <code> Please do not edit the fail2ban.conf, jail.conf, or any other files in the distributen as they will be overwritten upon each upgrade of the port. Instead, create new files named *.local e.g. fail2ban.local or jail.local. For more information, see the official manual: http://www.fail2ban.org/wiki/index.php/MANUAL_0_8#Configuration If you have custom filters or actions and you are upgrading from 0.9.x please check them. Users of pf: please read the notes in action.d/pf.conf and the discussion at https://github.com/fail2ban/fail2ban/pull/1925 Please note that fail2ban will put curly braces '{}' around the ports in the action so you shouldn't do it yourself. </code> ++++ 아래 설정은 [[https://phrye.com/tools/fail2ban-on-freebsd/]]를 보고 따라한 것이다. 먼저 /usr/local/etc/ipfw.rules 를 다음 내용으로 만들어 준다. <code> # Initial setting /bin/sh /etc/rc.firewall open # fail2ban IPs if ! ipfw table 1 info > /dev/null 2>&1; then ipfw table 1 create ipfw table 1 flush fi ipfw add 1 deny ip from "table(1)" to me </code> 그런 다음 /usr/local/etc/fail2ban/jail.local 를 만든다. <code> cd /usr/local/etc/fail2ban cp -Rp jail.conf jail.local </code> jai.local 에 다음 내용을 확인한다. <code> [sshd] enabled = true mode = aggressive action = ipfw-table[name=SSH,port=ssh,protocol=tcp] logpath = %(sshd_log)s backend = %(sshd_backend)s maxretry = 3 findtime = 600 bantime = 3600 </code> 이제 /usr/local/etc/fail2ban/action.d/ipfw-table.local 을 다음과 같은 내용으로 만든다. <code> [Definition] actionstart = actionstop = actioncheck = actionban = ipfw table 1 add <ip> actionunban = ipfw table 1 delete <ip> </code> 마지막으로 /etc/rc.conf 에 아래 명령어로 fail2ban과 방화벽에 관한 내용을 더한다. <code> sysrc fail2ban_enable="YES" sysrc firewall_enable="YES" sysrc firewall_type="OPEN" sysrc firewall_script="/usr/local/etc/ipfw.rules" </code> 이제 이 설정을 실행한다. 실행 전에, 방화벽 설정을 경험상 현재 접속한 계정에서 튕겨져 나가져 접속을 다시 못할 수도 있으니 설정에 주의에 주의를 요한다. <code> service ipfw start service fail2ban start </code> 마지막으로 제대로 설치되어 주어진 일을 하는지는 다음 명령어로 실행해서 알아볼 수 있다. <code> fail2ban-client status sshd Status for the jail: sshd |- Filter | |- Currently failed: 9 | |- Total failed: 9 | `- File list: /var/log/auth.log `- Actions |- Currently banned: 3 |- Total banned: 3 `- Banned IP list: 207.119.191.239 71.221.84.13 75.170.123.224 </code> 그리고 ipfw show 에서 다음 줄이 보이연 제대로 작동하는 거다. <code> 00001 0 0 deny ip from table(1) to me </code>
freebsd/py-fail2ban.txt
· 마지막으로 수정됨: 2021/01/10 09:07 저자
127.0.0.1
문서 도구
문서 보기
이전 판
역링크
Cite current page
Fold/unfold all
맨 위로