Skip to content

Commit

Permalink
githubwebhooks: allow infosec-prod account to access unfiltered GitHu…
Browse files Browse the repository at this point in the history
…b stream

This was requested by @gene1wood so infosec can monitor GitHub
activity.
  • Loading branch information
indygreg committed Nov 30, 2017
1 parent ef6fa26 commit f7d7791
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
19 changes: 19 additions & 0 deletions githubwebhooks/iam-roles.tf
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,22 @@ resource "aws_iam_role_policy" "lambda_github_webhooks_pulse" {
role = "${aws_iam_role.lambda_github_webhooks_pulse.id}"
policy = "${data.aws_iam_policy_document.lambda_github_webhooks_pulse.json}"
}

data "aws_iam_policy_document" "sns_webhooks_all" {
# Grant access to infosec-prod account.
statement = {
sid = "github_webhooks_all_infosec_subscribe"
effect = "Allow"
actions = [
"SNS:ListSubscriptionsByTopic",
"SNS:Subscribe",
]
resources = [
"${aws_sns_topic.webhooks_all.arn}",
]
principals {
type = "AWS"
identifiers = ["371522382791"]
}
}
}
5 changes: 5 additions & 0 deletions githubwebhooks/sns.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ resource "aws_sns_topic" "webhooks_all" {
name = "github-webhooks-all"
}

resource "aws_sns_topic_policy" "webhooks_all" {
arn = "${aws_sns_topic.webhooks_all.arn}"
policy = "${data.aws_iam_policy_document.sns_webhooks_all.json}"
}

resource "aws_sns_topic" "webhooks_public" {
name = "github-webhooks-public"
}
Expand Down

0 comments on commit f7d7791

Please sign in to comment.