Completely useless for OPNSense 25.x
Seems to be a great tool; however, since OPNsense completely reorganized its API, it is useless.
None of the API endpoints are correct, so the script fails immediately trying to query any information from an OPNsense host.
Would you consider updating the tool for the newer versions? Thanks!
Hi,
I just checked the execution of the project on OPNsense 25.7.10, and it is functional. You need to configure the config.py file located in the modules folder. Four parameters must be defined for OPNsense: GATEWAY_TYPE, OPNS_BASE_URL, OPNS_SECRET, and OPNS_KEY.
Hi,
I also tested it and it works for OPNsense (tested on version 25.7.10). Perhaps you reversed the API key and secret ? Does the user used to connect to the API have the correct privileges?
Note: I have corrected the OPNS configuration example in the README.
Working here, GATEWAY_TYPE was optional. Running OPNsense 25.7.8
Can confirm its important to check the order, because the config file wants SECRET first, but the downloaded API key file from OPNsense puts KEY first.
Thanks to all of you I got it working. Turns out the documentation is misleading:
- In Configuration section you have
Edit pyfrc2g/config.pywhere it should beEdit pyfrc2g/modules/config.pyBecause the script is ignoring the config from the main directory it tries to connect to a non-existent host spewing:
2025-12-29 22:45:33 - root - INFO - Starting rule extraction for pfsense
2025-12-29 22:45:33 - root - INFO - Fetching aliases from API...
2025-12-29 22:45:33 - root - ERROR - Connection error while fetching pfSense aliases from https://<PFS_ADDRESS>/api/v2/firewall/aliases: HTTPSConnectionPool(host='%3cpfs_address%3e', port=443): Max retries exceeded with url: /api/v2/firewall/aliases (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x78d99a9c9d30>: Failed to resolve '%3cpfs_address%3e' ([Errno -2] Name or service not known)"))
2025-12-29 22:45:33 - root - ERROR - Connection error while fetching pfSense interfaces from https://<PFS_ADDRESS>/api/v2/interfaces: HTTPSConnectionPool(host='%3cpfs_address%3e', port=443): Max retries exceeded with url: /api/v2/interfaces (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x78d99aa22710>: Failed to resolve '%3cpfs_address%3e' ([Errno -2] Name or service not known)"))
2025-12-29 22:45:33 - root - INFO - Attempting auto-detection of interfaces...
2025-12-29 22:45:33 - root - ERROR - Connection error while detecting pfSense interfaces (primary method) from https://<PFS_ADDRESS>/api/v2/interfaces: HTTPSConnectionPool(host='%3cpfs_address%3e', port=443): Max retries exceeded with url: /api/v2/interfaces (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x78d99aa23250>: Failed to resolve '%3cpfs_address%3e' ([Errno -2] Name or service not known)"))
2025-12-29 22:45:33 - root - ERROR - Connection error while detecting pfSense interfac
After modifying modules/config.py the script works as expected!
- Please also correct the documentation in "Generated files" section. The results are produced into the directory
results/, nottmp/.
Ah just realized that as well, have created a PR.