Taming the beasts… aka suricata blueprint
-
And I will third it :)
I am in the process of installing a new pfsense firewall and v2.0 of the infamous guide would come just in handy :)
-
jflsakfja, I cannot thank you enough for this. Over the last week I read through this entire thread and I am going to have to go through and read at least the first few pages again before trying this for myself.
I am sure I am not alone in having set up Snort/Suricata piecemeal, tweaking based on the odd nugget of advice picked up here and there but always wondering "am I really doing this right?". I am looking forward to seeing the updated guide, thak you again for all your efforts.
-
I am in the process of installing a new pfsense firewall and v2.0 of the infamous guide would come just in handy :)
Agreed :D
I have a matching hardware spare so I've started a 2.2.1 build and am just going to hold tight until the guide comes out. I'm venturing into new territory with Suricata and would rather follow the knowledge. Until then, my 2.1.5 with Snort is running just fine.
Curious though, is there any "school of thought" as to order of loading Squid3, PfBlockerNG and Suricata?
Rick
- 11 days later
-
@jflsakfja any progress? I'm pretty sure you're probably done with the write up, but still waiting on the pfSense team to give the OK?
-
Negative on progress, since I still haven't got the OK. Patience is a virtue we all need ;)
-
@jflsakfja:
Patience is a virtue we all need ;)
I'll second that one too!
Rick
-
Hello,
On my home I use pfsense 2.1.5 and now I switched from Snort to Suricata, set it as recommended by jflsakfja instructions in this thread….
Looking at alert logs yesterday I found that China people try to probe/hack my home network ( probably they found that Lenovo tablet can't report home and want to see whats wrong... ) so I put them in an alias blocked and set them in firewall as permanent blocked traffic In ( WAN ) and Out ( LAN ) but I still get alert in Suricata from there IP.
And by the way I still have Pfblocker set up to block all incoming traffic from Asia, and other sources.
Isn't pfsense firewall blocking traffic before it arriving at Suricata ?
Thank you.
edit:
security by obscurity ( pictures removed ) -
@jflsakfja:
Patience is a virtue we all need ;)
After reading https://forum.pfsense.org/index.php?topic=88244 , I think we will need more then patience. I understand what you're doing/asking for.. I've seen many pfsense guides on the internet, and none of them have gotten in trouble.. They just put the standard trademark disclaimer.
I'll wait and see
-
Hello,
On my home I use pfsense 2.1.5 and now I switched from Snort to Suricata, set it as recommended by jflsakfja instructions in this thread….
Looking at alert logs yesterday I found that China people try to probe/hack my home network ( probably they found that Lenovo tablet can't report home and want to see whats wrong... ) so I put them in an alias blocked and set them in firewall as permanent blocked traffic In ( WAN ) and Out ( LAN ) but I still get alert in Suricata from there IP.
And by the way I still have Pfblocker set up to block all incoming traffic from Asia, and other sources.
Isn't pfsense firewall blocking traffic before it arriving at Suricata ?
Thank you.
edit:
security by obscurity ( pictures removed )Short answer is nope :).
Long answer is: Think of the way packets are processed as a realtime copy of the packet stream. pf processes the actual packets, while at the same time copying them and sending them to suricata (actually logging the stream as is, and suricata sniffing that copy, but that's contrary to my stupidly simple explanations, so ignore it).Here's what happens and why you still get alerts:
A packet arrives from IP 1.1.1.1. That packet is copied and processed, sent on its way to your computer. At the exact time (relative, play along) that the packet is copied, suricata picks it up and starts processing the copy. The actual packet has long reached your computer, suricata is munching on a copy. After it decides that IP 1.1.1.1 is bad, it adds it to the blocked hosts. The next time a packet from that IP arrives, both pf and suricata will pick it up (original+copy). While pf is still deciding what to do with the packet (it will drop it, since the IP is known bad), suricata will still process a copy of it, and generate an alert.The downside: wasted processing. I tried working around with it with suricata's BPF (an exercise for the extremely stubborn out there) but could not, not without significant performance penalties. Basically BPF says "ignore packets from these IPs". There is no reason to analyze a packet that's known to be blocked anyway.
The upside: each time the bad IP generates an alert, the alert timestamp is updated. If it keeps doing it while being inside the ban timeframe, then the IP is perpetually kept on blocked hosts (well, until something like a reboot kicks it (temporarily) out).
All in all, don't worry if you are still seeing alerts from blocked IPs. As long as your rules are set up correctly (easy to test) then you are set :)
-
On my home I use pfsense 2.1.5 and now I switched from Snort to Suricata, set it as recommended by jflsakfja instructions in this thread….
Unless you are writing your own rules or you are an ISP dealing with 30k users, right now you are better with Snort than Suricata. Using ET open and Snort VRT rulesets, youll get more coverage of threat protection with Snort (All VRT rules compatible with the engine)
I personnaly prefer Suricata for a few reasons. IP protocol detection is better tuned…it will actually alert on some IPv6, Hop-by-Hop, etc... And when writing rules and outputting to syslog, I get more info on why the rules didnt load... Plus, the loggin is more detailed with Suricata.
But the Snort OpenAppID is promising and give you a good overlook of apps on your network/ports -do you know whats on your port TCP 443 ?- And the IP reputation with Snort is alot more user friendly than Suricata. Also, the host attribute table feature of Snort can be usefull depending on the size of your network and uniqueness of your users. Again, I find Snort better at detecting packet overlapping, while you could spend days fine tuning Surita Stream engine and end up just disabling the Stream rules ;)
30$/year VRT with Snort is a great deal of protection for the money. ET Pro is more expensive…which they had a home user pricing...
Then again, if you have time up your sleeve, try them both Suricata/Snort and find out for yourself their strengths. But honestly, on pfSense, for protecting a home or SOHO network w/o getting too much into technical stuff; go with the Snort package.
F.
- 22 days later
-
@jflsakfja:
…
The upside: each time the bad IP generates an alert, the alert timestamp is updated. If it keeps doing it while being inside the ban timeframe, then the IP is perpetually kept on blocked hosts (well, until something like a reboot kicks it (temporarily) out).All in all, don't worry if you are still seeing alerts from blocked IPs. As long as your rules are set up correctly (easy to test) then you are set :)
Hi to all and thanks for creating this thread !
I'm following your suggestion to set up a suricata ids,
Can someone explain how can I check the list of "blocked hosts" and their timers?Thanks,
Chris–-
I figured it out: services -> suricata -> blocks gives me all the info I need. -
Unless you are writing your own rules or you are an ISP dealing with 30k users, right now you are better with Snort than Suricata. Using ET open and Snort VRT rulesets, youll get more coverage of threat protection with Snort (All VRT rules compatible with the engine)
There was talk (here and elsewhere) many months back that Snort as a long term product was dead… or dying... in the wake of Suricata and its resources. Has there been a change to that thought? New people involved?
Just curious?
Rick
-
There was talk (here and elsewhere) many months back that Snort as a long term product was dead… or dying... in the wake of Suricata and its resources. Has there been a change to that thought? New people involved?
Just curious?
Rick
I think a couple of things have happened. First, thus far the Cisco purchase of Snort has not resulted in the open source project side being squashed. That was a fear early on after the purchase. Second, Snort 3.0-BETA supports multi-threading. So once v3.0 goes from BETA to RELEASE, the argument about Suricata's performance advantages will lose some steam.
I think both systems are fine. Each has its own unique features. Suricata can grab and log a lot more information than Snort can at the moment (all the JSON stuff, TLS cert exchanges, etc.), but Snort sports the new OpenAppID functionality.
Bill
-
New user here, bear with me.
Following the first post and reading it over and over, I don't understand the part about floating rules.
Here's what I did(also see screenshots)
- Created new interface called DMZ(did this to test on my current system)
- Created Floating Rule, as described, but ONLY for the interface DMZ
- Created allow rule for everything on the interface tab for DMZ(started out with DNS only, but nothing went through, so I changed it to any)
Testing with ping = failed
Testing NSLOOKUP = failedWhen disabling the floating rule, all traffic pass, as expected.
I'm sure it's me messing this up in some way, but I don't see how/why.
Assistance greatly appreciated.
BR Jim -
Can I see a screenshot of the floating rule in question?
If you are talking about the "block all" floating rule, it should only apply to traffic destined for pfsense's ports (that's why there is a giant red warning under it).
-
Thank you for the post - I've been walking through it and adjusting as necessary. I have a server at a colo accessed via a tunnel so some adjustment is necessary.
About that floating rule, the first one your mention where you write in large red "DON'T CHANGE DESTINATION PORT RANGE!!!". If I follow that example EXACTLY as you write it, rule #1 :P, then I end up blocking all outgoing traffic. Here is the float rule: (attached) Do you really intend to block ALL? I'm corn-fused?! Maybe I missed a step?
Thx.
-
Most common question I had to answer so far ;D
The rule you show will block all traffic.
The rule you want will block all traffic destined for pfsense's ports!. That's where the "don't change ports" part comes in.
Adjust that rule to destination pfsense's ports and it will be OK ;)
-
@jflsakfja:
Can I see a screenshot of the floating rule in question?
If you are talking about the "block all" floating rule, it should only apply to traffic destined for pfsense's ports (that's why there is a giant red warning under it).
Thanks for your reply. I guess the post above concerns the same confusion. Don't get me wrong, but you write the following:
Next up Floating tab:
Set up a rule but make these changes:
Action Block
Quick TICKED!!!
Interface Hold CTRL and click on all interfaces EXCEPT LAN(admin) and SYNC
Direction any
Source any
Destination anyIf you read this directly(as I did, since I'm absolute beginner), your rule will block everything in/out on all interfaces, except "LAN".
I did this, and got confused. I could not wrap my head around, how on earth a Floating block ANY ANY ANY to all interfaces would possibly allow any traffic to pass through.
My suggestion is to clarify(maybe more red big letters) that this floating block rule is ONLY for the ports you specify as being web interface and SSH(which makes good sense).
Thanks for your guide, I'm looking forward to following the next steps.
BR Jim
-
I agree, the text is a bit confusing, but it was meant to say "you created the rule, now head over to the floating tab and set up an identical rule to it, making these changes".
It's getting changed in the next version anyways (since I can't edit old posts) when I finally find the time to finish it. Caught up with work (a LOT of it) these days, and the guide is pushed back on my priorities list.
-
Sounds great, thanks for the clarification. Couldn't wrap my head around that weird floating rule :)
Looking forward to Version2 8)
-
Ok – reading through 28(!) pages is not my idea of fun. Is there a good summary for current (May, 2015) setups from scratch on 2.2.2 of PFSense, and using Suricata and any other helpful stuff for a colo'd LAN offering services to folks on the Internet?
-
Not currently, something is being worked on :)
-
@jflsakfja:
Not currently, something is being worked on :)
Cant wait!
- 15 days later
-
Hi, jflaskfja
Thanks for offering the ruleset settings, I got them from https://github.com/jflsakfja/suricata-rules/blob/master/list.txt, But I have 2 questions:
Question1: when I go to setup (enable/disable) the rules, I saw some of them have been disabled ORIGINALLY, Should I enable them all first before following your instructions in the list? or Should I keep them as is then disable what were mentioned in the list?
Question2: I can't find some rule#, like:
emerging-attack_response > all except:
2100498 GPL ATTACK_RESPONSE id check returned root <<< Based on plaintext value. False positive on http://planet.suricata-ids.org/DISABLED:1
is that because I used Balanced Policy?
- 12 days later
-
Apologies for the late reply, but I was involved in a double car accident. Almost snapped my neck, spent two weeks immobilized in a hospital bed.
@all: don't expect me to be active these days. I'm mostly in and out of bed recovering from a series of injuries throughout my body.
-
Yes, enable all, even originally disabled rules. Then go through the list and disable those mentioned.
-
Rules that cannot be found are rules that were deleted upstream (ET). In that case, please ignore them.
-
-
@jflsakfja:
Thanks much, Sorry about your car accident, Feel better!
- 9 days later
-
Wow, just read this. :o
I wish you a speedy recovery.
Steve
-
speed recovery jflsakfja!!
-
fast recovery jflsakfja!!!
-
Firstly to jflsakfja, sorry to hear about your accident. I hope you're OK!
So I've finally made it through the 29 pages (the first few I had to read quite a few times) and I still have a couple of noob questions.
-
I'm getting quite a few "ET SCAN NMAP -sS window 1024" alerts (among others) in my logs. It adds the IP to the block list of Suricata, which is great. But I continue to get these scans from the same IP. Does this mean the blocking isn't quite happening or am I just being alerted that the scan is being attempted? I would have thought if the block was there it wouldn't be getting any packets through at all?
-
Just in case, I manually added some of these IPs into an IP Alias to block on the floating tab in through WAN and out of LAN. Is there a way of having Suricata automatically add IPs into a permanent block list Alias or something? Even adding these rules manually I still get the alert in Suricata, which again I would have thought the firewall would block the packets way before Suricata would be seeing anything.
-
The default settings are to block hosts for 1 hour within Suricata. Is there a particular reason why you wouldn't block them permanently?
Apologies if these are stupid questions!
-
-
You are still seeing alerts because of the way snort/suricata work on pfsense. Follow the next steps through, and you will understand why.
- A packet comes in on your WAN interface
- A copy of that packet is immediately made, and passed on to snort/suricata
- pf decides what to do with the packet
- snort/suricata decides what to do with the copy of the packet
- If rules allow it, pf passes on the packet to your LAN interface
- If snort/suricata rules call for an alert, an alert is generated
- The original packet has likely reached its destination
8 ) The offending IP is added by snort/suricata (actually no, but good enough) to the blocked table.
The most important part is 2: that shows exactly how snort/suricata work, and why alerts are generated. Fast forwarding another round of that list, shows that by the time pf decides that a second packet from the offender should be blocked, snort/suricata already sees the copy of that packet, re-generating an alert. As you can see, no matter what you do, the alerts will always be generated.
The only 2 ways to stop those alerts is by using an upstream router to block packets from that IP, or using BPF to tell suricata to not inspect packets from those IPs, which is not currently supported nor encouraged (last time I tried it on my 4 million permanently banned IPs, the box crashed, on smaller lists suricata start up took a day or so).
You don't have to worry about the alerts being generated. That does not mean that packets are passing, they could be blocked and the alert will still be generated on the copy of the packet.
I like to set up the ban time as 28 days. Offenders (including so-called "state sponsored hax0rz") being mostly script kiddies they will come again with a packet that will generate an alert within that timeframe. The bonus of having snort/suricata work the way they do now, is that once an attacker generates an alert, and he keeps on coming, he will be perpetually banned. Each time an alert is generated, the timestamp for that IP is updated, which means resetting the timer back to 28 days.
Every now and then, manually inspect the snort/suricata blocked list, and decide on what to do. For example if a number of IPs from a certain /24 subnet are always there, they get added to a permanently banned list, that is used in a rule on all interfaces (block WAN side, reject LAN side). Not that it stops the alerts, but in case the blocked list is flushed (eg reboot?) the IPs are still banned.
@all: thanks for the wishes. Slowly recovering :-)
- 15 days later
-
Got my 'new' home network almost up and going, so I popped in to see how the thread was doing. I had to comment and say jflsakfja I hope your recovery is going well!!
- 19 days later
-
jflsakfja thanks so much for all the time you've spent on getting this up and running. I read through the ridiculously long thread on getting the half dozen sentences you wanted in order to begin working on the guide. Now that that's done, what's the timeframe looking like on that and what kind of help do you need to get started?
-
on getting the half dozen sentences you wanted in order to begin working on the guide.
and what kind of help do you need to get started?
I've read this more than once, but I think I'm not quite sure what the question is. Now I'm not JFL, so your question isn't directed at me, but I'm still being curious as to what the question is ( ;D ).
-
hahahaha well I thought it was pretty clear. ;)
Let me try to be more clear. Do you need:
- Someone to help edit for English grammar?
- Someone to convert some of the forum topics over to github so that you can edit from there?
- Someone to grab pfSense screenshots, crop them and put them in a repo somewhere?
- Someone to write a section from scratch?
- etc
- etc
- etc
-
Still recovering and becoming a regular at the doctors'. Went through everything so far, x-rays, CTs, EMGs, MRIs…(notice the "s" at the end of each one). Still have 2 MRIs to go through, but that's going to take a while, not scheduled for another 4 months or so. Not saying that the guide is going to be delayed until then, but for now, I'm more focused on easing back to my regular life and workflow.
I only ask for your patience for now :). Bone marrow and nerves are slow in recovery...
The upside is that my head is still attached to my neck, that's good!
- 7 days later
-
@jflsakfja:
Can I see a screenshot of the floating rule in question?
If you are talking about the "block all" floating rule, it should only apply to traffic destined for pfsense's ports (that's why there is a giant red warning under it).
Thanks for your reply. I guess the post above concerns the same confusion. Don't get me wrong, but you write the following:
Next up Floating tab:
Set up a rule but make these changes:
Action Block
Quick TICKED!!!
Interface Hold CTRL and click on all interfaces EXCEPT LAN(admin) and SYNC
Direction any
Source any
Destination anyIf you read this directly(as I did, since I'm absolute beginner), your rule will block everything in/out on all interfaces, except "LAN".
I did this, and got confused. I could not wrap my head around, how on earth a Floating block ANY ANY ANY to all interfaces would possibly allow any traffic to pass through.
My suggestion is to clarify(maybe more red big letters) that this floating block rule is ONLY for the ports you specify as being web interface and SSH(which makes good sense).
Thanks for your guide, I'm looking forward to following the next steps.
BR Jim
Ahhhhh….thanks for the clarification! I read it that way too.
- 3 months later
-
@jflsakfja:
Next up Floating tab:
Set up a rule but make these changes:| Action | Block |
| Quick | TICKED!!! |
| Interface | Hold CTRL and click on all interfaces EXCEPT LAN(admin) and SYNC |
| Direction | any |
| Source | any |
| Destination | any |DON'T CHANGE DESTINATION PORT RANGE!!! Had to add this since I confused a few people already :p
Those are pretty much the only changes you need to make. Save and apply the rule. When adding other floating rules, make sure this rule stays at the absolute top of the list.
I am either missing something or this is truly going over my head and I apologize for resurrecting an old(er) thread.
When I add the Floating rule, all traffic on my network grinds to a halt.
Can someone explain to me how to set it up correctly? I apologize for this, I've looked over the thread several times and can't come to an answer. I tried varying setups and, still, nothing.Here's a link to my current rules:
Floating: http://i.imgur.com/oqVGRyD.png
WAN: http://i.imgur.com/kezi74q.png
LAN: http://i.imgur.com/n7g15kf.pngThanks.
P.S., hope you're alright, jflsakfja. :D
-
-
you missed the destination admin ports for your pfsense box.
So, they need to be in the LAN and Floating section? Also, I noticed I might've mislabeled the LAN and WAN Imgur links. Sorry.