{"id":239,"date":"2021-12-26T15:56:59","date_gmt":"2021-12-26T23:56:59","guid":{"rendered":"https:\/\/perilouscodpiece.org\/blaeg\/?p=239"},"modified":"2021-12-26T15:57:00","modified_gmt":"2021-12-26T23:57:00","slug":"replacing-the-self-signed-ssl-cert-on-a-tp-link-omada-oc200-hardware-controller","status":"publish","type":"post","link":"https:\/\/perilouscodpiece.org\/blaeg\/2021\/12\/26\/replacing-the-self-signed-ssl-cert-on-a-tp-link-omada-oc200-hardware-controller\/","title":{"rendered":"replacing the self-signed ssl cert on a TP-Link Omada OC200 Hardware Controller"},"content":{"rendered":"\n<p>Since TP-Link&#8217;s documentation is *awesome* for this (sarcasm alert), I thought I&#8217;d share what I finally figured out to get the self-signed cert replaced with one from a local CA that doesn&#8217;t make Chrome complain.  This was the result of several hours of fiddling around, waiting for oc200 reboots, and getting uber-helpful error messages from the device (sarcasm meter explodes).<br \/><br \/>Pre-reqs:<br \/> 1. passing familiarity with openssl command-line usage, including how to set up a local certificate authority (CA; out of scope for this post\/rant but this looks decent as an intro: https:\/\/gist.github.com\/Soarez\/9688998)<br \/> 2. the patience not to see how far you can shot-put the oc200 device<br \/> 3. some machine with openssl installed (I used a linux machine running ubuntu 20.04 fwiw)<br \/><br \/>First, you&#8217;ll want to create a config file to save typing later and enable Subject Alternate Names for your cert (so the same cert&#8217;ll be valid from the controller raw ip, or name, or short name).  Call it san.conf or similar. <br \/><pre>[req]<br \/>req_extensions = req_ext<br \/>distinguished_name = req_distinguished_name<br \/>prompt=no<br \/><br \/>[req_distinguished_name]<br \/>countryName                     = <br \/>stateOrProvinceName             = <br \/>localityName                    = <br \/>organizationalUnitName          = <br \/>commonName                      = <br \/>emailAddress                    = <br \/><br \/>[req_ext]<br \/>subjectAltName = @alt_names<br \/><br \/>[alt_names] <br \/>IP.1=192.168.5.2<br \/>DNS.1=oc200.lan.example.com<br \/>DNS.2=oc200<\/pre><br \/><br \/>Now, on to making the actual cert (filenames may of course be altered to your taste, just be consistent):<br \/><br \/>1. openssl req -new -keyout oc200.key -sha256 -config san.conf -out oc200.csr<br \/> a. note that you probably want a password here (used by key).<br \/> b. if you&#8217;re ok with a less secure key sans password, add a -nodes argument above<br \/><br \/>2. openssl x509 -req -days 365 -in oc200.csr -CA  -CAkey  -CAcreateserial -extensions req_ext -extfile san.conf -out oc200.crt<br \/> a. note that recent chrome builds are moving to deny validity of certs with longer than one year. (imho this is overkill for rfc1918 networks, but c&#8217;est la guerre.)<br \/><br \/>3. openssl pkcs12 -export -in oc200.crt -inkey oc200.key -out oc200.pfx -CApath \/etc\/ssl\/certs\/ -CAfile  -caname root -name oc200 -chain<br \/> a. note that you probably want to use a password here as well<br \/> b. note also that the Omada web ui is picky about filename extensions. you&#8217;ll want to end your pkcs12-exported cert to end in &#8220;.pfx&#8221; to keep it happy on upload later<br \/><br \/>From here, with the pfx file and (optionally, but recommended) the key and pfx passwords, you can proceed to Settings &gt; Controller &gt; HTTP Certificate session, upload your pfx file, fill in any required passwords (be sure to pay attention to which password is which re: key vs cert file aka keystore), and save at the bottom of the screen.  You will then want to go to Settings &gt; Maintenance &gt; Hardware Controller section and reboot (this will take several minutes to complete).  <br \/><br \/>You may also need to do a full flush of your browser&#8217;s cache if there were earlier attempts with the same identity cert (e.g. accidentally making it valid for too long and learning a painful lesson). You will need to import the root CA cert into your browser\/OS trusted roots collection as well if you haven&#8217;t already done so (out of scope for this, but googling something like &#8220;import root ca cert &#8221; would help).<br \/><br \/>Hope this saves someone a few hours of irritation. :) <br \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Since TP-Link&#8217;s documentation is *awesome* for this (sarcasm alert), I thought I&#8217;d share what I finally figured out to get the self-signed cert replaced with one from a local CA that doesn&#8217;t make Chrome complain. This was the result of several hours of fiddling around, waiting for oc200 reboots, and getting uber-helpful error messages from &hellip; <a href=\"https:\/\/perilouscodpiece.org\/blaeg\/2021\/12\/26\/replacing-the-self-signed-ssl-cert-on-a-tp-link-omada-oc200-hardware-controller\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">replacing the self-signed ssl cert on a TP-Link Omada OC200 Hardware Controller<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-239","post","type-post","status-publish","format-standard","hentry","category-tech"],"_links":{"self":[{"href":"https:\/\/perilouscodpiece.org\/blaeg\/wp-json\/wp\/v2\/posts\/239","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/perilouscodpiece.org\/blaeg\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/perilouscodpiece.org\/blaeg\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/perilouscodpiece.org\/blaeg\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/perilouscodpiece.org\/blaeg\/wp-json\/wp\/v2\/comments?post=239"}],"version-history":[{"count":2,"href":"https:\/\/perilouscodpiece.org\/blaeg\/wp-json\/wp\/v2\/posts\/239\/revisions"}],"predecessor-version":[{"id":242,"href":"https:\/\/perilouscodpiece.org\/blaeg\/wp-json\/wp\/v2\/posts\/239\/revisions\/242"}],"wp:attachment":[{"href":"https:\/\/perilouscodpiece.org\/blaeg\/wp-json\/wp\/v2\/media?parent=239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/perilouscodpiece.org\/blaeg\/wp-json\/wp\/v2\/categories?post=239"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/perilouscodpiece.org\/blaeg\/wp-json\/wp\/v2\/tags?post=239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}