-
Notifications
You must be signed in to change notification settings - Fork 2
Feature/add signing resources #633
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
Changes from 5 commits
b805b35
a684453
7c16734
99b23a9
5dd3b81
17c63ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| resource "aws_signer_signing_profile" "lambda_signing" { | ||
| name = "${terraform.workspace == "default" ? "" : "${terraform.workspace}"}EligibilityApiLambdaSigningProfile" | ||
| #aws signer is strict with names, does not like hyphens or underscores | ||
|
|
||
| platform_id = "AWSLambda-SHA384-ECDSA" | ||
|
|
||
| signature_validity_period { | ||
| value = 365 | ||
| type = "DAYS" | ||
| } | ||
| } | ||
|
|
||
| resource "aws_lambda_code_signing_config" "signing_config" { | ||
| allowed_publishers { | ||
| signing_profile_version_arns = [ | ||
| aws_signer_signing_profile.lambda_signing.version_arn | ||
| ] | ||
| } | ||
|
|
||
| policies { | ||
| untrusted_artifact_on_deployment = "Enforce" | ||
| } | ||
|
|
||
| description = "Only allow Lambda bundles signed by our trusted signer profile" | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -809,6 +809,78 @@ resource "aws_iam_policy" "cloudwatch_management" { | |
| tags = merge(local.tags, { Name = "cloudwatch-management" }) | ||
| } | ||
|
|
||
| resource "aws_iam_policy" "code_signing_management" { | ||
| #checkov:skip=CKV_AWS_290: Actions require wildcard resource for Lambda code signing configs and Signer jobs | ||
| #checkov:skip=CKV_AWS_235: Actions require wildcard resource for Lambda code signing configs and Signer jobs | ||
| #checkov:skip=CKV_AWS_355: Actions require wildcard resource for Lambda code signing configs and Signer jobs | ||
| name = "code-signing-management" | ||
| description = "Allow GitHub Actions to manage Lambda code signing and start Signer jobs" | ||
| path = "/service-policies/" | ||
|
|
||
| policy = jsonencode({ | ||
| Version = "2012-10-17", | ||
| Statement = [ | ||
| { | ||
| Sid = "LambdaCodeSigningConfigManagement", | ||
| Effect = "Allow", | ||
| Action = [ | ||
| "lambda:CreateCodeSigningConfig", | ||
| "lambda:UpdateCodeSigningConfig", | ||
| "lambda:DeleteCodeSigningConfig", | ||
| "lambda:GetCodeSigningConfig", | ||
| "lambda:ListCodeSigningConfigs", | ||
| "lambda:GetFunctionCodeSigningConfig", | ||
| "lambda:ListTags", | ||
| "lambda:DeleteFunctionCodeSigningConfig", | ||
| "lambda:PutFunctionCodeSigningConfig" | ||
| ], | ||
| Resource = "*" | ||
|
||
| }, | ||
| { | ||
| Sid = "LambdaFunctionSigningManagement", | ||
| Effect = "Allow", | ||
| Action = [ | ||
| "lambda:DeleteFunctionCodeSigningConfig", | ||
| "lambda:PutFunctionCodeSigningConfig" | ||
| ], | ||
| Resource = "arn:aws:lambda:*:${data.aws_caller_identity.current.account_id}:function:eligibility_signposting_api" | ||
| }, | ||
| { | ||
| Sid = "SignerProfileManagement" | ||
| Effect = "Allow" | ||
| Action = [ | ||
| "signer:GetSigningProfile", | ||
| "signer:TagResource", | ||
| "signer:UntagResource", | ||
| "signer:ListTagsForResource" | ||
| ] | ||
| Resource = local.lambda_signing_profile_arn | ||
| }, | ||
| { | ||
| Sid = "SignerProfileCreateAndList" | ||
| Effect = "Allow" | ||
| Action = [ | ||
| "signer:PutSigningProfile", | ||
| "signer:ListSigningProfiles" | ||
| ] | ||
| Resource = "*" | ||
| }, | ||
| { | ||
| Sid = "SignerJobUsage", | ||
| Effect = "Allow", | ||
| Action = [ | ||
| "signer:StartSigningJob", | ||
| "signer:DescribeSigningJob", | ||
| "signer:ListSigningJobs" | ||
| ], | ||
| Resource = "*" | ||
| }, | ||
| ] | ||
| }) | ||
|
|
||
| tags = merge(local.tags, { Name = "code-signing-management" }) | ||
| } | ||
|
|
||
| # Attach the policies to the role | ||
| resource "aws_iam_role_policy_attachment" "terraform_state" { | ||
| role = aws_iam_role.github_actions.name | ||
|
|
@@ -859,3 +931,8 @@ resource "aws_iam_role_policy_attachment" "kinesis_management_attach" { | |
| role = aws_iam_role.github_actions.name | ||
| policy_arn = aws_iam_policy.kinesis_management.arn | ||
| } | ||
|
|
||
| resource "aws_iam_role_policy_attachment" "code_signing_management" { | ||
| role = aws_iam_role.github_actions.name | ||
| policy_arn = aws_iam_policy.code_signing_management.arn | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| locals { | ||
| stack_name = "iams-developer-roles" | ||
| lambda_signing_profile_name = "${terraform.workspace == "default" ? "" : "${terraform.workspace}"}EligibilityApiLambdaSigningProfile" | ||
| lambda_signing_profile_arn = "arn:aws:signer:${var.default_aws_region}:${data.aws_caller_identity.current.account_id}:/signing-profiles/${local.lambda_signing_profile_name}" | ||
|
TOEL2 marked this conversation as resolved.
|
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.