From cedbc11e15bd70fef3a55d4c0f6b57eda6a52fcc Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 3 Apr 2015 18:39:04 +0100 Subject: [PATCH] Simplify the certificate renewal instructions --- doc/EN/faq.org | 82 +++++---------------------------- website/EN/faq.html | 110 ++++++-------------------------------------- 2 files changed, 27 insertions(+), 165 deletions(-) diff --git a/doc/EN/faq.org b/doc/EN/faq.org index d6601271..d99fb26e 100644 --- a/doc/EN/faq.org +++ b/doc/EN/faq.org @@ -274,91 +274,33 @@ Now go to [[startssl.com]] and click on the keys icon on the right hand side to Once your email is validated then go to *Validations Wizard* and choose *Domain name validation*. Enter your domain name and select *postmaster@yourdomainname*. After a while you should receive a validation email and you can then enter the code. -Log into the Freedombone and become the root user. Now we can generate a new certificate request as follows. +Log in to the Freedombone, become the root user, then issue the renew command: #+BEGIN_SRC bash -export HOSTNAME=mydomainname.com -openssl genrsa -out /etc/ssl/private/$HOSTNAME.new.key 2048 -chown root:ssl-cert /etc/ssl/private/$HOSTNAME.new.key -chmod 440 /etc/ssl/private/$HOSTNAME.new.key -mkdir /etc/ssl/requests +ssh username@mydomainname -p 2222 +su +freedombone-renew-cert -h mydomainname #+END_SRC -Now make a certificate request as follows. You should copy and paste the whole of this, not just line by line. - -#+BEGIN_SRC bash -openssl req -new -sha256 -key /etc/ssl/private/$HOSTNAME.new.key -out /etc/ssl/requests/$HOSTNAME.csr -#+END_SRC - -For the email address it's a good idea to use postmaster@mydomainname. +For the email address it's a good idea to use /postmaster@mydomainname/. Use a random 20 character password, and keep a note of it. We'll remove this later. -View the request with: +On the StartSSL site select *Certificates Wizard* then *Web server SSL/TLS Certificate*. You can then click on "skip" and then copy and paste the certificate request into the text entry box. You may now need to wait a few hours for a confirmation email indicating that the new certificate was created. + +Select *Tool Box* and then *Retrieve Certificate* from the list. Make sure to choose the one with the correct expiration date. Copy the text, then on the Freedombone. #+BEGIN_SRC bash -cat /etc/ssl/requests/$HOSTNAME.csr +editor /etc/ssl/certs/mydomainname.new.crt #+END_SRC -On the StartSSL site select *Certificates Wizard* then *Web server SSL/TLS Certificate*. You can then click on "skip" and then copy and paste the encrypted request into the text entry box. You may now need to wait a few hours for a confirmation email indicating that the new certificate was created. - -Select *Tool Box* and then *Retrieve Certificate* from the list. Make sure to choose the one with the correct expiration date. Copy the text. +Paste the public key from the StartSSL site. Save and exit. Then run the renew command again: #+BEGIN_SRC bash -mv /etc/ssl/private/$HOSTNAME.new.key /etc/ssl/private/$HOSTNAME.key -editor /etc/ssl/certs/$HOSTNAME.crt -#+END_SRC - -Delete any existing contents then paste the public key from the StartSSL site. Save and exit. Then run the following commands: - -#+BEGIN_SRC bash -mkdir /etc/ssl/roots -mkdir /etc/ssl/chains -wget "http://www.startssl.com/certs/ca.pem" --output-document="/etc/ssl/roots/startssl-root.ca" -wget "http://www.startssl.com/certs/sub.class1.server.ca.pem" --output-document="/etc/ssl/chains/startssl-sub.class1.server.ca.pem" -wget "http://www.startssl.com/certs/sub.class2.server.ca.pem" --output-document="/etc/ssl/chains/startssl-sub.class2.server.ca.pem" -wget "http://www.startssl.com/certs/sub.class3.server.ca.pem" --output-document="/etc/ssl/chains/startssl-sub.class3.server.ca.pem" -ln -s "/etc/ssl/roots/startssl-root.ca" "/etc/ssl/roots/$HOSTNAME-root.ca" -ln -s "/etc/ssl/chains/startssl-sub.class1.server.ca.pem" "/etc/ssl/chains/$HOSTNAME.ca" -cp "/etc/ssl/certs/$HOSTNAME.crt" "/etc/ssl/certs/$HOSTNAME.crt+chain+root" -test -e "/etc/ssl/chains/$HOSTNAME.ca" && cat "/etc/ssl/chains/$HOSTNAME.ca" >> "/etc/ssl/certs/$HOSTNAME.crt+chain+root" -test -e "/etc/ssl/roots/$HOSTNAME-root.ca" && cat "/etc/ssl/roots/$HOSTNAME-root.ca" >> "/etc/ssl/certs/$HOSTNAME.crt+chain+root" -#+END_SRC - -Remove the certificate password, so if the server is rebooted then it won't wait indefinitely for a non-existant keyboard user to type in a password. - -#+BEGIN_SRC bash -openssl rsa -in /etc/ssl/private/$HOSTNAME.key -out /etc/ssl/private/$HOSTNAME.new.key -cp /etc/ssl/private/$HOSTNAME.new.key /etc/ssl/private/$HOSTNAME.key -shred -zu /etc/ssl/private/$HOSTNAME.new.key -#+END_SRC - -Create a bundled certificate which joins the certificate and chain file together. - -#+BEGIN_SRC bash -cat /etc/ssl/certs/$HOSTNAME.crt /etc/ssl/chains/startssl-sub.class1.server.ca.pem > /etc/ssl/certs/$HOSTNAME.bundle.crt -#+END_SRC - -And also add it to the overall bundle of certificates for the Freedombone. This will allow you to easily install the certificates onto other systems. - -#+BEGIN_SRC bash -cp /etc/ssl/certs/$HOSTNAME.bundle.crt /etc/ssl/mycerts -cat /etc/ssl/mycerts/*.crt > /etc/ssl/freedombone-bundle.crt -tar -czvf /etc/ssl/freedombone-certs.tar.gz /etc/ssl/mycerts/*.crt -#+END_SRC - -To avoid any possibility of the certificates being accidentally overwritten by self-signed ones at a later date you can create backups. - -#+BEGIN_SRC bash -mkdir /etc/ssl/backups -mkdir /etc/ssl/backups/certs -mkdir /etc/ssl/backups/private -cp /etc/ssl/certs/$HOSTNAME* /etc/ssl/backups/certs/ -cp /etc/ssl/private/$HOSTNAME* /etc/ssl/backups/private/ -chmod -R 400 /etc/ssl/backups/certs/* -chmod -R 400 /etc/ssl/backups/private/* +freedombone-renew-cert -h mydomainname #+END_SRC +The new certificate will then be installed. * Why use self-signed certificates? Almost everywhere on the web you will read that self-signed certificates are worthless. They bring up scary looking browser warnings and gurus will advise you not to use them. Self-signed certificates are quite useful though. What the scary warnings mean - and it would be good if they explained this more clearly - is that you have an encrypted connection established but there is /no certainty about who that connection is with/. The usual solution to this is to get a "real" SSL certificate from one of the certificate authorities, but it's far from clear that such authorities can be trusted. There have been various scandals involving such organisations, and it does not seem plausible to assume that they are somehow immune to the sort of treatment which [[http://en.wikipedia.org/wiki/Lavabit][Lavabit]] received. So although most internet users have been trained to look for the lock icon as an indication that the connection is secured that belief may not always be well founded. diff --git a/website/EN/faq.html b/website/EN/faq.html index ce71bb0b..dcef87e8 100644 --- a/website/EN/faq.html +++ b/website/EN/faq.html @@ -4,7 +4,7 @@ - + @@ -630,31 +630,19 @@ Once your email is validated then go to Validations Wizard and choose

-Log into the Freedombone and become the root user. Now we can generate a new certificate request as follows. +Log in to the Freedombone, become the root user, then issue the renew command:

-
export HOSTNAME=mydomainname.com
-openssl genrsa -out /etc/ssl/private/$HOSTNAME.new.key 2048
-chown root:ssl-cert /etc/ssl/private/$HOSTNAME.new.key
-chmod 440 /etc/ssl/private/$HOSTNAME.new.key
-mkdir /etc/ssl/requests
+
ssh username@mydomainname -p 2222
+su
+freedombone-renew-cert -h mydomainname
 

-Now make a certificate request as follows. You should copy and paste the whole of this, not just line by line. -

- -
- -
openssl req -new -sha256 -key /etc/ssl/private/$HOSTNAME.new.key -out /etc/ssl/requests/$HOSTNAME.csr
-
-
- -

-For the email address it's a good idea to use postmaster@mydomainname. +For the email address it's a good idea to use postmaster@mydomainname.

@@ -662,102 +650,34 @@ Use a random 20 character password, and keep a note of it. We'll remove this la

-View the request with: +On the StartSSL site select Certificates Wizard then Web server SSL/TLS Certificate. You can then click on "skip" and then copy and paste the certificate request into the text entry box. You may now need to wait a few hours for a confirmation email indicating that the new certificate was created. +

+ +

+Select Tool Box and then Retrieve Certificate from the list. Make sure to choose the one with the correct expiration date. Copy the text, then on the Freedombone.

-
cat /etc/ssl/requests/$HOSTNAME.csr
+
editor /etc/ssl/certs/mydomainname.new.crt
 

-On the StartSSL site select Certificates Wizard then Web server SSL/TLS Certificate. You can then click on "skip" and then copy and paste the encrypted request into the text entry box. You may now need to wait a few hours for a confirmation email indicating that the new certificate was created. -

- -

-Select Tool Box and then Retrieve Certificate from the list. Make sure to choose the one with the correct expiration date. Copy the text. +Paste the public key from the StartSSL site. Save and exit. Then run the renew command again:

-
mv /etc/ssl/private/$HOSTNAME.new.key /etc/ssl/private/$HOSTNAME.key
-editor /etc/ssl/certs/$HOSTNAME.crt
+
freedombone-renew-cert -h mydomainname
 

-Delete any existing contents then paste the public key from the StartSSL site. Save and exit. Then run the following commands: +The new certificate will then be installed.

- -
- -
mkdir /etc/ssl/roots
-mkdir /etc/ssl/chains
-wget "http://www.startssl.com/certs/ca.pem" --output-document="/etc/ssl/roots/startssl-root.ca"
-wget "http://www.startssl.com/certs/sub.class1.server.ca.pem" --output-document="/etc/ssl/chains/startssl-sub.class1.server.ca.pem"
-wget "http://www.startssl.com/certs/sub.class2.server.ca.pem" --output-document="/etc/ssl/chains/startssl-sub.class2.server.ca.pem"
-wget "http://www.startssl.com/certs/sub.class3.server.ca.pem" --output-document="/etc/ssl/chains/startssl-sub.class3.server.ca.pem"
-ln -s "/etc/ssl/roots/startssl-root.ca" "/etc/ssl/roots/$HOSTNAME-root.ca"
-ln -s "/etc/ssl/chains/startssl-sub.class1.server.ca.pem" "/etc/ssl/chains/$HOSTNAME.ca"
-cp "/etc/ssl/certs/$HOSTNAME.crt" "/etc/ssl/certs/$HOSTNAME.crt+chain+root"
-test -e "/etc/ssl/chains/$HOSTNAME.ca" && cat "/etc/ssl/chains/$HOSTNAME.ca" >> "/etc/ssl/certs/$HOSTNAME.crt+chain+root"
-test -e "/etc/ssl/roots/$HOSTNAME-root.ca" && cat "/etc/ssl/roots/$HOSTNAME-root.ca" >> "/etc/ssl/certs/$HOSTNAME.crt+chain+root"
-
-
- -

-Remove the certificate password, so if the server is rebooted then it won't wait indefinitely for a non-existant keyboard user to type in a password. -

- -
- -
openssl rsa -in /etc/ssl/private/$HOSTNAME.key -out /etc/ssl/private/$HOSTNAME.new.key
-cp /etc/ssl/private/$HOSTNAME.new.key /etc/ssl/private/$HOSTNAME.key
-shred -zu /etc/ssl/private/$HOSTNAME.new.key
-
-
- -

-Create a bundled certificate which joins the certificate and chain file together. -

- -
- -
cat /etc/ssl/certs/$HOSTNAME.crt /etc/ssl/chains/startssl-sub.class1.server.ca.pem > /etc/ssl/certs/$HOSTNAME.bundle.crt
-
-
- -

-And also add it to the overall bundle of certificates for the Freedombone. This will allow you to easily install the certificates onto other systems. -

- -
- -
cp /etc/ssl/certs/$HOSTNAME.bundle.crt /etc/ssl/mycerts
-cat /etc/ssl/mycerts/*.crt > /etc/ssl/freedombone-bundle.crt
-tar -czvf /etc/ssl/freedombone-certs.tar.gz /etc/ssl/mycerts/*.crt
-
-
- -

-To avoid any possibility of the certificates being accidentally overwritten by self-signed ones at a later date you can create backups. -

- -
- -
mkdir /etc/ssl/backups
-mkdir /etc/ssl/backups/certs
-mkdir /etc/ssl/backups/private
-cp /etc/ssl/certs/$HOSTNAME* /etc/ssl/backups/certs/
-cp /etc/ssl/private/$HOSTNAME* /etc/ssl/backups/private/
-chmod -R 400 /etc/ssl/backups/certs/*
-chmod -R 400 /etc/ssl/backups/private/*
-
- -

Why use self-signed certificates?