Mainos / Advertisement:

Ero sivun ”Letsencrypt” versioiden välillä

Kohteesta Taisto
Siirry navigaatioon Siirry hakuun
 
(48 välissä olevaa versiota samalta käyttäjältä ei näytetä)
Rivi 1: Rivi 1:
Let's Encrypt on uusi Certificate Authority. Se on ilmainen, automaattinen sekä avoin.
+
Let's Encrypt on uusi Certificate Authority. Se on ilmainen, automaattinen sekä avoin. Let's Encrypt on helppo käyttää komentorivillä Linux  käyttöjärjestelmässä ja on tuettuna automaattinen asennuksena [[Apache2.4|Apache:lle]]. Nginxille tuki on tulossa vielä.
  
Let's Encrypt on suljettuna BETA:na 3.12.2015 asti. Sinun tulee rekisteröityä että voit käyttää tätä sitä ennen.
+
Tällä hetkellä osa palveluntarjoajista (Webhotellit esimerkiksi) tukevat Let's Encryptiä. Kannattaa kysyä palveluntarjoajan asiakaspalvelusta Let's Encrypt tuesta. Käytämme taisto.org sivussamme Let's Encryptillä varmennettua sertifikaattia. Palveluntarjoajia jotka tukevat Let's Encrypt: https://github.com/letsencrypt/letsencrypt/wiki/Web-Hosting-Supporting-LE (suomalaisia palveluntarjoajia ei ole listalla)
 +
 
 +
Let's Encrypt tuetaan suurimmassa osassa käyttöjärjestelmissä ja selaimissa Identrust sertifikaatti juuren kautta. Lista tuetuista ja tukemattomista käyttöjärjestelmistä löydät täältä: https://community.letsencrypt.org/t/which-browsers-and-operating-systems-support-lets-encrypt/4394
 +
 
 +
Rajoitukset:
 +
 
 +
* Sertifikaatin uusiminen rajoitettu noin 5 per 7 päivään.
  
 
== Asennus ==
 
== Asennus ==
  
Asenna Git ja tämän jälkeen ajaa seuraava komento
+
Asennetaan Certbot client
 +
 
 +
<pre>
 +
sudo apt-get update
 +
sudo apt-get install software-properties-common
 +
sudo add-apt-repository ppa:certbot/certbot
 +
sudo apt-get update
 +
sudo apt-get install certbot
 +
</pre>
 +
 
 +
== Käyttö ==
 +
 
 +
* Apachelle luo sertifikaatit komennolla
 +
 
 +
sudo certbot --apache
 +
 
 +
* Manuaalinen, vaatii että portti 80 tai 443 on auki. Suosittelen Webroot menetelmää, jos käytät Nginx tai muuta webserveriä.
 +
 
 +
<pre>
 +
certbot certonly --standalone --email [email protected] -d example.com -d www.example.com -d intra.example.com
 +
</pre>
 +
 
 +
==== Webroot menetelmä (suosittelen) ====
 +
 
 +
Lisää tämä jokaiseen Vhostiin konfiguroidaksesi (Nginx)
  
   aptitude install git
+
<pre>
 +
server {
 +
   listen              80;
 +
  listen              [::]:80;
 +
  server_name        example.net example.org;
 +
  location '/.well-known/acme-challenge' {
 +
    default_type "text/plain";
 +
      root        /opt/letsencrypt;
 +
  }
  
  git clone https://github.com/letsencrypt/letsencrypt
 
  cd letsencrypt
 
  
Asenna ja käynnistä asiakas ohjelmisto
+
  location / {
 +
    return              301 https://$server_name$request_uri;
 +
  }
 +
}
 +
</pre>
  
  ./letsencrypt-auto
+
Tai Apache:
 +
 
 +
<pre>
 +
Alias /.well-known/acme-challenge/ "/opt/letsencrypt/.well-known/acme-challenge/"
 +
<Directory "/opt/letsencrypt/">
 +
    AllowOverride None
 +
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
 +
    Require method GET POST OPTIONS
 +
</Directory>
 +
</pre>
  
Apua saat komennolla
+
Luo hakemisto
  
   ./letsencrypt-auto --help
+
   sudo mkdir /opt/letsencrypt/
  
Sertifikaatit löytyvät täältä /etc/letsencrypt/keys ja /etc/letsencrypt/archive arkistoroituna ja /etc/letsencrypt/live löytyvät uusimmat.
+
Aja sitten certbot
  
Sieltä löytyy tiedostot
+
sudo certbot certonly --webroot -w /opt/letsencrypt -d example.com -d www.example.com
  
  privkey.pem -> Privaattiavain. Älä jaa tätä kenelekkään!
+
=== Sertifikaatin uudistaminen ===
  chain.pem -> Kaikki sertifikaatit ovat tässä, eli palvelin, root sekä väli sertifikaatti.
 
  fullchain.pem -> Tässä on kaikki sertifikaatit, lisäksi palvelin sertifikaatti.
 
  
== Päivittäminen (BETA) ==
+
Aja seuraava komento testataksesi uudistamista
  
Siirry letsencrypt hakemistoon
+
sudo certbot renew --dry-run
  
  cd letsencrypt
+
Jos kaikki menee hyvin voit ajaa alla olevan komennon, tämä lisää croniin / systemd:hen tehtävän sitä varten.
  git pull
 
  ./letsencrypt-auto --agree-dev-preview --server https://acme-v01.api.letsencrypt.org/directory
 
  
 +
sudo certbot renew --quiet --no-self-upgrade
  
 +
Jos tulee "Expected a numeric value for http01_port" virhe niin vaihda /etc/letsencrypt/renewal/[my.domain].conf tiedostosta http01_port = None :sta http01_port = 80
  
== Käyttö (BETA) ==
+
Nginx:lle sertifikaatin uudistamiskomento komento joka pysäyttää Nginx palvelun ja käynnistää sen uudelleen
  
Siirry letsencrypt hakemistoon
+
sudo certbot renew --standalone --pre-hook "service nginx stop" --post-hook "service nginx start"
  
  cd letsencrypt
+
=== Konfigurointi tiedosto ===
  
Luo sertifikaatti tällä komennolla. Sinulla tulee olla DNS record (A) määritetty tähän palvelimeen missä ajat letsencrypt sovellusta. Sammuta muu webserveri pois käytöstä väliaikaisesti.
+
Käytä konfiguraatio tiedostoa letsencrypt-auto:ssa:
  
 
<pre>
 
<pre>
./letsencrypt-auto certonly -a standalone  \
+
sudo certbot --config cli.ini
-d example.com -d www.example.com -d intra.example.com \
 
--server https://acme-v01.api.letsencrypt.org/directory --agree-dev-preview
 
 
</pre>
 
</pre>
  
Lisää sertifikaatit webserverin konfiguraatioon ja käynnistä uudelleen.
+
 
 +
Esimerkki konfiguraatio. Tallenna tämä /etc/letsencrypt/cli.ini tiedostoksi.
 +
 
 +
<pre>
 +
# This is an example of the kind of things you can do in a configuration file.
 +
# All flags used by the client can be configured here. Run Let's Encrypt with
 +
# "--help" to learn more about the available options.
 +
 
 +
# Use a 4096 bit RSA key instead of 2048
 +
rsa-key-size = 4096
 +
 
 +
# Uncomment and update to register with the specified e-mail address
 +
 +
 
 +
# Uncomment and update to generate certificates for the specified
 +
# domains.
 +
# domains = example.com, www.example.com
 +
 
 +
# Uncomment to use a text interface instead of ncurses
 +
# text = True
 +
 
 +
# Uncomment to use the standalone authenticator on port 443
 +
# authenticator = standalone
 +
# standalone-supported-challenges = tls-sni-01
 +
 
 +
# Uncomment to use the webroot authenticator. Replace webroot-path with the
 +
# path to the public_html / webroot folder being served by your web server.
 +
# authenticator = webroot
 +
# webroot-path = /usr/share/nginx/html
 +
</pre>
  
 
== Asenna sertifikaatti webpalvelimelle ==
 
== Asenna sertifikaatti webpalvelimelle ==
Rivi 80: Rivi 154:
 
SSLCertificateFile    /etc/letsencrypt/live/example.org/cert.pem
 
SSLCertificateFile    /etc/letsencrypt/live/example.org/cert.pem
 
SSLCertificateKeyFile /etc/letsencrypt/live/example.org/privkey.pem
 
SSLCertificateKeyFile /etc/letsencrypt/live/example.org/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/example.org/fullchain.pem
+
SSLCertificateChainFile /etc/letsencrypt/live/example.org/chain.pem
 
</VirtualHost>
 
</VirtualHost>
 
</pre>
 
</pre>
Rivi 87: Rivi 161:
  
 
   service apache2 reload
 
   service apache2 reload
 
  
  
Rivi 107: Rivi 180:
 
   service nginx reload
 
   service nginx reload
  
[[Luokka:Linux|Letsencrypt]]
+
== Automaattinen sertifikaatin uusiminen ==
 +
 
 +
Tämä uusii joka kahden kuukauden välein (Let's Encrypt sertifikaatit voimassa 3kk ajan) että jos jokin menee pieleen niin voit uusia helposti manuaalisestikkin.
 +
 
 +
Lisää tämä croniin. Tämä on tehty Nginx:lle mutta toimii Apachellakin kunhan muutat service nginx reload -> service apache2 reload
 +
 
 +
<pre>
 +
0 3 1 */2 * certbot renew --quiet && sudo service nginx reload
 +
</pre>
 +
 
 +
== Lähde ==
 +
 
 +
https://letsencrypt.readthedocs.org/en/latest/using.html

Nykyinen versio 26. kesäkuuta 2018 kello 07.53

Let's Encrypt on uusi Certificate Authority. Se on ilmainen, automaattinen sekä avoin. Let's Encrypt on helppo käyttää komentorivillä Linux käyttöjärjestelmässä ja on tuettuna automaattinen asennuksena Apache:lle. Nginxille tuki on tulossa vielä.

Tällä hetkellä osa palveluntarjoajista (Webhotellit esimerkiksi) tukevat Let's Encryptiä. Kannattaa kysyä palveluntarjoajan asiakaspalvelusta Let's Encrypt tuesta. Käytämme taisto.org sivussamme Let's Encryptillä varmennettua sertifikaattia. Palveluntarjoajia jotka tukevat Let's Encrypt: https://github.com/letsencrypt/letsencrypt/wiki/Web-Hosting-Supporting-LE (suomalaisia palveluntarjoajia ei ole listalla)

Let's Encrypt tuetaan suurimmassa osassa käyttöjärjestelmissä ja selaimissa Identrust sertifikaatti juuren kautta. Lista tuetuista ja tukemattomista käyttöjärjestelmistä löydät täältä: https://community.letsencrypt.org/t/which-browsers-and-operating-systems-support-lets-encrypt/4394

Rajoitukset:

  • Sertifikaatin uusiminen rajoitettu noin 5 per 7 päivään.

Asennus

Asennetaan Certbot client

sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install certbot 

Käyttö

  • Apachelle luo sertifikaatit komennolla
sudo certbot --apache
  • Manuaalinen, vaatii että portti 80 tai 443 on auki. Suosittelen Webroot menetelmää, jos käytät Nginx tai muuta webserveriä.
certbot certonly --standalone --email [email protected] -d example.com -d www.example.com -d intra.example.com

Webroot menetelmä (suosittelen)

Lisää tämä jokaiseen Vhostiin konfiguroidaksesi (Nginx)

server {
  listen              80;
  listen              [::]:80;
  server_name         example.net example.org;
  location '/.well-known/acme-challenge' {
     default_type "text/plain";
      root        /opt/letsencrypt;
  }


  location / {
    return              301 https://$server_name$request_uri;
  }
}

Tai Apache:

Alias /.well-known/acme-challenge/ "/opt/letsencrypt/.well-known/acme-challenge/"
<Directory "/opt/letsencrypt/">
    AllowOverride None
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    Require method GET POST OPTIONS
</Directory>

Luo hakemisto

 sudo mkdir /opt/letsencrypt/

Aja sitten certbot

sudo certbot certonly --webroot -w /opt/letsencrypt -d example.com -d www.example.com

Sertifikaatin uudistaminen

Aja seuraava komento testataksesi uudistamista

sudo certbot renew --dry-run

Jos kaikki menee hyvin voit ajaa alla olevan komennon, tämä lisää croniin / systemd:hen tehtävän sitä varten.

sudo certbot renew --quiet --no-self-upgrade

Jos tulee "Expected a numeric value for http01_port" virhe niin vaihda /etc/letsencrypt/renewal/[my.domain].conf tiedostosta http01_port = None :sta http01_port = 80

Nginx:lle sertifikaatin uudistamiskomento komento joka pysäyttää Nginx palvelun ja käynnistää sen uudelleen

sudo certbot renew --standalone --pre-hook "service nginx stop" --post-hook "service nginx start"

Konfigurointi tiedosto

Käytä konfiguraatio tiedostoa letsencrypt-auto:ssa:

sudo certbot --config cli.ini


Esimerkki konfiguraatio. Tallenna tämä /etc/letsencrypt/cli.ini tiedostoksi.

# This is an example of the kind of things you can do in a configuration file.
# All flags used by the client can be configured here. Run Let's Encrypt with
# "--help" to learn more about the available options.

# Use a 4096 bit RSA key instead of 2048
rsa-key-size = 4096

# Uncomment and update to register with the specified e-mail address
# email = [email protected]

# Uncomment and update to generate certificates for the specified
# domains.
# domains = example.com, www.example.com

# Uncomment to use a text interface instead of ncurses
# text = True

# Uncomment to use the standalone authenticator on port 443
# authenticator = standalone
# standalone-supported-challenges = tls-sni-01

# Uncomment to use the webroot authenticator. Replace webroot-path with the
# path to the public_html / webroot folder being served by your web server.
# authenticator = webroot
# webroot-path = /usr/share/nginx/html

Asenna sertifikaatti webpalvelimelle

Webpalvelimelle asennus on helppoa. Let's Encrypt osaa Apachelle tehdä valmiit konfiguraatiot mutta ohjeemme on tehty yleisellä tasolla monelle webpalvelimelle.

Apachelle

Tässä on esimerkki Vhost konfiguraatio Apachelle. Muuta example.org vastaamaan domainisi nimeä. Lisäohjeita tästä.

<VirtualHost *:443>
ServerName www.example.org
ServerAlias www.example.org
DocumentRoot /var/www/

<Directory /var/www/>
        Options +Includes -Indexes FollowSymLinks -MultiViews
        AllowOverride All
</Directory>

CustomLog ${APACHE_LOG_DIR}/access.log combined
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn

SSLEngine on
SSLCertificateFile    /etc/letsencrypt/live/example.org/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.org/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/example.org/chain.pem
</VirtualHost>

Muista ladata konfiguraatiot uudelleen muutosten jälkeen

 service apache2 reload


Nginx

Esimerkki konfiguraatio Nginx - webpalvelimelle. Muuta example.org vastaanaan sinun domain nimeäsi. Lisäohjeita https käyttöönottoon.

server {
  listen 443 ssl;
  server_name example.org www.example.org;

  ssl_certificate      /etc/letsencrypt/live/example.org/fullchain.pem;
  ssl_certificate_key  /etc/letsencrypt/live/example.org/privkey.pem;

Muutosten jälkeen lataa konfiguraatiot uudelleen

 service nginx reload

Automaattinen sertifikaatin uusiminen

Tämä uusii joka kahden kuukauden välein (Let's Encrypt sertifikaatit voimassa 3kk ajan) että jos jokin menee pieleen niin voit uusia helposti manuaalisestikkin.

Lisää tämä croniin. Tämä on tehty Nginx:lle mutta toimii Apachellakin kunhan muutat service nginx reload -> service apache2 reload

0 3 1 */2 * certbot renew --quiet && sudo service nginx reload

Lähde

https://letsencrypt.readthedocs.org/en/latest/using.html

Mainos / Advertisement: