fail2ban의 ban 알림을 Line Notify를 사용하여 LINE 그룹에 알립니다.
4444 단어 fail2banLineNotify
그래서, 무단 액세스 등을 검지한
fail2ban
가, 특정의 IP 주소를 ban 했을 때에, LINE 그룹에 통지하려고 해 보았습니다.이러한 느낌으로, 스탬프의 송신도 가능합니다.
버전
CentOS 7.3
fail2ban 0.9.6
LINE측 준비
Line Notify 는 브라우저에서 조작합니다. 또한 알림용 LINE 그룹을 만들기 때문에 스마트폰과 브라우저 모두에서 작업이 필요합니다.
LINE 앱에 알림용 그룹 만들기
Line Notify 는 브라우저에서 조작합니다. 또한 알림용 LINE 그룹을 만들기 때문에 스마트폰과 브라우저 모두에서 작업이 필요합니다.
LINE 앱에 알림용 그룹 만들기
Line Notify을 브라우저에서 열고 LINE 계정으로 로그인합니다.
Line Notify 알림용 토큰 생성
fail2ban 설정
fail2ban에는 LINE 통지에 대한 액션이 없으므로 새로 작성합니다. 작성한 action을 jail의 정의에 포함합니다.
액션 만들기
/etc/fail2ban/action.d
아래에 LINE 통지용의 action 파일을 새롭게 작성합니다. 이번에는 send-line.conf라는 파일로하고 있습니다.
vi /etc/fail2ban/action.d/send-line.conf
설정 내용은 이것뿐입니다.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
는 Line Notify에서 얻은 토큰입니다. 교체하십시오.
/etc/fail2ban/action.d/send-line.conf[Definition]
actionban = curl -X POST -H 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' -F 'message=[Fail2Ban] <name>: banned <ip>' -F 'stickerPackageId=1' -F 'stickerId=14' https://notify-api.line.me/api/notify
[Init]
name = default
vi /etc/fail2ban/action.d/send-line.conf
[Definition]
actionban = curl -X POST -H 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' -F 'message=[Fail2Ban] <name>: banned <ip>' -F 'stickerPackageId=1' -F 'stickerId=14' https://notify-api.line.me/api/notify
[Init]
name = default
스탬프 그룹 ID 및 스탬프 ID 목록은 다음 URL에서 공개됩니다.
라인 스탬프 목록 : ttps://devdocs.line.me/files/sticker_list.pdf
텍스트 통지만으로 좋다면
stickerPackageId
와 stickerId
를 적절히 제외해 주세요.jail 설정
이번에는 sshd의 jail 설정에 방금 만든 LINE 알림 설정을 포함해 보았습니다.
vi /etc/fail2ban/jail.d/02-enable-jail.conf
sshd 섹션의
action
에 send-line[name=sshd]
를 추가합니다./etc/fail2ban/jail.d/02-enable-jail.conf
[sshd]
enabled = true
action = firewallcmd-multiport[name=sshd, port="ssh", protocol=tcp, blocktype=DROP]
sendmail-whois-ipjailmatches[name=sshd, [email protected], [email protected]]
send-line[name=sshd]
이것으로 준비가 완료됩니다.
확인
sshd의 jail을 다시로드 해보십시오.
# fail2ban-client reload sshd
잘하면 ban 알림이 LINE에 올 것입니다.
참고
LINE Engineers 'Blog : ぇぇぺぺrs. 네코 rp. 이 m/bぉg/그럼/? p=3819
Reference
이 문제에 관하여(fail2ban의 ban 알림을 Line Notify를 사용하여 LINE 그룹에 알립니다.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/htakeda/items/7552cae4363ec365a794
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
# fail2ban-client reload sshd
LINE Engineers 'Blog : ぇぇぺぺrs. 네코 rp. 이 m/bぉg/그럼/? p=3819
Reference
이 문제에 관하여(fail2ban의 ban 알림을 Line Notify를 사용하여 LINE 그룹에 알립니다.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/htakeda/items/7552cae4363ec365a794텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)