-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SNS notifications for GitOps issued certificates (#214)
- Loading branch information
1 parent
288dd75
commit 5051d3c
Showing
11 changed files
with
169 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,6 +115,7 @@ ROOT_CA_INFO=$(jq -n '{}') | |
export ROOT_CA_INFO | ||
export ROOT_CRL_DAYS="1" | ||
export ROOT_CRL_SECONDS="600" | ||
export SNS_TOPIC_ARN="arn:aws:sns:<REGION>:<ACCOUNT-ID>:serverless-ca-notifications-dev" | ||
``` | ||
* copy and paste AWS Powershell CLI variables to terminal | ||
* enter `python` | ||
|
@@ -163,6 +164,7 @@ $Env:PROJECT="serverless" | |
$Env:ROOT_CA_INFO=(@{country = "GB"; state = "London"; lifetime = 7300; locality = "London"; organization = "serverless"; organizationalUnit = "Security Operations"; commonName = "Serverless Development Root CA"; emailAddress = "[email protected]"; pathLengthConstraint = 1} | ConvertTo-Json) | ||
$Env:ROOT_CRL_DAYS="1" | ||
$Env:ROOT_CRL_SECONDS="600" | ||
$Env:SNS_TOPIC_ARN="arn:aws:sns:<REGION>:<ACCOUNT-ID>:serverless-ca-notifications-dev" | ||
``` | ||
* copy and paste AWS Powershell CLI variables to terminal | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import boto3 | ||
import json | ||
|
||
|
||
def publish_to_sns(json_data, subject, sns_topic_arn, keys_to_publish="All"): | ||
# Filter out unwanted keys | ||
if keys_to_publish == "All": | ||
keys_to_publish = json_data.keys() | ||
|
||
filtered_json_data = {key: json_data[key] for key in keys_to_publish if key in json_data} | ||
|
||
client = boto3.client("sns") | ||
|
||
response = client.publish( | ||
TargetArn=sns_topic_arn, | ||
Subject=subject, | ||
Message=json.dumps({"default": json.dumps(filtered_json_data)}), | ||
MessageStructure="json", | ||
) | ||
|
||
return response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters