Date: Fri, 8 Apr 2011 11:36:29 +0200 From: Quentin Narvor <quentin.narvor@gmail.com> To: "J. Hellenthal" <jhell@dataix.net> Cc: =?ISO-8859-1?Q?Ermal_Lu=E7i?= <eri@freebsd.org>, freebsd-net@freebsd.org, nicolas.greneche@univ-orleans.fr Subject: Re: [PATCH] New feature in Packet Filter Message-ID: <BANLkTinU8fAVNfqSYeTCVwzFqjV18rQWwg@mail.gmail.com> In-Reply-To: <20110407232315.GA33170@DataIX.net> References: <BANLkTi=fMCfzJrTavK3Pe0zUXHbQgpPE=Q@mail.gmail.com> <BANLkTimVE9KX20PX8VGe%2BpZ3URYHqiNP8g@mail.gmail.com> <BANLkTim71WDHb5fSTkCPP%2B1Xf9-KnpbGtg@mail.gmail.com> <BANLkTimLFg-BbUE5f5s=BhEp2h-ispRUyw@mail.gmail.com> <20110407232315.GA33170@DataIX.net>
next in thread | previous in thread | raw e-mail | index | archive | help
2011/4/8 J. Hellenthal <jhell@dataix.net> > On Thu, Apr 07, 2011 at 07:54:56PM +0200, Ermal Lu=E7i wrote: > >On Thu, Apr 7, 2011 at 5:14 PM, Quentin Narvor <quentin.narvor@gmail.com= > > wrote: > >> 2011/4/7 Ermal Lu=E7i <eri@freebsd.org> > >> > >>> On Thu, Apr 7, 2011 at 10:21 AM, Quentin Narvor > >>> <quentin.narvor@gmail.com> wrote: > >>> > Hello, > >>> > > >>> > My name is Quentin Narvor and I am currently working on intrusion > >>> detection. > >>> > I use Freebsd 8.2 and I recently needed pf to be able to dynamicall= y > fill > >>> in > >>> > tables according pass rule. > >>> > > >>> > For performances reasons, I didn't want to do it with a script and > pfctl. > >>> > Then, with the help of Mr Nicolas Greneche, I made this patch named > >>> "add". > >>> > It enables pf to add src ip or dst ip in a table when a match occur= s > on a > >>> > pass rule. > >>> > > >>> > >>> I cannot see, apart collecting ips in tables, anything else that > >>> cannot be done through pf(4) tags! > >>> Can you please describe a use case for this patch? > >> > >> > >> Indeed, it enables pf to change its behaviour toward some hosts > dynamically. > >> I will build a blacklist of ip which have been recognized as compromiz= ed > >> (botnets, spam, etc). I build a table with thoses IP. > >> > >> If I match a connection between one host of my internal network and on= e > >> blacklisted ip, there are chances that this host is infected. > >> I want to do a comprehensive capture of this host connections by addin= g > src > >> ip to a table of hosts to watch. A dup-to rule dump traffic from "host > to > >> watch" table to a sensor. > >> > >> Here are the rules : > >> pass in on $int_if from any to <blacklist> add ipsrc <infected_hosts> > >> pass in on $int_if dup-to ($sensor_if, sensor_ip) from <infected_hosts= > > to > >> any > > > >Hmm, the below should work. > > > >..... > >pass in on $int_if from any to <blacklist> tag SUSPECT > >pass in on $int_if dup-to ($sensor_if, sensor_ip) from all tagged SUSPEC= T > >..... > > This won't work in my case. It would work if I want to capture only connections from my host to a blacklisted one. But I want to capture all the traffic of my host (not only the one to any blacklisted host) after a connection of this host to a blacklisted one occurs. Source connection tracking would probably also work here too but unless > you are planning on filling up RAM per table usage I would certainly > suggest using tagging. > > An example of what I use for src connection tracking that overloads to a > blacklist would be one for SSH logins. > > pass in log quick proto tcp from !<trusted> port >1023 to any port > $shports label "Login/SSH:$dstport" keep state (max-src-conn 5, > max-src-conn-rate 15/30 overload <blacklist> flush global) > > But this may not be exactly what your looking for even though it could > be tricked out to put every IP into a table but like I said your going > to be filling up some RAM fairly quickly by keeping those hosts in a > table depending on how often your rule is going to match. > > I have seen the option overload. I could have used it if it was possible = to set max_src_conn to 0 : overload table would have been filled in as soon as a connection to a blacklisted host occurs. In my case, hosts which will be added to the table are the one on my internal network. Although this is a university, number of ip addresses which will be added in a table is limited, I don't worry about RAM usage.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BANLkTinU8fAVNfqSYeTCVwzFqjV18rQWwg>