/var/logs/secure

red10won의 이미지

#!/bin/bash

days=`date +%d`

for i in $( cat /var/log/secure | grep "Failed password for" | awk '$2= $days {print $13}' | sort | uniq -c | awk '$1 > 5

{print $2}'); do
echo "%-A INPUT -s $i -j DROP" >> /root/shells/user.conf
done

#####################################################
%-A INPUT -s 116.55.245.45 -j DROP
%-A INPUT -s 122.194.12.114 -j DROP
%-A INPUT -s 211.233.37.39 -j DROP
%-A INPUT -s 219.240.39.206 -j DROP
%-A INPUT -s 220.176.20.208 -j DROP
%-A INPUT -s 50.17.32.157 -j DROP
%-A INPUT -s 59.34.5.10 -j DROP
%-A INPUT -s 60.190.27.132 -j DROP
%-A INPUT -s 61.135.209.203 -j DROP
%-A INPUT -s 84.45.38.216 -j DROP
%-A INPUT -s port -j DROP
%-A INPUT -s 110.77.150.90 -j DROP
%-A INPUT -s 111.93.115.74 -j DROP
%-A INPUT -s 112.64.143.162 -j DROP
%-A INPUT -s 115.236.10.182 -j DROP
%-A INPUT -s 117.21.127.36 -j DROP
%-A INPUT -s 119.188.7.200 -j DROP
%-A INPUT -s 123.138.37.67 -j DROP
%-A INPUT -s 186.192.100.186 -j DROP
%-A INPUT -s 200.111.82.35 -j DROP
%-A INPUT -s 202.97.194.171 -j DROP
%-A INPUT -s 211.154.145.52 -j DROP
%-A INPUT -s 218.61.196.98 -j DROP
%-A INPUT -s 33008 -j DROP
%-A INPUT -s 40584 -j DROP
%-A INPUT -s 47346 -j DROP
%-A INPUT -s 47880 -j DROP
%-A INPUT -s 56438 -j DROP
%-A INPUT -s 58.71.149.79 -j DROP
%-A INPUT -s 60550 -j DROP
%-A INPUT -s 112.2.4.77 -j DROP
%-A INPUT -s 115.236.10.182 -j DROP
%-A INPUT -s 115.236.75.252 -j DROP
%-A INPUT -s 115.238.55.166 -j DROP
%-A INPUT -s 117.21.127.36 -j DROP
%-A INPUT -s 119.46.224.234 -j DROP
%-A INPUT -s 120.89.36.16 -j DROP
%-A INPUT -s 121.8.126.220 -j DROP
%-A INPUT -s 124.137.147.235 -j DROP
%-A INPUT -s 201.213.124.82 -j DROP
%-A INPUT -s 202.103.226.187 -j DROP
%-A INPUT -s 210.83.80.104 -j DROP
%-A INPUT -s 211.239.173.230 -j DROP
%-A INPUT -s 222.33.56.100 -j DROP
%-A INPUT -s 55634 -j DROP
%-A INPUT -s 58.137.59.75 -j DROP
%-A INPUT -s 59722 -j DROP
%-A INPUT -s 60854 -j DROP
%-A INPUT -s 85.114.137.178 -j DROP
%-A INPUT -s 95.168.183.134 -j DROP
%-A INPUT -s port -j DROP
%-A INPUT -s 122.49.35.235 -j DROP
%-A INPUT -s 178.162.191.101 -j DROP
%-A INPUT -s 182.131.22.235 -j DROP
%-A INPUT -s 195.184.64.32 -j DROP
%-A INPUT -s 202.121.166.203 -j DROP
%-A INPUT -s 220.227.156.22 -j DROP
%-A INPUT -s 220.241.14.209 -j DROP
%-A INPUT -s 221.182.115.21 -j DROP
%-A INPUT -s 46.28.64.213 -j DROP
%-A INPUT -s 60.29.0.22 -j DROP
%-A INPUT -s 61.136.171.198 -j DROP
%-A INPUT -s 89.108.182.250 -j DROP
%-A INPUT -s 202.121.166.203 -j DROP
%-A INPUT -s 202.41.85.87 -j DROP
%-A INPUT -s 202.63.105.85 -j DROP
%-A INPUT -s 203.91.121.68 -j DROP
%-A INPUT -s 220.165.5.7 -j DROP
%-A INPUT -s 220.178.61.20 -j DROP
%-A INPUT -s 60.29.0.22 -j DROP
%-A INPUT -s 61.206.21.196 -j DROP
%-A INPUT -s 63.139.189.22 -j DROP
%-A INPUT -s 89.202.172.146 -j DROP
%-A INPUT -s from -j DROP
%-A INPUT -s port -j DROP

어떻게 하면 효과적으로 저 ip들을 다 deny 시킬까요 ㅎㅎㅎ
매번 쌓이는것도 번거롭고 ㅎㅎ

익명 사용자의 이미지

fail2ban은 어떤가요 ?
http://www.fail2ban.org/wiki/index.php/Features

자동 차단 및 자동 가능.
5분이내 3회 이상 로그인 실패 시 48시간 접속 차단 등...

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.