Skip to content

Commit

Permalink
security/crowdsec-firewall-bouncer: fix file quoting
Browse files Browse the repository at this point in the history
When the api key contains a '/' character, if the yaml field is
not quoted it will include the comment as well. fix: quote the field and
remove the comment with the bouncer name.

PR:		276096
MFH:		2024Q1
  • Loading branch information
mmetc authored and clausecker committed Mar 19, 2024
1 parent e91ecc7 commit 7873631
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion security/crowdsec-firewall-bouncer/Makefile
@@ -1,5 +1,5 @@
PORTNAME= crowdsec-firewall-bouncer
PORTREVISION= 3
PORTREVISION= 4
DISTVERSIONPREFIX= v
DISTVERSION= 0.0.28
CATEGORIES= security
Expand Down
Expand Up @@ -49,7 +49,7 @@ crowdsec_firewall_precmd() {
# THEN, register it to the local API
API_KEY=$($CSCLI bouncers add "${crowdsec_firewall_name}" -o raw)
if [ -n "$API_KEY" ]; then
sed -i "" "s|^${orig_line}|api_key: ${API_KEY} # ${crowdsec_firewall_name}|" "${crowdsec_firewall_config}"
sed -i "" "s|^${orig_line}|api_key: '${API_KEY}'|" "${crowdsec_firewall_config}"
echo "Registered: ${crowdsec_firewall_name}"
fi
fi
Expand Down Expand Up @@ -85,6 +85,7 @@ crowdsec_firewall_stop()
crowdsec_firewall_start() {
# ensure we have a backend if the config file was not patched
export BACKEND=pf
# shellcheck disable=SC2086
/usr/sbin/daemon -f -p "$pidfile" -t "$desc" -- \
"$command" -c "$crowdsec_firewall_config" ${crowdsec_firewall_flags}
}
Expand Down

0 comments on commit 7873631

Please sign in to comment.