ValueError: Error getting directory
时间:2021-12-17 ┊ 阅读:5,975 次 ┊ 标签: 编程 , 经验 , 问题
ssl证书过期了
明明自动renew的
然后看log已经好久没更新成功了
查半天是当前server不信任远程连接
只能自己改代码
报错:
21-12-17 13:01:11
Generate CSR...amkevin.csr
amkevin.csr generated.
/home/wwwroot/amkevin/.well-known/acme-challenge/ created.
Parsing account key...
Parsing CSR...
Found domains: amkevin.com, www.amkevin.com
Getting directory...
Traceback (most recent call last):
File "/ssl/acme_tiny.py", line 199, in
main(sys.argv[1:])
File "/ssl/acme_tiny.py", line 195, in main
signed_crt = get_crt(args.account_key, args.csr, args.acme_dir, log=LOGGER, CA=args.ca, disable_check=args.disable_check, directory_url=args.directory_url, contact=args.contact, check_port=args.check_port)
File "/ssl/acme_tiny.py", line 105, in get_crt
directory, _, _ = _do_request(directory_url, err_msg="Error getting directory")
File "/ssl/acme_tiny.py", line 34, in _do_request
resp = urlopen(Request(url, data=data, headers={"Content-Type": "application/jose+json", "User-Agent": "acme-tiny"}), context=ssl._create_unverified_context())
NameError: global name 'ssl' is not defined
import ssl
加到py脚本里
然后在发送请求时,加入参数, context=ssl._create_unverified_context()
然后,重新跑正常了:
21-12-17 13:02:20
Generate CSR...amkevin.csr
amkevin.csr generated.
/home/wwwroot/amkevin/.well-known/acme-challenge/ created.
Parsing account key...
Parsing CSR...
Found domains: amkevin.com, www.amkevin.com
Getting directory...
Directory found!
Registering account...
Already registered! Account ID: https://acme-v02.api.letsencrypt.org/acme/acct/17278387
Creating new order...
Order created!
Verifying amkevin.com...
amkevin.com verified!
Verifying www.amkevin.com...
www.amkevin.com verified!
Signing certificate...
Certificate signed!
amkevin.chained.crt generated.
New cert: amkevin.chained.crt has been generated
nginx: the configuration file /www/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /www/nginx/conf/nginx.conf test is successful
重新载入 nginx:
nginx reloaded.