Invalid return character or leading space in header: Authorization
semeral opened this issue · 3 comments
I'm running TrueNAS-12.0-U8.1, I haven't touched neither acme.sh
nor deploy_freenas.py
scripts, and I'm constantly getting an error:
Traceback (most recent call last):
File "/mnt/pool/root/deploy-freenas/deploy_freenas.py", line 91, in <module>
r = session.post(
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 581, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 519, in request
prep = self.prepare_request(req)
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 452, in prepare_request
p.prepare(
File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 314, in prepare
self.prepare_headers(headers)
File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 448, in prepare_headers
check_header_validity(header)
File "/usr/local/lib/python3.9/site-packages/requests/utils.py", line 942, in check_header_validity
raise InvalidHeader("Invalid return character or leading space in header: %s" % name)
requests.exceptions.InvalidHeader: Invalid return character or leading space in header: Authorization
[Sun Sep 4 22:18:01 CEST 2022] Reload error for :
Unfortunately I have no experience with python and I would appreciate any input, as I don't have the slightest clue where to even look for issues.
That makes it look like there's an issue with how the password or API key are entered in the config file. Can you confirm it matches the example in the README?
I browsed through other opened and closed issues and tried removing "f"
in 'Authorization': f'Bearer {API_KEY}'
, as was suggested in #41. Then I was getting this error when I set api_key
in deploy_config
:
Error importing certificate!
401: Unauthorized
When I tried authorizing with password, it worked, but I can't get it working with API key, I'm still getting this error. But that is, I guess, another issue.
I tried tweaking both config_deploy
and deploy_freenas.py
and I think that it’s maybe parsing password and api_key incorrectly. It throws 401 error if there is any other value set in config_deploy
, e.g. cert_fqdn
. When I add print(API_KEY)
to deploy_freenas.py
, it prints the api_key value and any other value that I uncommented in the deploy_config
. Only when the password is left uncommented, it succesfully deploys certs, it still fails with 401 with api_key.