A
A
Anatoly2018-04-01 00:38:50
Python
Anatoly, 2018-04-01 00:38:50

How to overcome Python error (ascii' codec can't decode) when creating a Let's Encrypt certificate?

Debian 9, Nginx, certbot-auto.
Today I tried to create a Let's Encrypt certificate for a new domain, but after launch, certbot-auto updated the version of Python, now it is installed - python / stable, now 2.7.13-2 amd64, which I unfortunately did not remember earlier.
So, after specifying the domain for which I need to get a certificate, I get an error:
An unexpected error occurred:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 2: ordinal not in range(128)
Please see the logfiles in /var/log/letsencrypt for more details.

Encoding problem. If I remove Cyrillic from the nginx config, then the domain receives a certificate.
I have a lot of comments in Russian in my configs and I would not like to delete them, I understand that maybe I need to know English and comment on everything in English, but still, why did everything work before, but now it doesn’t?
I add new domains according to the template, so it's the same on all domains. Updating certificates after 3 months also went without problems, now I'm afraid it will be necessary to globally clean the Cyrillic alphabet. :(
Are there any options for how to deal with this?
Thank you.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Anatoly, 2018-04-02
@Tolly

Removed all certificates, removed all certbot-auto and certbot settings.
I installed certbot again, now everything works fine, it doesn’t complain about Russian letters, and what’s interesting is that you don’t need to add anything now and no service folders are created. In general, everything is as before, only now I launch certbot and that's it.
Thanks to chupasaurus for pointing out that certbot-auto is just a certbot update script, i.e. I won’t install it anymore, it’s quite enough for the update:
apt update
apt upgrade
while I’m covering the topic, there are no questions, as it were, but I don’t know if this problem will still appear or not, it’s
strange, of course, that’s all

C
chupasaurus, 2018-04-01
@chupasaurus

  1. Add a line to /etc/letsencrypt/cli.ini ,webroot-path = /some/path as a result of which the webroot plugin will be automatically used, through which the "auto"configuration of nginx/apache works.
  2. Give this directory the right to read nginx and, accordingly, add it to the nginx configs on each domain
    location ^~ /.well-known/acme-challenge/ {
      root /some/path;
    }
    I prefer to set the path to the tokens in a variable in nginx.conf for the consistency of site configs.
    Then the standard certbot certonly -d new.domain.tldandcertbot renew

G
Gluck Virtualen, 2018-08-28
@gluck59

The problem is still there, it hasn't gone away.
I see Python for the first time, I have never encountered it before. As far as I understand, the feature is that certbot is written in the second python, which has a native encoding in ascii, and we shove the data to it (more precisely, not us, but the sertbot) in utf8.
I don't know if the solution is racially correct, but it works.

# после строки
import sys  
#вставить строки
reload(sys)  
sys.setdefaultencoding('utf8')

After that, the certificate is installed, there is no more error.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question