Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snort3 basic setup #885

Merged
merged 23 commits into from
Dec 3, 2024
Merged

Snort3 basic setup #885

merged 23 commits into from
Dec 3, 2024

Conversation

gsanchietti
Copy link
Member

@gsanchietti gsanchietti commented Nov 4, 2024

NethSecurity configuration for Snort3:

  • new rules download script
  • improved init

Features:

  • rules: Snort community and Snort subscriber
  • bypass: source and destination for IPv4 and IPv6
  • automatic configuration in NFQ mode
  • automatic configuration for HOME_NET variable including VPN networks
  • suppression rules by source and destination
  • log alert to syslog

Possible improvements:

  • add a description for IPS bypass rules
  • add a description for disabled rules
  • add an API to add/edit/delete the bypass rules
  • add an API to add/edit/delete the suppression rules

Documentation:

  • README for more info and how to use and configure
  • API README for more info on the API calls

Quick benchmarks on APU hardware in mbit/s:

  • no ips: ~ 750
  • ids (tap): ~ 410
  • ips (nfq): ~200
  • ips with 4000 rules: ~150

This PR replaces #870 with a rebase on latest commit on main branch.

References:

@gsanchietti gsanchietti force-pushed the snort3_giacomo branch 2 times, most recently from 21e0def to 3a52186 Compare November 4, 2024 15:42
@gsanchietti gsanchietti changed the base branch from snort3 to main November 4, 2024 15:43
@gsanchietti gsanchietti self-assigned this Nov 7, 2024
@gsanchietti gsanchietti marked this pull request as ready for review November 7, 2024 14:42
@gsanchietti gsanchietti mentioned this pull request Nov 7, 2024
gsanchietti added a commit to NethServer/python3-nethsec that referenced this pull request Dec 2, 2024
@gsanchietti gsanchietti force-pushed the snort3_giacomo branch 2 times, most recently from 33ee9b1 to 4bdce2f Compare December 3, 2024 16:24
filippocarletti and others added 15 commits December 3, 2024 17:27
Nethesis custom config is under /var/ns-snort.
The directory contains both temporary data and configuration.

- Make sure there is always at least one rule so snort can correctly
  start
- Setup all basic lua scripts
- Move configuration and download data to a custom directory
Exclude blocking rules without relevant metadata.
At time of writing, the number of blocked changes from 3075 to 2107.
The default rule is not required: snort can start without rules.
Also the default rule was marking all traffic as pass.
API to configure Snort 3
Changes:
- always setup queue_count and thread_count
- add ns_policy option
- add ns_disabled_rules option

New options are directly used from ns-snort-rules
Changes:
- remove ET rules: these rules do not work correctly on Snort 3
- read configuration from UCI
- add --download option to force rules download
When a machine is rebooted or updated using an image, Snort rules are
not present because stored in RAM.

During the service start, if rules are not present,
the init script now tries to load the rules multiple times.
Maximum wait time is 1 minute.

Snort will not fail the start: a nightly cron job
can update the rules and restart the service.
The restart is required to load the new rules.
Official rules with a policy are rarerly triggered.
Add the ns_alert_excluded option to alert all rules not
belonging to a policy: this will give the user some
insight about the network traffic without blocking
rules with low confidence.
Make sure that all logs are stored to /var/log/messages to ease
debugging.
Also, such log can be sent remotely and stored safefly on the
controller.
@gsanchietti gsanchietti merged commit 623e529 into main Dec 3, 2024
1 check passed
@gsanchietti gsanchietti deleted the snort3_giacomo branch December 3, 2024 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants