Skip to content

Commit 03ff18a

Browse files
committed
[Firewall-ipset] enable daily ipset autoupdate
Finishes the feature added in hestiacp#819
1 parent 3620c81 commit 03ff18a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

bin/v-add-firewall-ipset

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,12 @@ fi
161161
chmod 660 $HESTIA/data/firewall/ipset.conf
162162
chmod 660 "${IPSET_PATH}/${IPSET_FILE}.iplist"
163163

164+
# Install ipset daily cron updater
165+
if ! grep --no-messages "v-update-firewall-ipset" $HESTIA/data/queue/daily.pipe; then
166+
cmd="$BIN/v-update-firewall-ipset yes"
167+
echo "$cmd" >> $HESTIA/data/queue/daily.pipe
168+
fi
169+
164170

165171
#----------------------------------------------------------#
166172
# Hestia #

bin/v-update-firewall-ipset

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ for ipset_name in $(search_objects "$ipset_hstobject" 'SUSPENDED' 'no' 'LISTNAME
4141

4242
last_updated_ts=$(date -d "$ipset_date $ipset_time" +%s)
4343
now=$(date +%s)
44-
hours_since_update=$(( (now - last_updated_ts) / 60 ))
44+
hours_since_update=$(( (now - last_updated_ts) / (60*60) ))
4545

46-
if [[ "$hours_since_update" -lt 70 ]] && [ "$force" = 'no' ]; then
46+
if [[ "$hours_since_update" -lt 24 ]] && [ "$force" = 'no' ]; then
4747
# load existing ip list files in the kernel but don't auto update them
4848
$BIN/v-add-firewall-ipset "$ipset_name"
4949
continue

0 commit comments

Comments
 (0)