O sistema de timer / serviço do letsencrypt / certbot não funciona no Ubuntu 18.04


1

Instalei o certbot para o nginx e o script autorenew foi configurado automaticamente, mas este é o email que recebo sempre que ele é executado:

/home/foobar/certbot-renew.sh: 1: /home/foobar/certbot-renew.sh: /usr/bin/certbot: not found

O que me confunde é que não há certbot-renew.shna minha casa dir ...?

Mais informações de systemctl:

# /lib/systemd/system/certbot.timer
[Unit]
Description=Run certbot twice daily

[Timer]
OnCalendar=*-*-* 00,12:00:00
RandomizedDelaySec=43200
Persistent=true

[Install]
WantedBy=timers.target

e

# /lib/systemd/system/certbot.service
[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

Eu sou novo em usar systemd, ajuda é apreciada!

Editar:

Como @grawity sugeriu, eu chequei meus crontabs e achei isto:

foo@bar:~$ cat /etc/crontab
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#

Também isso:

foo@bar:~$ 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.
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

Esclarecer:

foo@bar:~$ which certbot
/usr/bin/certbot

foo@bar:~$ certbot --version
certbot 0.26.1

Respostas:


0

Os serviços do Systemd não geram notificações por email. Empregos Cron fazer.

Tudo isso indica que suas unidades systemd mostradas não estão relacionadas ao problema (é possível que elas já funcionem sem problemas) - mas a mesma tarefa está sendo feita de outro lugar; muito provavelmente um trabalho definido no seu crontab .

Use crontab -lpara listar tarefas agendadas para sua conta de usuário e crontab -eeditá-las.

Certifique-se de verificar seu próprio crontab, o crontab (via sudo) e o /etc/crontabarquivo do sistema (nenhum comando especial para esse).


Você está certo, eu não sabia disso. Eu ainda não sei o que está errado, então editei minha pergunta acima com algumas informações adicionais. Obrigado pela sua contribuição!
moritzjacobs

0

Certbot tem seu próprio serviço para renovar as coisas, você não precisa de linhas adicionais de crontab. Em teoria.

Praticamente eu parei de certbot.timerparar parecendo sem nenhum motivo:

$ sudo systemctl status certbot.timer
● certbot.timer - Run certbot twice daily
   Loaded: loaded (/lib/systemd/system/certbot.timer; enabled; vendor preset: enabled)
   Active: inactive (dead) since .....; 1 months 7 days ago

Nesse caso, reiniciá-lo ajuda:

sudo systemctl enable certbot.timer
sudo systemctl start certbot.timer

A razão pela qual ele para de funcionar ainda está para ser encontrada.

Ao utilizar nosso site, você reconhece que leu e compreendeu nossa Política de Cookies e nossa Política de Privacidade.
Licensed under cc by-sa 3.0 with attribution required.