<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.discord.digital/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Pixl</id>
	<title>DiscordDigital Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.discord.digital/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Pixl"/>
	<link rel="alternate" type="text/html" href="https://wiki.discord.digital/Special:Contributions/Pixl"/>
	<updated>2026-04-24T21:27:26Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.36.1</generator>
	<entry>
		<id>https://wiki.discord.digital/index.php?title=How_to_become_a_local_TLS_certificate_authority&amp;diff=20</id>
		<title>How to become a local TLS certificate authority</title>
		<link rel="alternate" type="text/html" href="https://wiki.discord.digital/index.php?title=How_to_become_a_local_TLS_certificate_authority&amp;diff=20"/>
		<updated>2021-02-27T20:00:41Z</updated>

		<summary type="html">&lt;p&gt;Pixl: Added Let&amp;#039;s Encrypt link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h2&amp;gt;Prologue&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;This guide will show you how to create your own local certificate authority and how to create and sign certificates with it.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;You can use this for local web development, or for anything that requires a self-signed certificate.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;For external websites that are available through the internet I recommend using [https://letsencrypt.org/ Let’s Encrypt] which is free.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Prerequisites&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Before you can start you need to fulfill following conditions to make this guide work:&amp;lt;/p&amp;gt;&lt;br /&gt;
#Have a Linux system with openssl installed.&lt;br /&gt;
#Be administrator or have root privileges on the systems you want to install the certificate on.&lt;br /&gt;
#Know basic linux commands and have a rough understanding of how CA certificates work.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Creating the certificate authority&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Generating the CA key file&amp;lt;/h3&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;At this point we need to give our certificate authority a name.&amp;lt;br&amp;gt;&lt;br /&gt;
I decided to name it &amp;quot;DigitalCA&amp;quot;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;We create a folder to put our CA files in:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir -p /opt/CA/&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Change the directory to the newly created folder:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;cd /opt/CA/&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Then we create our certificate key file:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;openssl genrsa -des3 -out DigitalCA.key 2048&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;You will be prompted to enter a password. &amp;lt;br&amp;gt;&lt;br /&gt;
Do not skip this step, the password will be used everytime you sign a certificate.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Generating the root certificate file&amp;lt;/h3&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;openssl req -x509 -new -nodes -key DigitalCA.key -sha256 -days 1825 -out DigitalCA.pem&amp;lt;/code&amp;gt;&lt;br /&gt;
{| style=&amp;quot;border:1px solid black&amp;quot;&lt;br /&gt;
| If you create this CA for Apple devices. Do not exceed 825 days, otherwise the certificate will be invalid.&lt;br /&gt;
This is a restriction Apple specifically made for their devices on self-signed certificates.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;p&amp;gt;During the creation you will be asked to enter the password you entered earlier.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;When asked for the Common Name I suggest you enter something you will recognize, such as DigitalCA in this case.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;At this point you&amp;#039;re done, make sure to remember the password and backup these files safely.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Creating a certificate for a local website&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;First we define a folder to put our files in. &amp;lt;br&amp;gt;&lt;br /&gt;
In this case I chose &amp;quot;/opt/DigitalWeb&amp;quot;, as the DNS name will be digitalweb.domain.lan&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir -p /opt/DigitalWeb&amp;lt;/code&amp;gt;&lt;br /&gt;
Then we navigate into our folder.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;cd /opt/DigitalWeb&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;We create the key file for our DigitalWeb website:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;openssl genrsa -out digitalweb.domain.lan.key 2048&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Next we create the CSR file which we need later to sign it with our CA.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;openssl req -new -key digitalweb.domain.lan.key -out digitalweb.domain.lan.csr&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;You will be asked a lot of questions. Make sure when it asks for Common Name to enter the server FQDN. In this case: digitalweb.domain.lan&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;We create a new file named: digitalweb.domain.lan.ext&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Paste in following text and adjust it to your needs.&amp;lt;br&amp;gt;&lt;br /&gt;
You can add more DNS names at the bottom.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;authorityKeyIdentifier=keyid,issuer&lt;br /&gt;
basicConstraints=CA:FALSE&lt;br /&gt;
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment&lt;br /&gt;
subjectAltName = @alt_names&lt;br /&gt;
&lt;br /&gt;
[alt_names]&lt;br /&gt;
DNS.1 = digitalweb.domain.lan&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Save the file and create the certificate with following command:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;openssl x509 -req -in digitalweb.domain.lan.csr -CA /opt/CA/DigitalCA.pem -CAkey /opt/CA/DigitalCA.key -CAcreateserial -out digitalweb.domain.lan.crt -days 825 -sha256 -extfile digitalweb.domain.lan.ext&amp;lt;/code&amp;gt;&lt;br /&gt;
{| style=&amp;quot;border:1px solid black&amp;quot;&lt;br /&gt;
| If you create this certificate for Apple devices. Do not exceed 825 days, otherwise the certificate will be invalid.&lt;br /&gt;
This is a restriction Apple specifically made for their devices on self-signed certificates.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;p&amp;gt;After entering the password your CA you will have following files:&amp;lt;/p&amp;gt;&lt;br /&gt;
*/opt/DigitalWeb/digitalweb.domain.lan.crt&lt;br /&gt;
*/opt/DigitalWeb/digitalweb.domain.lan.ext&lt;br /&gt;
*/opt/DigitalWeb/digitalweb.domain.lan.csr&lt;br /&gt;
*/opt/DigitalWeb/digitalweb.domain.lan.key&lt;br /&gt;
&amp;lt;p&amp;gt;Using the crt and key file you can now use it within any webserver and run the page with that certificate.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Keep in mind, for that certificate to be valid, the device needs to have the CA installed.&amp;lt;/br&amp;gt;&lt;br /&gt;
In the next step we will import our certificate to a Windows computer, this works on phones, tablets and also on linux.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Importing the CA certificate on Windows&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;We open our settings for &amp;quot;computer certificates&amp;quot;, we can do that by searching it on Windows.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Then we right click &amp;quot;Trusted Root Certification Authorities&amp;quot; and go to &amp;quot;All Tasks&amp;quot; and &amp;quot;Import&amp;quot;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;The window you&amp;#039;re looking for looks like this:&amp;lt;/p&amp;gt;&lt;br /&gt;
[[File:Windows_computer_certificate_import.png]]&lt;br /&gt;
&amp;lt;p&amp;gt;In this case we import the file &amp;lt;b&amp;gt;DigitalCA.pem&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;After it has been imported, it will work out of the box on all browsers except Firefox.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;For Firefox follow the next step in this guide.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Configuring Firefox to allow certificate authorities from the computer&amp;lt;/h3&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;In the URL bar of Firefox we type in:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;about:config&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;We will be prompted with a security warning, we confirm it with &amp;quot;Accept the risk and continue&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then we search on top of the page for: &amp;quot;enterprise_root&amp;quot;, we can set the option to &amp;lt;b&amp;gt;True&amp;lt;/b&amp;gt; by double clicking it.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Firefox will now check against any certificate authorities you imported on your operating system.&amp;lt;/p&amp;gt;&lt;br /&gt;
[[Category:cryptography]]&lt;br /&gt;
[[Category:certificates]]&lt;br /&gt;
[[Category:Web development]]&lt;/div&gt;</summary>
		<author><name>Pixl</name></author>
	</entry>
</feed>