Feature Requests -- UDM Pro Support and backup file archival

Posted on
Sat Feb 15, 2020 10:46 pm
Ramias offline
Posts: 272
Joined: Nov 24, 2015

Re: Feature Requests -- UDM Pro Support and backup file arch

I did some tinkering on Karl's code to get this working for the Controller piece of my UDM Pro. But failing on the curl login to the controller (so... not getting very far at all).

This is what I'm entering:
Code: Select all
/usr/bin/curl --insecure -c /tmp/fooCookie  --data '{"username": "MyUser", "password": "MyPassword"}' 'https://192.168.0.1:443/proxy/network/api/login'


Getting back
{"meta":{"rc":"error","msg":"api.err.Invalid"},"data":[]}%

Any idea what I'm doing wrong?

Posted on
Sun Feb 16, 2020 10:09 am
kw123 offline
User avatar
Posts: 8335
Joined: May 12, 2013
Location: Dallas, TX

Re: Feature Requests -- UDM Pro Support and backup file arch

this one works for me.
Code: Select all
/usr/bin/curl --insecure -c /tmp/fooCookie  --data '{"username": "xx", "password": "xx"}' 'https://192.168.x.x:8443/api/login'


you have >> /proxy/network/<<
added..

and yours is 443 not 8443, but I guess that is by design.

Karl

Posted on
Sun Feb 16, 2020 11:30 am
Ramias offline
Posts: 272
Joined: Nov 24, 2015

Re: Feature Requests -- UDM Pro Support and backup file arch

Code: Select all
/usr/bin/curl --insecure -c /tmp/unifiCookie -H "Content-Type: application/json" --data '{"username": "xx", "strict": "True", "password": "xx"}' 'https://192.168.0.1:443/api/auth/login'


Ok this works and issues a cookie (though I'm not certain if this is the right login URL; was told this was for the websocket connection and that /proxy/network/api/login should work for the controller login; but I can't get that to work.

But this returns "Not Found":
Code: Select all
/usr/bin/curl --insecure -b /tmp/unifiCookie  --data '{"type": "all", "conn": "all"}'  -X PUT  'https://192.168.0.1:443/proxy/network/api/s/default/stat/alluser'

Posted on
Sun Feb 16, 2020 12:22 pm
kw123 offline
User avatar
Posts: 8335
Joined: May 12, 2013
Location: Dallas, TX

Re: Feature Requests -- UDM Pro Support and backup file arch

could you try to drop
proxy/network/
from the address

Karl

Posted on
Sun Feb 16, 2020 1:14 pm
Ramias offline
Posts: 272
Joined: Nov 24, 2015

Re: Feature Requests -- UDM Pro Support and backup file arch

/proxy/network is needed for the UDM Pro.

For example, if I go here: https://192.168.0.1:443/proxy/network/a ... at/alluser in a browser tab from a browser I'm already logged into the UDMP with, I get several pages of json.

If I drop the /proxy/network it just takes me back to the main UDMP page.

If I try this with curl: https://192.168.0.1:443/api/login it just gives this:

Code: Select all
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1"><link href="/2.css" rel="stylesheet"></head>
<body>
<div id="root"></div>
<script type="text/javascript" src="/vendor.270c6910.chunk.js"></script><script type="text/javascript" src="/main.0a9cc80e.js"></script></body>
</html>

Posted on
Sun Feb 16, 2020 1:45 pm
Ramias offline
Posts: 272
Joined: Nov 24, 2015

Re: Feature Requests -- UDM Pro Support and backup file arch

This is in php but looks like line 161 shows for the UDM Pro that /api/auth/login is the login path.

https://github.com/Art-of-WiFi/UniFi-AP ... Client.php

Line 169 shows them also sending the application-type header which I also had to do:
curl_setopt($ch, CURLOPT_HTTPHEADER, ['content-type: application/json; charset=utf-8']);

And then their line 3997 shows /proxy/network added to the base url for the various api calls.

Now, what is interesting for me:
/usr/bin/curl --insecure -b /tmp/unifiCookie -X GET 'https://192.168.0.1:443/proxy/network/api/s/default/stat/alluser'

returns a ton of JSON. If I drop the -b and cookie path, it fails with LoginRequired.

But this: (the code from your exiting plugin, modified for the new baseURL) fails with Not Found:
/usr/bin/curl --insecure -b /tmp/unifiCookie --data '{"type": "all", "conn": "all"}' -X PUT 'https://192.168.0.1:443/proxy/network/api/s/default/stat/alluser'

Posted on
Sun Feb 16, 2020 3:41 pm
kw123 offline
User avatar
Posts: 8335
Joined: May 12, 2013
Location: Dallas, TX

Re: Feature Requests -- UDM Pro Support and backup file arch

>>Now, what is interesting for me:
/usr/bin/curl --insecure -b /tmp/unifiCookie -X GET 'https://192.168.0.1:443/proxy/network/api/s/default/stat/alluser'

returns a ton of JSON. If I drop the -b and cookie path, it fails with LoginRequired.<<

could you send me the json output?
this might has some config info in there, so may be do not post it ==> karlwachs me com

Karl
ps
not having one makes it really difficult to test.
Normally i need 20-30 tries then it works. Over the forum that would take weeks, doing everything at home ~ 1 day.

And they are not returnable so just $400 for trying looks expensive. And it does not have enough ports for me

Posted on
Sun Feb 16, 2020 4:30 pm
Ramias offline
Posts: 272
Joined: Nov 24, 2015

Re: Feature Requests -- UDM Pro Support and backup file arch

The /alluser JSON output is just a bunch of elements for each of my devices. I suspect the same as a "regular" controller.

Is there a better API URL. you'd like me to call that may have more info? Or dump something via SSH?

There will of course be some debugging because the UDM itself (As a switch) has some new items (but those can be had via SSH).

For example, these lines make a repeat appearance:

Code: Select all
   
   uniFiAP Error                   getMessages: forcing restart of listener for: dictLoop.exp   @ SWdict  after 192.168.0.1 sec without message180
   uniFiAP Error                   in Line 7250 has error=u'network_table'
   uniFiAP Warning                 getMessages: ListenProcess started for uType: SWdict;  ip: 192.168.0.1  pid:40168
   uniFiAP Error                   in Line 8248 has error=u'overheating'


But for the controller piece, I think once I get the correct syntax and path for the Curl we may be much closer.

Posted on
Mon Feb 24, 2020 11:47 am
kw123 offline
User avatar
Posts: 8335
Joined: May 12, 2013
Location: Dallas, TX

Re: Feature Requests -- UDM Pro Support and backup file arch

@Ramias

https://www.dropbox.com/s/scaceyhzayi4hlb/uniFiAP.indigoPlugin.zip?dl=1

try this version.

in config select UDM as controller type
set GW on and pick ip number
select switch 12 w the same ip number as for the gateway

Karl

Posted on
Tue Feb 25, 2020 7:08 am
evansgo offline
Posts: 223
Joined: Nov 29, 2013

Re: Feature Requests -- UDM Pro Support and backup file arch

I just tried it and am getting error connection errors for the dashboard
This is the URL for the dashboard now, note the 8443 has gone.

https://192.168.10.1/network/site/default/dashboard

This is for the controller settings page
https://192.168.10.1/settings/general

Posted on
Tue Feb 25, 2020 4:35 pm
kw123 offline
User avatar
Posts: 8335
Joined: May 12, 2013
Location: Dallas, TX

Re: Feature Requests -- UDM Pro Support and backup file arch

this seems to work for UDM - pro (80% of functions)

https://www.dropbox.com/s/scaceyhzayi4hlb/uniFiAP.indigoPlugin.zip?dl=1

still some tuning and clean up left to do

Karl

Posted on
Wed Feb 26, 2020 7:13 am
evansgo offline
Posts: 223
Joined: Nov 29, 2013

Re: Feature Requests -- UDM Pro Support and backup file arch

Not sure what I'm doing wrong but this is what I see, using the build above, I'll keep trying..

    ogin (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10a6dbb90>: Failed to establish a new connection: [Errno 61] Connection refused',)) Connection
    uniFiAP Error in Line 3887 has error=HTTPSConnectionPool(host='192.168.10.1', port=8443): Max retries exceeded with url: /api/auth/login (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x109e39ad0>: Failed to establish a new connection: [Errno 61] Connection refused',)) Connection
    uniFiAP Error in Line 3887 has error=HTTPSConnectionPool(host='192.168.10.1', port=8443): Max retries exceeded with url: /api/auth/login (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10a6dbb10>: Failed to establish a new connection: [Errno 61] Connection refused',)) Connection
    uniFiAP Error in Line 3887 has error=HTTPSConnectionPool(host='192.168.10.1', port=8443): Max retries exceeded with url: /api/auth/login (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10a70c750>: Failed to establish a new connection: [Errno 61] Connection refused',)) Connection
    uniFiAP Error in Line 3887 has error=HTTPSConnectionPool(host='192.168.10.1', port=8443): Max retries exceeded with url: /api/auth/login (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10a6dbc50>: Failed to establish a new connection: [Errno 61] Connection refused',)) Connection
    uniFiAP start runConcurrentThread, initializing loop settings and threads ..
    uniFiAP Error in Line 3887 has error=HTTPSConnectionPool(host='192.168.10.1', port=8443): Max retries exceeded with url: /api/auth/login (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x109e39fd0>: Failed to establish a new connection: [Errno 61] Connection refused',)) Connection
    uniFiAP Error in Line 3887 has error=HTTPSConnectionPool(host='192.168.10.1', port=8443): Max retries exceeded with url: /api/auth/login (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10a6db4d0>: Failed to establish a new connection: [Errno 61] Connection refused',)) Connection
    uniFiAP initialized ... looping
    uniFiAP Error getMessages: (1) error connecting to ip#: 192.168.10.1 wrong ip/ password or system down or ssh timed out or ..?

    26 Feb 2020 at 17:10:28
    uniFiAP Error getMessages: (1) error connecting to ip#: 192.168.10.1 wrong ip/ password or system down or ssh timed out or ..?
    Z-Wave received "Qubino - Temperature" sensor update to -20.1 °C
    uniFiAP Error in Line 3887 has error=HTTPSConnectionPool(host='192.168.10.1', port=8443): Max retries exceeded with url: /api/auth/login (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10a6db690>: Failed to establish a new connection: [Errno 61] Connection refused',)) Connection
    uniFiAP Error getMessages: (1) error connecting to ip#: 192.168.10.1 wrong ip/ password or system down or ssh timed out or ..?

    26 Feb 2020 at 17:10:58
    uniFiAP Error getMessages: (1) error connecting to ip#: 192.168.10.1 wrong ip/ password or system down or ssh timed out or ..?

    26 Feb 2020 at 17:11:13
    uniFiAP Error getMessages: (1) error connecting to ip#: 192.168.10.1 wrong ip/ password or system down or ssh timed out or ..?
    uniFiAP Error in Line 3887 has error=HTTPSConnectionPool(host='192.168.10.1', port=8443): Max retries exceeded with url: /api/auth/login (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10a6db150>: Failed to establish a new connection: [Errno 61] Connection refused',)) Connection

    26 Feb 2020 at 17:11:28
    uniFiAP Error getMessages: (1) error connecting to ip#: 192.168.10.1 wrong ip/ password or system down or ssh timed out or ..?

    26 Feb 2020 at 17:11:44
    uniFiAP Error getMessages: (1) error connecting to ip#: 192.168.10.1 wrong ip/ password or system down or ssh timed out or ..?
    uniFiAP Error in Line 3887 has error=HTTPSConnectionPool(ho

Posted on
Wed Feb 26, 2020 8:08 am
kw123 offline
User avatar
Posts: 8335
Joined: May 12, 2013
Location: Dallas, TX

Re: Feature Requests -- UDM Pro Support and backup file arch

could you email me karlwachs me com

menu / print config

screen copy of your config, ie parameters you used for UDM setup

you can xxx your ids and passwords

Karl

Posted on
Thu Feb 27, 2020 5:40 am
evansgo offline
Posts: 223
Joined: Nov 29, 2013

Re: Feature Requests -- UDM Pro Support and backup file arch

OK some progress :)
So I decided to take a gamble and install the UDM Pro firmware as I had read that even through it said pro only it would work. Well it does, you have to fully reset to factory defaults the UDM, but I am now on controller version 5.12.59 and FW 1.6.4.2306.

What this did for me was to give me a SSH switch in the Controller area (it may have been there before but I didn't notice it if it was) which was off. I have turned it on and thanks to @Ramias used the user name of root and added the same password as I had for the other devices SSH and now its much improved.....

I'm getting this reported a lot
27 Feb 2020 at 15:37:05
uniFiAP Error in Line 3909 has error=local variable 'ret' referenced before assignment Connection
uniFiAP Error error:>> <Response [401]> Reconnect


Still happy for you to log in if we can align timezones, but it feels a lot closer now :)
and I'll send you another log file

Posted on
Thu Feb 27, 2020 7:05 am
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Feature Requests -- UDM Pro Support and backup file arch

evansgo wrote:
OK some progress :)
So I decided to take a gamble and install the UDM Pro firmware as I had read that even through it said pro only it would work. Well it does, you have to fully reset to factory defaults the UDM, but I am now on controller version 5.12.59 and FW 1.6.4.2306.


I’m amazed that worked.. but also quite impressed! How does the devices page look when you’re looking at the port settings for the switch, etc?


Sent from my iPhone using Tapatalk Pro

Computer says no.

Who is online

Users browsing this forum: No registered users and 1 guest