PyFRC2G icon indicating copy to clipboard operation
PyFRC2G copied to clipboard

Completely useless for OPNSense 25.x

Open gitcatpeter opened this issue 11 months ago • 5 comments

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!

gitcatpeter avatar Dec 23 '25 19:12 gitcatpeter

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.

Image

GuyGuy-59 avatar Dec 27 '25 16:12 GuyGuy-59

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.

olivierb46 avatar Dec 29 '25 09:12 olivierb46

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.

ozskywalker avatar Dec 29 '25 17:12 ozskywalker

Thanks to all of you I got it working. Turns out the documentation is misleading:

  1. In Configuration section you have Edit pyfrc2g/config.py where it should be Edit pyfrc2g/modules/config.py Because 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!

  1. Please also correct the documentation in "Generated files" section. The results are produced into the directory results/, not tmp/.

gitcatpeter avatar Dec 30 '25 05:12 gitcatpeter

Ah just realized that as well, have created a PR.

ozskywalker avatar Dec 30 '25 05:12 ozskywalker