travisghansen / hass-opnsense

OPNsense integration with Home Assistant
Apache License 2.0
219 stars 29 forks source link

Errors in opnsense since update to 23.1.4 #68

Closed cpw closed 1 year ago

cpw commented 1 year ago

Hi there, getting an error since updating to 23.1.4 this morning:

[21-Mar-2023 10:31:32 America/Toronto] PHP Fatal error:  Uncaught Error: Call to undefined function openvpn_get_active_servers() in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code:37
Stack trace:
#0 /usr/local/etc/inc/xmlrpc/hass.inc(12): eval()
#1 /usr/local/opnsense/contrib/IXR/IXR_Library.php(446): exec_php_xmlrpc('\nini_set('displ...')
#2 /usr/local/opnsense/contrib/IXR/IXR_Library.php(384): IXR_Server->call('opnsense.exec_p...', '\nini_set('displ...')
#3 /usr/local/opnsense/contrib/IXR/IXR_Library.php(357): IXR_Server->serve('__construct(Array)
#5 /usr/local/www/xmlrpc.php(104): XMLRPCServer->start()
#6 {main}
  thrown in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code on line 37
[21-Mar-2023 10:32:03 America/Toronto] PHP Fatal error:  Uncaught Error: Call to undefined function openvpn_get_active_servers() in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code:37
Stack trace:
#0 /usr/local/etc/inc/xmlrpc/hass.inc(12): eval()
#1 /usr/local/opnsense/contrib/IXR/IXR_Library.php(446): exec_php_xmlrpc('\nini_set('displ...')
#2 /usr/local/opnsense/contrib/IXR/IXR_Library.php(384): IXR_Server->call('opnsense.exec_p...', '\nini_set('displ...')
#3 /usr/local/opnsense/contrib/IXR/IXR_Library.php(357): IXR_Server->serve('__construct(Array)
#5 /usr/local/www/xmlrpc.php(104): XMLRPCServer->start()
#6 {main}
  thrown in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code on line 37
[21-Mar-2023 10:32:34 America/Toronto] PHP Fatal error:  Uncaught Error: Call to undefined function openvpn_get_active_servers() in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code:37
Stack trace:
#0 /usr/local/etc/inc/xmlrpc/hass.inc(12): eval()
#1 /usr/local/opnsense/contrib/IXR/IXR_Library.php(446): exec_php_xmlrpc('\nini_set('displ...')
#2 /usr/local/opnsense/contrib/IXR/IXR_Library.php(384): IXR_Server->call('opnsense.exec_p...', '\nini_set('displ...')
#3 /usr/local/opnsense/contrib/IXR/IXR_Library.php(357): IXR_Server->serve('__construct(Array)
#5 /usr/local/www/xmlrpc.php(104): XMLRPCServer->start()
#6 {main}
  thrown in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code on line 37
[21-Mar-2023 10:33:05 America/Toronto] PHP Fatal error:  Uncaught Error: Call to undefined function openvpn_get_active_servers() in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code:37
Stack trace:
#0 /usr/local/etc/inc/xmlrpc/hass.inc(12): eval()
#1 /usr/local/opnsense/contrib/IXR/IXR_Library.php(446): exec_php_xmlrpc('\nini_set('displ...')
#2 /usr/local/opnsense/contrib/IXR/IXR_Library.php(384): IXR_Server->call('opnsense.exec_p...', '\nini_set('displ...')
#3 /usr/local/opnsense/contrib/IXR/IXR_Library.php(357): IXR_Server->serve('__construct(Array)
#5 /usr/local/www/xmlrpc.php(104): XMLRPCServer->start()
#6 {main}
  thrown in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code on line 37
[21-Mar-2023 10:33:36 America/Toronto] PHP Fatal error:  Uncaught Error: Call to undefined function openvpn_get_active_servers() in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code:37
Stack trace:
#0 /usr/local/etc/inc/xmlrpc/hass.inc(12): eval()
#1 /usr/local/opnsense/contrib/IXR/IXR_Library.php(446): exec_php_xmlrpc('\nini_set('displ...')
#2 /usr/local/opnsense/contrib/IXR/IXR_Library.php(384): IXR_Server->call('opnsense.exec_p...', '\nini_set('displ...')
#3 /usr/local/opnsense/contrib/IXR/IXR_Library.php(357): IXR_Server->serve('__construct(Array)
#5 /usr/local/www/xmlrpc.php(104): XMLRPCServer->start()
#6 {main}
  thrown in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code on line 37
[21-Mar-2023 10:34:07 America/Toronto] PHP Fatal error:  Uncaught Error: Call to undefined function openvpn_get_active_servers() in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code:37
Stack trace:
#0 /usr/local/etc/inc/xmlrpc/hass.inc(12): eval()
#1 /usr/local/opnsense/contrib/IXR/IXR_Library.php(446): exec_php_xmlrpc('\nini_set('displ...')
#2 /usr/local/opnsense/contrib/IXR/IXR_Library.php(384): IXR_Server->call('opnsense.exec_p...', '\nini_set('displ...')
#3 /usr/local/opnsense/contrib/IXR/IXR_Library.php(357): IXR_Server->serve('__construct(Array)
#5 /usr/local/www/xmlrpc.php(104): XMLRPCServer->start()
#6 {main}
  thrown in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code on line 37
[21-Mar-2023 10:34:38 America/Toronto] PHP Fatal error:  Uncaught Error: Call to undefined function openvpn_get_active_servers() in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code:37
Stack trace:
#0 /usr/local/etc/inc/xmlrpc/hass.inc(12): eval()
#1 /usr/local/opnsense/contrib/IXR/IXR_Library.php(446): exec_php_xmlrpc('\nini_set('displ...')
#2 /usr/local/opnsense/contrib/IXR/IXR_Library.php(384): IXR_Server->call('opnsense.exec_p...', '\nini_set('displ...')
#3 /usr/local/opnsense/contrib/IXR/IXR_Library.php(357): IXR_Server->serve('__construct(Array)
#5 /usr/local/www/xmlrpc.php(104): XMLRPCServer->start()
#6 {main}
  thrown in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code on line 37
[21-Mar-2023 10:35:09 America/Toronto] PHP Fatal error:  Uncaught Error: Call to undefined function openvpn_get_active_servers() in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code:37
Stack trace:
#0 /usr/local/etc/inc/xmlrpc/hass.inc(12): eval()
#1 /usr/local/opnsense/contrib/IXR/IXR_Library.php(446): exec_php_xmlrpc('\nini_set('displ...')
#2 /usr/local/opnsense/contrib/IXR/IXR_Library.php(384): IXR_Server->call('opnsense.exec_p...', '\nini_set('displ...')
#3 /usr/local/opnsense/contrib/IXR/IXR_Library.php(357): IXR_Server->serve('__construct(Array)
#5 /usr/local/www/xmlrpc.php(104): XMLRPCServer->start()
#6 {main}
  thrown in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code on line 37
[21-Mar-2023 10:35:40 America/Toronto] PHP Fatal error:  Uncaught Error: Call to undefined function openvpn_get_active_servers() in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code:37
Stack trace:
#0 /usr/local/etc/inc/xmlrpc/hass.inc(12): eval()
#1 /usr/local/opnsense/contrib/IXR/IXR_Library.php(446): exec_php_xmlrpc('\nini_set('displ...')
#2 /usr/local/opnsense/contrib/IXR/IXR_Library.php(384): IXR_Server->call('opnsense.exec_p...', '\nini_set('displ...')
#3 /usr/local/opnsense/contrib/IXR/IXR_Library.php(357): IXR_Server->serve('__construct(Array)
#5 /usr/local/www/xmlrpc.php(104): XMLRPCServer->start()
#6 {main}
  thrown in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code on line 37
[21-Mar-2023 10:36:11 America/Toronto] PHP Fatal error:  Uncaught Error: Call to undefined function openvpn_get_active_servers() in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code:37
Stack trace:
#0 /usr/local/etc/inc/xmlrpc/hass.inc(12): eval()
#1 /usr/local/opnsense/contrib/IXR/IXR_Library.php(446): exec_php_xmlrpc('\nini_set('displ...')
#2 /usr/local/opnsense/contrib/IXR/IXR_Library.php(384): IXR_Server->call('opnsense.exec_p...', '\nini_set('displ...')
#3 /usr/local/opnsense/contrib/IXR/IXR_Library.php(357): IXR_Server->serve('__construct(Array)
#5 /usr/local/www/xmlrpc.php(104): XMLRPCServer->start()
#6 {main}
  thrown in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code on line 37
[21-Mar-2023 10:36:42 America/Toronto] PHP Fatal error:  Uncaught Error: Call to undefined function openvpn_get_active_servers() in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code:37
Stack trace:
#0 /usr/local/etc/inc/xmlrpc/hass.inc(12): eval()
#1 /usr/local/opnsense/contrib/IXR/IXR_Library.php(446): exec_php_xmlrpc('\nini_set('displ...')
#2 /usr/local/opnsense/contrib/IXR/IXR_Library.php(384): IXR_Server->call('opnsense.exec_p...', '\nini_set('displ...')
#3 /usr/local/opnsense/contrib/IXR/IXR_Library.php(357): IXR_Server->serve('__construct(Array)
#5 /usr/local/www/xmlrpc.php(104): XMLRPCServer->start()
#6 {main}
  thrown in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code on line 37
[21-Mar-2023 10:37:13 America/Toronto] PHP Fatal error:  Uncaught Error: Call to undefined function openvpn_get_active_servers() in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code:37
Stack trace:
#0 /usr/local/etc/inc/xmlrpc/hass.inc(12): eval()
#1 /usr/local/opnsense/contrib/IXR/IXR_Library.php(446): exec_php_xmlrpc('\nini_set('displ...')
#2 /usr/local/opnsense/contrib/IXR/IXR_Library.php(384): IXR_Server->call('opnsense.exec_p...', '\nini_set('displ...')
#3 /usr/local/opnsense/contrib/IXR/IXR_Library.php(357): IXR_Server->serve('__construct(Array)
#5 /usr/local/www/xmlrpc.php(104): XMLRPCServer->start()
#6 {main}
  thrown in /usr/local/etc/inc/xmlrpc/hass.inc(12) : eval()'d code on line 37

I suspect it's related to the openvpn changes listed here: https://forum.opnsense.org/index.php?topic=33144.0 but I haven't been able to identify the specific change in their github yet. Sorry.

Axsgranted commented 1 year ago

Seeing the same thing after I upgraded!

alexdelprete commented 1 year ago

I suspect it's related to the openvpn changes listed here: https://forum.opnsense.org/index.php?topic=33144.0 but I haven't been able to identify the specific change in their github yet.

It's not simply the openvpn changes. I suspect they changed something more basic, even basic function calls like these aren't working. I hope they just renamed things and didn't remove them, otherwise this integration might cease to work permanently. Hope @travisghansen has some time to take a look at it and tell us if it can be adapted.

This error originated from a custom integration.
Logger: custom_components.opnsense.pyopnsense
Source: custom_components/opnsense/pyopnsense/__init__.py:100
Integration: OPNsense (documentation, issues)
First occurred: 19 March 2023 at 18:55:58 (269 occurrences)
Last logged: 16:34:05
Unexpected get_system_info error err=<ProtocolError for ljbjZkGD40iPwoRQzHFSxxjR9fUrb2JZWvdSRfTASjczybBmJSThYV%2F5IZlwu71SpnOfzGslvr6OcDcL:W9qgCPbhLqQynIAb%2FLRrWaF7jdfl%2B2rrD1DerqO%2BG5albjR6KSHSQhMbWLfd41TwSS2DobQD80VrDYfA@opnsense.osilife.net/xmlrpc.php: 500 Internal Server Error>, type(err)=<class 'xmlrpc.client.ProtocolError'>
Unexpected get_system_info error err=ConnectionRefusedError(111, 'Connection refused'), type(err)=<class 'ConnectionRefusedError'>
Unexpected upgrade_status error err=JSONDecodeError('Expecting value: line 1 column 1 (char 0)'), type(err)=<class 'requests.exceptions.JSONDecodeError'>
Unexpected get_telemetry error err=<ProtocolError for ljbjZkGD40iPwoRQzHFSxxjR9fUrb2JZWvdSRfTASjczybBmJSThYV%2F5IZlwu71SpnOfzGslvr6OcDcL:W9qgCPbhLqQynIAb%2FLRrWaF7jdfl%2B2rrD1DerqO%2BG5albjR6KSHSQhMbWLfd41TwSS2DobQD80VrDYfA@opnsense.osilife.net/xmlrpc.php: 500 Internal Server Error>, type(err)=<class 'xmlrpc.client.ProtocolError'>
travisghansen commented 1 year ago

Sorry team I won't have time to look at this for a bit :( If someone gets to the bottom of it I'm happy to review and fix and merge it but my time is quite limited currently.

alexdelprete commented 1 year ago

@cpw was right, it was the openvpn changes, preparing a quick fix, but openvpn info won't be available untile Travis finds the time for a proper fix. Preparing the PR now.

alexdelprete commented 1 year ago

@travisghansen this is the update that caused the issue: https://github.com/opnsense/core/commit/bb1aa668026a1071a2af40a58a5c4ffddab9dcd0

They refactored with this: https://github.com/opnsense/core/commit/b9a1633a18e702ce0908c87504d196b53e0f3dcd

@cpw please let us know if v0.1.15 works for you, thanks.

cpw commented 1 year ago

The issue seems to have stopped with the recent update, thanks! 👍

alexdelprete commented 1 year ago

The issue seems to have stopped with the recent update, thanks! 👍

Great. Can you close the issue for now please? Once Travis finds the time, he will properly fix this in a new release, readding the OpenVPN active server info. Thanks.

firestormo commented 1 year ago

@cpw & @alexdelprete

How can I install v0.1.15? ive run the update command and in the mimugmail repo i see nothing updating and still receive the error.

alexdelprete commented 1 year ago

This is an Home Asisstant custom component. How did you install it in HA? :)

firestormo commented 1 year ago

I thought it was the component in opnsense that was the issue, if thats not the case and its in HACS, then ill update it there and my bad for not understanding

firestormo commented 1 year ago

that did it, sorry for the confusion.

JimmyMPage commented 1 year ago

Sorry for submitting a third issue...I didn't understand the solution either. Will look closer at other issues next time.

alexdelprete commented 1 year ago

I'll try to explain it: in order to communicate with OPNsense, this project needed a small plugin that you install on OPNsense. So this HA component communicates with OPNsense through that plugin and executes PHP code that calls functions on OPNsense to get data.

When OPNsense changes one of the functions, the HA component won't work, but not because of the plugin, that is more or less a sort of API proxy, but because they remove a function, or simply change it, rename it, etc.

In the 23.1.4 update, OPNsense devs removed the openvpn_get_active_servers() function, so the HA component called that function and it threw an error.

Hope it's more clear now. :)

dvbit commented 1 year ago

Having the same problem- not clear to me how to instal the mod. Shall I switch to dev beta to import fix before it is merged?

alexdelprete commented 1 year ago

not clear to me how to instal the mod. Shall I switch to dev beta to import fix before it is merged?

No, you install latest version of this integration (v0.1.15).