Hi! I need to automate the interface creation in OPNSense 25.1.9. I followed the feature request from here: https://github.com/opnsense/core/issues/7324 where szymczag shared his code for a controller that is supposed to create new interfaces: https://gist.github.com/szymczag/df152a82e86aff67b984ed3786b027ba
I tried to follow the instructions and added the script to /usr/local/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/ but when I hit the controller it returns
I found that I should run the command configctl template reload OPNSense but it just returns ERR. The same story with configctl template reload OPNSense/Interfaces but configctl template reload OPNSense/IPFW returns OK.
The last lines in cat /var/log/configd/latest.log that correspond with the execution that returned ERR, are:
Is it possible to do what I am attempting? Creating a new controller on a live system? Because I suspect there must be some form or build that aggregates all the controllers, most likely when OPNSense is built.
Versions
OPNsense 25.1.9_2-amd64
FreeBSD 14.2-RELEASE-p3
OpenSSL 3.0.16
I tried to follow the instructions and added the script to /usr/local/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/ but when I hit the controller it returns
Code Select
{"errorMessage":"Endpoint not found"}
I found that I should run the command configctl template reload OPNSense but it just returns ERR. The same story with configctl template reload OPNSense/Interfaces but configctl template reload OPNSense/IPFW returns OK.
The last lines in cat /var/log/configd/latest.log that correspond with the execution that returned ERR, are:
Code Select
<13>1 2025-06-25T00:50:30+03:00 OPNsense.example.com configd.py 265 - [meta sequenceId="1"] [cf305853-66dc-4ab9-8c46-37859a274a7c] generate template OPNsense/Interfaces
<13>1 2025-06-25T00:50:34+03:00 OPNsense.example.com configd.py 265 - [meta sequenceId="2"] [b7efa9b9-bcc1-4c9d-8d97-1e52c1ad7522] generate template OPNsense
Is it possible to do what I am attempting? Creating a new controller on a live system? Because I suspect there must be some form or build that aggregates all the controllers, most likely when OPNSense is built.
Versions
OPNsense 25.1.9_2-amd64
FreeBSD 14.2-RELEASE-p3
OpenSSL 3.0.16