OPNsense Forum

Archive => 20.7 Legacy Series => Topic started by: clopmz on August 07, 2020, 03:50:51 pm

Title: Loading pftables from files
Post by: clopmz on August 07, 2020, 03:50:51 pm
Hi all,

 I have configured several pftables as external sources and I have scheduled several cronjobs to create/update these pftables and to store data in plain files. But how can I configure opnsense to read these files and insert data in the correct pftable every time fw start or restarts?

Thanks
Title: Re: Loading pftables from files
Post by: clopmz on August 10, 2020, 12:18:13 pm
Please, any help/tip on this?
Title: Re: Loading pftables from files
Post by: franco on August 10, 2020, 12:29:13 pm
Hi there,

https://docs.opnsense.org/manual/aliases.html

"External (advanced)

Externally managed alias, this only handles the placeholder. Content is set from another source (plugin, api call, etc)"

https://docs.opnsense.org/manual/aliases.html#add-new-entries-using-our-api


Cheers,
Franco
Title: Re: Loading pftables from files
Post by: clopmz on August 10, 2020, 01:12:29 pm
Thanks Franco,

 Is it the only option? I would like my pf tables be consistent when fw starts ... Using curl option, pf tables will be empty until scripts run ...
Title: Re: Loading pftables from files
Post by: franco on August 10, 2020, 01:29:05 pm
pfctl can help you:

https://www.openbsdhandbook.com/pf/cheat_sheet/#maintaining-pf-tables

Syntax may differ a little from OpenBSD to FreeBSD.

You can run system "start" hooks via:

https://docs.opnsense.org/development/backend/autorun.html


Cheers,
Franco