zmNinja works from external connection but not locally

Discussion topics related to mobile applications for ZoneMinder
Post Reply
skydiver
Posts: 82
Joined: Wed Jun 16, 2004 7:15 pm

zmNinja works from external connection but not locally

Post by skydiver » Thu Sep 13, 2018 6:30 pm

I have a unique problem. I have a 1.30.4 instance running on my home network. I can access ZM system through my firewall remotely with zmNinja using NAT port forwarding through my Sophos firewall.

The problem I have is that when I am connected on my local network (Phone on the same 192.168.5./24 network as ZM is located on) or from outside my house when connected to my home network via VPN (Phone VPN'd onto a different internal network segment 1923.168.9.0/24 from ZM ), zmNinja will authenticate but throw API Error.

If I disconnect from the internal network zmNinja works like a champ. I am running ZM on Ubuntu server with the package from the general ubuntu apt repository

User avatar
asker
Posts: 950
Joined: Sun Mar 01, 2015 12:12 pm

Re: zmNinja works from external connection but not locally

Post by asker » Thu Sep 13, 2018 8:40 pm

Can you post logs?
--
My collection of ZoneMinder learnings:
https://wiki.zoneminder.com/Various_ZM_thoughts

skydiver
Posts: 82
Joined: Wed Jun 16, 2004 7:15 pm

Re: zmNinja works from external connection but not locally

Post by skydiver » Thu Sep 13, 2018 10:03 pm

Which logs would you like to see? Apache and what else?

skydiver
Posts: 82
Joined: Wed Jun 16, 2004 7:15 pm

Re: zmNinja works from external connection but not locally

Post by skydiver » Fri Sep 14, 2018 12:48 am

Here is the Apache ERROR Log.
The events @ 19:30 are from inside the local network and fails in zmNinja
The events @ 19:35 are from outside the local network and WORKS in zmNinja

Code: Select all

[Thu Sep 13 18:19:35.172339 2018] [:error] [pid 1423] [client 192.168.5.100:63801] PHP Warning:  file_put_contents(/tmp/zmlogs/cake_error.log) [<a href='http://php.net/function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory in /usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php on line 142
[Thu Sep 13 18:19:35.172381 2018] [:error] [pid 1423] [client 192.168.5.100:63801] PHP Warning:  file_put_contents(/var/log/zmerror.log) [<a href='http://php.net/function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: Permission denied in /usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php on line 142
[Thu Sep 13 18:19:35.172536 2018] [:error] [pid 1423] [client 192.168.5.100:63801] PHP Warning:  file_put_contents(/tmp/zmlogs/cake_error.log) [<a href='http://php.net/function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory in /usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php on line 142
[Thu Sep 13 18:19:35.172558 2018] [:error] [pid 1423] [client 192.168.5.100:63801] PHP Warning:  file_put_contents(/var/log/zmerror.log) [<a href='http://php.net/function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: Permission denied in /usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php on line 142
[Thu Sep 13 18:19:35.212524 2018] [:error] [pid 1423] [client 192.168.5.100:63801] INF [Login successful for user "admin"]
[Thu Sep 13 19:30:34.108214 2018] [:error] [pid 12856] [client 192.168.5.100:63972] PHP Warning:  file_put_contents(/tmp/zmlogs/cake_error.log) [<a href='http://php.net/function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory in /usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php on line 142
[Thu Sep 13 19:30:34.108275 2018] [:error] [pid 12856] [client 192.168.5.100:63972] PHP Warning:  file_put_contents(/var/log/zmerror.log) [<a href='http://php.net/function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: Permission denied in /usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php on line 142
[Thu Sep 13 19:30:34.108479 2018] [:error] [pid 12856] [client 192.168.5.100:63972] PHP Warning:  file_put_contents(/tmp/zmlogs/cake_error.log) [<a href='http://php.net/function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory in /usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php on line 142
[Thu Sep 13 19:30:34.108506 2018] [:error] [pid 12856] [client 192.168.5.100:63972] PHP Warning:  file_put_contents(/var/log/zmerror.log) [<a href='http://php.net/function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: Permission denied in /usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php on line 142
[Thu Sep 13 19:30:34.276627 2018] [:error] [pid 12856] [client 192.168.5.100:63972] INF [Login successful for user "admin"]
[Thu Sep 13 19:30:36.808638 2018] [:error] [pid 12856] [client 192.168.5.100:63972] PHP Warning:  file_put_contents(/tmp/zmlogs/cake_error.log) [<a href='http://php.net/function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory in /usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php on line 142
[Thu Sep 13 19:30:36.808734 2018] [:error] [pid 12856] [client 192.168.5.100:63972] PHP Warning:  file_put_contents(/var/log/zmerror.log) [<a href='http://php.net/function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: Permission denied in /usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php on line 142
[Thu Sep 13 19:30:36.808909 2018] [:error] [pid 12856] [client 192.168.5.100:63972] PHP Warning:  file_put_contents(/tmp/zmlogs/cake_error.log) [<a href='http://php.net/function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory in /usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php on line 142
[Thu Sep 13 19:30:36.808940 2018] [:error] [pid 12856] [client 192.168.5.100:63972] PHP Warning:  file_put_contents(/var/log/zmerror.log) [<a href='http://php.net/function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: Permission denied in /usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php on line 142
[Thu Sep 13 19:30:36.926566 2018] [:error] [pid 12856] [client 192.168.5.100:63972] INF [Login successful for user "admin"]
[Thu Sep 13 19:35:21.198048 2018] [:error] [pid 12690] [client 192.168.5.1:42435] PHP Warning:  file_put_contents(/tmp/zmlogs/cake_error.log) [<a href='http://php.net/function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory in /usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php on line 142
[Thu Sep 13 19:35:21.198088 2018] [:error] [pid 12690] [client 192.168.5.1:42435] PHP Warning:  file_put_contents(/var/log/zmerror.log) [<a href='http://php.net/function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: Permission denied in /usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php on line 142
[Thu Sep 13 19:35:21.198253 2018] [:error] [pid 12690] [client 192.168.5.1:42435] PHP Warning:  file_put_contents(/tmp/zmlogs/cake_error.log) [<a href='http://php.net/function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory in /usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php on line 142
[Thu Sep 13 19:35:21.198274 2018] [:error] [pid 12690] [client 192.168.5.1:42435] PHP Warning:  file_put_contents(/var/log/zmerror.log) [<a href='http://php.net/function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: Permission denied in /usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php on line 142
[Thu Sep 13 19:35:21.754366 2018] [:error] [pid 12690] [client 192.168.5.1:42435] PHP Warning:  file_put_contents(/tmp/zmlogs/cake_error.log) [<a href='http://php.net/function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory in /usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php on line 142
[Thu Sep 13 19:35:21.754432 2018] [:error] [pid 12690] [client 192.168.5.1:42435] PHP Warning:  file_put_contents(/var/log/zmerror.log) [<a href='http://php.net/function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: Permission denied in /usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php on line 142
[Thu Sep 13 19:35:21.754588 2018] [:error] [pid 12690] [client 192.168.5.1:42435] PHP Warning:  file_put_contents(/tmp/zmlogs/cake_error.log) [<a href='http://php.net/function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory in /usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php on line 142
[Thu Sep 13 19:35:21.754610 2018] [:error] [pid 12690] [client 192.168.5.1:42435] PHP Warning:  file_put_contents(/var/log/zmerror.log) [<a href='http://php.net/function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: Permission denied in /usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php on line 142
[Thu Sep 13 19:35:22.047963 2018] [:error] [pid 12989] [client 192.168.5.1:42436] INF [Login successful for user "admin"]
[Thu Sep 13 19:35:22.950665 2018] [:error] [pid 1422] [client 192.168.5.1:42437] PHP Warning:  file_put_contents(/tmp/zmlogs/cake_error.log) [<a href='http://php.net/function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory in /usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php on line 142
[Thu Sep 13 19:35:22.950723 2018] [:error] [pid 1422] [client 192.168.5.1:42437] PHP Warning:  file_put_contents(/var/log/zmerror.log) [<a href='http://php.net/function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: Permission denied in /usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php on line 142
[Thu Sep 13 19:35:22.950941 2018] [:error] [pid 1422] [client 192.168.5.1:42437] PHP Warning:  file_put_contents(/tmp/zmlogs/cake_error.log) [<a href='http://php.net/function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory in /usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php on line 142
[Thu Sep 13 19:35:22.950973 2018] [:error] [pid 1422] [client 192.168.5.1:42437] PHP Warning:  file_put_contents(/var/log/zmerror.log) [<a href='http://php.net/function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: Permission denied in /usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php on line 142

skydiver
Posts: 82
Joined: Wed Jun 16, 2004 7:15 pm

Re: zmNinja works from external connection but not locally

Post by skydiver » Fri Sep 14, 2018 1:01 am

I created the tmp/zmlogs directory and performed both connect types again. Here is the cake error log:

Code: Select all

2018-09-13 19:56:07 Error: [UnauthorizedException] User not found
Request URL: /zm/api/host/login.json
Stack Trace:
#0 /usr/share/zoneminder/www/api/lib/Cake/Event/CakeEventManager.php(243): AppController->beforeFilter(Object(CakeEvent))
#1 /usr/share/zoneminder/www/api/lib/Cake/Controller/Controller.php(677): CakeEventManager->dispatch(Object(CakeEvent))
#2 /usr/share/zoneminder/www/api/lib/Cake/Routing/Dispatcher.php(189): Controller->startupProcess()
#3 /usr/share/zoneminder/www/api/lib/Cake/Routing/Dispatcher.php(167): Dispatcher->_invoke(Object(HostController), Object(CakeRequest))
#4 /usr/share/zoneminder/www/api/app/webroot/index.php(107): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#5 {main}
2018-09-13 19:56:07 Warning: Warning (2): file_put_contents(/var/log/zmerror.log): failed to open stream: Permission denied in [/usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php, line 142]
Trace:
file_put_contents - [internal], line ??
FileLog::write() - CORE/Cake/Log/Engine/FileLog.php, line 142
CakeLog::write() - CORE/Cake/Log/CakeLog.php, line 442
ErrorHandler::_log() - CORE/Cake/Error/ErrorHandler.php, line 188
ErrorHandler::handleException() - CORE/Cake/Error/ErrorHandler.php, line 118
[main] - [internal], line ??

2018-09-13 19:56:09 Error: [NotFoundException] Invalid config
Request URL: /zm/api/configs/viewByName/ZM_MIN_STREAMING_PORT.json
Stack Trace:
#0 [internal function]: ConfigsController->viewByName('ZM_MIN_STREAMIN...')
#1 /usr/share/zoneminder/www/api/lib/Cake/Controller/Controller.php(491): ReflectionMethod->invokeArgs(Object(ConfigsController), Array)
#2 /usr/share/zoneminder/www/api/app/Plugin/Crud/Lib/CrudControllerTrait.php(31): Controller->invokeAction(Object(CakeRequest))
#3 /usr/share/zoneminder/www/api/lib/Cake/Routing/Dispatcher.php(193): AppController->invokeAction(Object(CakeRequest))
#4 /usr/share/zoneminder/www/api/lib/Cake/Routing/Dispatcher.php(167): Dispatcher->_invoke(Object(ConfigsController), Object(CakeRequest))
#5 /usr/share/zoneminder/www/api/app/webroot/index.php(107): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#6 {main}
2018-09-13 19:56:09 Warning: Warning (2): file_put_contents(/var/log/zmerror.log): failed to open stream: Permission denied in [/usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php, line 142]
Trace:
file_put_contents - [internal], line ??
FileLog::write() - CORE/Cake/Log/Engine/FileLog.php, line 142
CakeLog::write() - CORE/Cake/Log/CakeLog.php, line 442
ErrorHandler::_log() - CORE/Cake/Error/ErrorHandler.php, line 188
ErrorHandler::handleException() - CORE/Cake/Error/ErrorHandler.php, line 118
[main] - [internal], line ??

2018-09-13 19:56:39 Error: [UnauthorizedException] User not found
Request URL: /zm/api/host/login.json
Stack Trace:
#0 /usr/share/zoneminder/www/api/lib/Cake/Event/CakeEventManager.php(243): AppController->beforeFilter(Object(CakeEvent))
#1 /usr/share/zoneminder/www/api/lib/Cake/Controller/Controller.php(677): CakeEventManager->dispatch(Object(CakeEvent))
#2 /usr/share/zoneminder/www/api/lib/Cake/Routing/Dispatcher.php(189): Controller->startupProcess()
#3 /usr/share/zoneminder/www/api/lib/Cake/Routing/Dispatcher.php(167): Dispatcher->_invoke(Object(HostController), Object(CakeRequest))
#4 /usr/share/zoneminder/www/api/app/webroot/index.php(107): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#5 {main}
2018-09-13 19:56:39 Warning: Warning (2): file_put_contents(/var/log/zmerror.log): failed to open stream: Permission denied in [/usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php, line 142]
Trace:
file_put_contents - [internal], line ??
FileLog::write() - CORE/Cake/Log/Engine/FileLog.php, line 142
CakeLog::write() - CORE/Cake/Log/CakeLog.php, line 442
ErrorHandler::_log() - CORE/Cake/Error/ErrorHandler.php, line 188
ErrorHandler::handleException() - CORE/Cake/Error/ErrorHandler.php, line 118
[main] - [internal], line ??

2018-09-13 19:56:41 Error: [UnauthorizedException] User not found
Request URL: /zm/api/host/login.json
Stack Trace:
#0 /usr/share/zoneminder/www/api/lib/Cake/Event/CakeEventManager.php(243): AppController->beforeFilter(Object(CakeEvent))
#1 /usr/share/zoneminder/www/api/lib/Cake/Controller/Controller.php(677): CakeEventManager->dispatch(Object(CakeEvent))
#2 /usr/share/zoneminder/www/api/lib/Cake/Routing/Dispatcher.php(189): Controller->startupProcess()
#3 /usr/share/zoneminder/www/api/lib/Cake/Routing/Dispatcher.php(167): Dispatcher->_invoke(Object(HostController), Object(CakeRequest))
#4 /usr/share/zoneminder/www/api/app/webroot/index.php(107): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#5 {main}
2018-09-13 19:56:41 Warning: Warning (2): file_put_contents(/var/log/zmerror.log): failed to open stream: Permission denied in [/usr/share/zoneminder/www/api/lib/Cake/Log/Engine/FileLog.php, line 142]
Trace:
file_put_contents - [internal], line ??
FileLog::write() - CORE/Cake/Log/Engine/FileLog.php, line 142
CakeLog::write() - CORE/Cake/Log/CakeLog.php, line 442
ErrorHandler::_log() - CORE/Cake/Error/ErrorHandler.php, line 188
ErrorHandler::handleException() - CORE/Cake/Error/ErrorHandler.php, line 118
[main] - [internal], line ??
In zmNinja I have the following settings:
Use zm authentication is checked
using a user name (admin) and password

skydiver
Posts: 82
Joined: Wed Jun 16, 2004 7:15 pm

Re: zmNinja works from external connection but not locally

Post by skydiver » Fri Sep 14, 2018 2:36 am

Looking at my system a bit more I am running apt install from Isaac Conners repository

User avatar
asker
Posts: 950
Joined: Sun Mar 01, 2015 12:12 pm

Re: zmNinja works from external connection but not locally

Post by asker » Fri Sep 14, 2018 2:45 pm

It seems to me your ZM install is broken, but I'm surprised how its working in WAN.
Not sure about your timezone, but if you join the ZM slack channel, we can debug it better. You can join via https://zoneminder-chat.herokuapp.com/
--
My collection of ZoneMinder learnings:
https://wiki.zoneminder.com/Various_ZM_thoughts

skydiver
Posts: 82
Joined: Wed Jun 16, 2004 7:15 pm

Re: zmNinja works from external connection but not locally

Post by skydiver » Mon Sep 17, 2018 4:05 am

Asker, I will reach out to you tomorrow sometime. I am UTC -6:00. When is the best tine to reach you?

User avatar
asker
Posts: 950
Joined: Sun Mar 01, 2015 12:12 pm

Re: zmNinja works from external connection but not locally

Post by asker » Mon Sep 17, 2018 11:44 am

UTC-4 I think (East coast, US)
--
My collection of ZoneMinder learnings:
https://wiki.zoneminder.com/Various_ZM_thoughts

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest