[Ubuntu-cat] Servidor

Josep Pujadas-Jubany jpujades a gmail.com
dll mar 25 20:21:52 UTC 2019


Ok, gràcies pels aclariments!


Missatge de Miki <mikcat a gmail.com> del dia dl., 25 de març 2019 a les 6:59:

> Bon dia,
>
> Fent servir els settings per defecte (és a dir, sense editar cap fitxer),
> si has afegit el certificat per l'apache no cal afegir-hi el apache reload,
> ja ho fa ell sol, per assegurar-ho pots fer un dry-run (veure a sota)
>
> Desconec per quins altres serveis també ho fa (o sap fer-ho), per deploys
> més complexos també tens la opció de ficar-te els teus scripts a:
> /etc/letsencrypt/renewal-hooks/
> deploy  post  pre
>
> Després comentar que no cal "patir" perquè certbot s'executi 2 cops al
> dia, els hooks només s'executen quan s'actualitza algun certificat, per
> tant no reiniciarà l'apache 2 cops al dia:
> "When Certbot detects that a certificate is due for renewal, --pre-hook
> and --post-hook hooks run before and after each attempt to renew it. If you
> want your hook to run only after a successful renewal, use --deploy-hook in
> a command like this."
> (el --renew-hook encara funciona però millor fer servir --deploy-hook)
>
> https://letsencrypt.readthedocs.io/en/latest/using.html#renewing-certificates
>
> # certbot --version
> certbot 0.31.0
>
> # certbot renew --dry-run
> Saving debug log to /var/log/letsencrypt/letsencrypt.log
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> - - -
> Processing /etc/letsencrypt/renewal/domini.editat.cat.conf
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> - - -
> Cert not due for renewal, but simulating renewal for dry run
> Plugins selected: Authenticator apache, Installer apache
> Renewing an existing certificate
> Performing the following challenges:
> http-01 challenge for domini.editat.cat
> Waiting for verification...
> Cleaning up challenges
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> - - -
> *new certificate deployed with reload of apache server*; fullchain is
> /etc/letsencrypt/live/domini.editat.cat/fullchain.pem
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> - - -
>
> cat /etc/cron.d/certbot /lib/systemd/system/certbot.service
> /lib/systemd/system/certbot.timer
>
> # /etc/cron.d/certbot: crontab entries for the certbot package
> #
> # Upstream recommends attempting renewal twice a day
> #
> # Eventually, this will be an opportunity to validate certificates
> # haven't been revoked, etc.  Renewal will only occur if expiration
> # is within 30 days.
> #
> # Important Note!  This cronjob will NOT be executed if you are
> # running systemd as your init system.  If you are running systemd,
> # the cronjob.timer function takes precedence over this cronjob.  For
> # more details, see the systemd.timer manpage, or use systemctl show
> # certbot.timer.
> SHELL=/bin/sh
> PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
>
> 0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system &&
> perl -e 'sleep int(rand(43200))' && certbot -q renew
> [Unit]
> Description=Certbot
> Documentation=file:///usr/share/doc/python-certbot-doc/html/index.html
> Documentation=https://letsencrypt.readthedocs.io/en/latest/
> [Service]
> Type=oneshot
> ExecStart=/usr/bin/certbot -q renew
> PrivateTmp=true
> [Unit]
> Description=Run certbot twice daily
>
> [Timer]
> OnCalendar=*-*-* 00,12:00:00
> RandomizedDelaySec=43200
> Persistent=true
>
> [Install]
> WantedBy=timers.target
>
>
> Salut !
> Miki
>
> Missatge de Aniol Martí <amarti a caliu.cat> del dia dg., 24 de març 2019 a
> les 22:10:
>
>> Hola Josep,
>>
>> On 24/3/19 21:04, Josep Pujadas-Jubany wrote:
>> > Pregunto sobre això, per a un nou 18.04 que acabo de posar en marxa ...
>> >
>> > A*/lib/systemd/system* veig *certbot.service* i *certbot.timer*
>> >
>> > i dins de *certbot.service* la línia:
>> >
>> > ExecStart=/usr/bin/certbot -q renew
>> >
>> > on, segons
>> >
>> https://stevenwestmoreland.com/2017/11/renewing-certbot-certificates-using-a-systemd-timer.html
>> >
>> > hauria de dir (per a apache2):
>> >
>> > ExecStart=/usr/bin/certbot -q renew  |--post-hook "systemctl restart
>> > apache2"|
>>
>> A Caliu fem servir acme.sh i no Certbot. En tot cas, utilitzo Certbot a
>> altres llocs i tinc el fitxer `/etc/cron.weekly/certbot` amb el contingut:
>>
>> ```
>> /usr/bin/certbot -q renew --renew-hook "/etc/ldap/certs && service nginx
>> reload && service slapd restart"
>> ```
>>
>> >
>> > Si quan he emès els certificats certbot ho ha fet tot (no sé si reload o
>> > restart) he de fer reload o restart?
>> >
>> > I cal fer restart o amb reload és suficient?
>>
>> Com pots veure a la tasca de Cron hi tinc un reload i no m'ha donat mai
>> problemes.
>>
>> >
>> > També tinc dubtes amb certbot.timer perquè actua cada 12 hores i fer
>> > restar d'apache2 cada 12 hores em sembla una mica paranoic ...
>>
>> Ho veig completament innecessari.
>>
>> >
>> > Dic tot això perquè suposo que la 18.04 fa servir systemd i, per tant,
>> > el cron no serveix de res:
>>
>> Que jo sàpiga una cosa no és incompatible amb l'altre. La configuració
>> que he descrit és en una Debian 9 que porta systemd. Diria que és cert
>> que es recomana utilitzar els timers de systemd en lloc de tasques del
>> Cron, però fins on jo sé segueixen funcionant.
>>
>> >
>> > cat */etc/cron.d/certbot*
>> >
>> > # /etc/cron.d/certbot: crontab entries for the certbot package
>> > #
>> > # Upstream recommends attempting renewal twice a day
>> > #
>> > # Eventually, this will be an opportunity to validate certificates
>> > # haven't been revoked, etc.  Renewal will only occur if expiration
>> > # is within 30 days.
>> > #
>> > # Important Note!  This cronjob will NOT be executed if you are
>> > # running systemd as your init system.  If you are running systemd,
>> > # the cronjob.timer function takes precedence over this cronjob.  For
>> > # more details, see the systemd.timer manpage, or use systemctl show
>> > # certbot.timer.
>> > SHELL=/bin/sh
>> > PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
>> >
>> > 0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system
>> > && perl -e 'sleep int(rand(43200))' && certbot -q renew
>> >
>> > Tot plegat un bon embolic!
>> >
>> >
>> >
>> > --
>> > Josep Pujadas i Jubany
>> >
>> >
>>
>> Espero haver pogut aclarir alguna cosa.
>>
>>
>> Salut!
>>
>> --
>> Aniol Martí gpg C6F0514F
>> www.aniolmarti.cat
>
>
-------------- part següent --------------
Un document HTML ha estat eliminat...
URL: <https://lists.ubuntu.com/archives/ubuntu-cat/attachments/20190325/a123a994/attachment.html>


Més informació sobre la llista de correu Ubuntu-cat