Skip to content

Commit

Permalink
feat(module): add validTo and validFrom to acme_sh.issue
Browse files Browse the repository at this point in the history
  • Loading branch information
genaumann committed Jan 11, 2024
1 parent e0b63f6 commit f3130b8
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion _modules/acme_sh.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ def issue(
user="root",
cert_path=None,
dns_credentials=None,
force=False
force=False,
validTo=None,
validFrom=None
):
"""
Obtain a certificate
Expand Down Expand Up @@ -206,6 +208,14 @@ def issue(
force
force issuing a certificate
default = False
validTo
NotAfter field in cert
see https://github.com/acmesh-official/acme.sh/wiki/Validity
validFrom
NotBefore field in cert
see https://github.com/acmesh-official/acme.sh/wiki/Validity
"""

home_dir = __salt__['user.info'](user)['home']
Expand Down Expand Up @@ -275,6 +285,12 @@ def issue(
if force:
cmd.append("--force")

# validity
if validTo:
cmd.extend["--valid-to", validTo]
if validFrom:
cmd.extend["--valid-from", validFrom]

if acme_mode == "dns":
log.debug("Set dns_credentials as temporary env")
__salt__["environ.setenv"](dns_credentials)
Expand Down

0 comments on commit f3130b8

Please sign in to comment.