{"id":493,"date":"2016-05-24T00:13:35","date_gmt":"2016-05-23T16:13:35","guid":{"rendered":"https:\/\/www.techcoil.com\/blog\/?p=493"},"modified":"2018-09-03T21:04:47","modified_gmt":"2018-09-03T13:04:47","slug":"how-i-built-my-home-raspberry-pi-3-cctv-using-a-motion-eye-os-image-from-home-surveillance","status":"publish","type":"post","link":"https:\/\/www.techcoil.com\/blog\/how-i-built-my-home-raspberry-pi-3-cctv-using-a-motion-eye-os-image-from-home-surveillance\/","title":{"rendered":"How I built my Raspberry Pi 3 CCTV using a motionEyeOS image for home surveillance"},"content":{"rendered":"<p>When I bought my Raspberry Pi 2, I also bought the first version of the <a title=\"Amazon page on Raspberry Pi Camera Module\" href=\"http:\/\/www.amazon.com\/gp\/product\/B00E1GGE40\/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=B00E1GGE40&linkCode=as2&tag=clivsperswebs-20&linkId=ZQRTJJJBCV3ZI3JV\" target=\"_blank\">Raspberry Camera Module<\/a> just for the fun of it. After <a title=\"The steps that I took to build my Raspberry Pi 2 TV box via the OpenELEC Mediacenter image\" href=\"https:\/\/www.techcoil.com\/blog\/the-steps-that-i-took-to-build-my-raspberry-pi-2-tv-box-via-the-openelec-mediacenter-image\/\" target=\"_blank\">setting up my Raspberry Pi 2 as a TV box for my wife<\/a>, that camera module became an ornament. Feeling bad about such wastage, I bought another <a title=\"Amazon page for Rasberry Pi 3 Model B Mother board\" href=\"http:\/\/www.amazon.com\/gp\/product\/B01CD5VC92?ie=UTF8&camp=1789&creativeASIN=B01CD5VC92&linkCode=xm2&tag=clivsperswebs-20\" target=\"_blank\">Raspberry Pi 3<\/a> to utilise the camera module in performing home surveillance.<\/p>\n<p>This post documents the steps that I took to build my Raspberry Pi 3 CCTV via a MotionEyeOS image for home surveillance.<\/p>\n<h2>Getting the hardware for my Raspberry Pi 3 CCTV<\/h2>\n<p>I used the following hardware to realise my Raspberry Pi 3 CCTV:<\/p>\n<ol>\n<li>A <a title=\"Amazon page for Rasberry Pi 3 Model B Mother board\" href=\"http:\/\/www.amazon.com\/gp\/product\/B01CD5VC92?ie=UTF8&camp=1789&creativeASIN=B01CD5VC92&linkCode=xm2&tag=clivsperswebs-20\" target=\"_blank\">Raspberry Pi 3 motherboard<\/a><\/li>\n<li>A <a title=\"Amazon page for Raspberry Camera Module\" href=\"http:\/\/www.amazon.com\/gp\/product\/B00E1GGE40\/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=B00E1GGE40&linkCode=as2&tag=clivsperswebs-20&linkId=ZQRTJJJBCV3ZI3JV\" target=\"_blank\">Raspberry Pi Camera Module<\/a><\/li>\n<li>A <a title=\"Amazon page for Raspberry Pi Model B+ Case Enclosure (Clear)\" href=\"http:\/\/www.amazon.com\/gp\/product\/B00LV9ALGW\/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=B00LV9ALGW&linkCode=as2&tag=clivsperswebs-20&linkId=HLBGGTBYEVXNW33C\" target=\"_blank\">Raspberry Pi Model B+ Case Enclosure (Clear)<\/a><\/li>\n<li>A <a title=\"Amazon page on SanDisk Ultra 64 GB microSDHC \/microSDXC Micro SD UHS-I Card \" href=\"http:\/\/www.amazon.com\/gp\/product\/B010NE3QPS\/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=B010NE3QPS&linkCode=as2&tag=clivsperswebs-20&linkId=VMKK3Y6QGGQEZDQI\" target=\"_blank\">SanDisk Ultra 64 GB microSDXC Micro SD<\/a><\/li>\n<\/ol>\n<h2>Getting the MotionEyeOS image for my Raspberry Pi 3<\/h2>\n<p>After I got the hardware, I went on to download the MotionEyeOS image for my Raspberry Pi 3. <a title=\"Calin Crisan's Github profile page\" href=\"https:\/\/github.com\/ccrisan\" target=\"_blank\">Calin Crisan<\/a> had created a page for us to download <a title=\"MotionEyeOS releases \" href=\"https:\/\/github.com\/ccrisan\/motioneyeos\/releases\" target=\"_blank\">different releases of MotionEyeOS<\/a> for different <a href=\"\/glossary\/single-board-computer\/\" target=\"_blank\">Single Board Computers<\/a>. I chose <a title=\"motioneyeos-raspberrypi3-20160410.img.gz download link\" href=\"https:\/\/github.com\/ccrisan\/motioneyeos\/releases\/download\/20160410\/motioneyeos-raspberrypi3-20160410.img.gz\" target=\"_blank\">motioneyeos-raspberrypi3-20160410.img.gz<\/a> and saved it onto the file system of my Windows machine.<\/p>\n<p>I then used <a title=\"7-zip download page\" href=\"http:\/\/www.7-zip.org\/download.html\" target=\"_blank\">7-zip<\/a> to extract the .img file from <code>motioneyeos-raspberrypi3-20160410.img.gz<\/code>. Once the .img file was extracted, I <a href=\"https:\/\/www.techcoil.com\/blog\/how-to-prepare-the-operating-system-to-run-your-raspberry-pi-with-your-windows-machine\/\" target=\"_blank\">used Win32 Disk Imager to write the .img file<\/a> into the <a title=\"Amazon page on SanDisk Ultra 64 GB microSDHC \/microSDXC Micro SD UHS-I Card \" href=\"http:\/\/www.amazon.com\/gp\/product\/B010NE3QPS\/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=B010NE3QPS&linkCode=as2&tag=clivsperswebs-20&linkId=VMKK3Y6QGGQEZDQI\" target=\"_blank\">SanDisk microSD card<\/a> via the SD card drive on my laptop<\/p>\n<h2>Booting into my MotionEyeOS on my Raspberry Pi 3 CCTV<\/h2>\n<p>After my Win32 Disk Imager completed writing the MotionEyeOS onto my microSD card, I inserted the microSD card into the microSD card slot on my Raspberry Pi 3 board.<\/p>\n<p>I then proceeded to <a href=\"https:\/\/www.techcoil.com\/blog\/connect-raspberry-pi-camera-module-raspberry-pi-2-raspberry-pi-3\/\" target=\"_blank\">connect my Raspberry Pi Camera module to the Raspberry Pi 3 board<\/a> and put them inside the <a href=\"http:\/\/www.amazon.com\/gp\/product\/B00LV9ALGW\/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=B00LV9ALGW&linkCode=as2&tag=clivsperswebs-20&linkId=HLBGGTBYEVXNW33C\" target=\"_blank\">case enclosure<\/a>.<\/p>\n<p>To have a glimpse of what will happen the first time my Raspberry Pi 3 CCTV boots up, I connected my Samsung monitor and my <a title=\"Amazon page for Logitech K120 keyboard\" href=\"http:\/\/www.amazon.com\/gp\/product\/B003ELVLKU\/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=B003ELVLKU&linkCode=as2&tag=clivsperswebs-20&linkId=MT4UKKKAL7ECKMU6\" target=\"_blank\">Logitech keyboard<\/a> to it.<\/p>\n<p>I also connected my Raspberry Pi 3 with my network cable so that I could configure it via a web browser.<\/p>\n<p>Lastly, I connected my Raspberry Pi 3 CCTV to my <a title=\"Amazon page on Belkin 4-Foot MIXIT Micro USB cable\" href=\"http:\/\/www.amazon.com\/gp\/product\/B00E65OM3Q\/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=B00E65OM3Q&linkCode=as2&tag=clivsperswebs-20&linkId=6U5CEOWOEZBQANTR\" target=\"_blank\">Belkin micro USB cable<\/a> which was in turned connected to my USB wall plug charger.<\/p>\n<h3>Key activities that MotionEyeOS did when it boots up for the first time<\/h3>\n<p>When my MotionEyeOS image booted up for the first time, it performed the following:<\/p>\n<ol>\n<li>Expanded the data partition to take the entire microSD card space<\/li>\n<li>Configured a default hostname<\/li>\n<li>Created a default password for the root user, which was empty<\/li>\n<li>Configured the network settings of the ethernet port of my Raspberry Pi 3 to request an IP address via DHCP<\/li>\n<\/ol>\n<p>Among the initial configurations, my MotionEyeOS also started syslogd, the watchdog, brownout detector, eudev, http date updater, crond, sshd, proftpd. smbd, nmbd and motioneye.<\/p>\n<p>The IP address that was allocated to my MotionEyeOS was also shown before the login prompt.<\/p>\n<h2>Accessing my camera video stream with my browser from within my home network<\/h2>\n<p>After my Raspberry Pi 3 CCTV had booted up successfully, I opened a browser from a computer that is connected to my home network and entered the IP address of the Raspberry Pi 3 CCTV in the location bar. With that, I was shown a window that showed a video stream from the camera on my Raspberry Pi 3 CCTV:<\/p>\n<p><img decoding=\"async\" alt=\"First time access to my Raspberry Pi 3 CCTV from the browser\" src=\"\/ph\/img\/blog\/posts\/motion-eye-os-first-access-from-browser.jpg\" \/><\/p>\n<h2>Ensuring that my Raspberry Pi 3 CCTV can only be accessed through my user account<\/h2>\n<p>It felt insecure to have my Raspberry Pi 3 CCTV showing the video stream from its camera without any login prompt. As such, I proceeded to set some passwords to guard accesses to my Raspberry Pi 3.<\/p>\n<p>To apply access control to my Rasberry Pi 3 CCTV, I would need to login as the admin user.<\/p>\n<p>To login as the admin user, I clicked on the second button at the top left corner. I was then shown the login screen:<\/p>\n<p><img decoding=\"async\" alt=\"Login screen to log into Raspberry Pi 3 CCTV from the browser to configure things\" src=\"\/ph\/img\/blog\/posts\/motion-eye-os-login-screen.gif\" \/><\/p>\n<p>At the login prompt, I entered <strong>admin<\/strong> as the username, left the password field blank and clicked on <strong>Login<\/strong>.<\/p>\n<p>After that, the browser would show the video stream from my camera again.<\/p>\n<p>I then clicked on the first button on the top left corner to get the following screen:<\/p>\n<p><img decoding=\"async\" alt=\"General settings screen on my Rasberry Pi 3 CCTV\" src=\"\/ph\/img\/blog\/posts\/motion-eye-os-general-settings-screen.jpg\" \/><\/p>\n<h3>Setting a password for the admin user<\/h3>\n<p>In MotionEyeOS, the admin user is given the rights to configure MotionEyeOS.<\/p>\n<p>The username of the admin user cannot be changed.<\/p>\n<p>To set a password for the admin user, I entered a password in the <strong>Admin Username<\/strong> text field.<\/p>\n<h3>Creating the surveillance user<\/h3>\n<p>The surveillance user is only granted view access to the video stream from my Raspberry Pi 3 camera. Configuring a username and password for the surveillance user would ensure that the video stream from my Raspberry Pi 3 CCTV camera only displays after either the surveillance user or admin user logs in successfully.<\/p>\n<p>To create a surveillance user, I entered a username in the <strong>Surveillance Username<\/strong> text field and a password in the <strong>Surveillance Password<\/strong> text field.<\/p>\n<h3>Applying password changes made to the admin user and the surveillance user<\/h3>\n<p>After I had keyed in the details for the admin and Surveillance users, I clicked on the <strong>Apply<\/strong> button on the top to persist the changes. With that, the following prompt appeared to get me to reboot my Raspberry Pi 3 CCTV:<\/p>\n<p><img decoding=\"async\" alt=\"MotionEyeOS reboot prompt\" src=\"\/ph\/img\/blog\/posts\/motion-eye-os-reboot-prompt.jpg\" \/><\/p>\n<p>I clicked <strong>Yes<\/strong> to make MotionEyeOS reboot itself.<\/p>\n<p>After my Raspberry Pi 3 CCTV started up again, I was shown the login prompt.<\/p>\n<p>I keyed in my admin user credentials to continue on with the rest of the configurations.<\/p>\n<h2>Changing the default timezone<\/h2>\n<p>Since I do not reside in a region that is part of the UTC timezone, the timestamp reflected on my video stream was incorrect. An inaccurate time display would create inconvenience when I wanted to verify whether the deliveryman from the postal service had really attempted to come to my house at the time that they claimed in their failed delivery sms message.<\/p>\n<p>To change the default timezone to the one that my region followed, I clicked on the first button on the top left corner to open up the settings drawer. Inside the settings drawer, I located the <strong>General Settings<\/strong> section and clicked on the toggle button next to <strong>Advanced Settings<\/strong>. After doing so, I was able to change the Time Zone on my Raspberry Pi 3 CCTV:<\/p>\n<p><img decoding=\"async\" alt=\"MotionEyeOS advanced settings toggled for General Settings\" src=\"\/ph\/img\/blog\/posts\/motion-eye-os-advanced-settings-for-general-settings-toggled-on.jpg\" \/><\/p>\n<p>To configure the Time Zone on my Raspberry Pi CCTV, I selected <strong>Asia\/Singapore<\/strong> from the <strong>Time Zone<\/strong> dropbox and clicked the <strong>Apply<\/strong> button at the top of the screen to commit the changes. I clicked <strong>Yes<\/strong> when MotionEyeOS asked to reboot itself.<\/p>\n<p>After my Raspberry Pi 3 CCTV started up again, I keyed in my admin user credentials to continue on with the other configurations.<\/p>\n<h2>Configuring wireless connection to my home network<\/h2>\n<p>Since Raspberry Pi 3 comes with wifi capability, configuring my CCTV to connect to my home network connection wirelessly would eliminate the need for another cable for network communications.<\/p>\n<p>To configure wireless access, I first clicked on the first button at the top left corner to bring out the configurations drawer.<\/p>\n<p>After that, I clicked on the <strong>Network<\/strong> tab to expand the network settings section:<\/p>\n<p><img decoding=\"async\" alt=\"MotionEyeOS Network configuration section with Wireless Network off\" src=\"\/ph\/img\/blog\/posts\/motion-eye-os-network-settings-panel-expanded-with-wireless-network-off.jpg\" \/><\/p>\n<p>I then clicked on the toggle button for <strong>Wireless Network<\/strong> to turn on wireless network connections. This would make the <strong>Wireless Network Name<\/strong> and <strong>Wireless Network Key<\/strong>&nbsp;text fields appear for me to key in my home wireless network details.<\/p>\n<p>Once I was done with my Wireless Network configurations, I clicked the <strong>Apply<\/strong> button and rebooted my Raspberry Pi 3 CCTV.<\/p>\n<p>When my Raspberry Pi 3 CCTV started up, I keyed in my admin user credentials to continue on with the other configurations.<\/p>\n<p>To get the IP address that my Raspberry Pi 3 had gotten for its wifi interface, I connected my monitor to it and looked for the status output that looked like the following:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nInterface wlan0 has IP address 192.168.0.107\/24\r\n<\/pre>\n<p>In this case, I would enter <strong>192.168.0.107<\/strong> in the location bar of my browser from a computer that is connected to my home network so as to connect to my Raspberry Pi 3 CCTV via its wifi interface.<\/p>\n<h2>Turning off the camera LED indicator<\/h2>\n<p>Seeing the video stream would be sufficient for me to determine that the camera is working. As such, I went on to turn off the camera LED indicator so that I can reduce the power consumption of my Raspberry Pi 3 CCTV.<\/p>\n<p>To do so, I first clicked on the first button on the top left of the screen to bring out the configurations drawer.<\/p>\n<p>I then looked for the <strong>Expert Settings<\/strong> tab and clicked on it to expand the expert settings section:<\/p>\n<p><img decoding=\"async\" alt=\"MotionEyeOS Expert Settings configurations section expanded\" src=\"\/ph\/img\/blog\/posts\/motion-eye-os-expert-settings-configurations-section-expanded.jpg\" \/><\/p>\n<p>To turn off the LED indicator of the camera, I clicked on the toggle button for <strong>Enable CSI Camera Led<\/strong> to switch it off.<\/p>\n<p>I then click on the <strong>Apply<\/strong> button at the top and rebooted my Raspberry Pi 3 CCTV.<\/p>\n<p>After my Raspberry Pi 3 CCTV booted up again, I keyed in the admin user credentials to continue with the other configurations.<\/p>\n<h2>Limiting the preservation of still images and movies<\/h2>\n<p>By default, MotionEyeOS keeps pictures and movies for as long as it can. However, I figured out that I would only require the still images and movies be kept for one month.<\/p>\n<p>As such, I went on to configure my Raspberry Pi 3 CCTV to keep pictures and movies for a maximum of 1 month.<\/p>\n<p>To configure the preservation period of pictures and movies, I first clicked on the first button on the top left of the screen to bring out the configurations drawer.<\/p>\n<p>I then clicked on the <strong>Still Images<\/strong> and <strong>Movies<\/strong> tabs to expand both configuration sections:<\/p>\n<p><img decoding=\"async\" alt=\"MotionEyeOS Still Images and Movies configuration sections expanded\" src=\"\/ph\/img\/blog\/posts\/motion-eye-os-still-images-and-movies-configuration-sections-expanded.jpg\" \/><\/p>\n<p>I then chose the <strong>For One Month<\/strong> option for <strong>Preserve Pictures<\/strong> and <strong>Preserve Movies<\/strong> and clicked <strong>Ok<\/strong> on the prompts that appeared.<\/p>\n<p>Once I was done with that, I clicked on the <strong>Apply<\/strong> button at the top to persist the configurations and rebooted my Raspberry Pi 3 CCTV.<\/p>\n<p>With that, I was satisfied with the configurations that I wanted for my Raspberry Pi 3 CCTV.<\/p>\n<h2>Making my Raspberry Pi 3 CCTV camera accessible from outside my home network through HTTPS<\/h2>\n<p>Without HTTPS, it would be insecure to access my Raspberry Pi 3 CCTV camera from outside my home network. Protecting the HTTP traffic between a web browser and my Raspberry Pi 3 CCTV camera would require a <a href=\"https:\/\/www.techcoil.com\/blog\/the-reverse-proxy-server\/\" target=\"_blank\">reverse proxy server<\/a>, a domain name and a SSL certificate. <\/p>\n<p>Through my experience in <a href=\"https:\/\/www.techcoil.com\/blog\/setting-up-a-lemp-web-server-on-raspberry-pi-3-with-an-ubuntu-server-15-10-3-image-to-host-a-wordpress-website\/\" target=\"_blank\">setting up a LEMP web server on Raspberry Pi 3<\/a> and <a href=\"https:\/\/www.techcoil.com\/blog\/setting-up-a-free-ca-signed-ssl-certificate-from-lets-encrypt-for-my-lemp-server-on-my-raspberry-pi-3-with-an-ubuntu-server-15-10-3-image-to-secure-my-wordpress-site\/\" target=\"_blank\">setting up a free CA signed SSL certificate to secure a WordPress site hosted on it<\/a>, I had the hardware and software resources to secure access to my Raspberry Pi 3 CCTV camera with HTTPS.<\/p>\n<h3>Creating a sub domain from a domain that I already owned and point that sub domain to the public IP address of my home router<\/h3>\n<p>Since I own a couple of domain names, I could create a sub domain from one of the domain names. And since I am leveraging on DigitalOcean name servers to translate my domain names into IP addresses, I could create a sub domain via DigitalOcean's control panel. <\/p>\n<p>To create a sub domain via DigitalOcean's control panel, I logged into my <a href=\"https:\/\/m.do.co\/c\/68b7d9b94341\" target=\"_blank\">Digital Ocean<\/a> account and go to the \"Networking\" page. I then proceeded to the \"Domain\" tab to select a domain which I wanted to create a sub domain from. <\/p>\n<p>At the \"Create new record\" page, I entered the sub domain that I wanted for my Raspberry Pi 3 CCTV camera and the public IP address of my home router:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/digital-ocean-page-to-create-a-new-type-a-dns-record-for-cctv-camera.gif\" alt=\"Digital Ocean page to create a new Type A DNS record for CCTV camera\" \/><\/p>\n<p>After clicking on the \"Create Record\" button, I was able to get the IP address of my home router by sending a ping to <code>cctv.adomainname.com<\/code>.<\/p>\n<p>And being able to reach my home router will meant that I was able to reach the <a href=\"https:\/\/www.techcoil.com\/blog\/setting-up-a-lemp-web-server-on-raspberry-pi-3-with-an-ubuntu-server-15-10-3-image-to-host-a-wordpress-website\/\" target=\"_blank\">LEMP server running on my Raspberry Pi 3<\/a>.<\/p>\n<h3>Configuring nginx to facilitate the Let's Encrypt client in acquiring the SSL certificate for my sub domain<\/h3>\n<p>Once I was sure that the nginx server running on my Raspberry Pi 3 could receive HTTP requests directed at my sub domain, I proceeded on with creating the nginx configurations to facilitate the Let's Encrypt client in acquiring the SSL certificate for my sub domain.<\/p>\n<p>To do so, I connected to my Raspberry Pi 3 LEMP server via SSH:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nssh root@192.168.0.123\r\n<\/pre>\n<p>Once I got into my Raspberry Pi 3 LEMP server, I used nano to create a configuration file at <code>\/etc\/nginx\/sites-enabled\/cctv.adomainname.com.conf<\/code>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo nano \/etc\/nginx\/sites-enabled\/cctv.adomainname.com.conf\r\n<\/pre>\n<p>Once inside my nano editor, I created the following nginx configuration:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nserver {\r\n\tlisten 80;\r\n\tserver_name  cctv.adomainname.com;\r\n\r\n\troot \/var\/www\/cctv.adomainname.com;\r\n\r\n\tlocation ~ \/.well-known {\r\n\t\tallow all;\r\n\t}\r\n}<\/pre>\n<p>After creating the nginx configurations, I saved the file and restarted my nginx server:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo systemctl restart nginx.service\r\n<\/pre>\n<p>I also created the directory <code>\/www\/var\/cctv.adomainname.com<\/code> for the Let's Encrypt client to use in the process of acquiring the SSL certificate for my sub domain:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo mkdir \/www\/var\/cctv.adomainname.com\r\nsudo chown www-data:www-data \/www\/var\/cctv.adomainname.com\r\n<\/pre>\n<h3>Running Let's Encrypt client to get a SSL certificate artefacts for the sub domain to my Raspberry Pi 3 CCTV camera<\/h3>\n<p>Once I had the configurations necessary for the Let's Encrypt client to acquire the SSL certificate artefacts for my sub domain, I ran the following command to get the Let's Encrypt client running:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\/opt\/letsencrypt\/letsencrypt-auto certonly -a webroot --webroot-path=\/var\/www\/cctv.adomainname.com -d cctv.adomainname.com\r\n<\/pre>\n<h3>Generating a strong Diffie-Hellman group<\/h3>\n<p>After the SSL certificate and the corresponding private key were created successfully, I went on to precompute a strong Diffie-Hellman group for my server to use for exchanging cryptographic keys with its clients:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo openssl dhparam -out \/etc\/ssl\/certs\/dhparam.pem 2048\r\n<\/pre>\n<p>This process took a very long time to complete but it was worth the effort as it would make communicating with my server more secure.<\/p>\n<h3>Creating the nginx configurations for serving HTTPS on behalf of my Raspberry Pi 3 CCTV camera<\/h3>\n<p>Once I had the corresponding SSL certificate artefacts for my sub domain, my nginx was ready for the corresponding configurations to serve HTTPS on behalf of my Raspberry Pi 3 CCTV camera. The following is the last set of configurations that I included in <code>\/etc\/nginx\/sites-enabled\/cctv.adomainname.com.conf<\/code>. These set of configurations allows me to access my Raspberry Pi 3 CCTV camera over HTTPS via my sub domain:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# Redirect HTTP requests to HTTPS \r\nserver {\r\n\tlisten 80;\r\n\tserver_name  cctv.adomainname.com;\r\n\treturn 301 https:\/\/$host$request_uri;\r\n}\r\n\r\n# For ssl\r\nserver {\r\n\tssl on;\r\n\tssl_certificate \/etc\/letsencrypt\/live\/cctv.adomainname.com\/fullchain.pem;\r\n\tssl_certificate_key \/etc\/letsencrypt\/live\/cctv.adomainname.com\/privkey.pem;\r\n\tssl_protocols TLSv1 TLSv1.1 TLSv1.2;\r\n\tssl_prefer_server_ciphers on;\r\n\tssl_dhparam \/etc\/ssl\/certs\/dhparam.pem;\r\n\tssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';\r\n\tssl_session_timeout 1d;\r\n\tssl_session_cache shared:SSL:50m;\r\n\tssl_stapling on;\r\n\tssl_stapling_verify on;\r\n\tadd_header Strict-Transport-Security max-age=15768000;\r\n\t\r\n\tdefault_type  application\/octet-stream;\r\n\t\r\n\tlisten 443;\r\n\tserver_name  cctv.adomainname.com;\r\n\r\n\troot \/var\/www\/cctv.adomainname.com;\r\n\r\n\tlocation ~ \/.well-known {\r\n\t\tallow all;\r\n\t}\r\n\r\n\tlocation \/ {\r\n\t\tproxy_pass http:\/\/192.168.0.107;\r\n\t}\r\n}\r\n<\/pre>\n<h2>Buying your Raspberry Pi 3 CCTV camera from Amazon<\/h2>\n<p>If you do not have the Raspberry Pi 3 components mentioned in this post yet, you may want to purchase them from Amazon. Simply click on the button below to add the Raspberry Pi 3 components to your cart. You may remove anything that you already have or replace some of the components with other components.<\/p>\n<p><center><\/p>\n<form action=\"https:\/\/www.amazon.com\/gp\/aws\/cart\/add.html\" method=\"GET\" target=\"_blank\"><input name=\"AssociateTag\" type=\"hidden\" value=\"clivsperswebs-20\"><input name=\"SubscriptionId\" type=\"hidden\" value=\"[AKIAIMND5UBCQU2HRSUA]\"><input name=\"ASIN.1\" type=\"hidden\" value=\"B01CD5VC92\"><input name=\"Quantity.1\" type=\"hidden\" value=\"1\"><input name=\"ASIN.2\" type=\"hidden\" value=\"B01ER2SKFS\"><input name=\"Quantity.2\" type=\"hidden\" value=\"1\"><input name=\"ASIN.3\" type=\"hidden\" value=\"B00LV9ALGW\"><input name=\"Quantity.3\" type=\"hidden\" value=\"1\"><input name=\"ASIN.4\" type=\"hidden\" value=\"B010NE3QPS\"><input name=\"Quantity.4\" type=\"hidden\" value=\"1\"><br \/>\n<input alt=\"Buy from Amazon.com\" name=\"add\" type=\"image\" src=\"https:\/\/images-na.ssl-images-amazon.com\/images\/G\/01\/associates\/remote-buy-box\/buy4.gif\" value=\"Buy from Amazon.com\"><\/form>\n<p><\/center><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/How-to-setup-a-Raspberry-Pi-3-security-camera-with-motionEyeOS.jpg\" alt=\"How to setup a Raspberry Pi 3 security camera with motionEyeOS\" \/><\/p>\n\n      <ul id=\"social-sharing-buttons-list\">\n        <li class=\"facebook\">\n          <a href=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fwp.me%2Fp245TQ-7X\" target=\"_blank\" role=\"button\" rel=\"nofollow\">\n            <img decoding=\"async\" src=\"\/ph\/img\/3rd-party\/social-icons\/Facebook.png\" alt=\"Facebook icon\"> Share\n          <\/a>\n        <\/li>\n        <li class=\"twitter\">\n          <a href=\"https:\/\/twitter.com\/intent\/tweet?text=&url=https%3A%2F%2Fwp.me%2Fp245TQ-7X&via=Techcoil_com\" target=\"_blank\" role=\"button\" rel=\"nofollow\">\n          <img decoding=\"async\" src=\"\/ph\/img\/3rd-party\/social-icons\/Twitter.png\" alt=\"Twitter icon\"> Tweet\n          <\/a>\n        <\/li>\n        <li class=\"linkedin\">\n          <a href=\"https:\/\/www.linkedin.com\/shareArticle?mini=1&title=&url=https%3A%2F%2Fwp.me%2Fp245TQ-7X&source=https:\/\/www.techcoil.com\" target=\"_blank\" role=\"button\" rel=\"nofollow\">\n          <img decoding=\"async\" src=\"\/ph\/img\/3rd-party\/social-icons\/linkedin.png\" alt=\"Linkedin icon\"> Share\n          <\/a>\n        <\/li>\n        <li class=\"pinterest\">\n          <a href=\"https:\/\/pinterest.com\/pin\/create\/button\/?url=https%3A%2F%2Fwww.techcoil.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F493&description=\" class=\"pin-it-button\" target=\"_blank\" role=\"button\" rel=\"nofollow\" count-layout=\"horizontal\">\n          <img decoding=\"async\" src=\"\/ph\/img\/3rd-party\/social-icons\/Pinterest.png\" alt=\"Pinterest icon\"> Save\n          <\/a>\n        <\/li>\n      <\/ul>\n    ","protected":false},"excerpt":{"rendered":"<p>When I bought my Raspberry Pi 2, I also bought the first version of the Raspberry Camera Module just for the fun of it. After setting up my Raspberry Pi 2 as a TV box for my wife, that camera module became an ornament. Feeling bad about such wastage, I bought another Raspberry Pi 3 to utilise the camera module in performing home surveillance.<\/p>\n<p>This post documents the steps that I took to build my Raspberry Pi 3 CCTV via a MotionEyeOS image for home surveillance.<\/p>\n","protected":false},"author":1,"featured_media":1199,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"footnotes":""},"categories":[4],"tags":[275,277,411,240,308,410,423,279],"jetpack_featured_media_url":"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/Raspberry-Pi-3-CCTV-with-transparent-case-held-by-mobile-phone-holder-clamped-to-desk.jpg","jetpack_shortlink":"https:\/\/wp.me\/p245TQ-7X","jetpack-related-posts":[],"jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/posts\/493"}],"collection":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/comments?post=493"}],"version-history":[{"count":0,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/posts\/493\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/media\/1199"}],"wp:attachment":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/media?parent=493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/categories?post=493"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/tags?post=493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}