{"id":441,"date":"2013-02-28T13:45:31","date_gmt":"2013-02-28T12:45:31","guid":{"rendered":"http:\/\/songoku.homelinux.com\/wordpress\/?p=441"},"modified":"2023-10-24T17:13:18","modified_gmt":"2023-10-24T15:13:18","slug":"create-self-signed-certificates-with-openssl","status":"publish","type":"post","link":"https:\/\/ndk.sytes.net\/wordpress\/?p=441","title":{"rendered":"Create self-signed certificates with OpenSSL"},"content":{"rendered":"\n<p>Hey, here are a few steps to create your own self-signed certificates with your own CA:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Generate your 4096 bit CA key (no password):<br><em># openssl genrsa -out CA.key 4096<\/em><br>or generate one with a password:<br><em>#&nbsp;openssl genrsa -out CA.key 4096&nbsp;-des3<\/em><\/li>\n<\/ol>\n\n\n\n<p><strong>\u200bPlease note that if someone gets this key and it&#8217;s not password protected he can generate valid certificates in your name, which is really really bad, so keep it secret!<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\">\n<li>Generate your CA certificate:<br><em># openssl req -new -x509 -extensions v3_ca -key CA.key -days 10000 -out CA.crt<\/em><\/li>\n<\/ol>\n\n\n\n<p>\u200bThis creates a valid CA certificate wich is valid for 10000 days. Why so long? Because when this CA expires you have to revoke and regenerate all the certificates based on this one which could be timeconsuming, but feel free to set a lower number.&nbsp;<span style=\"line-height: 1.6em;\">In order to recognize your self-signed certificates this CA must be installed on your computer which calls the website or alike. which varies between operating systems and programs.<\/span><\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"3\">\n<li>Generate a key for the server (again with or without password, simply add -des3 if you want password protection):<br><em># openssl genrsa -out server.key 4096<\/em><\/li>\n\n\n\n<li>Create A CSR (certificat signing request):<br><em># openssl req -new -key server.key -out server.csr<em>\u200b<\/em><\/em><\/li>\n<\/ol>\n\n\n\n<p>\u200bNow before creating a CRT file: if you need multiple domains you can specifiy them in a separate file. In my example i named it multidomains.cnf and added the following line:<\/p>\n\n\n\n<p>subjectAltName=DNS:www.domain.com,DNS:mail.domain.com,DNS:domain.com,DNS:mysql.domain.com<\/p>\n\n\n\n<p>Please note that you need to specify the normal domain too (domain.com) in this file and as CommonName when generating the CSR.<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"5\">\n<li>Generate the server certificate:<br><em># openssl x509 -req -in server.csr -CA CA.crt -CAkey CA.key -CAcreateserial -out server.crt -days 365<\/em><br>generate with multidomains:<br><em># openssl x509 -req -in server.csr -CA CA.crt -CAkey CA.key -CAcreateserial -extfile multidomains.cnf -out server.crt -days 365<\/em><\/li>\n<\/ol>\n\n\n\n<p>In case you want the to do quickly a certificate, you can do it also in one line:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout server.key -out server.crt<\/code><\/code><\/pre>\n\n\n\n<p>\u200bAll you have to do now is copy the <em>server.key<\/em>&nbsp;and <em>server.crt<\/em>&nbsp;onto your machine and configure your application to use this certificates.<\/p>\n\n\n\n<p>Here are some useful sites if found about SSL:<br><a href=\"http:\/\/www.chainsawonatireswing.com\/2013\/01\/28\/creating-self-signed-website-certificates-while-acting-as-your-own-certificate-authority\/#Create_the_root_key\" target=\"_blank\" rel=\"noopener\">http:\/\/www.chainsawonatireswing.com<\/a><br><a href=\"http:\/\/phaseshiftllc.com\/articles\/2008\/10\/27\/multiple-secure-subdomains-with-a-wildcard-ssl-certificate.html\" target=\"_blank\" rel=\"noopener\">http:\/\/phaseshiftllc.com<\/a><br><a href=\"http:\/\/blog.didierstevens.com\/2008\/12\/30\/howto-make-your-own-cert-with-openssl\/\" target=\"_blank\" rel=\"noopener\">http:\/\/blog.didierstevens.com<\/a><br><a href=\"http:\/\/shib.kuleuven.be\/docs\/ssl_commands.shtml\" target=\"_blank\" rel=\"noopener\">http:\/\/shib.kuleuven.be<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey, here are a few steps to create your own self-signed certificates with your own CA: \u200bPlease note that if someone gets this key and it&#8217;s not password protected he can generate valid certificates in your name, which is really really bad, so keep it secret! \u200bThis creates a valid CA certificate wich is valid [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,10,7,9],"tags":[],"class_list":["post-441","post","type-post","status-publish","format-standard","hentry","category-linuxunix","category-mac-osx","category-servers","category-windows"],"_links":{"self":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/441","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=441"}],"version-history":[{"count":3,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/441\/revisions"}],"predecessor-version":[{"id":1287,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/441\/revisions\/1287"}],"wp:attachment":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=441"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=441"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=441"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}