Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check raises login error on "UniFi OS 3.2.7" #19

Open
jrttr opened this issue Dec 15, 2023 · 4 comments
Open

Check raises login error on "UniFi OS 3.2.7" #19

jrttr opened this issue Dec 15, 2023 · 4 comments

Comments

@jrttr
Copy link

jrttr commented Dec 15, 2023

/share/check_mk/agents/special/agent_unifi_controller

 def check_unifi_os(self):
        _response = self.request("GET",url=self.url,allow_redirects=False)
        self.is_unifios= _response.status_code == 200 and _response.headers.get("x-csrf-token")

Header x-csrf-token is no longer available, so it is not possible to correctly determine whether unifiOS is being used. The wrong login URL is therefore used in def login()

File "/omd/sites/XXX/local/share/check_mk/agents/special/agent_unifi_controller", line 641, in <module>
_api = unifi_controller_api(**args.__dict__)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/omd/sites/XXX/local/share/check_mk/agents/special/agent_unifi_controller", line 551, in __init__
self.login(username,password)
File "/omd/sites/XXX/local/share/check_mk/agents/special/agent_unifi_controller", line 585, in login
raise unifi_api_exception("Login failed")
@FirstS0ul
Copy link

same here! please update ;-)

@c3rberus
Copy link

Same issue here, can we please get an updated check?

@n00rm
Copy link

n00rm commented Jan 19, 2024

Have the same issue. UniFi OS 3.2.7 on Cloudkey+ with Unifi Network Version 8.0.26.

image

@thorstenspille Will this project still be supported?

@itswfpu
Copy link

itswfpu commented Jan 19, 2024

The issue can be resolved by modifying the check_unifi_os method as follows:

def check_unifi_os(self):
    _response = self.request("GET", url=self.url, allow_redirects=False)
    self.is_unifios = _response.status_code == 200

As you've observed, the x-csrf-token is no longer present in the response payload, resulting in self.is_unifios consistently being set to false. This creates a problem in the login method, as it relies on is_unifios being true to select the correct API endpoint. Consequently, the login process consistently fails. By implementing the revised method in ~/local/share/check_mk/agents/special/agent_unifi_controller, the plugin should function properly once again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants