Skip to content

Commit

Permalink
cleanup and fixing similarly missing quotes
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Schmittner <[email protected]>
  • Loading branch information
Echsecutor committed Jun 21, 2024
1 parent bc16bfd commit 26d5b1d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions run/add_ddos_protection_iptables_rule.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ CONN_LOGGING_LEVEL=${6}
source ./ip_tables_utils.sh

add() {
if [ -z ${DELETE} ]; then
if [ -z "${DELETE}" ]; then
return 0
else
return 1
fi
}

delete() {
if [ -n ${DELETE} ]; then
if [ -n "${DELETE}" ]; then
return 0
else
return 1
Expand Down Expand Up @@ -163,14 +163,13 @@ else
fi

# Make sure the previous default logging rule is removed. It causes too much CPU overhead under load.
RULE="${LOG_CHAIN} -j LOG --log-level ${CONN_LOGGING_LEVEL} --log-prefix connlimit:"
RULE="${LOG_CHAIN} -j LOG --log-level ${CONN_LOGGING_LEVEL} --log-prefix 'connlimit:'"
delete_rule ${RULE}

# Append a rule that sets log level and log prefix
# Default to no logging unless a logging level is explicitly supplied.
if [ -n ${CONN_LOGGING_LEVEL} ]; then
# RULE="${LOG_CHAIN} -j LOG --log-level ${CONN_LOGGING_LEVEL} --log-prefix \"connlimit: \""
RULE="${LOG_CHAIN} -j LOG --log-level ${CONN_LOGGING_LEVEL} --log-prefix connlimit:"
if [ -n "${CONN_LOGGING_LEVEL}" ]; then
RULE="${LOG_CHAIN} -j LOG --log-level ${CONN_LOGGING_LEVEL} --log-prefix 'connlimit:'"
${OPERATION} ${RULE}
fi

Expand Down

0 comments on commit 26d5b1d

Please sign in to comment.