From: Anatoliy Lisjutin <SilverFox@rgantd.ru>
To: ALT Linux sysadmin discuss <sysadmins@lists.altlinux.org>
Subject: Re: [Sysadmins] Snort rules
Date: Fri, 10 Mar 2006 11:13:04 +0300
Message-ID: <200603101113.04480.SilverFox@rgantd.ru> (raw)
In-Reply-To: <20060309103547.3ccc04af@shadow.orionagro.com.ua>
[-- Attachment #1: Type: text/plain, Size: 843 bytes --]
Здравствуйте!
В сообщении от Четверг 09 Март 2006 11:35 Dmitriy L. Kruglikov написал(a):
> On Wed, 08 Mar 2006 19:49:48 +0700
> Мне бы хотелось писать правила в iptables, а BlockHosts
> пишет в hosts.deny ...
>
> А для того, чтобы сработали запреты в hosts.deny нужно установить
> соединение с сервисом ... А мне это не нравится ....
Посылаю два скрипта для vsftp и ssh. Работают по крону. пишут в hosts.deny,
но главное список дают , а правило по списку адресов нарушителей воткнуть
в iptables не проблема при этом , надо немножко изменить конечную часть..
Ну то есть вметсто строчки echo -en "ALL: "$i "\t# Added by rw...
воткнуть правило iptables , где IP зловредного источника $i.
Или я не догоняю что-то?
--
With my best regards to you !!
http://rusarchives.ru http://rgantd.ru http://victory.rusarchives.ru
SilverFox@rgantd.ru
[-- Attachment #2: rwsecure --]
[-- Type: text/plain, Size: 615 bytes --]
#
# rwsecure parses the /var/log/auth/all file for Invalid usernames or
# Failed password. If more than 3 invalid or failed attempts by one
# IP, it will add that IP to your /etc/hosts.deny file.
#
file=`awk '/Invalid|Failed password/' /var/log/auth/all | sed s/.*from./""/ | sed s/port.*/""/| awk '{print $1}' | sort | uniq -c | sort -n | awk '{if ($1>15){print $2}else{}}'`
for i in $file
do
x=`grep $i /etc/hosts.deny | sed 's/.#.*//'`
if [ "$x" ]
then
y=0
else
echo -en "ALL: "$i "\t# Added by rwsecure on "`date | awk '{print $2 " " $3 " " $4 " " $6}'`"\n" >> /etc/hosts.deny
fi
done
[-- Attachment #3: ftpsecure --]
[-- Type: text/plain, Size: 607 bytes --]
#
# rwsecure parses the /var/log/auth/all file for Invalid usernames or
# Failed password. If more than 3 invalid or failed attempts by one
# IP, it will add that IP to your /etc/hosts.deny file.
#
file=`awk '/FAIL LOGIN/' /var/log/vsftpd.log | sed s/.*Client\ \"/""/ | sed s/\"/""/ | awk '{print $1}' | sort | uniq -c | sort -n | awk '{if ($1>15){print $2}else{}}'`
for i in $file
do
x=`grep $i /etc/hosts.deny | sed 's/.#.*//'`
if [ "$x" ]
then
y=0
else
echo -en "ALL: "$i "\t# Added by ftpsecure on "`date | awk '{print $2 " " $3 " " $4 " " $6}'`"\n" >> /etc/hosts.deny
fi
done
next prev parent reply other threads:[~2006-03-10 8:13 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-07 9:52 Dmitriy L. Kruglikov
2006-03-07 10:03 ` Dmitriy L. Kruglikov
2006-03-08 7:31 ` Avramenko Andrew
2006-03-08 8:48 ` Evgenii Terechkov
2006-03-08 12:49 ` Evgenii Terechkov
2006-03-09 7:44 ` Sergiy Guminilovych
2006-03-09 7:51 ` Терешков Евгений
2006-03-09 8:35 ` Dmitriy L. Kruglikov
2006-03-09 8:45 ` Терешков Евгений
2006-03-09 9:00 ` Dmitriy L. Kruglikov
2006-03-10 8:13 ` Anatoliy Lisjutin [this message]
2006-03-10 8:16 ` Anatoliy Lisjutin
2006-03-10 8:37 ` Dmitriy L. Kruglikov
2006-03-10 8:57 ` Anatoliy Lisjutin
2006-03-10 10:01 ` Dmitriy L. Kruglikov
2006-03-10 13:18 ` Anatoliy Lisjutin
2006-03-08 13:07 ` Smont
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200603101113.04480.SilverFox@rgantd.ru \
--to=silverfox@rgantd.ru \
--cc=sysadmins@lists.altlinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
ALT Linux sysadmins discussion
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/sysadmins/0 sysadmins/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 sysadmins sysadmins/ http://lore.altlinux.org/sysadmins \
sysadmins@lists.altlinux.org sysadmins@lists.altlinux.ru sysadmins@lists.altlinux.com
public-inbox-index sysadmins
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.sysadmins
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git