Page 1 of 2

Disabled Cloud, changed password, gets weird

PostPosted: Thu Apr 08, 2021 7:16 am
by Different Computers
First off, if there's a way to change the web login password without having cloud enabled, I can't find it.

So I changed my ui.com login credentials, which would change my UDM web login credentials too.... IF I hadn't disabled cloud before I changed the password. I need the new password for ui.com, and the old one for the UDM.

Everything still sort of seems to be working, but this morning when I look at it for the first time, I see lots of this happening as shown in the image.

Screen Shot 2021-04-08 at 9.09.39 AM.png
Screen Shot 2021-04-08 at 9.09.39 AM.png (54.02 KiB) Viewed 3985 times


How does that even make sense? All three of those are the same device.

Disabled Cloud, changed password, gets weird

PostPosted: Thu Apr 08, 2021 2:30 pm
by kw123
q:
are these all dev type unifi (client) or unifi devices (ap, switch, gw) in the plugin?

if unifi client: edit and check what is used to do up/down/expired, set to optimized.

if unifi device eg ap/ switch I have to think about it .

Karl

Re: Disabled Cloud, changed password, gets weird

PostPosted: Fri Apr 09, 2021 10:29 am
by Different Computers
I'm not entirely sure I understand what you're asking.

All of these devices are in the "UNIFI_system" group, which I believe is a default group created by the plug-in. The Dream Machine AP Model is Device-AP, for example.

Disabled Cloud, changed password, gets weird

PostPosted: Fri Apr 09, 2021 1:46 pm
by kw123
What are the device types
check the column in the main display.

[edit] I believe it is called Model in the display
Sent from my iPhone using Tapatalk

Re: Disabled Cloud, changed password, gets weird

PostPosted: Sun Apr 11, 2021 8:48 am
by Different Computers
These are all the same device.

Re: Disabled Cloud, changed password, gets weird

PostPosted: Sun Apr 11, 2021 8:53 am
by kw123
Is this a UDM pro?
That does not have the wifi ap part.

I did not define a UDM or UDM pro device in the plugin. Used existing devices( gateway switch ap) to show the dev states.

Since I don’t have a UDM it’s difficult to really tune the dicta and dev states to those devices.

But I will think about it.


Sent from my iPhone using Tapatalk

Re: Disabled Cloud, changed password, gets weird

PostPosted: Sun Apr 11, 2021 9:37 am
by Different Computers
It is a UDM, not the pro.

Re: Disabled Cloud, changed password, gets weird

PostPosted: Sun Apr 11, 2021 9:55 am
by kw123
So it has the wifi ap part?


Sent from my iPhone using Tapatalk

Re: Disabled Cloud, changed password, gets weird

PostPosted: Sun Apr 11, 2021 2:18 pm
by DaveL17
You may find some tips in the comment section of this video:

https://youtu.be/EhC_JgXjoBg

Re: Disabled Cloud, changed password, gets weird

PostPosted: Sun Apr 11, 2021 4:16 pm
by kw123
@Different Computers could you run this is a terminal?

-select
- copy
- open file editor
-paste
-change userid password ip number
-save as test.py in users/youruserid/desktop
-open terminal
-cd desktop
-python test.py

then email me (karlwachs at me com ) the output ... MANY lines. I don't think there are any userid .. in the output.

I need to see the structure of the dicts

it will print site name, basic device info, complete device info


Code: Select all
#! /usr/bin/env python
# -*- coding: utf-8 -*-
####################


import json
import requests
import time

requests.packages.urllib3.disable_warnings(requests.packages.urllib3.exceptions.InsecureRequestWarning)

print(u" testing unif controller")

userID    = "userid of udm web"
passwd    = "password of udm web"
ipN    = "192.168.1.x"  #the ip number of the UDM   
port    = "443"
unifi_os = True
   
headers = {"Accept": "application/json", "Content-Type": "application/json"}
login_headers = {"Accept": "application/json", "Content-Type": "application/json", "referer": "/login"}
base_url = "https://{}:{}/".format(ipN, port)
loginDict = { "username": userID, "password": passwd} #, 'strict': True}
ssl_verify = False

with requests.Session() as session:


   try:
      url = "https://"+ipN+":"+port+"/api/login"
      url = "https://"+ipN+":"+port+"/login?redirect=/api/login"
      url = "https://"+ipN+":"+port+"/api/auth/login"
      print(u"url login send:{}".format(url))
      response = session.post(url, headers=login_headers, json=loginDict, verify=ssl_verify, timeout=10.0)
      print(u"UniFi Controller Login Response: {}".format(response.text[0:100]))
   except Exception as err:
      print(u"UniFi Controller Login Connection Error: {}".format(err))

   if 'X-CSRF-Token' in response.headers:
      headers['X-CSRF-Token'] = response.headers['X-CSRF-Token']
   
   cookies_dict = requests.utils.dict_from_cookiejar(session.cookies)
   print response.headers

   if unifi_os:
      cookies = {"TOKEN": cookies_dict.get('TOKEN')}
   else:
      cookies = {"unifises": cookies_dict.get('unifises'), "csrf_token": cookies_dict.get('csrf_token')}

   # print site names
   url = "https://"+ipN+":"+port+"/proxy/network/api/self/sites"                   # works w get
   print url
   response = session.get(url,  headers=headers, cookies=cookies, allow_redirects=False, verify=ssl_verify, stream=False )     
   if response.status_code != requests.codes.ok:
      print(u"UniFi Controller Status Error: {}".format(response.status_code))
   else:   
      print(u"UniFi Controller  Response: >>{}<< ".format(json.dumps(json.loads(response.text),  sort_keys=True, indent=2),))


   # print site devices basic info
   url = "https://"+ipN+":"+port+"/proxy/network/api/s/default/stat/device-basic"                   # works w get
   print url
   response = session.get(url,  headers=headers, cookies=cookies, allow_redirects=False, verify=ssl_verify, stream=False )     
   if response.status_code != requests.codes.ok:
      print(u"UniFi Controller Status Error: {}".format(response.status_code))
   else:   
      print(u"UniFi Controller  Response: >>{}<< ".format(json.dumps(json.loads(response.text),  sort_keys=True, indent=2),))


   # print site devices  complete
   url = "https://"+ipN+":"+port+"/proxy/network/api/s/default/stat/device"                   # works w get
   print url
   response = session.get(url,  headers=headers, cookies=cookies, allow_redirects=False, verify=ssl_verify, stream=False )     
   if response.status_code != requests.codes.ok:
      print(u"UniFi Controller Status Error: {}".format(response.status_code))
   else:   
      print(u"UniFi Controller  Response: >>{}<< ".format(json.dumps(json.loads(response.text),  sort_keys=True, indent=2),))



Re: Disabled Cloud, changed password, gets weird

PostPosted: Sun Apr 11, 2021 4:33 pm
by kw123
Re the unifi breach and 2fa.

It seems that the unifi single sign on (SSO) password is also the local unifi web password.
And switching on 2FA for the public web account access will also then switch on 2FA for the local web access. That is used in plugin to get certain info.

The other part of the plugin uses unix ssh access to the switches and AP and GW. That is not impacted by SSO / 2FA
You can leave the web userid/password empty and only rely on the direct device info. 80% of the plugin will still be working. (devices up/down expired...)

Karl

Re: Disabled Cloud, changed password, gets weird

PostPosted: Tue Apr 13, 2021 11:24 am
by Different Computers
I'll give this a try tonight.

I'm also seeing this. I have no UNIFI cameras at all.
Code: Select all
uniFiAP Error                   error in  Line# 5709 ;  error='key name Unifi_Camera_with_Event not found in database'

Disabled Cloud, changed password, gets weird

PostPosted: Tue Apr 13, 2021 11:34 am
by kw123
I guess you have switch cameras off?


Sent from my iPhone using Tapatalk

Re: Disabled Cloud, changed password, gets weird

PostPosted: Wed Apr 14, 2021 10:30 am
by Different Computers
Just double checked, and yes, they are off and always have been. Pretty sure that is the default, right?

Re: Disabled Cloud, changed password, gets weird

PostPosted: Wed Apr 14, 2021 10:49 am
by kw123
which version?...

it can only get tho that place when
if camera =="protect":
....