Lestscripts ошибка обновления сертификата для Seafile

Через, примерно, два месяца после установки seafile при обновлении сертификатов получил ошибку:

Simulating renewal of an existing certificate for tst-amo.net.ua and 4 more domains
Performing the following challenges:
http-01 challenge for seafile.tst-amo.net.ua
http-01 challenge for cloud.tst-amo.net.ua
http-01 challenge for mail.tst-amo.net.ua
http-01 challenge for tst-amo.net.ua
http-01 challenge for www.tst-amo.net.ua
Using the webroot path /home/www for all unmatched domains.
Waiting for verification...
Challenge failed for domain seafile.tst-amo.net.ua
http-01 challenge for seafile.tst-amo.net.ua
Cleaning up challenges
Running post-hook command: service nginx reload
Error output from post-hook command service:
Redirecting to /bin/systemctl reload nginx.service

Some challenges have failed.

IMPORTANT NOTES:
- The following errors were reported by the server:

Domain: seafile.tst-amo.net.ua
Type: unauthorized
Detail: Invalid response from
http://seafile.tst-amo.net.ua/.well-known/acme-challenge/trV7-GvdK_9eK-Fbm3dqaf-qWxA5Jwj2-EgHCMMwt38
[94.158.83.27]: "<html>\r\n<head><title>404 Not
Found</title></head>\r\n<body>\r\n<center><h1>404 Not
Found</h1></center>\r\n<hr><center>nginx</center>\r\n"

To fix these errors, please make sure that your domain name was
entered correctly and the DNS A/AAAA record(s) for that domain
contain(s) the right IP address.

Очевидно, что скрипт не нашел путь в поддомене seafile.

Решение

Создаем проверочный файлик test.html и директории (я просто их скопировал)

# cp -R /home/www/.well-known /home/www/seafile/
# cd /home/www/seafile/ && echo "TEST CERTBOT" > /.well-known/acme-chalenge/test.html

Проверяем, должен быть ответ вида:

# curl -L seafile.tst-amo.net.ua/.well-known/acme-challenge/test.html
TEST CERTBOT

Если получен – значит ошибка в конфигурации nginx.

Так и есть. В секции подключения lestcripts у меня использовался общий файл описания:

# Let'sCript
include acme.conf;
# cat acme.conf
location /.well-known {
root /home/www;
}

Нужно изменить это поведение, для этого создаем еще один файл acme.conf но для seafile:

# pwd
/etc/nginx
# vi acme_seafile.conf
location /.well-known {
       root /home/www/seafile;
}

и прописываем в конфигурации nginx для seafile:

# vi  /etc/nginx/sites-available/seafile

# Let'sCript
include acme_seafile.conf;

А также добавил в секцию:

server {
    listen 80;
    server_name seafile.tst-amo.net.ua;
    server_tokens off;
    root /home/www/seafile;
    location /seafile {
      rewrite ^ https://$http_host$request_uri? permanent; # force redirect http to https
      }
}

Проверяем и рестартуем сервисы:

# nginx -t && nginx -s reload

Запускаем letscript в черновом режиме:

# certbot certonly --dry-run -w /home/www/ -d tst-amo.net.ua,www.tst-amo.net.ua,mail.tst-amo.net.ua,cloud.tst-amo.net.ua -w /home/www/seafile/ -d seafile.tst-amo.net.ua

Если все хорошо, то запускаем без ключа –dry-run.

image_pdfimage_print

Leave a Reply

Your email address will not be published. Required fields are marked *