Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Dec 2009 12:27:10 -0500
From:      jhell <jhell@dataix.net>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: Hacked - FreeBSD 7.1-Release
Message-ID:  <1507588526.20091229122710@dataix.net>
In-Reply-To: <20091229112037.GA34719@icarus.home.lan>
References:  <bd52e0bd614fbaffcf8c9ff9da35286e@mail.isot.com> <4B20B509.4050501@yahoo.it> <600C0C33850FFE49B76BDD81AED4D25801371D8056@IMCMBX3.MITRE.ORG> <ce92ed41260c438977298c2cf9dd1e3f.HRCIM@webmail.1command.com> <600C0C33850FFE49B76BDD81AED4D25801371D8737@IMCMBX3.MITRE.ORG> <8bdcbc5f08e9b762c3d2dcfe2fd00558.HRCIM@webmail.1command.com> <6201873e0912281550w34937b9eg3498547722739aee@mail.gmail.com> <20091229112037.GA34719@icarus.home.lan>

next in thread | previous in thread | raw e-mail | index | archive | help
------------CD30835AEC7DB
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

=0D=0ATuesday, December 29, 2009, 6:20:37 AM, you wrote:

> On Mon, Dec 28, 2009 at 05:50:23PM -0600, Adam Vande More wrote:
>> On Mon, Dec 28, 2009 at 4:59 PM, Chris H <chris#@1command.com> wrote:
>>=20
>> >
>> > My point here was that by increasing the verbosity, you will more easi=
ly be
>> > able
>> > to grep against login /failures/, and more easily discover dictionary/
>> > brute-force
>> > attacks. It's certainly made my job easier, and hasn't required any
>> > modifications
>> > to our current policies. You /have/ considered PF(4), haven't you? It's
>> > /really/
>> > an excellent strategy for securing your network.
>> >
>> > --Chris H
>> >
>> > To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.o=
rg"
>> >
>>=20
>> I use security/denyhosts for this, very simple to setup like 5 minutes if
>> you're a fast reader.  There are other options as well that offer similar
>> functionality.

> Then I simply do /etc/rc.d/pf check && /etc/rc.d/pf reload.

> I also have a script that pushes out the pf.conf.ssh-deny machines
> to other hosts on our network and executes the above commands.

Increase verbosity ? why not just create a pflog file just for port 22
or whatever you listen on for ssh or some kind of login and parse
that. See attached script for a start on parsing the explained pflog.

I have been toying around with the attached idea that makes use of
connection tracking in pf.

pass in log quick proto { tcp } from any port >1024 to any port \
 { $shports } label "SCT/Login:$dstport" keep state (max-src-conn 5, \
  max-src-conn-rate 15/30 overload <blacklist> flush global)

This has worked out quite well so far but the script that is attached
has a few bugs and optimizations that could be made to it but it does
its job regardless without third-party utilities. I have added some
parsing of the pflogs through the use of tcpdump and sed to pull bad
IPs out as well but do not use that on a regular basis. I have the
script setup in a cron job to run once a hour and pull the IPs from
the active table and combine the contents with the blacklist file and
ultimately sort, uniq & reload the table with the contents of the
blacklist file making adding IPs to the blacklist just add to the
table on the next cron run..

Depending on where you put your blacklist deny rule you can be saving
the rest of your services from the attackers to.

Still lots of work to be done on this but I figured I would put it out
there for someone else to toy with and see what comes out of it.

Best regards.

--=20

 Tuesday, December 29, 2009 12:09:10 PM

 jhell
------------CD30835AEC7DB
Content-Type: application/octet-stream;
 name="pflog_fil.sh"
Content-transfer-encoding: base64
Content-Disposition: attachment;
 filename="pflog_fil.sh"

IyEvYmluL3NoCgojCiMgRm9yIHVzZSB3aXRoIHRoZSBmb2xsb3dpbmcgcnVsZXMsIHRhYmxl
cywgbWFjcm9zLgojCiMgdGFibGUgPGJsYWNrbGlzdD4gZmlsZSAiL2V0Yy9wZi5ob3N0cy1i
bGFja2xpc3QiCiMgc2hwb3J0cz0iMjIiCiMgYmxvY2sgbG9nIHF1aWNrIGZyb20gPGJsYWNr
bGlzdD4gbGFiZWwgIkJsYWNrbGlzdGVkIgojIHBhc3MgaW4gbG9nIHF1aWNrIHByb3RvIHsg
dGNwIH0gZnJvbSBhbnkgcG9ydCA+MTAyNCB0byBhbnkgcG9ydCB7ICRzaHBvcnRzIH0gbGFi
ZWwgIlNDVC9Mb2dpbjokZHN0cG9ydCIga2VlcCBzdGF0ZSAobWF4LXNyYy1jb25uIDUsIG1h
eC1zcmMtY29ubi1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UQUJMRSAtVCBhZGQgYGNhdCAkQkxJU1RgCgpybSAtZiAk
VE1QRklMRTEgJFRNUEZJTEUyCg==
------------CD30835AEC7DB--




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1507588526.20091229122710>