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

Connection through WireGuard fails to communicate with API #955

Closed
HighPriest opened this issue Jun 19, 2020 · 5 comments
Closed

Connection through WireGuard fails to communicate with API #955

HighPriest opened this issue Jun 19, 2020 · 5 comments

Comments

@HighPriest
Copy link

HighPriest commented Jun 19, 2020

Server

Ubuntu Bionic 18.04.04
Zoneminder 1.34.16

Client

Desktop Windows 10.0.18363
WireGuard 0.1.1
zmNinja 1.4.007

The bug
zmNinja client won't authenticate over WireGuard connection while Web Console works fine.

Debug logs

Jun 19, 2020 08:09:56 PM INFO Login data not changed, not saving
Jun 19, 2020 08:09:52 PM INFO API login error {"data":"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p>The requested URL was not found on this server.</p>\n<hr>\n<address>Apache/2.4.29 (Ubuntu) Server at 192.168.66.240 Port 80</address>\n</body></html>\n","status":404,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"url":"http://192.168.66.240/api/host/getVersion.json?","headers":{"Accept":"application/json, text/plain, */*","X-ZmNinja":"zmNinja_%APPVER%"},"withCredentials":true},"statusText":"Not Found"}
Jun 19, 2020 08:09:52 PM INFO Validating APIs at http://192.168.66.240/api/host/getVersion.json?
Jun 19, 2020 08:09:52 PM DEBUG zmAutoLogin: Inside auth-error broadcast
Jun 19, 2020 08:09:52 PM INFO zmAutologin Error {"data":"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p>The requested URL was not found on this server.</p>\n<hr>\n<address>Apache/2.4.29 (Ubuntu) Server at 192.168.66.240 Port 80</address>\n</body></html>\n","status":404,"config":{"method":"POST","transformResponse":[null],"timeout":10000,"url":"http://192.168.66.240/index.php?view=console","skipIntercept":true,"headers":{"Content-Type":"application/x-www-form-urlencoded","Accept":"application/json","X-ZmNinja":"zmNinja_%APPVER%"},"data":{"username":"admin",<password removed>,"action":"login","view":"console"},"withCredentials":true},"statusText":"Not Found"} and status undefined
Jun 19, 2020 08:09:52 PM INFO Not intercepting as skipIntercept true
Jun 19, 2020 08:09:52 PM DEBUG Logging in using old web-scrape method
Jun 19, 2020 08:09:52 PM DEBUG obfuscate: original:5334 obfuscated:1361 scheme:lzs
Jun 19, 2020 08:09:52 PM INFO API based login not supported, need to use web scraping...
Jun 19, 2020 08:09:52 PM INFO Not intercepting as skipIntercept true
Jun 19, 2020 08:09:52 PM INFO ZM has recaptcha disabled - good
Jun 19, 2020 08:09:52 PM INFO Doing fresh login to ZM
Jun 19, 2020 08:09:52 PM INFO Token login not being used
Jun 19, 2020 08:09:52 PM DEBUG Resetting zmCookie...
Jun 19, 2020 08:09:52 PM INFO Checking if reCaptcha is enabled in ZM...
Jun 19, 2020 08:09:52 PM DEBUG Inside _doLogin()
Jun 19, 2020 08:09:52 PM DEBUG Saved isFirstUse ok
Jun 19, 2020 08:09:52 PM DEBUG Logging out using Web method
Jun 19, 2020 08:09:52 PM INFO http://192.168.66.240=>Logging out of any existing ZM sessions...
Jun 19, 2020 08:09:52 PM INFO No need to do a reachability test, as there are no fallbacks
Jun 19, 2020 08:09:52 PM INFO reached end of chain loop
Jun 19, 2020 08:09:52 PM INFO Fallback of 192.168.66.240 is 
Jun 19, 2020 08:09:52 PM INFO Adding to chain stack: 192.168.66.240>http://192.168.66.240
Jun 19, 2020 08:09:52 PM DEBUG _doLogoutAndLogin: Clearing cookies
Jun 19, 2020 08:09:52 PM DEBUG obfuscate: original:5334 obfuscated:1361 scheme:lzs
Jun 19, 2020 08:09:52 PM DEBUG Setting multi-port to:false
Jun 19, 2020 08:09:52 PM DEBUG Setting server version to:
Jun 19, 2020 08:09:52 PM DEBUG obfuscate: original:5334 obfuscated:1361 scheme:lzs
Jun 19, 2020 08:09:52 PM DEBUG Setting isFirstUse to:false
Jun 19, 2020 08:09:52 PM DEBUG Inside save Items
Jun 19, 2020 08:09:52 PM DEBUG CACHE: Flushing all network API caches...
Jun 19, 2020 08:09:52 PM DEBUG obfuscate: original:5334 obfuscated:1361 scheme:lzs
Jun 19, 2020 08:09:52 PM DEBUG Clearing all unsupported flags
Jun 19, 2020 08:09:52 PM DEBUG Clearing Multiport...
Jun 19, 2020 08:09:52 PM DEBUG User tapped save, calling SaveItems
Jun 19, 2020 08:09:48 PM DEBUG Does login need to hear the wizard? false
Jun 19, 2020 08:09:48 PM DEBUG skipping image refresh, packery is still loading
Jun 19, 2020 08:09:48 PM DEBUG Setting up cycle interval of:10000
Jun 19, 2020 08:09:48 PM DEBUG bandwidth: highbw montage refresh set to: 2
Jun 19, 2020 08:09:48 PM DEBUG Multiport=0
Jun 19, 2020 08:09:48 PM INFO sending stored ZM_MIN_STREAMING_PORT 0
Jun 19, 2020 08:09:48 PM DEBUG Montage beforeEnter: copying monitors to montage monitors
Jun 19, 2020 08:09:48 PM DEBUG Montage beforeEnter: got 0 monitors
Jun 19, 2020 08:09:48 PM DEBUG Setting streamQuery timer to 10000
Jun 19, 2020 08:09:48 PM ERROR Monitor load failed {"data":"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p>The requested URL was not found on this server.</p>\n<hr>\n<address>Apache/2.4.29 (Ubuntu) Server at 192.168.66.240 Port 80</address>\n</body></html>\n","status":404,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"url":"http://192.168.66.240/api/monitors/index/Type !=:WebSite.json?","headers":{"Accept":"application/json, text/plain, */*","X-ZmNinja":"zmNinja_%APPVER%"},"withCredentials":true},"statusText":"Not Found"}
Jun 19, 2020 08:09:48 PM INFO CACHE: error with http get {"data":"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p>The requested URL was not found on this server.</p>\n<hr>\n<address>Apache/2.4.29 (Ubuntu) Server at 192.168.66.240 Port 80</address>\n</body></html>\n","status":404,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"url":"http://192.168.66.240/api/monitors/index/Type !=:WebSite.json?","headers":{"Accept":"application/json, text/plain, */*","X-ZmNinja":"zmNinja_%APPVER%"},"withCredentials":true},"statusText":"Not Found"}
Jun 19, 2020 08:09:48 PM DEBUG CACHE: NOT found for:cached_monitors reverting to HTTP
Jun 19, 2020 08:09:48 PM DEBUG Monitor URL to fetch is:http://192.168.66.240/api/monitors/index/Type !=:WebSite.json?
Jun 19, 2020 08:09:48 PM DEBUG ZMS Multiport reported: 0
Jun 19, 2020 08:09:48 PM DEBUG Setting multi-port to:false
Jun 19, 2020 08:09:48 PM INFO ZM_MIN_STREAMING_PORT not supported
Jun 19, 2020 08:09:48 PM INFO CACHE: error with http get {"data":"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p>The requested URL was not found on this server.</p>\n<hr>\n<address>Apache/2.4.29 (Ubuntu) Server at 192.168.66.240 Port 80</address>\n</body></html>\n","status":404,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"url":"http://192.168.66.240/api/configs/viewByName/ZM_MIN_STREAMING_PORT.json?","headers":{"Accept":"application/json, text/plain, */*","X-ZmNinja":"zmNinja_%APPVER%"},"withCredentials":true},"statusText":"Not Found"}
Jun 19, 2020 08:09:48 PM DEBUG CACHE: NOT found for:cached_multi_port reverting to HTTP
Jun 19, 2020 08:09:48 PM INFO Checking value of ZM_MIN_STREAMING_PORT for the first time
Jun 19, 2020 08:09:48 PM INFO getMonitors:Loading all monitors
Jun 19, 2020 08:09:48 PM DEBUG NVR: Regenerating connkeys for all monitors at 1592590188594
Jun 19, 2020 08:09:48 PM INFO API not valid, not going to this state

Screenshots
image

@welcome
Copy link

welcome bot commented Jun 19, 2020

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you follow the issue template or I may not respond.

@HighPriest HighPriest changed the title Connection through WireGuard fails to connect with API Connection through WireGuard fails to communicate with API Jun 19, 2020
@pliablepixels
Copy link
Member

Are you sure this is WireGuard related?

The log says:

Jun 19, 2020 08:09:48 PM ERROR Monitor load failed {"data":"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p>The requested URL was not found on this server.</p>\n<hr>\n<address>Apache/2.4.29 (Ubuntu) Server at 192.168.66.240 Port 80</address>\n</body></html>\n","status":404,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"url":"http://192.168.66.240/api/monitors/index/Type !=:WebSite.json?","headers":{"Accept":"application/json, text/plain, */*","X-ZmNinja":"zmNinja_%APPVER%"},"withCredentials":true},"statusText":"Not Found"}
Jun 19, 2020 08:09:48 PM INFO CACHE: error with http get {"data":"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p>The requested URL was not found on this server.</p>\n<hr>\n<address>Apache/2.4.29 (Ubuntu) Server at 192.168.66.240 Port 80</address>\n</body></html>\n","status":404,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"url":"http://192.168.66.240/api/monitors/index/Type !=:WebSite.json?","headers":{"Accept":"application/json, text/plain, */*","X-ZmNinja":"zmNinja_%APPVER%"},"withCredentials":true},"statusText":"Not Found"}
Jun 

a 404 means it was reachable but the specific resource was not found. The URL in question is http://192.168.66.240/api/ - are you sure that is correct? It usually is http://192.168.66.240/zm/api/

@HighPriest
Copy link
Author

Are you sure this is WireGuard related?

The log says:

Jun 19, 2020 08:09:48 PM ERROR Monitor load failed {"data":"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p>The requested URL was not found on this server.</p>\n<hr>\n<address>Apache/2.4.29 (Ubuntu) Server at 192.168.66.240 Port 80</address>\n</body></html>\n","status":404,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"url":"http://192.168.66.240/api/monitors/index/Type !=:WebSite.json?","headers":{"Accept":"application/json, text/plain, */*","X-ZmNinja":"zmNinja_%APPVER%"},"withCredentials":true},"statusText":"Not Found"}
Jun 19, 2020 08:09:48 PM INFO CACHE: error with http get {"data":"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p>The requested URL was not found on this server.</p>\n<hr>\n<address>Apache/2.4.29 (Ubuntu) Server at 192.168.66.240 Port 80</address>\n</body></html>\n","status":404,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"url":"http://192.168.66.240/api/monitors/index/Type !=:WebSite.json?","headers":{"Accept":"application/json, text/plain, */*","X-ZmNinja":"zmNinja_%APPVER%"},"withCredentials":true},"statusText":"Not Found"}
Jun 

a 404 means it was reachable but the specific resource was not found. The URL in question is http://192.168.66.240/api/ - are you sure that is correct? It usually is http://192.168.66.240/zm/api/

Well damn, that's what happens when you work without a proper meal.
Thank you so much.

@HighPriest
Copy link
Author

HighPriest commented Jun 19, 2020

Unfortunately, now Events List is empty despite the api responding with data when accessed through browser.

Jun 19, 2020 11:15:33 PM DEBUG EventCtrl: Deregistering resize listener
Jun 19, 2020 11:15:33 PM DEBUG Cancelling page reload timer
Jun 19, 2020 11:15:30 PM DEBUG No more - We have a total of 1 and are at page=1
Jun 19, 2020 11:15:30 PM DEBUG EventCtrl:loading one more page just in case we don't have enough to display
Jun 19, 2020 11:15:30 PM DEBUG EventCtrl: success, got 0 events
Jun 19, 2020 11:15:30 PM DEBUG We have a total of 1 and are at page=1
Jun 19, 2020 11:15:29 PM DEBUG Setting up carousel watchers
Jun 19, 2020 11:15:29 PM DEBUG getEvents:http://192.168.66.240/zm/api/events/index/AlarmFrames >=:1.json?&sort=StartTime&direction=desc&page=1&token=<removed>
Jun 19, 2020 11:15:29 PM DEBUG EventCtrl: grabbing events for: id=0 Date/Time:-
Jun 19, 2020 11:15:29 PM DEBUG EventCtrl: grabbing # of event pages
Jun 19, 2020 11:15:29 PM DEBUG getInitialEvents called
Jun 19, 2020 11:15:29 PM DEBUG Starting page refresh timer
Jun 19, 2020 11:15:29 PM DEBUG EventSever: Not sending WSS message as event server is off
Jun 19, 2020 11:15:29 PM DEBUG EventSever: sendMessage: received->{"event":"push","data":{"type":"badge","badge":0}}
Jun 19, 2020 11:15:29 PM INFO Image padding digits reported as 5
Jun 19, 2020 11:15:29 PM DEBUG >>>height of list/scrub set to 330 and 370
Jun 19, 2020 11:15:29 PM INFO EventCtrl called with: E/MID=0 playEvent =  false
Jun 19, 2020 11:15:29 PM DEBUG getMonitorsNow: returning 46 monitors
Jun 19, 2020 11:15:29 PM INFO Returning pre-loaded list of 46 monitors

@HighPriest
Copy link
Author

Empty event list was fixed by selecting "..." three dot menu in event list and pressing "show all events".
Thank you for great software, have a pleasant and productive day.

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

2 participants