mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-07 17:52:46 +01:00
yara download and update
This commit is contained in:
@@ -93,25 +93,45 @@ strelkarepos:
|
||||
- makedirs: True
|
||||
{% endif %}
|
||||
|
||||
yara_update_script:
|
||||
file.managed:
|
||||
- name: /usr/sbin/so-yara-update
|
||||
- source: salt://manager/tools/sbin_jinja/so-yara-update
|
||||
- user: root
|
||||
- group: root
|
||||
yara_update_scripts:
|
||||
file.recurse:
|
||||
- name: /usr/sbin/
|
||||
- source: salt://manager/tools/sbin_jinja/
|
||||
- user: socore
|
||||
- group: socore
|
||||
- mode: 755
|
||||
- template: jinja
|
||||
- defaults:
|
||||
ISAIRGAP: {{ GLOBALS.airgap }}
|
||||
EXCLUDEDRULES: {{ STRELKAMERGED.rules.excluded }}
|
||||
|
||||
{% if GLOBALS.airgap %}
|
||||
remove_strelka-yara-download:
|
||||
cron.absent:
|
||||
- user: socore
|
||||
- identifier: strelka-yara-download
|
||||
|
||||
strelka-yara-update:
|
||||
cron.present:
|
||||
- user: root
|
||||
- user: socore
|
||||
- name: '/usr/sbin/so-yara-update >> /nsm/strelka/log/yara-update.log 2>&1'
|
||||
- identifier: strelka-yara-update
|
||||
- hour: '7'
|
||||
- minute: '1'
|
||||
{% else %}
|
||||
remove_strelka-yara-update:
|
||||
cron.absent:
|
||||
- user: socore
|
||||
- identifier: strelka-yara-update
|
||||
|
||||
strelka-yara-download:
|
||||
cron.present:
|
||||
- user: socore
|
||||
- name: '/usr/sbin/so-yara-download >> /nsm/strelka/log/yara-download.log 2>&1'
|
||||
- identifier: strelka-yara-download
|
||||
- hour: '7'
|
||||
- minute: '1'
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% else %}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ if [ "$gh_status" == "200" ] || [ "$gh_status" == "301" ]; then
|
||||
|
||||
echo "Done!"
|
||||
|
||||
/usr/sbin/so-yara-update
|
||||
|
||||
else
|
||||
echo "Server returned $gh_status status code."
|
||||
@@ -4,6 +4,8 @@
|
||||
# https://securityonion.net/license; you may not use this file except in compliance with the
|
||||
# Elastic License 2.0.
|
||||
|
||||
NOROOT=1
|
||||
. /usr/sbin/so-common
|
||||
|
||||
echo "Starting to check for yara rule updates at $(date)..."
|
||||
|
||||
@@ -19,7 +21,7 @@ OUTPUTDIR=/opt/so/saltstack/local/salt/strelka/rules
|
||||
|
||||
mkdir -p $OUTPUTDIR
|
||||
|
||||
for i in $(find $SORUKLEDIR -name "*.yar*"); do
|
||||
for i in $(find $SORULEDIR -name "*.yar*"); do
|
||||
rule_name=$(echo $i | awk -F '/' '{print $NF}')
|
||||
if [[ ! "${excluded_rules}" =~ ${rule_name} ]]; then
|
||||
echo "Adding rule: $rule_name..."
|
||||
|
||||
@@ -579,7 +579,7 @@ strelka:
|
||||
helpLink: strelka.html
|
||||
advanced: False
|
||||
repos:
|
||||
description: List of repos for so-yara-update to use to download rules.
|
||||
description: List of repos for so-yara-download to use to download rules.
|
||||
readonly: False
|
||||
global: False
|
||||
helpLink: strelka.html
|
||||
|
||||
@@ -666,7 +666,7 @@ if ! [[ -f $install_opt_file ]]; then
|
||||
title "Restarting Suricata to pick up the new rules"
|
||||
logCmd "so-suricata-restart"
|
||||
title "Downloading YARA rules"
|
||||
logCmd "runuser -l socore 'so-yara-update'"
|
||||
logCmd "runuser -l socore 'so-yara-download'"
|
||||
title "Restarting Strelka to use new rules"
|
||||
logCmd "so-strelka-restart"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user