Skip to content

Commit

Permalink
2.209.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Avo Cado committed Dec 24, 2024
1 parent 4a5761e commit 9945373
Show file tree
Hide file tree
Showing 9 changed files with 206 additions and 30 deletions.
7 changes: 0 additions & 7 deletions aws_deprecated/aws_roles/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -437,15 +437,8 @@ resource "aws_iam_role_policy" "policy" {
"Sid": "RequiredForGuardDutyMonitoring",
"Effect": "Allow",
"Action": [
"guardduty:ListIPSets",
"guardduty:ListThreatIntelSets",
"guardduty:ListDetectors",
"guardduty:ListOrganizationAdminAccounts",
"guardduty:ListFindings",
"guardduty:ListFilters",
"guardduty:ListPublishingDestinations",
"guardduty:ListInvitations",
"guardduty:ListMembers",
"guardduty:GetFindings"
],
"Resource": "*"
Expand Down
16 changes: 2 additions & 14 deletions aws_v2/modules/iam/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,7 @@ resource "aws_iam_role_policy" "instance_policy" {
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:RestoreObject",
"s3:PutObjectTagging",
"s3:GetObjectTagging"
"s3:RestoreObject"
],
"Resource": "arn:aws:s3:::${var.s3_bucket_id}/*"
},
Expand Down Expand Up @@ -280,9 +278,7 @@ resource "aws_iam_role_policy" "policy" {
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:RestoreObject",
"s3:PutObjectTagging",
"s3:GetObjectTagging"
"s3:RestoreObject"
],
"Resource": "arn:aws:s3:::${var.s3_bucket_id}/*"
},
Expand Down Expand Up @@ -316,7 +312,6 @@ resource "aws_iam_role_policy" "policy" {
"s3:ListAllMyBuckets",
"s3:GetObject",
"s3:RestoreObject",
"s3:GetObjectTagging",
"s3:ListBucket",
"s3:GetBucketLocation"
],
Expand Down Expand Up @@ -521,15 +516,8 @@ resource "aws_iam_role_policy" "policy" {
"Sid": "RequiredForGuardDutyMonitoring",
"Effect": "Allow",
"Action": [
"guardduty:ListIPSets",
"guardduty:ListThreatIntelSets",
"guardduty:ListDetectors",
"guardduty:ListOrganizationAdminAccounts",
"guardduty:ListFindings",
"guardduty:ListFilters",
"guardduty:ListPublishingDestinations",
"guardduty:ListInvitations",
"guardduty:ListMembers",
"guardduty:GetFindings"
],
"Resource": "*"
Expand Down
13 changes: 10 additions & 3 deletions azure/azure_transient/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@ variable "deploy_nfs" {
default = true
}

variable "image_id" {
variable "blob_url" {
type = string
description = "Cado Response VHD blobstore URL"
default = ""
}

variable "image_id" {
type = string
description = "A fully scoped resource id for a cado image e.g. /subscriptions/{ID}/resourceGroups/{NAME}/providers/Microsoft.Compute/images/cadoresponse"
default = ""
}

variable "ip_pattern_https" {
type = list(string)
description = "Incoming IPs permitted to access https. CIDR or source IP range or * to match any IP."
Expand Down Expand Up @@ -122,14 +128,15 @@ data "azurerm_client_config" "current" {}
// Network

resource "azurerm_image" "image" {
count = var.image_id != "" ? 0 : 1 # if image_id is set, we won't need an image from a blob
name = "cado_response"
location = data.azurerm_resource_group.group.location
resource_group_name = data.azurerm_resource_group.group.name

os_disk {
os_type = "Linux"
os_state = "Generalized"
blob_uri = var.image_id # azurerm_storage_blob.vhd.url
blob_uri = var.blob_url # azurerm_storage_blob.vhd.url
size_gb = 30
}
}
Expand Down Expand Up @@ -298,7 +305,7 @@ resource "azurerm_linux_virtual_machine" "vm" {

tags = var.tags

source_image_id = azurerm_image.image.id
source_image_id = var.image_id != "" ? var.image_id : azurerm_image.image[0].id
}

resource "azurerm_virtual_machine_data_disk_attachment" "data_disk_attachment" {
Expand Down
9 changes: 8 additions & 1 deletion azure/cado/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,18 @@ variable "deploy_acquisition_permissions" {
default = true
}

variable "image_id" {
variable "blob_url" {
type = string
description = "Cado Response VHD blobstore URL"
default = "<VHD BLOBSTORE URL FROM YOUR STORAGE ACCOUNT>"
}

variable "image_id" {
type = string
description = "A fully scoped resource id for a cado image e.g. /subscriptions/{ID}/resourceGroups/{NAME}/providers/Microsoft.Compute/images/cadoresponse"
default = ""
}

variable "ip_pattern_https" {
type = list(string)
description = "Incoming IPs permitted to access https. CIDR or source IP range or * to match any IP."
Expand Down Expand Up @@ -155,6 +161,7 @@ module "azure_persistent" {
module "azure_transient" {
source = "./../azure_transient"
resource_group = var.resource_group
blob_url = var.blob_url
image_id = var.image_id
ip_pattern_https = var.ip_pattern_https
deploy_nfs = var.deploy_nfs
Expand Down
1 change: 0 additions & 1 deletion cross-account/CrossAccountPolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ Statement:
- s3:ListAllMyBuckets
- s3:GetObject
- s3:RestoreObject
- s3:GetObjectTagging
- s3:ListBucket
- s3:GetBucketLocation
Resource: '*'
Expand Down
1 change: 0 additions & 1 deletion cross-account/CrossAccountStackSet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ Resources:
- s3:ListAllMyBuckets
- s3:GetObject
- s3:RestoreObject
- s3:GetObjectTagging
- s3:ListBucket
- s3:GetBucketLocation
Resource: '*'
Expand Down
186 changes: 186 additions & 0 deletions new-roles/AWSInstanceRole.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
[
{
"Sid": "IAM",
"Effect": "Allow",
"Action": [
"sts:AssumeRole",
"iam:GetInstanceProfile",
"iam:GetRole",
"iam:ListAttachedRolePolicies",
"iam:ListInstanceProfilesForRole",
"iam:ListRolePolicies",
"iam:PassRole",
"sts:GetCallerIdentity",
"sts:GetSessionToken"
],
"Resource": "arn:aws:iam::*:role/*CadoResponse*"
},
{
"Sid": "RequiredForSecretsManagement",
"Effect": "Allow",
"Action": [
"secretsmanager:PutSecretValue",
"secretsmanager:CreateSecret",
"secretsmanager:GetSecretValue",
"secretsmanager:TagResource"
],
"Resource": "*",
"Condition": {
"StringLike": {
"aws:ResourceTag/Name": "CadoResponse*"
}
}
},
{
"Sid": "RequiredForWorkers",
"Effect": "Allow",
"Action": [
"ec2:DeleteVolume",
"ec2:DeleteSnapshot",
"ec2:TerminateInstances",
"ec2:AttachVolume",
"ec2:DetachVolume",
"ec2:StopInstances",
"ec2:StartInstances",
"ec2:RunInstances",
"ec2:DescribeInstances",
"ec2:DescribeInstanceStatus",
"ec2:CreateTags",
"ec2:DescribeAddresses",
"ec2:AssociateAddress"
],
"Resource": "*"
},
{
"Sid": "RequiredForWorkersAndUpdatesIAM",
"Effect": "Allow",
"Action": [
"iam:PassRole"
],
"Resource": "arn:aws:iam::*:role/*CadoResponse*"
},
{
"Sid": "RequiredForNativeUpdates",
"Effect": "Allow",
"Action": [
"ec2:DeleteVolume",
"ec2:DeleteSnapshot",
"ec2:TerminateInstances",
"ec2:AttachVolume",
"ec2:DetachVolume",
"ec2:StopInstances",
"ec2:StartInstances",
"ec2:RunInstances",
"ec2:CreateTags",
"ec2:DescribeInstanceStatus",
"ec2:DescribeInstances",
"ec2:DescribeAddresses",
"ec2:AssociateAddress",
"ec2:DescribeImages",
"ec2:DescribeVolumes",
"ec2:DescribeInstanceAttribute"
],
"Resource": "*"
},
{
"Sid": "RequiredForNativeUpdatesWithALB",
"Effect": "Allow",
"Action": [
"elasticloadbalancing:DescribeTargetHealth",
"elasticloadbalancing:DescribeTargetGroups",
"elasticloadbalancing:RegisterTargets",
"elasticloadbalancing:DeregisterTargets"
],
"Resource": "*"
},
{
"Sid": "RequiredForCadoHostAndPreservation",
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:RestoreObject"
],
"Resource": {
"Fn::Join": [
"",
[
"arn:aws:s3:::",
{
"Ref": "CadoS3BucketAlt"
},
"/*"
]
]
}
},
{
"Sid": "RequiredForCadoHostAndPreservation2",
"Effect": "Allow",
"Action": [
"s3:ListAllMyBuckets",
"s3:ListBucket",
"s3:GetBucketLocation"
],
"Resource": {
"Fn::Join": [
"",
[
"arn:aws:s3:::",
{
"Ref": "CadoS3BucketAlt"
}
]
]
}
},
{
"Sid": "RequiredForHealthChecks",
"Effect": "Allow",
"Action": [
"s3:PutObject",
"ec2:DescribeInstanceTypes",
"ec2:DescribeSecurityGroups",
"cloudtrail:ListTrails",
"servicequotas:GetServiceQuota",
"cloudwatch:GetMetricData",
"cloudtrail:GetTrailStatus",
"iam:GetRolePolicy"
],
"Resource": "*"
},
{
"Sid": "RequiredForCloudWatchAgent",
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": {
"Fn::If": [
"ConfigureCloudWatch",
{
"Fn::Join": [
":",
[
"arn:aws:logs",
{
"Ref": "AWS::Region"
},
{
"Ref": "AWS::AccountId"
},
"log-group",
{
"Ref": "CadoLogGroup"
},
"*"
]
]
},
"*"
]
}
}
]
2 changes: 0 additions & 2 deletions new-roles/AWSInstanceRole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ Properties:
- s3:PutObject
- s3:GetObject
- s3:RestoreObject
- s3:PutObjectTagging
- s3:GetObjectTagging
Resource:
Fn::Join:
- ''
Expand Down
1 change: 0 additions & 1 deletion new-roles/AcquisitionPolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Statement:
- s3:ListAllMyBuckets
- s3:GetObject
- s3:RestoreObject
- s3:GetObjectTagging
- s3:ListBucket
- s3:GetBucketLocation
Resource: '*'
Expand Down

0 comments on commit 9945373

Please sign in to comment.