Skip to content

Commit

Permalink
Print errors to lambda logs (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulschwarzenberger authored Oct 30, 2024
1 parent 49fae49 commit 8adead9
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def is_invalid_certificate_request(project, env_name, ca_name, common_name, csr,

# check CSR includes a Common Name
if "CN=" not in csr.subject.rfc4514_string():
print("Certificate request rejected, CSR must include a Common Name")
return {"error": "CSR must include a Common Name"}

# get public key from CSR
Expand All @@ -147,6 +148,7 @@ def is_invalid_certificate_request(project, env_name, ca_name, common_name, csr,

# check lifetime is at least 1 day
if lifetime < 1:
print("Certificate request rejected, lifetime must be at least 1 day")
return {"error": f"{lifetime} is too short"}

return None
Expand Down

0 comments on commit 8adead9

Please sign in to comment.