diafygi / acme-tiny

A tiny script to issue and renew TLS certs from Let's Encrypt
MIT License
4.74k stars 572 forks source link

UTF8 problem #72

Closed Ulrar closed 8 years ago

Ulrar commented 8 years ago

Hi,

I'm trying to use acme_tiny, but I can't get it to work. If I use python3, it spits a long traceback about a bad header, so I tried using python2.7. Here is the traceback I get :

Parsing account key...
Parsing CSR...
Registering account...
Already registered!
Verifying <domain>...
Traceback (most recent call last):
  File "/usr/bin/acme_tiny.py", line 198, in <module>
    main(sys.argv[1:])
  File "/usr/bin/acme_tiny.py", line 194, in main
    signed_crt = get_crt(args.account_key, args.csr, args.acme_dir, log=LOGGER, CA=args.ca)
  File "/usr/bin/acme_tiny.py", line 118, in get_crt
    resp_data = resp.read().decode('utf8').strip()
  File "/usr/lib64/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x80 in position 0: invalid start byte

My domain is a pretty standard ascii one, nothing fancy. My system's locale is en_US.UTF-8

davidklaftenegger commented 8 years ago

this sounds like the challange token as delivered by your webserver is somehow in a non-utf8 format. Can you check what this file looks like?

nappy commented 8 years ago

I had the same issue with nginx: It was just sending a few bytes of garbage (according to fiddler). No headers, nothing. As soon as I disabled http2 on all of my non ssl redirect/acme sites, the acme-challenges where served correctly. Turns out http2 must only be used together with the ssl parameter:

https://www.nginx.com/blog/nginx-plus-r7-released/

Please note HTTP/2 is only supported when the ssl parameter is also included

nginx version: nginx/1.9.10 built with OpenSSL 1.0.2e 3 Dec 2015 (running with OpenSSL 1.0.2f 28 Jan 2016)

Certainly not an acme-tiny issue :+1:

diafygi commented 8 years ago

Thanks @nappy closing issue after http2 clarification.