Skip to content
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

Manuel/rm oracle7 cis #71

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions aws/ec2-instances/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ This repository contains Terraform code for provisioning AWS EC2 instances for t
| Oracle 8 cnspec | Latest Oracle 8 image with latest cnspec | `create_oracle8_cnspec` | |
| Oracle 8 CIS | CIS Oracle Linux 8 Benchmark - Level 1 | `create_oracle8_cis` | [CIS Oracle Linux 8 Benchmark - Level 1](https://aws.amazon.com/marketplace/pp/prodview-qohiqfju7iecs?sr=0-1&ref_=beagle&applicationId=AWSMPContessa) |
| Oracle 8 CIS cnspec | CIS Oracle Linux 8 Benchmark - Level 1 with latest cnspec | `create_oracle8_cis_cnspec` | [CIS Oracle Linux 8 Benchmark - Level 1](https://aws.amazon.com/marketplace/pp/prodview-qohiqfju7iecs?sr=0-1&ref_=beagle&applicationId=AWSMPContessa) |
| Oracle 9 | Latest Oracle 9 image | `create_oracle9` | |
| Oracle 9 cnspec | Latest Oracle 9 image with latest cnspec | `create_oracle9_cnspec` | |
| Oracle 9 CIS | CIS Oracle Linux 9 Benchmark - Level 1 | `create_oracle9_cis` | [CIS Oracle Linux 9 Benchmark - Level 1](https://aws.amazon.com/marketplace/pp/prodview-uvycouobpppp4?sr=0-1&ref_=beagle&applicationId=AWS-EC2-Console) |
| Oracle 9 CIS cnspec | CIS Oracle Linux 9 Benchmark - Level 1 with latest cnspec | `create_oracle9_cis_cnspec` | [CIS Oracle Linux 9 Benchmark - Level 1](https://aws.amazon.com/marketplace/pp/prodview-uvycouobpppp4?sr=0-1&ref_=beagle&applicationId=AWS-EC2-Console) |
| RHEL 7 | Latest Red Hat Enterprise Linux 7 | `create_rhel7` | |
| RHEL 7 cnspec | Latest Red Hat Enterprise Linux 7 with latest cnspec | `create_rhel7_cnspec` |
| RHEL 7 mondoo pass private | Saved image of a manually hardened CIS RHEL7 image (which CIS deleted) | `create_rhel7_pass_private` | |
Expand Down
46 changes: 40 additions & 6 deletions aws/ec2-instances/amis.tf
Original file line number Diff line number Diff line change
Expand Up @@ -404,12 +404,28 @@ data "aws_ami" "oracle7" {
owners = ["679593333241"]
}

data "aws_ami" "oracle7_cis" {
#data "aws_ami" "oracle7_cis" {
# most_recent = true
#
# filter {
# name = "name"
# values = ["CIS Oracle Linux 7 Benchmark*"]
# }
#
# filter {
# name = "virtualization-type"
# values = ["hvm"]
# }
#
# owners = ["679593333241"]
#}

data "aws_ami" "oracle8" {
most_recent = true

filter {
name = "name"
values = ["CIS Oracle Linux 7 Benchmark*"]
values = ["*SupportedImages OL8.8*"]
}

filter {
Expand All @@ -420,12 +436,12 @@ data "aws_ami" "oracle7_cis" {
owners = ["679593333241"]
}

data "aws_ami" "oracle8" {
data "aws_ami" "oracle8_cis" {
most_recent = true

filter {
name = "name"
values = ["*SupportedImages OL8.8*"]
values = ["CIS Oracle Linux 8 Benchmark*"]
}

filter {
Expand All @@ -436,12 +452,12 @@ data "aws_ami" "oracle8" {
owners = ["679593333241"]
}

data "aws_ami" "oracle8_cis" {
data "aws_ami" "oracle9" {
most_recent = true

filter {
name = "name"
values = ["CIS Oracle Linux 8 Benchmark*"]
values = ["*(SupportedImages) - Oracle Linux 9 LATEST x86_64*"]
}

filter {
Expand All @@ -451,6 +467,24 @@ data "aws_ami" "oracle8_cis" {

owners = ["679593333241"]
}


data "aws_ami" "oracle9_cis" {
most_recent = true

filter {
name = "name"
values = ["CIS Oracle Linux 9 Benchmark*"]
}

filter {
name = "virtualization-type"
values = ["hvm"]
}

owners = ["679593333241"]
}

data "aws_ami" "rocky9" {
most_recent = true

Expand Down
106 changes: 84 additions & 22 deletions aws/ec2-instances/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -318,27 +318,59 @@ module "oracle7_cnspec" {
user_data_replace_on_change = true
}

module "oracle7_cis" {
#module "oracle7_cis" {
# source = "terraform-aws-modules/ec2-instance/aws"
# version = "~> 5.6.1"
#
# create = var.create_oracle7_cis
# name = "${var.prefix}-oracle7-cis-${random_id.instance_id.id}"
# ami = data.aws_ami.oracle7_cis.id
# instance_type = var.linux_instance_type
# vpc_security_group_ids = [module.linux_sg.security_group_id]
# subnet_id = module.vpc.public_subnets[0]
# key_name = var.aws_key_pair_name
# associate_public_ip_address = true
#}

#module "oracle7_cis_cnspec" {
# source = "terraform-aws-modules/ec2-instance/aws"
# version = "~> 5.6.1"
#
# create = var.create_oracle7_cis_cnspec
# name = "${var.prefix}-oracle7-cis-cnspec-${random_id.instance_id.id}"
# ami = data.aws_ami.oracle7_cis.id
# instance_type = var.linux_instance_type
# vpc_security_group_ids = [module.linux_sg.security_group_id]
# subnet_id = module.vpc.public_subnets[0]
# key_name = var.aws_key_pair_name
# associate_public_ip_address = true
# user_data = base64encode(local.linux_user_data)
# user_data_replace_on_change = true
#}

// Oracle 8

module "oracle8" {
source = "terraform-aws-modules/ec2-instance/aws"
version = "~> 5.6.1"

create = var.create_oracle7_cis
name = "${var.prefix}-oracle7-cis-${random_id.instance_id.id}"
ami = data.aws_ami.oracle7_cis.id
create = var.create_oracle8
name = "${var.prefix}-oracle8-${random_id.instance_id.id}"
ami = data.aws_ami.oracle8.id
instance_type = var.linux_instance_type
vpc_security_group_ids = [module.linux_sg.security_group_id]
subnet_id = module.vpc.public_subnets[0]
key_name = var.aws_key_pair_name
associate_public_ip_address = true
}

module "oracle7_cis_cnspec" {
module "oracle8_cnspec" {
source = "terraform-aws-modules/ec2-instance/aws"
version = "~> 5.6.1"

create = var.create_oracle7_cis_cnspec
name = "${var.prefix}-oracle7-cis-cnspec-${random_id.instance_id.id}"
ami = data.aws_ami.oracle7_cis.id
create = var.create_oracle8_cnspec
name = "${var.prefix}-oracle8-cnspec-${random_id.instance_id.id}"
ami = data.aws_ami.oracle8.id
instance_type = var.linux_instance_type
vpc_security_group_ids = [module.linux_sg.security_group_id]
subnet_id = module.vpc.public_subnets[0]
Expand All @@ -348,15 +380,44 @@ module "oracle7_cis_cnspec" {
user_data_replace_on_change = true
}

// Oracle 8
module "oracle8_cis" {
source = "terraform-aws-modules/ec2-instance/aws"
version = "~> 5.6.1"

module "oracle8" {
create = var.create_oracle8_cis
name = "${var.prefix}-oracle8-cis-${random_id.instance_id.id}"
ami = data.aws_ami.oracle8_cis.id
instance_type = var.linux_instance_type
vpc_security_group_ids = [module.linux_sg.security_group_id]
subnet_id = module.vpc.public_subnets[0]
key_name = var.aws_key_pair_name
associate_public_ip_address = true
}

module "oracle8_cis_cnspec" {
source = "terraform-aws-modules/ec2-instance/aws"
version = "~> 5.6.1"

create = var.create_oracle8
name = "${var.prefix}-oracle8-${random_id.instance_id.id}"
ami = data.aws_ami.oracle8.id
create = var.create_oracle8_cis_cnspec
name = "${var.prefix}-oracle8-cis-cnspec-${random_id.instance_id.id}"
ami = data.aws_ami.oracle8_cis.id
instance_type = var.linux_instance_type
vpc_security_group_ids = [module.linux_sg.security_group_id]
subnet_id = module.vpc.public_subnets[0]
key_name = var.aws_key_pair_name
associate_public_ip_address = true
user_data = base64encode(local.linux_user_data)
user_data_replace_on_change = true
}

// Oracle 9
module "oracle9" {
source = "terraform-aws-modules/ec2-instance/aws"
version = "~> 5.6.1"

create = var.create_oracle9
name = "${var.prefix}-oracle9-${random_id.instance_id.id}"
ami = data.aws_ami.oracle9.id
instance_type = var.linux_instance_type
vpc_security_group_ids = [module.linux_sg.security_group_id]
subnet_id = module.vpc.public_subnets[0]
Expand All @@ -368,9 +429,9 @@ module "oracle8_cnspec" {
source = "terraform-aws-modules/ec2-instance/aws"
version = "~> 5.6.1"

create = var.create_oracle8_cnspec
name = "${var.prefix}-oracle8-cnspec-${random_id.instance_id.id}"
ami = data.aws_ami.oracle8.id
create = var.create_oracle9_cnspec
name = "${var.prefix}-oracle9-cnspec-${random_id.instance_id.id}"
ami = data.aws_ami.oracle9.id
instance_type = var.linux_instance_type
vpc_security_group_ids = [module.linux_sg.security_group_id]
subnet_id = module.vpc.public_subnets[0]
Expand All @@ -384,9 +445,9 @@ module "oracle8_cis" {
source = "terraform-aws-modules/ec2-instance/aws"
version = "~> 5.6.1"

create = var.create_oracle8_cis
name = "${var.prefix}-oracle8-cis-${random_id.instance_id.id}"
ami = data.aws_ami.oracle8_cis.id
create = var.create_oracle9_cis
name = "${var.prefix}-oracle9-cis-${random_id.instance_id.id}"
ami = data.aws_ami.oracle9_cis.id
instance_type = var.linux_instance_type
vpc_security_group_ids = [module.linux_sg.security_group_id]
subnet_id = module.vpc.public_subnets[0]
Expand All @@ -398,9 +459,9 @@ module "oracle8_cis_cnspec" {
source = "terraform-aws-modules/ec2-instance/aws"
version = "~> 5.6.1"

create = var.create_oracle8_cis_cnspec
name = "${var.prefix}-oracle8-cis-cnspec-${random_id.instance_id.id}"
ami = data.aws_ami.oracle8_cis.id
create = var.create_oracle9_cis_cnspec
name = "${var.prefix}-oracle9-cis-cnspec-${random_id.instance_id.id}"
ami = data.aws_ami.oracle9_cis.id
instance_type = var.linux_instance_type
vpc_security_group_ids = [module.linux_sg.security_group_id]
subnet_id = module.vpc.public_subnets[0]
Expand All @@ -410,6 +471,7 @@ module "oracle8_cis_cnspec" {
user_data_replace_on_change = true
}


// Red Hat Linux 9

module "rhel9" {
Expand Down
32 changes: 25 additions & 7 deletions aws/ec2-instances/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,13 @@ output "oracle7_cnspec" {
value = module.oracle7_cnspec.public_ip == null ? "" : "ssh -o StrictHostKeyChecking=no -i ~/.ssh/${var.aws_key_pair_name} ec2-user@${module.oracle7_cnspec.public_ip}"
}

output "oracle7_cis" {
value = module.oracle7_cis.public_ip == null ? "" : "ssh -o StrictHostKeyChecking=no -i ~/.ssh/${var.aws_key_pair_name} ec2-user@${module.oracle7_cis.public_ip}"
}

output "oracle7_cis_cnspec" {
value = module.oracle7_cis_cnspec.public_ip == null ? "" : "ssh -o StrictHostKeyChecking=no -i ~/.ssh/${var.aws_key_pair_name} ec2-user@${module.oracle7_cis_cnspec.public_ip}"
}
#output "oracle7_cis" {
# value = module.oracle7_cis.public_ip == null ? "" : "ssh -o StrictHostKeyChecking=no -i ~/.ssh/${var.aws_key_pair_name} ec2-user@${module.oracle7_cis.public_ip}"
#}
#
#output "oracle7_cis_cnspec" {
# value = module.oracle7_cis_cnspec.public_ip == null ? "" : "ssh -o StrictHostKeyChecking=no -i ~/.ssh/${var.aws_key_pair_name} ec2-user@${module.oracle7_cis_cnspec.public_ip}"
#}

# oracle8
output "oracle8" {
Expand All @@ -215,6 +215,24 @@ output "oracle8_cis_cnspec" {
value = module.oracle8_cis_cnspec.public_ip == null ? "" : "ssh -o StrictHostKeyChecking=no -i ~/.ssh/${var.aws_key_pair_name} ec2-user@${module.oracle8_cis_cnspec.public_ip}"
}

# oracle9
output "oracle9" {
value = module.oracle9.public_ip == null ? "" : "ssh -o StrictHostKeyChecking=no -i ~/.ssh/${var.aws_key_pair_name} ec2-user@${module.oracle9.public_ip}"
}

output "oracle9_cnspec" {
value = module.oracle9_cnspec.public_ip == null ? "" : "ssh -o StrictHostKeyChecking=no -i ~/.ssh/${var.aws_key_pair_name} ec2-user@${module.oracle9_cnspec.public_ip}"
}

output "oracle9_cis" {
value = module.oracle9_cis.public_ip == null ? "" : "ssh -o StrictHostKeyChecking=no -i ~/.ssh/${var.aws_key_pair_name} ec2-user@${module.oracle9_cis.public_ip}"
}

output "oracle9_cis_cnspec" {
value = module.oracle9_cis_cnspec.public_ip == null ? "" : "ssh -o StrictHostKeyChecking=no -i ~/.ssh/${var.aws_key_pair_name} ec2-user@${module.oracle9_cis_cnspec.public_ip}"
}


# rocky9
output "rocky9" {
value = module.rocky9.public_ip == null ? "" : "ssh -o StrictHostKeyChecking=no -i ~/.ssh/${var.aws_key_pair_name} rocky@${module.rocky9.public_ip}"
Expand Down
29 changes: 23 additions & 6 deletions aws/ec2-instances/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -272,30 +272,47 @@ variable "create_oracle7_cnspec" {
default = false
}

variable "create_oracle7_cis" {
#variable "create_oracle7_cis" {
# default = false
#}
#
#variable "create_oracle7_cis_cnspec" {
# default = false
#}

variable "create_oracle8" {
default = false
}

variable "create_oracle7_cis_cnspec" {
variable "create_oracle8_cnspec" {
default = false
}

variable "create_oracle8" {
variable "create_oracle8_cis" {
default = false
}

variable "create_oracle8_cnspec" {
variable "create_oracle8_cis_cnspec" {
default = false
}

variable "create_oracle8_cis" {
variable "create_oracle9" {
default = false
}

variable "create_oracle8_cis_cnspec" {
variable "create_oracle9_cnspec" {
default = false
}

variable "create_oracle9_cis" {
default = false
}

variable "create_oracle9_cis_cnspec" {
default = false
}


variable "create_rocky9" {
default = false
}
Expand Down
Loading