Hi all,
I've been using ZM for some time now and have it working great, the only issue I have is I run a separate virtual host webpage hosted by the same computer as ZM and use this to display selected monitors from ZM, monitors I want to view from public computers or let friends see. so the main thing from this page be security of the ZM side.
so far I have the public page display the images by using a feed directly into ZM so exposing ZM to the unfiltered webpage, I use the following code in my page to display images
http://192.168.0.2/cgi-bin/nph-zms?mode ... s=password
this lets the public see the username and password for a limited ZM account I have and also for those who are educated with these things that I run a ZM system behind it and possibly allow them to use some as yet unknow exploit to gain access.
Searching this forum I came across a possible solution to extract the image using zmu with the following command
zmu -m 1 -U admin -P password -i
This allowed me to produce an image file in the directory I ran the command from and then use this as the source for my public webpage.
http://www.zoneminder.com/forums/viewto ... ract+image
with this early success I wanted to automate the process with a little bit of php on my webpage
<php>
exec('(cd /var/www/html ; /usr/local/bin/zmu -m 1 -U admin -P password -i -v)');
?>
with this I should be able to run the image extraction automatically when ever I visit the page and get the latest image from the camera, the only problem is this dosent work and im my ZM log files says it does not have permission to access the image file its trying the write, Im guessing this is a user access problem but after hours of surfing I cant find a solution.
Error:
Feb 18 16:36:05 zoneminder_system zmu[1392]: ERR [Can't open Front_Door.jpg: Permission denied]
can anyone help in getting this small part of php script working, or give an alternative method to get images out of ZM.
Thanks
External Web Page image extraction
External Web Page image extraction
Last edited by clipo on Thu Feb 19, 2009 6:44 pm, edited 3 times in total.
-
- Posts: 11
- Joined: Mon Jan 26, 2009 10:02 am
Hello.
Maybe you could pass the encrypted auth parameter to the cgi script instead of the clear user/pass couple. Take a look at this topic:
http://www.zoneminder.com/forums/viewto ... hlight=md5
Maybe you could pass the encrypted auth parameter to the cgi script instead of the clear user/pass couple. Take a look at this topic:
http://www.zoneminder.com/forums/viewto ... hlight=md5
- zoneminder
- Site Admin
- Posts: 5215
- Joined: Wed Jul 09, 2003 2:07 pm
- Location: Bristol, UK
- Contact:
Feb 18 16:36:05 zoneminder_system zmu[1392]: ERR [Can't open Front_Door.jpg: Permission denied]zoneminder wrote:What error messages exactly are you getting?
This is the error I have been getting inside my zm.log file
chika_nidza:
I have had a look at that option and it seems a little better than my current method, but I would prefer to have as little connection between the two pages as possible, I will look at this again if I cant make this method work or find another solution.
Thanks for the suggestion
- zoneminder
- Site Admin
- Posts: 5215
- Joined: Wed Jul 09, 2003 2:07 pm
- Location: Bristol, UK
- Contact:
Your error seems straightforward. Either there is a file there of that name that cannot be overwritten (owned by root?) or perhaps your web user does not have permission to write to that directory. It should be relatively easy to work around, though you may need to create a special subdir with more open permissions.
Phil
Thank you for this solution I so far have it working now, I just need to make the full script work and will post a how to here for those who wish to follow this methodzoneminder wrote:Your error seems straightforward. Either there is a file there of that name that cannot be overwritten (owned by root?) or perhaps your web user does not have permission to write to that directory. It should be relatively easy to work around, though you may need to create a special subdir with more open permissions.
Mini How To
For those who want to extract images from ZM and have them available for other purposes i.e. viewing on a public page as I do this is the method I have searched for and use.
First is to add a new directory that you can change the access to, this director in my case is located in my main http folder "/var/www/http/images for CentOS users"
chmod this directory with chmod 744 or some other privilege you're happy with so apache can write to the folder
change the folders owner with chown apache:apache
this new director will contain the images ZMU will generate
next place the custom php script inside this folder with a name of your choice I called my script images.php
exec('(cd /var/www/html/images ; /usr/local/bin/zmu -m 1 -U admin -P password -i -v -S 85)');
exec('(cd /var/www/html/images ; /usr/local/bin/zmu -m 3 -U admin -P password -i -v -S 85)');
changing the username and passwords to a valid ZM user
this script will call zmu and generate two images on the 1st and 3rd ID the images will be named the same as the ZM name you have set for them, you can add or remove the lines and change the IDs as required
next inside your main page you need to add a call to this new script and then use the images generated as you desire.
include("/var/www/html/images/page1.php");
This little how to was quickly and with errors put together on a system running CentOS so you will need to change the paths ect to your own distro's
First is to add a new directory that you can change the access to, this director in my case is located in my main http folder "/var/www/http/images for CentOS users"
chmod this directory with chmod 744 or some other privilege you're happy with so apache can write to the folder
change the folders owner with chown apache:apache
this new director will contain the images ZMU will generate
next place the custom php script inside this folder with a name of your choice I called my script images.php
exec('(cd /var/www/html/images ; /usr/local/bin/zmu -m 1 -U admin -P password -i -v -S 85)');
exec('(cd /var/www/html/images ; /usr/local/bin/zmu -m 3 -U admin -P password -i -v -S 85)');
changing the username and passwords to a valid ZM user
this script will call zmu and generate two images on the 1st and 3rd ID the images will be named the same as the ZM name you have set for them, you can add or remove the lines and change the IDs as required
next inside your main page you need to add a call to this new script and then use the images generated as you desire.
include("/var/www/html/images/page1.php");
This little how to was quickly and with errors put together on a system running CentOS so you will need to change the paths ect to your own distro's