Skip to content

Commit

Permalink
Merge pull request #20 from ragoso/m1-compatibility
Browse files Browse the repository at this point in the history
fix to Apple M1 compatibility
  • Loading branch information
Frichetten committed Oct 18, 2022
2 parents 73c5337 + 01c8e2d commit bb30dee
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 28 deletions.
13 changes: 4 additions & 9 deletions aws/cicdont/attackbox.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,6 @@ resource "aws_security_group" "allow_inbound" {
}
}

data "template_file" "attackbox_user_data" {
template = file("attackbox_user_data.sh")
vars = {
player_password = random_string.player_password.result
player_username = var.player_username
}
}

/* This is the host the player can attack/recieve shells from */
resource "aws_instance" "attackbox" {
ami = data.aws_ami.ubuntu_ami.id
Expand All @@ -64,7 +56,10 @@ resource "aws_instance" "attackbox" {
vpc_security_group_ids = [aws_security_group.allow_inbound.id]
depends_on = [aws_internet_gateway.ctf_gw]

user_data = data.template_file.attackbox_user_data.rendered
user_data = templatefile("attackbox_user_data.sh", {
player_password = random_string.player_password.result
player_username = var.player_username
})

tags = {
Name = "attackbox"
Expand Down
11 changes: 3 additions & 8 deletions aws/cicdont/gamemaster_s3_bucket.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,11 @@ resource "aws_s3_bucket_object" "infra_deployer" {
resource "aws_s3_bucket_object" "upload_gamemaster_script" {
bucket = aws_s3_bucket.gamemaster_bucket.id
key = "gamemaster.sh"
content = data.template_file.gamemaster_script.rendered
}

data "template_file" "gamemaster_script" {
template = file("./gamemaster/gamemaster.sh")
vars = {
content = templatefile("./gamemaster/gamemaster.sh", {
gitlab_root_password = resource.random_string.gitlab_root_password.result
player_username = var.player_username
player_password = resource.random_string.player_password.result
access_key = aws_iam_access_key.aws_admin_user_access_key.id
secret_key = urlencode(aws_iam_access_key.aws_admin_user_access_key.secret)
}
}
})
}
17 changes: 6 additions & 11 deletions aws/cicdont/target_service.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,6 @@ resource "aws_security_group_rule" "allow_attackbox_inbound_rule" {
cidr_blocks = ["${aws_instance.attackbox.public_ip}/32"]
}

data "template_file" "target_user_data" {
template = file("target_service_user_data.sh")
vars = {
gitlab_root_password = resource.random_string.gitlab_root_password.result
player_username = var.player_username
player_password = resource.random_string.player_password.result
gamemaster_bucket = aws_s3_bucket.gamemaster_bucket.id
}
}

/* This is the target of the ctf */
resource "aws_instance" "target_service" {
ami = data.aws_ami.ubuntu_ami.id
Expand All @@ -71,7 +61,12 @@ resource "aws_instance" "target_service" {
volume_size = 24
}

user_data = data.template_file.target_user_data.rendered
user_data = templatefile("target_service_user_data.sh", {
gitlab_root_password = resource.random_string.gitlab_root_password.result
player_username = var.player_username
player_password = resource.random_string.player_password.result
gamemaster_bucket = aws_s3_bucket.gamemaster_bucket.id
})

metadata_options {
http_endpoint = "enabled"
Expand Down

0 comments on commit bb30dee

Please sign in to comment.