Hello,
I have a script which updates an alias twice a day (it replaces its content with a list of IPs taken from various sources). The script and cron job both (seem to) work fine. I only have one issue: if the opnsense box is rebooted, the alias is empty, it does not keep the last values which have been set by the script.
Here is the last part of the script which updates the alias:
# Update table from temp file
RESULT=`/sbin/pfctl -t ${ALIAS_NAME} -T replace -f ${TMP_FILE} 2>&1`
Is there a way to make this persistent in order to not have an empty list after reboot ? Is there another problem (such as alias flush at reboot) ?
Thank you in advance!
There is an API which you can use for handling aliases: https://docs.opnsense.org/development/api/core/firewall.html
Cheers
Maurice
1. If you have a cron job which updates the tables, why don't you use an @reboot entry in crontab to call that update script on reboot as well?
2. If the file is from a URL, you could as well use one or more "URL Table (IPs)"-type alias(es).
Quote from: Maurice on September 21, 2023, 03:03:43 PM
There is an API which you can use for handling aliases: https://docs.opnsense.org/development/api/core/firewall.html
Cheers
Maurice
Once again, thanks a lot Maurice.
Quote from: meyergru on September 21, 2023, 03:06:21 PM
1. If you have a cron job which updates the tables, why don't you use an @reboot entry in crontab to call that update script on reboot as well?
2. If the file is from a URL, you could as well use one or more "URL Table (IPs)"-type alias(es).
Hi,
1. This is what I'm doing, but it's a workaround
2. No it isn't, it is built from multiple sources that are processed/filtered