|
2 | 2 |
|
3 | 3 | Certificates are used to certify that your server is the genuine one and not a falsified one.
|
4 | 4 |
|
5 |
| -YunoHost provides a self-signed certificate. |
| 5 | +YunoHost provides a **self-signed** certificate, it means that your server guaranty the certificate validity. It's enough **for personal usage**, because you trust your own server. But this could be a problem if you want to open access to anonymous like web user for a website. |
| 6 | +Concretely users will go throw a screen like this: |
6 | 7 |
|
7 |
| -Client software (web browser, email client, XMPP client, etc) typically requires you to manually add an exception for that self-signed certificate. |
| 8 | +<img src="https://yunohost.org/images/postinstall_error.png" style="max-width:100%;border-radius: 5px;border: 1px solid rgba(0,0,0,0.15);box-shadow: 0 5px 15px rgba(0,0,0,0.35);"> |
8 | 9 |
|
9 |
| -You can have a certificate signed by an authority, in which case you must upload the appropriate certificate KEY and CRT files to the following files: |
| 10 | +This screen ask to the user : **"Do you trust this server that host this website?"** |
| 11 | +It could afraid a lot of users (rightly). |
| 12 | + |
| 13 | +To avoid this confusion, it's possible to get a signed certificate by a "known" authority : **Gandi**, **RapidSSL**, **StartSSL**, **CaCert**. |
| 14 | +In these cases, the point is to replace the self-signed certificate by the one that have been certified by an certificate authority, and the users won't have this warning screen anymore. |
| 15 | + |
| 16 | +### Add a signed certificate by an authority |
| 17 | + |
| 18 | +Get your certificate from your CA, you must get a private key, file key and a public certificate (file .crt) |
| 19 | +> Be carefull, the key file is very critical, it's strictly personal and have to be secured. |
| 20 | +
|
| 21 | +Copy this two files on the server, if not. |
| 22 | + |
| 23 | +```bash |
| 24 | +scp CERTIFICAT.crt [email protected]:ssl.crt |
| 25 | +scp CLE.key [email protected]:ssl.key |
| 26 | +``` |
| 27 | + |
| 28 | +From Windows, scp can be used with putty, download [pscp](http://the.earth.li/~sgtatham/putty/latest/x86/pscp.exe) |
| 29 | + |
| 30 | +```bash |
| 31 | +pscp -P 22 CERTIFICAT.crt [email protected]:ssl.crt |
| 32 | +pscp -P 22 CLE.key [email protected]:ssl.key ``` |
| 33 | +
|
| 34 | +Now the files are in the server. Open a shell on the server use [ssh](https://yunohost.org/#/ssh_fr) or locally. |
| 35 | +
|
| 36 | +First, create a directory for archive the certificates. |
| 37 | +
|
| 38 | +```bash |
| 39 | +sudo mkdir /etc/yunohost/certs/DOMAIN.TLD/ae_certs |
| 40 | +sudo mv ssl.key ssl.crt /etc/yunohost/certs/DOMAIN.TLD/ae_certs/``` |
| 41 | +
|
| 42 | +Then go to the parent directory and go on. |
| 43 | +
|
| 44 | +```bash |
| 45 | +cd /etc/yunohost/certs/DOMAIN.TLD/``` |
| 46 | +
|
| 47 | +Make a backup of the YunoHost original certificates , to be safe! |
| 48 | +
|
| 49 | +```bash |
| 50 | +sudo mkdir yunohost_self_signed |
| 51 | +sudo mv *.pem *.cnf yunohost_self_signed/``` |
| 52 | +
|
| 53 | +Depends on the CA, intermediate certificates and root have to be downloaded. |
| 54 | +
|
| 55 | +> **StartSSL** |
| 56 | +> ```bash |
| 57 | +> sudo wget http://www.startssl.com/certs/ca.pem -O ae_certs/ca.pem |
| 58 | +> sudo wget http://www.startssl.com/certs/sub.class1.server.ca.pem -O ae_certs/intermediate_ca.pem``` |
| 59 | +
|
| 60 | +> **Gandi** |
| 61 | +> ```bash |
| 62 | +> sudo wget https://www.gandi.net/static/CAs/GandiStandardSSLCA.pem -O ae_certs/intermediate_ca.pem``` |
| 63 | +
|
| 64 | +> **RapidSSL** |
| 65 | +> ```bash |
| 66 | +> sudo wget https://knowledge.rapidssl.com/library/VERISIGN/INTERNATIONAL_AFFILIATES/RapidSSL/AR1548/RapidSSLCABundle.txt -O ae_certs/intermediate_ca.pem``` |
| 67 | +
|
| 68 | +> **Cacert** |
| 69 | +> ```bash |
| 70 | +> sudo wget http://www.cacert.org/certs/root.crt -O ae_certs/ca.pem |
| 71 | +> sudo wget http://www.cacert.org/certs/class3.crt -O ae_certs/intermediate_ca.pem``` |
| 72 | +
|
| 73 | +Intermediate certificates and root must be merged with certificates obtained to create a unified chain certificates. |
| 74 | +
|
| 75 | +If you use a root certificate (StartSSL) : |
| 76 | +
|
| 77 | +```bash |
| 78 | +cat ae_certs/ssl.crt ae_certs/intermediate_ca.pem ae_certs/ca.pem | sudo tee crt.pem``` |
| 79 | +
|
| 80 | +If you use only an intermediate certificate. |
| 81 | +
|
| 82 | +```bash |
| 83 | +cat ae_certs/ssl.crt ae_certs/intermediate_ca.pem | sudo tee crt.pem``` |
| 84 | +
|
| 85 | +The private key have to be converted in PEM format. |
| 86 | +
|
| 87 | +```bash |
| 88 | +sudo openssl rsa -in ae_certs/ssl.key -out key.pem -outform PEM``` |
| 89 | +
|
| 90 | +Check certificates syntaxe, check file contents. |
| 91 | +
|
| 92 | +```bash |
| 93 | +cat crt.pem key.pem``` |
| 94 | +
|
| 95 | +Certificates and private key look like this : |
| 96 | +
|
| 97 | +`-----BEGIN CERTIFICATE-----` |
| 98 | +`MIICVDCCAb0CAQEwDQYJKoZIhvcNAQEEBQAwdDELMAkGA1UEBhMCRlIxFTATBgNV` |
| 99 | +`BAgTDENvcnNlIGR1IFN1ZDEQMA4GA1UEBxMHQWphY2NpbzEMMAoGA1UEChMDTExC` |
| 100 | +`MREwDwYDVQQLEwhCVFMgSU5GTzEbMBkGA1UEAxMSc2VydmV1ci5idHNpbmZvLmZy` |
| 101 | +`MB4XDTA0MDIwODE2MjQyNloXDTA0MDMwOTE2MjQyNlowcTELMAkGA1UEBhMCRlIx` |
| 102 | +`FTATBgNVBAgTDENvcnNlIGR1IFN1ZDEQMA4GA1UEBxMHQWphY2NpbzEMMAoGA1UE` |
| 103 | +`ChMDTExCMREwDwYDVQQLEwhCVFMgSU5GTzEYMBYGA1UEAxMPcHJvZi5idHNpbmZv` |
| 104 | +`LmZyMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDSUagxPSv3LtgDV5sygt12` |
| 105 | +`kSbN/NWP0QUiPlksOkF2NkPfwW/mf55dD1hSndlOM/5kLbSBo5ieE3TgikF0Iktj` |
| 106 | +`BWm5xSqewM5QDYzXFt031DrPX63Fvo+tCKTQoVItdEuJPMahVsXnDyYHeUURRWLW` |
| 107 | +`wc0BzEgFZGGw7wiMF6wt5QIDAQABMA0GCSqGSIb3DQEBBAUAA4GBALD640iwKPMf` |
| 108 | +`pqdYtfvmLnA7CiEuao60i/pzVJE2LIXXXbwYjNAM+7Lov+dFT+b5FcOUGqLymSG3` |
| 109 | +`kSK6OOauBHItgiGI7C87u4EJaHDvGIUxHxQQGsUM0SCIIVGK7Lwm+8e9I2X0G2GP` |
| 110 | +`9t/rrbdGzXXOCl3up99naL5XAzCIp6r5` |
| 111 | +`-----END CERTIFICATE-----` |
| 112 | +
|
| 113 | +At last, secure files of your certificate |
| 114 | +
|
| 115 | +```bash |
| 116 | +sudo chown root:metronome crt.pem key.pem |
| 117 | +sudo chmod 640 crt.pem key.pem |
| 118 | +sudo chown root:root -R ae_certs |
| 119 | +sudo chmod 600 -R ae_certs``` |
| 120 | +
|
| 121 | +Reload Nginx configuration to take into account the new certificate. |
| 122 | +
|
| 123 | +```bash |
| 124 | +sudo service nginx reload``` |
| 125 | +
|
| 126 | +Your certificate is ready to serve. You can check that every thing is correct byan external service like <a href="https://www.geocerts.com/ssl_checker" target="_blank">geocerts</a> |
10 | 127 |
|
11 |
| -* /etc/yunohost/certs/YourCertifiedDomain/crt.pem |
12 |
| -* /etc/yunohost/certs/YourCertifiedDomain/key.pem |
|
0 commit comments