Improved monkeyzoo docs, updated config, fixed prefix bugs

This commit is contained in:
VakarisZ 2019-09-04 10:19:36 +03:00
parent c779887955
commit 4f67eea2a1
4 changed files with 58 additions and 48 deletions

View File

@ -58,7 +58,7 @@ Requirements:
To deploy: To deploy:
1. Configure service account for your project: 1. Configure service account for your project:
a. Create a service account and name it “your\_name-monkeyZoo-user” a. Create a service account (GCP website -> IAM -> service accounts) and name it “your\_name-monkeyZoo-user”
b. Give these permissions to your service account: b. Give these permissions to your service account:
@ -74,7 +74,7 @@ To deploy:
**Project -> Owner** **Project -> Owner**
c. Download its **Service account key**. Select JSON format. c. Download its **Service account key** in JSON and place it in **/gcp_keys** as **gcp_key.json**.
2. Get these permissions in monkeyZoo project for your service account (ask monkey developers to add them): 2. Get these permissions in monkeyZoo project for your service account (ask monkey developers to add them):
a. **Compute Engine -\> Compute image user** a. **Compute Engine -\> Compute image user**
@ -82,20 +82,30 @@ To deploy:
../monkey/envs/monkey\_zoo/terraform/config.tf file (dont forget to ../monkey/envs/monkey\_zoo/terraform/config.tf file (dont forget to
link to your service account key file): link to your service account key file):
> provider "google" { provider "google" {
>
> project = "project-28054666" project = "test-000000" // Change to your project id
>
> region = "europe-west3" region = "europe-west3" // Change to your desired region or leave default
>
> zone = "europe-west3-b" zone = "europe-west3-b" // Change to your desired zone or leave default
>
> credentials = "${file("project-92050661-9dae6c5a02fc.json")}" credentials = "${file("../gcp_keys/gcp_key.json")}" // Change to the location and name of the service key.
> // If you followed instruction above leave it as is
> }
> }
> service\_account\_email="test@project-925243.iam.gserviceaccount.com"
locals {
resource_prefix = "" // All of the resources will have this prefix.
// Only change if you want to have multiple zoo's in the same project
service_account_email="tester-monkeyZoo-user@testproject-000000.iam.gserviceaccount.com" // Service account email
monkeyzoo_project="guardicore-22050661" // Project where monkeyzoo images are kept. Leave as is.
}
4. Run terraform init 4. Run terraform init
To deploy the network run:<br> To deploy the network run:<br>

View File

@ -2,7 +2,7 @@ provider "google" {
project = "test-000000" project = "test-000000"
region = "europe-west3" region = "europe-west3"
zone = "europe-west3-b" zone = "europe-west3-b"
credentials = "${file("testproject-000000-0c0b000b00c0.json")}" credentials = "${file("../gcp_keys/gcp_key.json")}"
} }
locals { locals {
resource_prefix = "" resource_prefix = ""

View File

@ -48,7 +48,7 @@ resource "google_compute_instance_from_template" "hadoop-2" {
auto_delete = true auto_delete = true
} }
network_interface { network_interface {
subnetwork="monkeyzoo-main" subnetwork="${local.resource_prefix}monkeyzoo-main"
network_ip="10.2.2.2" network_ip="10.2.2.2"
} }
// Add required ssh keys for hadoop service and restart it // Add required ssh keys for hadoop service and restart it
@ -65,7 +65,7 @@ resource "google_compute_instance_from_template" "hadoop-3" {
auto_delete = true auto_delete = true
} }
network_interface { network_interface {
subnetwork="monkeyzoo-main" subnetwork="${local.resource_prefix}monkeyzoo-main"
network_ip="10.2.2.3" network_ip="10.2.2.3"
} }
} }
@ -80,7 +80,7 @@ resource "google_compute_instance_from_template" "elastic-4" {
auto_delete = true auto_delete = true
} }
network_interface { network_interface {
subnetwork="monkeyzoo-main" subnetwork="${local.resource_prefix}monkeyzoo-main"
network_ip="10.2.2.4" network_ip="10.2.2.4"
} }
} }
@ -95,7 +95,7 @@ resource "google_compute_instance_from_template" "elastic-5" {
auto_delete = true auto_delete = true
} }
network_interface { network_interface {
subnetwork="monkeyzoo-main" subnetwork="${local.resource_prefix}monkeyzoo-main"
network_ip="10.2.2.5" network_ip="10.2.2.5"
} }
} }
@ -110,7 +110,7 @@ resource "google_compute_instance_from_template" "sambacry-6" {
} }
} }
network_interface { network_interface {
subnetwork="monkeyzoo-main" subnetwork="${local.resource_prefix}monkeyzoo-main"
network_ip="10.2.2.6" network_ip="10.2.2.6"
} }
} }
@ -127,7 +127,7 @@ resource "google_compute_instance_from_template" "sambacry-7" {
} }
} }
network_interface { network_interface {
subnetwork="monkeyzoo-main" subnetwork="${local.resource_prefix}monkeyzoo-main"
network_ip="10.2.2.7" network_ip="10.2.2.7"
} }
} }
@ -143,7 +143,7 @@ resource "google_compute_instance_from_template" "shellshock-8" {
auto_delete = true auto_delete = true
} }
network_interface { network_interface {
subnetwork="monkeyzoo-main" subnetwork="${local.resource_prefix}monkeyzoo-main"
network_ip="10.2.2.8" network_ip="10.2.2.8"
} }
} }
@ -158,11 +158,11 @@ resource "google_compute_instance_from_template" "tunneling-9" {
auto_delete = true auto_delete = true
} }
network_interface{ network_interface{
subnetwork="tunneling-main" subnetwork="${local.resource_prefix}tunneling-main"
network_ip="10.2.1.9" network_ip="10.2.1.9"
} }
network_interface{ network_interface{
subnetwork="monkeyzoo-main" subnetwork="${local.resource_prefix}monkeyzoo-main"
network_ip="10.2.2.9" network_ip="10.2.2.9"
} }
} }
@ -177,11 +177,11 @@ resource "google_compute_instance_from_template" "tunneling-10" {
auto_delete = true auto_delete = true
} }
network_interface{ network_interface{
subnetwork="tunneling-main" subnetwork="${local.resource_prefix}tunneling-main"
network_ip="10.2.1.10" network_ip="10.2.1.10"
} }
network_interface{ network_interface{
subnetwork="tunneling2-main" subnetwork="${local.resource_prefix}tunneling2-main"
network_ip="10.2.0.10" network_ip="10.2.0.10"
} }
} }
@ -196,7 +196,7 @@ resource "google_compute_instance_from_template" "tunneling-11" {
auto_delete = true auto_delete = true
} }
network_interface{ network_interface{
subnetwork="tunneling2-main" subnetwork="${local.resource_prefix}tunneling2-main"
network_ip="10.2.0.11" network_ip="10.2.0.11"
} }
} }
@ -211,7 +211,7 @@ resource "google_compute_instance_from_template" "sshkeys-11" {
auto_delete = true auto_delete = true
} }
network_interface { network_interface {
subnetwork="monkeyzoo-main" subnetwork="${local.resource_prefix}monkeyzoo-main"
network_ip="10.2.2.11" network_ip="10.2.2.11"
} }
} }
@ -226,7 +226,7 @@ resource "google_compute_instance_from_template" "sshkeys-12" {
auto_delete = true auto_delete = true
} }
network_interface { network_interface {
subnetwork="monkeyzoo-main" subnetwork="${local.resource_prefix}monkeyzoo-main"
network_ip="10.2.2.12" network_ip="10.2.2.12"
} }
} }
@ -241,7 +241,7 @@ resource "google_compute_instance_from_template" "rdpgrinder-13" {
} }
} }
network_interface { network_interface {
subnetwork="monkeyzoo-main" subnetwork="${local.resource_prefix}monkeyzoo-main"
network_ip="10.2.2.13" network_ip="10.2.2.13"
} }
} }
@ -257,7 +257,7 @@ resource "google_compute_instance_from_template" "mimikatz-14" {
auto_delete = true auto_delete = true
} }
network_interface { network_interface {
subnetwork="monkeyzoo-main" subnetwork="${local.resource_prefix}monkeyzoo-main"
network_ip="10.2.2.14" network_ip="10.2.2.14"
} }
} }
@ -272,7 +272,7 @@ resource "google_compute_instance_from_template" "mimikatz-15" {
auto_delete = true auto_delete = true
} }
network_interface { network_interface {
subnetwork="monkeyzoo-main" subnetwork="${local.resource_prefix}monkeyzoo-main"
network_ip="10.2.2.15" network_ip="10.2.2.15"
} }
} }
@ -287,7 +287,7 @@ resource "google_compute_instance_from_template" "mssql-16" {
auto_delete = true auto_delete = true
} }
network_interface { network_interface {
subnetwork="monkeyzoo-main" subnetwork="${local.resource_prefix}monkeyzoo-main"
network_ip="10.2.2.16" network_ip="10.2.2.16"
} }
} }
@ -302,7 +302,7 @@ resource "google_compute_instance_from_template" "upgrader-17" {
} }
} }
network_interface { network_interface {
subnetwork="monkeyzoo-main" subnetwork="${local.resource_prefix}monkeyzoo-main"
network_ip="10.2.2.17" network_ip="10.2.2.17"
access_config { access_config {
// Cheaper, non-premium routing // Cheaper, non-premium routing
@ -322,7 +322,7 @@ resource "google_compute_instance_from_template" "weblogic-18" {
auto_delete = true auto_delete = true
} }
network_interface { network_interface {
subnetwork="monkeyzoo-main" subnetwork="${local.resource_prefix}monkeyzoo-main"
network_ip="10.2.2.18" network_ip="10.2.2.18"
} }
} }
@ -337,7 +337,7 @@ resource "google_compute_instance_from_template" "weblogic-19" {
auto_delete = true auto_delete = true
} }
network_interface { network_interface {
subnetwork="monkeyzoo-main" subnetwork="${local.resource_prefix}monkeyzoo-main"
network_ip="10.2.2.19" network_ip="10.2.2.19"
} }
} }
@ -352,7 +352,7 @@ resource "google_compute_instance_from_template" "smb-20" {
auto_delete = true auto_delete = true
} }
network_interface { network_interface {
subnetwork="monkeyzoo-main" subnetwork="${local.resource_prefix}monkeyzoo-main"
network_ip="10.2.2.20" network_ip="10.2.2.20"
} }
} }
@ -367,7 +367,7 @@ resource "google_compute_instance_from_template" "scan-21" {
auto_delete = true auto_delete = true
} }
network_interface { network_interface {
subnetwork="monkeyzoo-main" subnetwork="${local.resource_prefix}monkeyzoo-main"
network_ip="10.2.2.21" network_ip="10.2.2.21"
} }
} }
@ -382,7 +382,7 @@ resource "google_compute_instance_from_template" "scan-22" {
auto_delete = true auto_delete = true
} }
network_interface { network_interface {
subnetwork="monkeyzoo-main" subnetwork="${local.resource_prefix}monkeyzoo-main"
network_ip="10.2.2.22" network_ip="10.2.2.22"
} }
} }
@ -397,7 +397,7 @@ resource "google_compute_instance_from_template" "struts2-23" {
auto_delete = true auto_delete = true
} }
network_interface { network_interface {
subnetwork="monkeyzoo-main" subnetwork="${local.resource_prefix}monkeyzoo-main"
network_ip="10.2.2.23" network_ip="10.2.2.23"
} }
} }
@ -412,7 +412,7 @@ resource "google_compute_instance_from_template" "struts2-24" {
auto_delete = true auto_delete = true
} }
network_interface { network_interface {
subnetwork="monkeyzoo-main" subnetwork="${local.resource_prefix}monkeyzoo-main"
network_ip="10.2.2.24" network_ip="10.2.2.24"
} }
} }
@ -429,7 +429,7 @@ resource "google_compute_instance_from_template" "island-linux-250" {
auto_delete = true auto_delete = true
} }
network_interface { network_interface {
subnetwork="monkeyzoo-main" subnetwork="${local.resource_prefix}monkeyzoo-main"
network_ip="10.2.2.250" network_ip="10.2.2.250"
access_config { access_config {
// Cheaper, non-premium routing (not available in some regions) // Cheaper, non-premium routing (not available in some regions)
@ -450,7 +450,7 @@ resource "google_compute_instance_from_template" "island-windows-251" {
auto_delete = true auto_delete = true
} }
network_interface { network_interface {
subnetwork="monkeyzoo-main" subnetwork="${local.resource_prefix}monkeyzoo-main"
network_ip="10.2.2.251" network_ip="10.2.2.251"
access_config { access_config {
// Cheaper, non-premium routing (not available in some regions) // Cheaper, non-premium routing (not available in some regions)

View File

@ -1,5 +1,5 @@
resource "google_compute_instance_template" "ubuntu16" { resource "google_compute_instance_template" "ubuntu16" {
name = "ubuntu16" name = "${local.resource_prefix}ubuntu16"
description = "Creates ubuntu 16.04 LTS servers at europe-west3-a." description = "Creates ubuntu 16.04 LTS servers at europe-west3-a."
tags = ["test-machine", "ubuntu16", "linux"] tags = ["test-machine", "ubuntu16", "linux"]
@ -24,7 +24,7 @@ resource "google_compute_instance_template" "ubuntu16" {
} }
resource "google_compute_instance_template" "windows2016" { resource "google_compute_instance_template" "windows2016" {
name = "windows2016" name = "${local.resource_prefix}windows2016"
description = "Creates windows 2016 core servers at europe-west3-a." description = "Creates windows 2016 core servers at europe-west3-a."
tags = ["test-machine", "windowsserver2016", "windows"] tags = ["test-machine", "windowsserver2016", "windows"]
@ -42,4 +42,4 @@ resource "google_compute_instance_template" "windows2016" {
email="${local.service_account_email}" email="${local.service_account_email}"
scopes=["cloud-platform"] scopes=["cloud-platform"]
} }
} }