1
Intrusion Detection and Prevention / Suricata rule modifications via suricata-update
« on: November 20, 2024, 09:03:42 am »
Goal:
To modify specific SIDs using suricata-update's "--modify" option
To do this we need suricata-update, and it is already installed w/Suricata! ^_^ Nice!!
Now, it has a lot of flags/options, and OPNSense's Suricata installation is a bit unique, so, after a bit of discovery I think I've resolve this to be the most accurate form of the command:
This appears to update/replace files in the /usr/local/suricata/rules folder, but, it does not make a sid map file in the same format (v1 and v2 both look different than the one OPNSense sets up) and OPNSense already does things for IDS Rules in a two different main fashions...
The two fashions are defined in this file:
In it are the update and reload details and a few other actions. The update (update) and reload (install) scrips are as such:
Rule Updater by OPNSense
Rule Installer by OPNSense
What I'm not sure about is, what might break if I get in the mix here, and...
To modify specific SIDs using suricata-update's "--modify" option
To do this we need suricata-update, and it is already installed w/Suricata! ^_^ Nice!!
Now, it has a lot of flags/options, and OPNSense's Suricata installation is a bit unique, so, after a bit of discovery I think I've resolve this to be the most accurate form of the command:
Code: [Select]
suricata-update --suricata-conf /usr/local/etc/suricata/suricata.yaml --suricata /usr/local/bin/suricata --data-dir /usr/local/etc/suricata --no-merge --modify-conf=/root/suricata/modify.conf --output /usr/local/etc/suricata/rules --no-test --no-reload --offlineThis appears to update/replace files in the /usr/local/suricata/rules folder, but, it does not make a sid map file in the same format (v1 and v2 both look different than the one OPNSense sets up) and OPNSense already does things for IDS Rules in a two different main fashions...
The two fashions are defined in this file:
Code: [Select]
/usr/local/opnsense/service/conf/actions.d/actions_ids.conf In it are the update and reload details and a few other actions. The update (update) and reload (install) scrips are as such:
Rule Updater by OPNSense
Code: [Select]
/usr/local/opnsense/scripts/suricata/rule-updater.py( gets updated rules from the internet, puts them in /usr/local/etc/suricata/rules )Rule Installer by OPNSense
Code: [Select]
/usr/local/opnsense/scripts/suricata/installRules.py( gets rules from /usr/local/etc/suricata/rules, and appears to copy/mod them to /usr/local/etc/suricata/opnsense.rules and then makes /usr/local/etc/suricata/installed_rules.yaml - it seems to also make an SQLite file for the SIDs )What I'm not sure about is, what might break if I get in the mix here, and...
- Disable OPNSense's Update & Reload (Install) Cron routines
- Setup new Cron Scripts in /usr/local/opnsense/service/conf/actions.d with 'Descriptions' so I can Cron them
- Have these scripts run the suricata-update with the correct flags, and create the expected merged file?



