Attempting to generate cert, getting "UnicodeError: encoding with 'idna' codec failed"

Thanks!

So, there are some Internet standards that say that the longest allowable label in a DNS name is 63 bytes. Your hostname ruby-rails-s-1vcpu-1gb-sfo2-01-1525916611287-s-2vcpu-4gb-sfo2-01 is 64 bytes.

This wouldn’t directly bother Certbot (and wouldn’t bother Let’s Encrypt if you’re not literally trying to get a certificate covering that name), but it looks like some of Python 3’s internal logic crashes when asked to deal with hostnames that are longer than 63 bytes.

We’ll probably need to discuss whether we want to ask the Python developers to change this or whether we want to change the particular function that we call here. In the meantime, you could work around this by

  • changing your system’s hostname so that it’s less than 64 bytes long
  • running Certbot with Python 2 rather than Python 3 (maybe edit /usr/bin/certbot so that it starts with #!/usr/bin/python2 instead of #!/usr/bin/python3?)
  • editing the Certbot code on your system so that it uses some other value for your local host name here
  • using a different Let’s Encrypt client rather than Certbot

Those are all the options that I can think of for the moment. :slight_smile:

2 Likes