polhenarejos / acme_email

ACME Email Client for EmailReply-00 Challenge
https://acme.castle.cloud
GNU General Public License v3.0
46 stars 7 forks source link

Cannot extract certificate #37

Closed augjoh closed 5 months ago

augjoh commented 11 months ago

When requesting a certificate, the following error hinders saving the certificate:

2023-10-07 20:16:12,056:DEBUG:acme.client:Storing nonce: 1a_NhWv1-TTLchs_l-gJMVBzziLJtjzjeEkghCqDdBE
2023-10-07 20:16:12,057:DEBUG:certbot._internal.log:Exiting abnormally:
Traceback (most recent call last):
  File "/builds/platynum/certification-authority/flows/acme_email/cli.py", line 264, in <module>
    main(args)
  File "/builds/platynum/certification-authority/flows/acme_email/cli.py", line 202, in main
    request_cert(args, config)
  File "/builds/platynum/certification-authority/flows/acme_email/cli.py", line 124, in request_cert
    cert_path, chain_path, fullchain_path = certbot_main._csr_get_and_save_cert(config, le_client)
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/certbot/_internal/main.py", line 1521, in _csr_get_and_save_cert
    cert_path, chain_path, fullchain_path = le_client.save_certificate(
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/certbot/_internal/client.py", line 618, in save_certificate
    cert_file, abs_cert_path = _open_pem_file(self.config, 'cert_path', cert_path)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/certbot/_internal/client.py", line 864, in _open_pem_file
    if config.set_by_user(cli_arg_path):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/certbot/configuration.py", line 110, in set_by_user
    raise RuntimeError(
RuntimeError: NamespaceConfig.set_by_user called without an ArgumentSources dict. See NamespaceConfig.set_argument_sources().
2023-10-07 20:16:12,058:ERROR:certbot._internal.log:An unexpected error occurred:
2023-10-07 20:16:12,058:ERROR:certbot._internal.log:RuntimeError: NamespaceConfig.set_by_user called without an ArgumentSources dict. See NamespaceConfig.set_argument_sources().
Ramirez97 commented 10 months ago

@polhenarejos I'm having this same issue as well. The certbot/configuration.py says there are no argument sources, throwing an exception/runtime error.

polhenarejos commented 9 months ago

Upgrade to acme_email 0.14.0 and do a pip install -U certbot to upgrade to certbot 2.7.4. It should be fixed.

colisee commented 5 months ago

Hi @polhenarejos

Unfortunately, the problem is still present.

Log:

2024-03-28 10:56:08,435:DEBUG:acme.client:Storing nonce: tNuSzTjWzgcMDYay6LZ7OQ
2024-03-28 10:56:08,438:DEBUG:certbot._internal.log:Exiting abnormally:
Traceback (most recent call last):
  File "/home/robin/Dev/acme_email/cli.py", line 265, in <module>
    main(args)
  File "/home/robin/Dev/acme_email/cli.py", line 203, in main
    request_cert(args, config)
  File "/home/robin/Dev/acme_email/cli.py", line 125, in request_cert
    cert_path, chain_path, fullchain_path = certbot_main._csr_get_and_save_cert(config, le_client)
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/robin/Dev/acme_email/venv/lib/python3.11/site-packages/certbot/_internal/main.py", line 1521, in _csr_get_and_save_cer
t
    cert_path, chain_path, fullchain_path = le_client.save_certificate(
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/robin/Dev/acme_email/venv/lib/python3.11/site-packages/certbot/_internal/client.py", line 618, in save_certificate
    cert_file, abs_cert_path = _open_pem_file(self.config, 'cert_path', cert_path)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/robin/Dev/acme_email/venv/lib/python3.11/site-packages/certbot/_internal/client.py", line 864, in _open_pem_file
    if config.set_by_user(cli_arg_path):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/robin/Dev/acme_email/venv/lib/python3.11/site-packages/certbot/configuration.py", line 111, in set_by_user
    raise RuntimeError(
RuntimeError: NamespaceConfig.set_by_user called without an ArgumentSources dict. See NamespaceConfig.set_argument_sources().
2024-03-28 10:56:08,442:ERROR:certbot._internal.log:An unexpected error occurred:
2024-03-28 10:56:08,443:ERROR:certbot._internal.log:RuntimeError: NamespaceConfig.set_by_user called without an ArgumentSources dict
. See NamespaceConfig.set_argument_sources().

Python stack

(venv) robin@blue:~/Dev/acme_email$ pip list Package Version


acme 2.9.0 certbot 2.9.0 certbot-castle 0.14.0.dev0

CLI invocation (sensitive data replaced by xxx)

python3 cli.py cert --email xxx --config-dir . --work-dir . --logs-dir . --contact xxx --imap --login xxx --password xxx --host xxx --ssl --smtp-method STARTTLS --smtp-host xxx
colisee commented 5 months ago

Hi @polhenarejos it works now. I was able to get the certificate files (.pem) as well as the PKCS12 container file (.pfx)

Thanks.