From 87abb1344ece0fae003757ed4b13129333e8279a Mon Sep 17 00:00:00 2001 From: Tommaso Bailetti Date: Mon, 13 Jan 2025 10:43:32 +0100 Subject: [PATCH] style: fixed indentation --- packages/snort3/files/snort.init | 60 ++++++++++++++++---------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/packages/snort3/files/snort.init b/packages/snort3/files/snort.init index 99b91625..7e24ab8d 100644 --- a/packages/snort3/files/snort.init +++ b/packages/snort3/files/snort.init @@ -26,33 +26,33 @@ update_bypass_set() { else echo -n "elements = {" > $set_file for ip in $ips; do - echo -n "$(echo "$ip" | cut -d, -f1)," >> $set_file + echo -n "$(echo "$ip" | cut -d, -f1)," >> $set_file done echo " }" >> $set_file - fi + fi } download_rules () { - oinkcode="$(uci -q get snort.snort.oinkcode)" - if [ -n "$oinkcode" ]; then - rm -f /var/ns-snort/*community-rules.tar.gz - rules="$(find /var/ns-snort -type f -name "snortrules-*.tar.gz")" - [ -n "$rules" ] && return - else - rm -f /var/ns-snort/snortrules-*.tar.gz - rules="$(find /var/ns-snort/ -type f -name "*community-rules.tar.gz")" - [ -n "$rules" ] && return - fi - # this is done every time the service is started - attempt=0 - until /usr/bin/ns-snort-rules --download; do - attempt=$((attempt + 1)) - if [ "$attempt" -ge 6 ]; then - echo "Error: failed to download snort rules after 6 attempts (1 minute)." - break - fi - sleep 10 - done + oinkcode="$(uci -q get snort.snort.oinkcode)" + if [ -n "$oinkcode" ]; then + rm -f /var/ns-snort/*community-rules.tar.gz + rules="$(find /var/ns-snort -type f -name "snortrules-*.tar.gz")" + [ -n "$rules" ] && return + else + rm -f /var/ns-snort/snortrules-*.tar.gz + rules="$(find /var/ns-snort/ -type f -name "*community-rules.tar.gz")" + [ -n "$rules" ] && return + fi + # this is done every time the service is started + attempt=0 + until /usr/bin/ns-snort-rules --download; do + attempt=$((attempt + 1)) + if [ "$attempt" -ge 6 ]; then + echo "Error: failed to download snort rules after 6 attempts (1 minute)." + break + fi + sleep 10 + done } setup_tweaks() { @@ -76,7 +76,7 @@ start_service() { # output.logdir, in the snort lua config, determines the PID file location. # Add '--create-pidfile' to the 'command', below. - local enabled + local enabled local manual local config_dir local interface @@ -94,17 +94,17 @@ start_service() { setup_tweaks fi - validate_snort_section snort || { - echo "Validation failed, try 'snort-mgr check'." - return 1 - } + validate_snort_section snort || { + echo "Validation failed, try 'snort-mgr check'." + return 1 + } [ "$enabled" = 0 ] && return procd_open_instance if [ "$manual" = 0 ]; then local config_file=$($MGR setup) - maxlen=$(uci -q get snort.nfq.queue_maxlen) + maxlen=$(uci -q get snort.nfq.queue_maxlen) if [ -z "${maxlen}" ]; then maxlen=1024 fi @@ -134,6 +134,6 @@ service_triggers() reload_service() { - stop - start + stop + start }