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