The main goal is to setup a free valid SSL-certificate for your DS provided by StartSSL.
Before we start you have to have ipkg installed on your DS. We also have to login into our DS. This can be done by enabling the option 'Enable SSH service' which can be found at our Disk Station Manager --> Network Services --> Terminal.
Okay, here we go!
1 -Log in your Synology DS as 'root' using putty (Windows) or using Linux command-prompt with instruction:
- Code: Select all
ssh root@<my-syno-ip-address>
2 - We have to make a map in '/urs/syno' called 'ssl' and copy a openssl.conf from Internet. This is needed for the creation of cerrtificates:
- Code: Select all
cd /usr/syno/
mkdir ssl
cd ssl
wget http://123adm.free.fr/home/pages/documents/syno-cert_fichiers/openssl.cnf
3 - When openssl.conf is downloaded and stored we change to a map which is only accessible to you so no one can copy your keys and crt files:
- Code: Select all
cd /volume1/<my-private-map>
4 - First we have to check our OpenSSL version. Version OpenSSL 0.9.8g 19 Oct 2007 and newer are tested (thanx skipper!). After that we have to generate a private key-file as suggested in http://arnoutboer.nl/weblog/?p=281:
- Code: Select all
openssl version
openssl genrsa -des3 -out some.key 2048
5 - Because a key is needed with no passphrase, a key-file is created from 'some.key' to 'some.nopass.key' with the instruction:
- Code: Select all
openssl rsa -in some.key -out some.nopass.key
6 - Change back to your private map and create a request for a StartSSL verification which will be created as a 'some.csr'-file
- Code: Select all
cd /volume1/<my-private-map>
openssl req -nodes -new -key some.key -out some.csr
Enter pass phrase for some.key: (Enter a the self-made passphrase from step 3)
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]: (Prefix of the country)
State or Province Name (full name) [Some-State]: (State or Province name)
Locality Name (eg, city) []: (City)
Organization Name (eg, company) [Internet Widgits Pty Ltd]: (The name of your company)
Organizational Unit Name (eg, section) []: (The OU)
Common Name (eg, YOUR name) []: Can be your own name at StarttSSL or http://www.your-domain.xxx, FQDN - Fully Qualifed Domain Name)
Email Address []: (your email adress@your-domain)
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: (Just press enter)
An optional company name []: (Just press enter)
7 - Make an account at StartSSL and perform a Domain Validation witch can be found under 'Validations Wizard'.
8 - Choose after login the 'Certificates Wizards'
8.1 - Select Certificate Purpose
* Make sure you have already validated a domain name or email address before using this tool! Select the "Validations Wizard" for this task.
* Depending on your preferences and type of software, you need to have a prepared certificate request (CSR) ready for submission.
Certificate Target: Web Server SSL/TLS Certificate
8.2 - Generate Private Key
* If you created your own private key and certificate request (CSR), please skip this step.
* Provide a password for your private key. (At least 10 characters, max. 32)
* Allowed are only letters and numbers, without spaces!
* Please remember it or write it down somewhere...
Hit the skip button
8.3 - Submit Certificate Request (CSR)
* Copy and paste the content from the certificate request into the textbox below.
* Make sure, that you do not alter the content and you did not add any spaces!
* Always include the headers and footers of the CSR.
* The CSR must have a SHA1 hash or better, MD5 hashes are not allowed.
* The RSA key size must be 2048 bit or higher.
Here you copy/paste the content of your 'some.csr'-file you created in step 6
8.4 - Certificate Request Received
* You submitted your certificate signing request successfully!.
* All content of the certificate signing request is ignored except its public key.
* You may proceed to the next step now.
Hit the 'Continue' Button
8.5 - Add Domains
* Select the top target domain name for your certificate.
* Note: Only domain names which were validated within the last 30 days are eligible for selection.
Choose your domain and hit 'Continue'
8.6 - Add Domains
* You must add one sub domain to this certificate.
* The base domain <mydomainname> will be included by default in the Alt Name section.
* Note: In order to add multiple domains and sub domains, your Identity must be at least Class 2 validated. Check your status at the "Identity Card".
Here you have to fill in the subdomain, http://<subdomain>.<domainname>. For example: www.mydomain.com .
Note: when you do this the first time, consider a testing subdomainname, because when things go wrong you can't delete a subdomain and start over!
Click on 'Continue' when you're done.
8.7 - Ready Processing Certificate
* We have gathered enough information in order to sign your certificate now.
* The common name of this certificate will be set to <subdomain>.<mydomain>
* The certificate will have the following host names supported:
1. <mydomain>
2. <subdomain>.<mydomain>
* Please click on Continue in order to process the certificate.
Click on 'Continue'
8.8 - Save Certificate
* In the textbox below is your PEM encoded certificate.
* Copy and paste the content into a file and save it as ssl.crt.
* Make sure, that you do not alter the content and you did not add any spaces! Save it in ASCII format (plain text).
Save also the intermediate and root CA certificates for the installation at your server (Save As...).
Copy/Paste the content of the shown textbox in a new file called ssl.crt (as suggested) and save the intermediate and root file to your computer.
Note: don't use Wordpad or MS office programs to do that, they will add characters to the content. Use 'Notepad' (Windows) or 'vi' (Linux) instead. I used 'Kate' which is provided with Linux KDE distributions.
When done click the 'Finish'-button
9 - Now we have 6 file's:
Created on the Synology:
- some.key (step 3)
- some.nopass.key (step 4)
- some.csr (step 6)
Created by StartSSL (step 8.8 ) :
- ssl.crt (PEM encoded certificate)
- sub.class1.server.ca.pem (intermediate CA certificate)
- ca.pem (root CA certificate)
Remark: you can also download sub.class1.server.ca.pem and ca.pem directly from http://www.startssl.com/certs/
10 - The final chapter.....
Open your Synology Station Manager and log in with your admin account. Go to 'Management' --> 'Network Services' --> 'Web Services'
The option 'Enable HTTPS connection' has to be enabled. Click on the button 'Import Certificate'.
- At location 'Private Key:' browse to the 'some.nopass.key'-file (made in step 4)
- At location 'Certificate:' browse to the 'ssl.crt'-file (made in step 8.8 )
Hit the 'OK'-button. The web-server will be restarted and your https://<subdomain>.<domainname> is encrypted and verified!
addition: Adding the root and intermediate CA certificate to your Synology Diskstation (Thanx to Dodge!)
(This is a procedure for solving recognition by some (older) browser(version)s who do not recognize StartCom as a valid Certificate Authority)
11 -Log in your Synology DS as 'root' using putty (Windows) or using Linux command-prompt with instruction:
- Code: Select all
ssh root@<my-syno-ip-address>
12 - Change to the map, which is only accessible to you, where you stored the ca.pem and sub.class1.server.ca.pem files:
- Code: Select all
cd /volume1/<my-private-map>
13 - Make a new map called ssl.root in /usr/syno/etc/ssl:
- Code: Select all
mkdir /usr/syno/etc/ssl/ssl.root
14 - Copy the ca.pem and sub.class1.server.ca.pem to the new map:
- Code: Select all
cp ca.pem /usr/syno/etc/ssl/ssl.root/
cp sub.class1.server.ca.pem /usr/syno/etc/ssl/ssl.root
15 - Change the owner/file permissions to user 'root', group 'root' and make it read only for root:
- Code: Select all
chown root:root /usr/syno/etc/ssl/ssl.root/*.pem
chmod 400 /usr/syno/etc/ssl/ssl.root/*.pem
16 - Add the certificates to your apache user- or system server. The user-webserver is the Apache configuration for you own website, the system-webserver handles the Synology system web-services (like the filemanager etc.). In this example we use the user-webserver:
- Code: Select all
vi /usr/syno/apache/conf/extra/httpd-ssl.conf-user
- press the 'a' -key to enter the 'text-editing-modus'. Now you can add the following text:
- Code: Select all
SSLCertificateChainFile /usr/syno/etc/ssl/ssl.root/sub.class1.server.ca.pem
- Add the following text:
- Code: Select all
SSLCACertificateFile /usr/syno/etc/ssl/ssl.root/ca.pem
- Now we want to save the file and exit. Hit the <ESC>-key to exit the 'text-editing-modus' and hit the following key-strokes ending with <ENTER>-key:
- Code: Select all
:wq!
NOTE: Changes made in /usr/syno/apache/conf/extra/httpd-ssl.conf-user or /usr/syno/apache/conf/extra/httpd-ssl.conf-sys do not survive a firmware update. Please remember to make the changes again after a firmware update.
16 - Finally, restart the Apache server:
- Code: Select all
/usr/syno/etc/rc.d/S97apache-user.sh restart
Done!
Remember to store/backup the files from step 9 to a save and secure location, only accessible to you! When done, remove the files in /volume1/<my-private-map> and on your computer.
A full Dutch translation is published here.
If you got additions to this wikki, don't hesitate to post your remarks!




