{"id":27,"date":"2017-05-11T00:13:38","date_gmt":"2017-05-11T00:13:38","guid":{"rendered":"http:\/\/www.f-bit.net\/?p=27"},"modified":"2017-05-11T00:13:38","modified_gmt":"2017-05-11T00:13:38","slug":"import-pre-existing-ssl-certificate-to-unifi-controller-on-debian","status":"publish","type":"post","link":"https:\/\/www.f-bit.net\/?p=27","title":{"rendered":"Import pre-existing SSL certificate to Unifi controller (on Debian)"},"content":{"rendered":"<p>This one was a bit of a pain. I&#8217;m assuming that you&#8217;ve generated the key, the CSR, sent that off to your CA (or signed it yourself), and received the certificate. You&#8217;ve also converted the certificate to DER format if necessary, since you&#8217;re familiar with openssl.<\/p>\n<p>&nbsp;<\/p>\n<p>Here&#8217;s the steps I had to go through to import the certificate and the key:<\/p>\n<ol>\n<li>Break out openssl and convert the certificate to PKCS12 format &#8211; <em>openssl pkcs12 -export -in &lt;signed server certificate&gt; -inkey &lt;private key&gt; -CAfile &lt;signing certificate&gt; -out &lt;PKCS12 certificate filename&gt; -passout pass:aircontrolenterprise -caname root -name unifi <\/em>&#8211; the &#8220;name&#8221; parameter is important as that&#8217;ll be used in the keystore. Don&#8217;t think you can skip any of these parameters to save time, you&#8217;ll just get errors later on. It&#8217;s quite finicky.<\/li>\n<li>Back up the keystore &#8211; by default it is at \/usr\/lib\/unifi\/data\/keystore &#8211; copy it to keystore.old or something like that.<\/li>\n<li>Import the key from your PKCS12 cert into the keystore (change directory to \/usr\/lib\/unifi\/ before running this command) &#8211; <em>keytool -importkeystore -srckeystore &lt;PKCS12 certificate filename&gt; -srcstoretype PKCS12 -srcstorepass aircontrolenterprise -destkeystore data\/keystore -deststorepass aircontrolenterprise -destkeypass aircontrolenterprise -alias unifi -trustcacerts<\/em><\/li>\n<li>Import the certificates you prepared earlier in DER format &#8211; <em>java -jar lib\/ace.jar import_cert &lt;signed server certificate&gt; &lt;signing certificate&gt;<\/em><\/li>\n<li>Grab a beer because you&#8217;re all done<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This one was a bit of a pain. I&#8217;m assuming that you&#8217;ve generated the key, the CSR, sent that off to your CA (or signed it yourself), and received the certificate. You&#8217;ve also converted the certificate to DER format if necessary, since you&#8217;re familiar with openssl. &nbsp; Here&#8217;s the steps I had to go through [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-27","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.f-bit.net\/index.php?rest_route=\/wp\/v2\/posts\/27","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.f-bit.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.f-bit.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.f-bit.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.f-bit.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=27"}],"version-history":[{"count":1,"href":"https:\/\/www.f-bit.net\/index.php?rest_route=\/wp\/v2\/posts\/27\/revisions"}],"predecessor-version":[{"id":28,"href":"https:\/\/www.f-bit.net\/index.php?rest_route=\/wp\/v2\/posts\/27\/revisions\/28"}],"wp:attachment":[{"href":"https:\/\/www.f-bit.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=27"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.f-bit.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=27"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.f-bit.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=27"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}