Skip to content

Commit aa1e28c

Browse files
committed
Firewall ipset: Trim comments (;#) and empty lines from ip lists
Fixes hestiacp#1039
1 parent 2296f1c commit aa1e28c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

bin/v-add-firewall-ipset

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ if [ ! -f "${IPSET_PATH}/${IPSET_FILE}.iplist" ] || [ "$force" = "yes" ]; then
116116
fi
117117

118118
# Cleanup ip list
119+
sed -r -i -e 's/[;#].*$//' -e 's/[ \t]*$//' -e '/^$/d' "$iplist_tempfile"
119120
if [[ $ip_version == 'v4' ]]; then
120121
sed -i -r -n -e '/^((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])/p' "$iplist_tempfile"
121122
elif [[ $ip_version == 'v6' ]]; then

0 commit comments

Comments
 (0)