Visitor counter, Heat Map, Conversion tracking, Search Rank

Home Security system using Zoneminder

A home security system consists of three essential,namely the Camera, the Digital Video Recorder(DVR) and the Internet. The camera which we have choosen are IP based camera having 720p video resolution. The camera are IP based and also having the wireless functionality, thereby reducing the effort required in cabling and quick installation/ re-location is possible. Now as far as the DVR goes we have gone in for an Free and Open Source(FOSS) Linux/Windows based Zoneminder software. As far as the Internet access to the DVR is concerned we require a dynamic-dns based URL to identify ourselves on the Internet. For that my personal choice is noip. 

 1. Camera

 

I bought three different camera from ebay as under. First Xiaomi YI Wifi HD 720P IP Wireless NIGHT VISION Home Security Smart CCTV Camera for Rs 2600. Second 720P Wireless WIFI Network IP Camera Outdoor Onvif H.264 IR Night Vision for Rs 2759 and third Sricam SP007 720P HD IR Network Wireless Outdoor Security IP Camera for Rs 3476

 

Its took me a lot of effort in order to get these camera to stream the video and for it to be seen on Zoneminder.

 

I will touch upon these in subsequent paragraphs. First the Xiaomi.....

 

 

Second the Wireless WIFI Network IP Camera Outdoor Onvif H.264 IR Night Vision which did neither have a make or a model.

To start with , the camera which I bought from ebay didn't have a manual. The only clue to the puzzle was an IP address which was written on the camera, which was 192.168.1.10 and the user id was admin. However, later I realized, that the camera was a used camera and hence someone had already changed the default IP. However, the user id was still the same. So, in order to find the IP of the camera, I connected the camera using a cross-cable to my laptop and started Wireshark packet sniffer program in my laptop and I could find the IP address of the camera as it was the only other system connected in the network. The IP address of the camera was 192.168.1.116. 

Thereafter, I did Nmap on the camera IP to find open ports. I could see that the camera was listening on port 80 (http), 554 (rtsp), 21 (telnet),  and 8899. Therefore, I opened a web browser and pointed it to the camera IP address. Little did I realize that the horror was not over as the webpage that opened was in Mandarin. Further, using my basic instinct, when I clicked the icon to play it said  that the required plugin is not there. So, I searched on the net with the keywords  as under

192.168.1.10   User:admin IP camera and I got a list of websites. As luck would have it, I chanced upon a webpage which had a pdf IPCamera Quick Guide.pdf. As the web interface in the manual and as seen by me appeared to be the same, I took it that this manual which I chanced upon is for the camera that I had procured. In that manual, there was a weblink https://xmeye.net. I opened the webpage and went to the link Download Web from where an executable file Active.exe was downloaded in my PC. From this, I gathered that the camera web interface was designed for Windows OS and not Linux, which I work on. Therefore, I used Virtual Windows OS using VirtualBox and opened the IP address of the camera in Chrome browser. In this also, on clicking the play button, I was told that the required plugin was missing. Again, taking the cue from the downloaded exe file, I presumed it was an Active X plugin, so I opened the link in Internet Explorer after installing Active.exe file. 

Now, in the Internet Explorer, there was an option to change the language to English. Furthere, on logging in with user admin and password blank, I could see the camera stream when I clicked the play button. Thereafter, it wsa simple configuration, which is self-explanatory when you browse the web interface. 

The only challenge left was how to view the stream in vlc or zoneminder. I knew that the camera is streaming an rtsp stream but how to get to it? So, I searched the net again and found this wonderful string: rtsp://[IP address]:554/user=[user Id]&password=[your password]&channel=1&stream=0.sdp? 

And so when I put this url in zoneminder I could view the camera. 

 

Third Sricam SP007 720P HD IR Network Wireless Outdoor Security IP Camera, I would say as compared to the other two this was a cake walk.

 

 

 

 

2. Zoneminder : Digital Video Recorder 

To start with install zoneminder, ZoneMinder runs on a LAMP stack. The ZoneMinder Wiki has installation instructions for various Linux versions. Pay special attention to configuring ZoneMinder to work with Apache. By default Apache disables CGI, which ZoneMinder needs. 

To install zoneminder

sudo apt-get install zoneminder

Now Change short_open_tag = Off in /etc/php5/apache2/php.ini to short_open_tag = On, and in /etc/init.d/zoneminder add sleep 15 on the line above zmfix -a, like this:

 /etc

start() {

        echo -n "Starting $prog: "

    sleep 15

    zmfix -a

        $command start

Now create link between files as under

$ sudo ln -s /etc/zm/apache.conf /etc/apache2/conf-enabled/zoneminder.conf

 

Now restart Apache 

$ sudo service apache2 restart and go to https://localhost/zm

Now go to options and check OPT_USE_AUTH  in system tab, at this stage you may get locked out and you will have this window appearing. 

 

Dont worry, just reset the admin password by foloowing the steps below 

 

$ mysql -u root -p

Enter password: 

 

enter the password you entered during zoneminder installation. Reset password by following steps as under

 

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| zm                 |

+--------------------+

4 rows in set (0.04 sec)

 

mysql> use zm

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

 

Database changed

mysql> update Users set Password="" where Username="admin";

Query OK, 1 row affected (0.04 sec)

Rows matched: 1  Changed: 1  Warnings: 0

 

mysql> 

 

Now go to https://localhost/zm and using user admin with password blank login into zoneminder. Now go to user tab and create users with viewing rights as under.

 

 

now add new monitors

To add camera which support onvif and stream using rtsp  add it under ffmpeg

in source path add rtsp://[user]:[password]@[IP]:554/onvif1

To add local camera use source type local and device path as /dev/video0

 

 

Now click Monitor-1 and if you get a blank screen as under, enable cgi module

 

sudo a2enmod cgi

sudo service apache2 restart

 

Ok this was all that is required to configure zoneminder, now to login your system from Internet you need to configure dyanmic dns.

 

 

3. Internet Access to the DVR

Now we need to create a noip dynamic dns mapping to your dynamic ip given by your ISP.

For this install noip linux client in your pc, by downloading noip updation client noip-duc-linux.tar.gz

 

 

wget https://www.noip.com/client/linux/noip-duc-linux.tar.gz

 

tar -zxvf ./noip-duc-linux.tar.gz 

cd noip-2.1.9-1

 

 

$ sudo make install

if [ ! -d /usr/local/bin ]; then mkdir -p /usr/local/bin;fi

if [ ! -d /usr/local/etc ]; then mkdir -p /usr/local/etc;fi

cp noip2 /usr/local/bin/noip2

/usr/local/bin/noip2 -C -c /tmp/no-ip2.conf

 

Auto configuration for Linux client of no-ip.com.

 

Please enter the login/email string for no-ip.com   This email address is being protected from spambots. You need JavaScript enabled to view it.

Please enter the password for user ' This email address is being protected from spambots. You need JavaScript enabled to view it. '  ****************

 

Only one host [msXXXXX.ddns.net] is registered to this account.

It will be used.

Please enter an update interval:[30]  30

Do you wish to run something at successful update?[N] (y/N)  y

Please enter the script/program name  

 

New configuration file '/tmp/no-ip2.conf' created.

 

mv /tmp/no-ip2.conf /usr/local/etc/no-ip2.conf

 

#configure a client

sudo /usr/local/bin/noip2 -C

 

Auto configuration for Linux client of no-ip.com.

 

Please enter the login/email string for no-ip.com   This email address is being protected from spambots. You need JavaScript enabled to view it.

Please enter the password for user ' This email address is being protected from spambots. You need JavaScript enabled to view it. '  ********

 

Only one host [msXXXXX.ddns.net] is registered to this account.

It will be used.

Please enter an update interval:[30]  

Do you wish to run something at successful update?[N] (y/N)  y

Please enter the script/program name  

 

New configuration file '/usr/local/etc/no-ip2.conf' created.

 

 

 

 

#display info about running clients

sudo /usr/local/bin/noip2 -S

No noip2 processes active.

 

Configuration data from /usr/local/etc/no-ip2.conf.

Account This email address is being protected from spambots. You need JavaScript enabled to view it.

configured for:

host  msXXXXX.ddns.net

Executing username=manindersinghgill%40gmail.com&pass=XXXXXXXXXX&h[]=msXXXXX.ddns.net upon successful update.

Updating every 5 minutes via /dev/wlan0 with NAT enabled.

 

 

Now we need to start the noip deamon.

 

sudo /usr/local/bin/noip2 -d

> GET https://ip1.dynupdate.no-ip.com/ HTTP/1.0

> User-Agent: Linux-DUC/2.1.9

< HTTP/1.0 200 OK

< Server: xipha

< Date: Wed, 02 Feb 2016 16:21:47 GMT

< Content-Type: text/html

< Connection: close

< XXX.203.164.XXX

! Our NAT IP address is XXX.203.164.XXX

! Last_IP_Addr = 0.0.0.0, IP = XXX.203.164.XXX

> GET https://dynupdate.no-ip.com/ducupdate.php?requestL=dXNlcm5hbWU9bWFuaW5ky5kZG5zLm5ldCZpcD0xMTcuMjAzLjE2NC4yOQ== HTTP/1.0

> User-Agent: Linux-DUC/2.1.9

< HTTP/1.1 200 OK

< Date: Tue, 02 Feb 2016 16:21:48 GMT

< Server: Apache

< Vary: Accept-Encoding

< Content-Length: 19

< Connection: close

< Content-Type: text/plain

< msXXXXX.ddns.net:1

Running username=manindersinghgill%40gmail.com&pass=XXXXXXXXXX&h[]=msXXXXX.ddns.net username=manindersinghgill%40gmail.com&pass=XXXXXXXXXX&h[]=msXXXXX.ddns.net XXX.203.164.XXX msXXXXX.ddns.net

execl username=manindersinghgill%40gmail.com&pass=XXXXXXXXXX&h[]=msXXXXX.ddns.net failed (No such file or directory)

> GET https://ip1.dynupdate.no-ip.com/ HTTP/1.0

> User-Agent: Linux-DUC/2.1.9

< HTTP/1.0 200 OK

< Server: xipha

< Date: Wed, 02 Feb 2016 16:21:49 GMT

< Content-Type: text/html

< Connection: close

< XXX.203.164.XXX

! Our NAT IP address is XXX.203.164.XXX

! Last_IP_Addr = XXX.203.164.XXX, IP = XXX.203.164.XXX

 

Now to make this run every time the pc starts add this line to the file /etc/rc.local before exit 0

sudo /usr/local/bin/noip2  

so that noip runs as a deamon  in the background

 

At this point we will change the port apache2 server in your machine is listening from port 80 to some other port say port 12345.

For this edit ports.conf

sudo nano   /etc/apache2/ports.conf 

 

and make the following changes, that is comment out port 80 and add the line for desired port.

#Listen 80

Listen 12345

 

thereafter restart apache2 server

sudo service apache2 restart

 

Now we need to provide access to the web server past the adsl modem, create a virtual server, and allow access from the WAN to LAN IP:12345 of your zoneminder pc. 

 

 

Add comment


Security code
Refresh