Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request-UNTESTED] Add INITIAL support for configurable (RSA) key sizes (2048, 3072, 4096) #1256

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/configuration_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ be defined in each relevant certificate configuration.
follow_cnames: false
reuse_key: false
key_type: ecdsa
key_size: 2048

``certificate`` properties
--------------------------
Expand Down Expand Up @@ -319,6 +320,12 @@ be defined in each relevant certificate configuration.
* *type*: ``string``
* *default*: ``rsa`` (a RSA-type key will be used)

``key_size``
~~~~~~~~~~~~
* Size of key to use when the certificate is generated. Must be ``2048`` or ``3072`` or ``4096``.
* *type*: ``integer``
* *default*: ``2048`` (a 2048-bit key will be used)


.. _link: https://letsencrypt.org/2019/10/09/onboarding-your-customers-with-lets-encrypt-and-acme.html#the-advantages-of-a-cname

Expand Down
5 changes: 5 additions & 0 deletions src/dnsrobocert/core/certbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def certonly(
force_renew: bool = False,
reuse_key: bool = False,
key_type: str = "rsa",
key_size: int = 2048,
) -> None:
if not domains:
return
Expand All @@ -85,6 +86,8 @@ def certonly(
additional_params.append("--reuse-key")
if key_type:
additional_params.extend(["--key-type", key_type])
if key_size:
additional_params.extend(["--rsa-key-size", key_size])

for domain in domains:
additional_params.append("-d")
Expand Down Expand Up @@ -134,6 +137,7 @@ def _issue(config_path: str, directory_path: str, lock: threading.Lock) -> None:
force_renew = certificate.get("force_renew", False)
reuse_key = certificate.get("reuse_key", False)
key_type = certificate.get("key_type", "rsa")
key_size = certificate.get("key_size", 2048)
LOGGER.info(
f"Handling the certificate for domain(s): {', '.join(domains)}"
)
Expand All @@ -146,6 +150,7 @@ def _issue(config_path: str, directory_path: str, lock: threading.Lock) -> None:
force_renew=force_renew,
reuse_key=reuse_key,
key_type=key_type,
key_size=key_size,
)
except BaseException as error:
LOGGER.error(
Expand Down
3 changes: 3 additions & 0 deletions src/dnsrobocert/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ properties:
key_type:
type: string
enum: [rsa, ecdsa]
key_size:
type: number
enum: [2048, 3072, 4096]
required: [domains, profile]
additionalProperties: false
additionalProperties: false
1 change: 1 addition & 0 deletions test/integration_tests/dnsrobocert_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ def test_it(tmp_path: Path) -> None:
follow_cnames: true
reuse_key: true
key_type: ecdsa
key_size: 2048
pfx:
export: true
passphrase: test
Expand Down