Skip to content

Commit

Permalink
Merge branch '3198-tunneling-9-image' into develop
Browse files Browse the repository at this point in the history
Issue #3198
PR #3246
  • Loading branch information
mssalvatore committed Apr 24, 2023
2 parents 2542aa2 + 55cc9c6 commit b3974ff
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 10 deletions.
4 changes: 2 additions & 2 deletions envs/monkey_zoo/docs/zoo_network.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ This document describes Infection Monkey’s test network.
<tbody>
<tr class="odd">
<td>OS:</td>
<td><strong>Ubuntu 16.04.05 x64</strong></td>
<td><strong>Ubuntu 18.04.6 x64</strong></td>
</tr>
<tr class="even">
<td>Software:</td>
Expand Down Expand Up @@ -161,7 +161,7 @@ This document describes Infection Monkey’s test network.
<tbody>
<tr class="odd">
<td>OS:</td>
<td><strong>Ubuntu 16.04.05 x64</strong></td>
<td><strong>Ubuntu 18.04.6 x64</strong></td>
</tr>
<tr class="even">
<td>Software:</td>
Expand Down
20 changes: 20 additions & 0 deletions envs/monkey_zoo/packer/setup_tunneling_10.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
- name: Configure Tunneling-10
hosts: all
remote_user: root

tasks:
- name: Add m0nk3y user
user:
name: m0nk3y
password: "{{ '3Q=(Ge(+&w]*' | password_hash('sha512') }}"
groups:
- sudo
append: yes
- name: Enable Password Authentication
lineinfile:
dest: /etc/ssh/sshd_config
regexp: '^PasswordAuthentication.*no'
line: "PasswordAuthentication yes"
state: present
backup: yes
20 changes: 20 additions & 0 deletions envs/monkey_zoo/packer/setup_tunneling_9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
- name: Configure Tunneling-9
hosts: all
remote_user: root

tasks:
- name: Add m0nk3y user
user:
name: m0nk3y
password: "{{ '`))jU7L(w}' | password_hash('sha512') }}"
groups:
- sudo
append: yes
- name: Enable Password Authentication
lineinfile:
dest: /etc/ssh/sshd_config
regexp: '^PasswordAuthentication.*no'
line: "PasswordAuthentication yes"
state: present
backup: yes
55 changes: 55 additions & 0 deletions envs/monkey_zoo/packer/tunneling.pkr.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
variable "project_id" {
type = string
}
variable "zone" {
type = string
default = "europe-west3-a"
}
variable "machine_type" {
type = string
default = "n1-standard-2"
}
variable "source_image" {
type = string
default = "ubuntu-1804-bionic-v20230418"
}
variable "account_file" {
type = string
}

source "googlecompute" "tunneling-9" {
image_name = "tunneling-9"
project_id = "${var.project_id}"
source_image = "${var.source_image}"
zone = "${var.zone}"
disk_size = 10
machine_type = "${var.machine_type}"
ssh_username = "root"
account_file = "${var.account_file}"
}

source "googlecompute" "tunneling-10" {
image_name = "tunneling-10"
project_id = "${var.project_id}"
source_image = "${var.source_image}"
zone = "${var.zone}"
disk_size = 10
machine_type = "${var.machine_type}"
ssh_username = "root"
account_file = "${var.account_file}"
}

build {
sources = [
"source.googlecompute.tunneling-9",
"source.googlecompute.tunneling-10"
]
provisioner "ansible" {
only = ["googlecompute.tunneling-9"]
playbook_file = "./packer/setup_tunneling_9.yml"
}
provisioner "ansible" {
only = ["googlecompute.tunneling-10"]
playbook_file = "./packer/setup_tunneling_10.yml"
}
}
14 changes: 6 additions & 8 deletions envs/monkey_zoo/terraform/monkey_zoo.tf
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,9 @@ resource "google_compute_instance_from_template" "hadoop-3" {
}
}

resource "google_compute_instance_from_template" "tunneling-9" {
name = "${local.resource_prefix}tunneling-9"
source_instance_template = local.default_ubuntu
machine_type = "n1-standard-2"
resource "google_compute_instance" "tunneling-9" {
name = "${local.resource_prefix}tunneling-9"
machine_type = "n1-standard-2"
boot_disk {
initialize_params {
image = data.google_compute_image.tunneling-9.self_link
Expand All @@ -147,10 +146,9 @@ resource "google_compute_instance_from_template" "tunneling-9" {
}
}

resource "google_compute_instance_from_template" "tunneling-10" {
name = "${local.resource_prefix}tunneling-10"
source_instance_template = local.default_ubuntu
machine_type = "n1-standard-2"
resource "google_compute_instance" "tunneling-10" {
name = "${local.resource_prefix}tunneling-10"
machine_type = "n1-standard-2"
boot_disk {
initialize_params {
image = data.google_compute_image.tunneling-10.self_link
Expand Down

0 comments on commit b3974ff

Please sign in to comment.