Qnap [ LetsEncrypt ] [ 0.6 ] Free SSL/TLS Certificates

QoolBox

Représentant QNAP
2 Janvier 2014
10 559
163
153
49
France
www.qnap.com
lets-encrypt.jpg


source : https://letsencrypt.org

x86 version : http://www.positiv-it.fr/QNAP/APP/LetsEncrypt_0.5_x86.qpkg.zip
x64 version :http://www.qoolbox.fr/LetsEncrypt_0.6_x86_64.qpkg.zip

Note :

open SSH command line
go in /opt/LetsEncrypt/bin

generate certificate with :

.
Code:
/letsencrypt --help

  letsencrypt [SUBCOMMAND] [options] [-d domain] [-d domain] ...

The Let's Encrypt agent can obtain and install HTTPS/TLS/SSL certificates.  By
default, it will attempt to use a webserver both for obtaining and installing
the cert. Major SUBCOMMANDS are:

  (default) run        Obtain & install a cert in your current webserver
  certonly             Obtain cert, but do not install it (aka "auth")
  install              Install a previously obtained cert in a server
  renew                Renew previously obtained certs that are near expiry
  revoke               Revoke a previously obtained certificate
  rollback             Rollback server configuration changes made during install
  config_changes       Show changes made to server config during installation
  plugins              Display information about installed plugins

Choice of server plugins for obtaining and installing cert:

  (the apache plugin is not installed)
  --standalone      Run a standalone webserver for authentication
  (nginx support is experimental, buggy, and not installed by default)
  --webroot         Place files in a server's webroot folder for authentication

OR use different plugins to obtain (authenticate) the cert and then install it:

  --authenticator standalone --installer apache

More detailed help:

  -h, --help [topic]    print this message, or detailed help on a topic;
                        the available topics are:

   all, automation, paths, security, testing, or any of the subcommands or
   plugins (certonly, install, nginx, apache, standalone, webroot, etc)

example :

./letsencrypt certonly -t --webroot -w /share/Web/example -d http://www.example.com


script example with Qapache ( here on legacy MD0_DATA, need to be adapted for HAL with CACHEDEV1_DATA )

/etc is not persistent on QNAP systems. Therefore, you need to change the letsencrypt config-dir to MD0_Data with the --config-dir parameter. My script looks like this:

Code:
#!/bin/sh

export PATH=/opt/LetsEncrypt/bin:$PATH
letsencrypt certonly --rsa-key-size 4096 --renew-by-default --webroot --webroot-path "/share/MD0_DATA/htdocs" -d domain.com,www.domain.com -t --agree-tos --config-dir "/share/MD0_DATA/letsencrypt"
/share/MD0_DATA/.qpkg/Qapache/Qapache.sh restart

Then, your certificates will be located in /share/MD0_DATA/letsencrypt, which is persistent after a restart.

http://wiki.qnap.com/wiki/Add_items_to_crontab shows how to add a cronjob to the QNAP crontab. My script mentioned above runs on my QNAP every month:

Code:
0 3 1 * * /share/MD0_DATA/custom_scripts/letsencrypt_cron.sh

With this QPKG, letsencrypt can run completely automated.
In addition, Apache 2.4 supports OCSP stapling which is very useful. The build-in QNAP Apache has version 2.2. If you use letsencrypt-certificates on your QNAP, you should configure your SSL-Settings to get an A+-Rating on SSLLabs (https://www.ssllabs.com/ssltest/). Here you find how to securely configure your Apache: https://raymii.org/s/tutorials/Strong_SSL_Security_On_Apache2.html
 
Merci Stéphane!

This is really good. When my 1 year free SSL certificate with gandi.net will expire I will have a look at how to use it as a new certificate of my NAS!!

giopas
 
Il serait bien qu'il soit intégré par QNAP directement (je sais que cela pourrait nuire son certificate business)...
 
Bonjour,

Les possesseurs de NAS ARM sont encore oubliés ; j'ai remarqué que peut d'applications sont portées pour les processeurs ARM , pourquoi ?

JCCHAP
 
CHAP a dit:
Bonjour,

Les possesseurs de NAS ARM sont encore oubliés ; j'ai remarqué que peut d'applications sont portées pour les processeurs ARM , pourquoi ?

JCCHAP

pour répondre à ta question.. les ARM en générale c'est un peu galère à cross compiler selon les applications.. quand c'est du C /C++ no problem.. bien que quelques fois à cause de la versio nde glbic des ARMV5 c'est des fois trés compliqués et demande un nombre de patch impressionant sans être sur du resultat.. pour les ARMV7 (series x31 et x31+) c'est déjà un peu plus simple, mais dés fois necessite un environnement ARM pour pouvoir lancer certains interpréteurs.. donc solution reste le chroot d'une distri avec glibc equivalent sur le NAS lui même et compilé directement sur le NAS...

mais la ca prends un siècle au regard de la puissance du processeur, et la faible quantité de mémoire
 
Bonjour,
J'ai crée un certificat avec letsencrypt avec la commande suivante :

./letsencrypt certonly --standalone --rsa-key-size 4096 -d mydomain.com -t --agree-tos --config-dir /share/CACHEDEV1_DATA/.qpkg/LetsEncrypt/ssl/certs/

Cette commande me demande d'arrêter les processus tournant sur le port 80 et 443.

J'ai du stopper les deux processus suivants : ./thttpd.sh stop et ./Qthttpd.sh stop. Par contre, j'ai toujours le processus apache_proxy qui tourne. J'arrive bien à l'arrêter avec la commande suivant: /usr/local/apache/bin/apache -k graceful-stop -f /etc/apache-sys-proxy-ssl.conf mais il revient à chaque fois.

Je voudrais automatiser la generation du certificat tous les 3 mois. Savez vous comment on stop le processus apache_proxy définitivement ?

Cordialement,
Hervé
 
Bonjour,
Est-ce que ce script permet de certifier les acces SSL directs sur le QNAP (par exemple le partage de fichier Qfile, ou même l'accès à l'interface) ?
Si oui, dans ce cas quelle est la commande à passer car je ne vois pas trop ce qu'il faut mettre pour simplement "certifier" le Qnap ?

Merci d'avance.
 
Et sais-tu quelle commande appelle l'IHM pour les certificats ? Le renew n'est pas automatique et l'IHM bloque à 10j avant c'est lourd ... Un cron pour appeler la fonction built-in serait l'idéal dans beaucoup de cas :D
 
Je viens de trouver le dossier avec un sh qui le fait justement, je fais quelques essais quand j'ai le temps. Si ça marche je peux l'indiquer une commande à mettre en cron ou c'est du "private QNAP" ?
 
Oh et bien oui mais il sera bref, à priori j'ai trouvé un appel qui marche et c'est tout simple donc oui tuto surement (après un prochain renew pour être sur) ;)