jkroepke/openvpn-auth-azure-ad

Can't use unix sockets to talk to openvpn management interface

ashak opened this issue · 2 comments

ashak commented

Hi,

I've been trying this out and I don't seem to be able to talk OpnVPN management interface with unix sockets. I just get the error:

Traceback (most recent call last): File "/usr/local/bin/openvpn-auth-azure-ad", line 8, in <module> sys.exit(main()) File "/usr/local/lib/python3.9/dist-packages/openvpn_auth_azure_ad/__init__.py", line 191, in main aad_authenticator = AADAuthenticator( File "/usr/local/lib/python3.9/dist-packages/openvpn_auth_azure_ad/authenticator.py", line 93, in __init__ self._openvpn.connect() File "/usr/local/lib/python3.9/dist-packages/openvpn_auth_azure_ad/openvpn/__init__.py", line 80, in connect self._mgmt_host, AttributeError: 'OpenVPNManagementInterface' object has no attribute '_mgmt_host'

I took a quick look at the code and it looks like the logging added to openvpn_auth_azure_ad/openvpn/init.py line 80 as part of this commit doesn't take into account that you might be using unix sockets. It tries to log self._mgmt_host regardless.

The fix seems simple enough. Probably just move the logging into the conditional that follows it. I don't know python things enough to know how to do that and then test it though :(

@ashak could you check, if the linked PR helps you?

ashak commented

Sorry, I don't think i'll be able to test this now

Since I couldn't get this to work (I used ip/port so that I could continue) I switched to doing the auth in a different way.
I have no spare system to test it on

I have no immediate plan to go back to it now that the other method is working
Nor do I have any idea how I would test the code in the PR on my systems