{"id":154,"date":"2018-01-26T17:56:22","date_gmt":"2018-01-26T22:56:22","guid":{"rendered":"http:\/\/www.scheh.com\/?p=154"},"modified":"2020-09-25T17:01:35","modified_gmt":"2020-09-25T22:01:35","slug":"setting-up-ssl-with-shinobi-video-using-lets-encrypt-and-certbot","status":"publish","type":"post","link":"https:\/\/www.scheh.com\/index.php\/2018\/01\/26\/setting-up-ssl-with-shinobi-video-using-lets-encrypt-and-certbot\/","title":{"rendered":"Setting up SSL with Shinobi Video using Let&#8217;s Encrypt and Certbot"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"154\" class=\"elementor elementor-154\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-53e41b90 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"53e41b90\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-5124a183\" data-id=\"5124a183\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-25cd4c80 elementor-widget elementor-widget-text-editor\" data-id=\"25cd4c80\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h6>Edit 2020-09-25<\/h6><p><a href=\"https:\/\/www.scheh.com\/index.php\/2020\/09\/23\/shinobi-video-ssl-2020-updated\/\">There is an updated version of this located here.<\/a><\/p><h6>End Edit<\/h6><p>This help text was compiled using Ubuntu 16.04 server LTS<\/p><p>Install Shinobi using the online documentation<\/p><p>Become a super user<\/p><pre><code>sudo su<\/code><\/pre><p>Make sure your distribution is up to date<\/p><pre><code>apt-get update\napt-get dist-upgrade<\/code><\/pre><p>First change the login email address and password for the super user in <code>super.json<\/code><\/p><p>Create an md5 hash of your password<\/p><pre><code>echo -n 'password' | md5sum<\/code><\/pre><p>Copy the result and edit the <code>super.json<\/code> file replacing the email and password with your info.<\/p><pre><code>cd \/home\/user\/Shinboi\nnano super.json<\/code><\/pre><p>Ctrl O, Enter to Save and Ctrl X to exit<\/p><p>Install certbot<\/p><pre><code>apt-get update\napt-get install software-properties-common\nadd-apt-repository ppa:certbot\/certbot\napt-get update\napt-get install certbot<\/code><\/pre><p>Setup the folder structure you are going to use for certbot<\/p><pre><code>cd \/home\/user\/Shinobi\nmkdir certs\ncd \/home\/user\/Shinobi\/web\nmkdir -p .well-known\/acme-challenge<\/code><\/pre><p>Generate the certificate<\/p><pre><code>certbot certonly --webroot -w \/home\/user\/Shinobi\/web -d shinobi.website.com<\/code><\/pre><p>Edit the Shinobi super configuration file to turn on SSL<\/p><pre><code>nano conf.json<\/code><\/pre><pre><code>{\n\"port\": 80,\n\"addStorage\": [\n{\n\"name\": \"second\",\n\"path\": \"__DIR__\/videos2\"\n}\n],\n\"db\": {\n\"host\": \"127.0.0.1\",\n\"user\": \"majesticflame\",\n\"password\": \"\",\n\"database\": \"ccio\",\n\"port\": 3306\n},\n\"mail\": {\n\"service\": \"gmail\",\n\"auth\": {\n\"user\": \"your_email@gmail.com\",\n\"pass\": \"your_password_or_app_specific_password\"\n}\n},\n\"ssl\": {\n\"key\": \"\/etc\/letsencrypt\/live\/website.ssl.name\/privkey.pem\",\n\"cert\": \"\/etc\/letsencrypt\/live\/website.ssl.name\/cert.pem\",\n\"port\": 443\n},\n\n\"cron\": {\n\n\"key\": \"change_this_to_something_very_random__just_anything_other_than_this\"\n},\n\"pluginKeys\": {\n\"Motion\": \"change_this_to_something_very_random____make_sure_to_match__\/plugins\/motion\/conf.json\",\n\"OpenCV\": \"change_this_to_something_very_random____make_sure_to_match__\/plugins\/opencv\/conf.json\",\n\"OpenALPR\": \"SomeOpenALPRkeySoPeopleDontMessWithYourShinobi\"\n}\n}<\/code><\/pre><p>Ctrl O, Enter to Save and Ctrl X to exit<\/p><p>Edit the Shinobi configuration file to add a static reference to the .well-known folder<\/p><pre><code>nano cameras.js<\/code><\/pre><p>Hit Ctrl W, type \/\/pages followed by enter to search for \/\/pages<\/p><p>make it look like the below by adding this line of text &#8211; <code>app.use('\/.well-known',express.static(__dirname + '\/web\/.well-known'));<\/code><\/p><pre><code>\/\/\/\/Pages\napp.enable('trust proxy');\napp.use('\/libs',express.static(__dirname + '\/web\/libs'));\napp.use('\/.well-known',express.static(__dirname + '\/web\/.well-known'));\napp.use(bodyParser.json());<\/code><\/pre><p>Ctrl O, Enter to save and Ctrl X to quit<\/p><p>Restart Shinobi<\/p><pre><code>pm2 start camera.js\npm2 start cron.js<\/code><\/pre><p>Profit<\/p><p>Update 2019\/04\/02<\/p><p>I had to change the ssl code in the super configuration from the below to what is already above:<\/p><pre>\"ssl\": {\n\"key\": \"\/home\/user\/Shinobi\/certs\/privkey.pem\",\n\"cert\": \"\/home\/user\/Shinobi\/certs\/cert.pem\",\n\"port\": 443\n},<\/pre><p>I also changed the certbot command from the below to the above:<\/p><pre><code>certbot certonly --webroot -w \/home\/user\/Shinobi\/web -d shinobi.website.com --cert-path \/home\/user\/Shinobi\/certs --key-path \/home\/user\/Shinobi\/certs --fullchain-path \/home\/user\/Shinobi\/certs --chain-path \/home\/user\/Shinobi\/certs<\/code><\/pre>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Edit 2020-09-25 There is an updated version of this located here. End Edit This help text was compiled using Ubuntu 16.04 server LTS Install Shinobi using the online documentation Become a super user sudo su Make sure your distribution is up to date apt-get update apt-get dist-upgrade First change the login email address and password [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1],"tags":[],"class_list":["post-154","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3eyIP-2u","_links":{"self":[{"href":"https:\/\/www.scheh.com\/index.php\/wp-json\/wp\/v2\/posts\/154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scheh.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scheh.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scheh.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scheh.com\/index.php\/wp-json\/wp\/v2\/comments?post=154"}],"version-history":[{"count":0,"href":"https:\/\/www.scheh.com\/index.php\/wp-json\/wp\/v2\/posts\/154\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.scheh.com\/index.php\/wp-json\/wp\/v2\/media?parent=154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scheh.com\/index.php\/wp-json\/wp\/v2\/categories?post=154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scheh.com\/index.php\/wp-json\/wp\/v2\/tags?post=154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}