mirror of
https://github.com/telekom-security/tpotce.git
synced 2025-07-02 01:27:27 -04:00
Begin of restructuring ...
- deprecate old release - set virtual version - we need tpot user / group, adding to installer - tweaking - do not use the dev branch, it will break stuff
This commit is contained in:
129
_deprecated/cloud/terraform/README.md
Normal file
129
_deprecated/cloud/terraform/README.md
Normal file
@ -0,0 +1,129 @@
|
||||
# T-Pot Terraform
|
||||
This [Terraform](https://www.terraform.io/) configuration can be used to launch a virtual machine, bootstrap any dependencies and install T-Pot in a single step.
|
||||
Configuration for Amazon Web Services (AWS) and Open Telekom Cloud (OTC) is currently included.
|
||||
This can easily be extended to support other [Terraform providers](https://registry.terraform.io/browse/providers?category=public-cloud%2Ccloud-automation%2Cinfrastructure).
|
||||
|
||||
[Cloud-init](https://cloudinit.readthedocs.io/en/latest/) is used to bootstrap the instance and install T-Pot on startup.
|
||||
|
||||
# Table of Contents
|
||||
- [What get's created](#what-created)
|
||||
- [Amazon Web Services (AWS)](#what-created-aws)
|
||||
- [Open Telekom Cloud (OTC)](#what-created-otc)
|
||||
- [Prerequisites](#pre)
|
||||
- [Amazon Web Services (AWS)](#pre-aws)
|
||||
- [Open Telekom Cloud (OTC)](#pre-otc)
|
||||
- [Terraform Variables](#variables)
|
||||
- [Common configuration items](#variables-common)
|
||||
- [Amazon Web Services (AWS)](#variables-aws)
|
||||
- [Open Telekom Cloud (OTC)](#variables-otc)
|
||||
- [Initialising](#initialising)
|
||||
- [Applying the Configuration](#applying)
|
||||
- [Connecting to the Instance](#connecting)
|
||||
|
||||
<a name="what-created"></a>
|
||||
## What get's created
|
||||
|
||||
<a name="what-created-aws"></a>
|
||||
### Amazon Web Services (AWS)
|
||||
* EC2 instance:
|
||||
* t3.large (2 vCPUs, 8 GB RAM)
|
||||
* 128 GB disk
|
||||
* Debian 10
|
||||
* Public IP
|
||||
* Security Group:
|
||||
* TCP/UDP ports <= 64000 open to the Internet
|
||||
* TCP ports 64294, 64295 and 64297 open to a chosen administrative IP
|
||||
|
||||
<a name="what-created-otc"></a>
|
||||
### Open Telekom Cloud (OTC)
|
||||
* ECS instance:
|
||||
* s3.medium.8 (1 vCPU, 8 GB RAM)
|
||||
* 128 GB disk
|
||||
* Debian 10
|
||||
* Public EIP
|
||||
* Security Group
|
||||
* All TCP/UDP ports are open to the Internet
|
||||
* Virtual Private Cloud (VPC) and Subnet
|
||||
|
||||
<a name="pre"></a>
|
||||
## Prerequisites
|
||||
* [Terraform](https://www.terraform.io/) 0.13
|
||||
|
||||
<a name="pre-aws"></a>
|
||||
### Amazon Web Services (AWS)
|
||||
* AWS Account
|
||||
* Existing VPC: VPC ID needs to be specified in `aws/variables.tf`
|
||||
* Existing subnet: Subnet ID needs to be specified in `aws/variables.tf`
|
||||
* Existing SSH key pair: Key name needs to be specified in `aws/variables.tf`
|
||||
* AWS Authentication credentials should be [set using environment variables](https://www.terraform.io/docs/providers/aws/index.html#environment-variables)
|
||||
|
||||
<a name="pre-otc"></a>
|
||||
### Open Telekom Cloud (OTC)
|
||||
* OTC Account
|
||||
* Existing SSH key pair: Key name needs to be specified in `otc/variables.tf`
|
||||
* OTC Authentication credentials (Username, Password, Project Name, User Domain Name) can be set in the `otc/clouds.yaml` file
|
||||
|
||||
<a name="variables"></a>
|
||||
## Terraform Variables
|
||||
|
||||
<a name="variables-common"></a>
|
||||
### Common configuration items
|
||||
These variables exist in `aws/variables.tf` and `otc/variables.tf` respectively.
|
||||
Settings for cloud-init:
|
||||
* `timezone` - Set the Server's timezone
|
||||
* `linux_password`- Set a password for the Linux Operating System user (which is also used on the Admin UI)
|
||||
|
||||
Settings for T-Pot:
|
||||
* `tpot_flavor` - Set the flavor of the T-Pot (Available flavors are listed in the variable's description)
|
||||
* `web_user` - Set a username for the T-Pot Kibana Dasboard
|
||||
* `web_password` - Set a password for the T-Pot Kibana Dashboard
|
||||
|
||||
<a name="variables-aws"></a>
|
||||
### Amazon Web Services (AWS)
|
||||
In `aws/variables.tf`, you can change the additional variables:
|
||||
* `admin_ip` - source IP address(es) that you will use to administer the system. Connections to TCP ports 64294, 64295 and 64297 will be allowed from this IP only. Multiple IPs or CIDR blocks can be specified in the format: `["127.0.0.1/32", "192.168.0.0/24"]`
|
||||
* `ec2_vpc_id` - Specify an existing VPC ID
|
||||
* `ec2_subnet_id` - Specify an existing Subnet ID
|
||||
* `ec2_region`
|
||||
* `ec2_ssh_key_name` - Specify an existing SSH key pair
|
||||
* `ec2_instance_type`
|
||||
|
||||
<a name="variables-otc"></a>
|
||||
### Open Telekom Cloud (OTC)
|
||||
In `otc/variables.tf`, you can change the additional variables:
|
||||
* `ecs_flavor`
|
||||
* `ecs_disk_size`
|
||||
* `availability_zone`
|
||||
* `key_pair` - Specify an existing SSH key pair
|
||||
* `eip_size`
|
||||
|
||||
... and some more, but these are the most relevant.
|
||||
|
||||
<a name="initialising"></a>
|
||||
## Initialising
|
||||
The [`terraform init`](https://www.terraform.io/docs/commands/init.html) command is used to initialize a working directory containing Terraform configuration files.
|
||||
|
||||
```
|
||||
$ cd aws
|
||||
$ terraform init
|
||||
```
|
||||
OR
|
||||
```
|
||||
$ cd otc
|
||||
$ terraform init
|
||||
```
|
||||
|
||||
<a name="applying"></a>
|
||||
## Applying the Configuration
|
||||
The [`terraform apply`](https://www.terraform.io/docs/commands/apply.html) command is used to apply the changes required to reach the desired state of the configuration, or the pre-determined set of actions generated by a [`terraform plan`](https://www.terraform.io/docs/commands/plan.html) execution plan.
|
||||
|
||||
```
|
||||
$ terraform apply
|
||||
```
|
||||
This will create your infrastructure and start a Cloud Server. On startup, the Server gets bootstrapped with cloud-init and will install T-Pot. Once this is done, the server will reboot.
|
||||
|
||||
If you want the remove the built infrastructure, you can run [`terraform destroy`](https://www.terraform.io/docs/commands/destroy.html) to delete it.
|
||||
|
||||
<a name="connecting"></a>
|
||||
## Connecting to the Instance
|
||||
When the installation is completed, you can proceed with connecting/logging in to the T-Pot according to the [documentation](https://github.com/telekom-security/tpotce#ssh-and-web-access).
|
20
_deprecated/cloud/terraform/aws/.terraform.lock.hcl
generated
Normal file
20
_deprecated/cloud/terraform/aws/.terraform.lock.hcl
generated
Normal file
@ -0,0 +1,20 @@
|
||||
# This file is maintained automatically by "terraform init".
|
||||
# Manual edits may be lost in future updates.
|
||||
|
||||
provider "registry.terraform.io/hashicorp/aws" {
|
||||
version = "3.26.0"
|
||||
constraints = "3.26.0"
|
||||
hashes = [
|
||||
"h1:0i78FItlPeiomd+4ThZrtm56P5K33k7/6dnEe4ZePI0=",
|
||||
"zh:26043eed36d070ca032cf04bc980c654a25821a8abc0c85e1e570e3935bbfcbb",
|
||||
"zh:2fe68f3f78d23830a04d7fac3eda550eef1f627dfc130486f70a65dc5c254300",
|
||||
"zh:3d66484c608c64678e639db25d63872783ce60363a1246e30317f21c9c23b84b",
|
||||
"zh:46ffd755cfd4cf94fe66342797b5afdcef010a24e126c67fee141b357d393535",
|
||||
"zh:5e96f24357e945c9067cf5e032ad1d003609629c956c2f9f642fefe714e74587",
|
||||
"zh:60c27aca36bb63bf3e865c2193be80ca83b376581d00f9c220af4b013e163c4d",
|
||||
"zh:896f0f22d19d41e71b22f9240b261714c3915b165ddefeb771e7734d69dc47ea",
|
||||
"zh:90de9966cb2fd3e2f326df291595e55d2dd2d90e7d6dd085c2c8691dce82bdb4",
|
||||
"zh:ad05a91a88ceb1d6de5a568f7cc0b0e5bc0a79f3da70bc28c1e7f3750e362d58",
|
||||
"zh:e8c63f59c6465329e1f3357498face3dd7ef10a033df3c366a33aa9e94b46c01",
|
||||
]
|
||||
}
|
66
_deprecated/cloud/terraform/aws/main.tf
Normal file
66
_deprecated/cloud/terraform/aws/main.tf
Normal file
@ -0,0 +1,66 @@
|
||||
provider "aws" {
|
||||
region = var.ec2_region
|
||||
}
|
||||
|
||||
resource "aws_security_group" "tpot" {
|
||||
name = "T-Pot"
|
||||
description = "T-Pot Honeypot"
|
||||
vpc_id = var.ec2_vpc_id
|
||||
ingress {
|
||||
from_port = 0
|
||||
to_port = 64000
|
||||
protocol = "tcp"
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
}
|
||||
ingress {
|
||||
from_port = 0
|
||||
to_port = 64000
|
||||
protocol = "udp"
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
}
|
||||
ingress {
|
||||
from_port = 64294
|
||||
to_port = 64294
|
||||
protocol = "tcp"
|
||||
cidr_blocks = var.admin_ip
|
||||
}
|
||||
ingress {
|
||||
from_port = 64295
|
||||
to_port = 64295
|
||||
protocol = "tcp"
|
||||
cidr_blocks = var.admin_ip
|
||||
}
|
||||
ingress {
|
||||
from_port = 64297
|
||||
to_port = 64297
|
||||
protocol = "tcp"
|
||||
cidr_blocks = var.admin_ip
|
||||
}
|
||||
egress {
|
||||
from_port = 0
|
||||
to_port = 0
|
||||
protocol = "-1"
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
}
|
||||
tags = {
|
||||
Name = "T-Pot"
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_instance" "tpot" {
|
||||
ami = var.ec2_ami[var.ec2_region]
|
||||
instance_type = var.ec2_instance_type
|
||||
key_name = var.ec2_ssh_key_name
|
||||
subnet_id = var.ec2_subnet_id
|
||||
tags = {
|
||||
Name = "T-Pot Honeypot"
|
||||
}
|
||||
root_block_device {
|
||||
volume_type = "gp2"
|
||||
volume_size = 128
|
||||
delete_on_termination = true
|
||||
}
|
||||
user_data = templatefile("../cloud-init.yaml", { timezone = var.timezone, password = var.linux_password, tpot_flavor = var.tpot_flavor, web_user = var.web_user, web_password = var.web_password })
|
||||
vpc_security_group_ids = [aws_security_group.tpot.id]
|
||||
associate_public_ip_address = true
|
||||
}
|
12
_deprecated/cloud/terraform/aws/outputs.tf
Normal file
12
_deprecated/cloud/terraform/aws/outputs.tf
Normal file
@ -0,0 +1,12 @@
|
||||
output "Admin_UI" {
|
||||
value = "https://${aws_instance.tpot.public_dns}:64294/"
|
||||
}
|
||||
|
||||
output "SSH_Access" {
|
||||
value = "ssh -i {private_key_file} -p 64295 admin@${aws_instance.tpot.public_dns}"
|
||||
}
|
||||
|
||||
output "Web_UI" {
|
||||
value = "https://${aws_instance.tpot.public_dns}:64297/"
|
||||
}
|
||||
|
93
_deprecated/cloud/terraform/aws/variables.tf
Normal file
93
_deprecated/cloud/terraform/aws/variables.tf
Normal file
@ -0,0 +1,93 @@
|
||||
variable "admin_ip" {
|
||||
default = ["127.0.0.1/32"]
|
||||
description = "admin IP addresses in CIDR format"
|
||||
}
|
||||
|
||||
variable "ec2_vpc_id" {
|
||||
description = "ID of AWS VPC"
|
||||
default = "vpc-XXX"
|
||||
}
|
||||
|
||||
variable "ec2_subnet_id" {
|
||||
description = "ID of AWS VPC subnet"
|
||||
default = "subnet-YYY"
|
||||
}
|
||||
|
||||
variable "ec2_region" {
|
||||
description = "AWS region to launch servers"
|
||||
default = "eu-west-1"
|
||||
}
|
||||
|
||||
variable "ec2_ssh_key_name" {
|
||||
default = "default"
|
||||
}
|
||||
|
||||
# https://aws.amazon.com/ec2/instance-types/
|
||||
# t3.large = 2 vCPU, 8 GiB RAM
|
||||
variable "ec2_instance_type" {
|
||||
default = "t3.large"
|
||||
}
|
||||
|
||||
# Refer to https://wiki.debian.org/Cloud/AmazonEC2Image/Bullseye
|
||||
variable "ec2_ami" {
|
||||
type = map(string)
|
||||
default = {
|
||||
"af-south-1" = "ami-0c372f041acae6d49"
|
||||
"ap-east-1" = "ami-079b8d011d4655385"
|
||||
"ap-northeast-1" = "ami-08dbbf1c0485a4aa8"
|
||||
"ap-northeast-2" = "ami-0269fe7d013b8e2dd"
|
||||
"ap-northeast-3" = "ami-0848d1e5fb6e3e3da"
|
||||
"ap-south-1" = "ami-020d429f17c9f1d0a"
|
||||
"ap-southeast-1" = "ami-09625a221230d9fe6"
|
||||
"ap-southeast-2" = "ami-03cbc6cddb06af2c2"
|
||||
"ca-central-1" = "ami-09125623b02302014"
|
||||
"eu-central-1" = "ami-00c36c60f07e21791"
|
||||
"eu-north-1" = "ami-052bea934e2d9dbfe"
|
||||
"eu-south-1" = "ami-04e2bb16d37324719"
|
||||
"eu-west-1" = "ami-0f87948fe2cf1b2a4"
|
||||
"eu-west-2" = "ami-02ed1bc837487d535"
|
||||
"eu-west-3" = "ami-080efd2add7e29430"
|
||||
"me-south-1" = "ami-0dbde382c834c4a72"
|
||||
"sa-east-1" = "ami-0a0792814cb068077"
|
||||
"us-east-1" = "ami-05dd1b6e7ef6f8378"
|
||||
"us-east-2" = "ami-04dd0542609808c50"
|
||||
"us-west-1" = "ami-07af5f877b3db9f73"
|
||||
"us-west-2" = "ami-0d0d8694ba492c02b"
|
||||
}
|
||||
}
|
||||
|
||||
## cloud-init configuration ##
|
||||
variable "timezone" {
|
||||
default = "UTC"
|
||||
}
|
||||
|
||||
variable "linux_password" {
|
||||
#default = "LiNuXuSeRPaSs#"
|
||||
description = "Set a password for the default user"
|
||||
|
||||
validation {
|
||||
condition = length(var.linux_password) > 0
|
||||
error_message = "Please specify a password for the default user."
|
||||
}
|
||||
}
|
||||
|
||||
## These will go in the generated tpot.conf file ##
|
||||
variable "tpot_flavor" {
|
||||
default = "STANDARD"
|
||||
description = "Specify your tpot flavor [STANDARD, HIVE, HIVE_SENSOR, INDUSTRIAL, LOG4J, MEDICAL, MINI, SENSOR]"
|
||||
}
|
||||
|
||||
variable "web_user" {
|
||||
default = "webuser"
|
||||
description = "Set a username for the web user"
|
||||
}
|
||||
|
||||
variable "web_password" {
|
||||
#default = "w3b$ecret"
|
||||
description = "Set a password for the web user"
|
||||
|
||||
validation {
|
||||
condition = length(var.web_password) > 0
|
||||
error_message = "Please specify a password for the web user."
|
||||
}
|
||||
}
|
9
_deprecated/cloud/terraform/aws/versions.tf
Normal file
9
_deprecated/cloud/terraform/aws/versions.tf
Normal file
@ -0,0 +1,9 @@
|
||||
terraform {
|
||||
required_version = ">= 0.13"
|
||||
required_providers {
|
||||
aws = {
|
||||
source = "hashicorp/aws"
|
||||
version = "3.26.0"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
provider "aws" {
|
||||
alias = "eu-west-2"
|
||||
region = "eu-west-2"
|
||||
}
|
||||
|
||||
provider "aws" {
|
||||
alias = "us-west-1"
|
||||
region = "us-west-1"
|
||||
}
|
27
_deprecated/cloud/terraform/aws_multi_region/main.tf
Normal file
27
_deprecated/cloud/terraform/aws_multi_region/main.tf
Normal file
@ -0,0 +1,27 @@
|
||||
module "eu-west-2" {
|
||||
source = "./modules/multi-region"
|
||||
ec2_vpc_id = "vpc-xxxxxxxx"
|
||||
ec2_subnet_id = "subnet-xxxxxxxx"
|
||||
ec2_region = "eu-west-2"
|
||||
tpot_name = "T-Pot Honeypot"
|
||||
|
||||
linux_password = var.linux_password
|
||||
web_password = var.web_password
|
||||
providers = {
|
||||
aws = aws.eu-west-2
|
||||
}
|
||||
}
|
||||
|
||||
module "us-west-1" {
|
||||
source = "./modules/multi-region"
|
||||
ec2_vpc_id = "vpc-xxxxxxxx"
|
||||
ec2_subnet_id = "subnet-xxxxxxxx"
|
||||
ec2_region = "us-west-1"
|
||||
tpot_name = "T-Pot Honeypot"
|
||||
|
||||
linux_password = var.linux_password
|
||||
web_password = var.web_password
|
||||
providers = {
|
||||
aws = aws.us-west-1
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
variable "ec2_vpc_id" {}
|
||||
variable "ec2_subnet_id" {}
|
||||
variable "ec2_region" {}
|
||||
variable "linux_password" {}
|
||||
variable "web_password" {}
|
||||
variable "tpot_name" {}
|
||||
|
||||
resource "aws_security_group" "tpot" {
|
||||
name = "T-Pot"
|
||||
description = "T-Pot Honeypot"
|
||||
vpc_id = var.ec2_vpc_id
|
||||
ingress {
|
||||
from_port = 0
|
||||
to_port = 64000
|
||||
protocol = "tcp"
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
}
|
||||
ingress {
|
||||
from_port = 0
|
||||
to_port = 64000
|
||||
protocol = "udp"
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
}
|
||||
ingress {
|
||||
from_port = 64294
|
||||
to_port = 64294
|
||||
protocol = "tcp"
|
||||
cidr_blocks = var.admin_ip
|
||||
}
|
||||
ingress {
|
||||
from_port = 64295
|
||||
to_port = 64295
|
||||
protocol = "tcp"
|
||||
cidr_blocks = var.admin_ip
|
||||
}
|
||||
ingress {
|
||||
from_port = 64297
|
||||
to_port = 64297
|
||||
protocol = "tcp"
|
||||
cidr_blocks = var.admin_ip
|
||||
}
|
||||
egress {
|
||||
from_port = 0
|
||||
to_port = 0
|
||||
protocol = "-1"
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
}
|
||||
tags = {
|
||||
Name = "T-Pot"
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_instance" "tpot" {
|
||||
ami = var.ec2_ami[var.ec2_region]
|
||||
instance_type = var.ec2_instance_type
|
||||
key_name = var.ec2_ssh_key_name
|
||||
subnet_id = var.ec2_subnet_id
|
||||
tags = {
|
||||
Name = var.tpot_name
|
||||
}
|
||||
root_block_device {
|
||||
volume_type = "gp2"
|
||||
volume_size = 128
|
||||
delete_on_termination = true
|
||||
}
|
||||
user_data = templatefile("../cloud-init.yaml", { timezone = var.timezone, password = var.linux_password, tpot_flavor = var.tpot_flavor, web_user = var.web_user, web_password = var.web_password })
|
||||
vpc_security_group_ids = [aws_security_group.tpot.id]
|
||||
associate_public_ip_address = true
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
output "Admin_UI" {
|
||||
value = "https://${aws_instance.tpot.public_dns}:64294/"
|
||||
}
|
||||
|
||||
output "SSH_Access" {
|
||||
value = "ssh -i {private_key_file} -p 64295 admin@${aws_instance.tpot.public_dns}"
|
||||
}
|
||||
|
||||
output "Web_UI" {
|
||||
value = "https://${aws_instance.tpot.public_dns}:64297/"
|
||||
}
|
||||
|
@ -0,0 +1,57 @@
|
||||
variable "admin_ip" {
|
||||
default = ["127.0.0.1/32"]
|
||||
description = "admin IP addresses in CIDR format"
|
||||
}
|
||||
|
||||
variable "ec2_ssh_key_name" {
|
||||
default = "default"
|
||||
}
|
||||
|
||||
# https://aws.amazon.com/ec2/instance-types/
|
||||
variable "ec2_instance_type" {
|
||||
default = "t3.xlarge"
|
||||
}
|
||||
|
||||
# Refer to https://wiki.debian.org/Cloud/AmazonEC2Image/Bullseye
|
||||
variable "ec2_ami" {
|
||||
type = map(string)
|
||||
default = {
|
||||
"af-south-1" = "ami-0c372f041acae6d49"
|
||||
"ap-east-1" = "ami-079b8d011d4655385"
|
||||
"ap-northeast-1" = "ami-08dbbf1c0485a4aa8"
|
||||
"ap-northeast-2" = "ami-0269fe7d013b8e2dd"
|
||||
"ap-northeast-3" = "ami-0848d1e5fb6e3e3da"
|
||||
"ap-south-1" = "ami-020d429f17c9f1d0a"
|
||||
"ap-southeast-1" = "ami-09625a221230d9fe6"
|
||||
"ap-southeast-2" = "ami-03cbc6cddb06af2c2"
|
||||
"ca-central-1" = "ami-09125623b02302014"
|
||||
"eu-central-1" = "ami-00c36c60f07e21791"
|
||||
"eu-north-1" = "ami-052bea934e2d9dbfe"
|
||||
"eu-south-1" = "ami-04e2bb16d37324719"
|
||||
"eu-west-1" = "ami-0f87948fe2cf1b2a4"
|
||||
"eu-west-2" = "ami-02ed1bc837487d535"
|
||||
"eu-west-3" = "ami-080efd2add7e29430"
|
||||
"me-south-1" = "ami-0dbde382c834c4a72"
|
||||
"sa-east-1" = "ami-0a0792814cb068077"
|
||||
"us-east-1" = "ami-05dd1b6e7ef6f8378"
|
||||
"us-east-2" = "ami-04dd0542609808c50"
|
||||
"us-west-1" = "ami-07af5f877b3db9f73"
|
||||
"us-west-2" = "ami-0d0d8694ba492c02b"
|
||||
}
|
||||
}
|
||||
|
||||
## cloud-init configuration ##
|
||||
variable "timezone" {
|
||||
default = "UTC"
|
||||
}
|
||||
|
||||
## These will go in the generated tpot.conf file ##
|
||||
variable "tpot_flavor" {
|
||||
default = "STANDARD"
|
||||
description = "Specify your tpot flavor [STANDARD, HIVE, HIVE_SENSOR, INDUSTRIAL, LOG4J, MEDICAL, MINI, SENSOR]"
|
||||
}
|
||||
|
||||
variable "web_user" {
|
||||
default = "webuser"
|
||||
description = "Set a username for the web user"
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
terraform {
|
||||
required_version = ">= 0.13"
|
||||
required_providers {
|
||||
aws = {
|
||||
source = "hashicorp/aws"
|
||||
version = "3.72.0"
|
||||
}
|
||||
}
|
||||
}
|
7
_deprecated/cloud/terraform/aws_multi_region/outputs.tf
Normal file
7
_deprecated/cloud/terraform/aws_multi_region/outputs.tf
Normal file
@ -0,0 +1,7 @@
|
||||
output "eu-west-2_Web_UI" {
|
||||
value = module.eu-west-2.Web_UI
|
||||
}
|
||||
|
||||
output "us-west-1_Web_UI" {
|
||||
value = module.us-west-1.Web_UI
|
||||
}
|
19
_deprecated/cloud/terraform/aws_multi_region/variables.tf
Normal file
19
_deprecated/cloud/terraform/aws_multi_region/variables.tf
Normal file
@ -0,0 +1,19 @@
|
||||
variable "linux_password" {
|
||||
#default = "LiNuXuSeRP4Ss!"
|
||||
description = "Set a password for the default user"
|
||||
|
||||
validation {
|
||||
condition = length(var.linux_password) > 0
|
||||
error_message = "Please specify a password for the default user."
|
||||
}
|
||||
}
|
||||
|
||||
variable "web_password" {
|
||||
#default = "w3b$ecret20"
|
||||
description = "Set a password for the web user"
|
||||
|
||||
validation {
|
||||
condition = length(var.web_password) > 0
|
||||
error_message = "Please specify a password for the web user."
|
||||
}
|
||||
}
|
26
_deprecated/cloud/terraform/cloud-init.yaml
Normal file
26
_deprecated/cloud/terraform/cloud-init.yaml
Normal file
@ -0,0 +1,26 @@
|
||||
#cloud-config
|
||||
timezone: ${timezone}
|
||||
|
||||
packages:
|
||||
- git
|
||||
|
||||
runcmd:
|
||||
- curl -sS --retry 5 https://github.com
|
||||
- git clone https://github.com/telekom-security/tpotce /root/tpot
|
||||
- /root/tpot/iso/installer/install.sh --type=auto --conf=/root/tpot.conf
|
||||
- rm /root/tpot.conf
|
||||
- /sbin/shutdown -r now
|
||||
|
||||
password: ${password}
|
||||
chpasswd:
|
||||
expire: false
|
||||
|
||||
write_files:
|
||||
- content: |
|
||||
# tpot configuration file
|
||||
myCONF_TPOT_FLAVOR='${tpot_flavor}'
|
||||
myCONF_WEB_USER='${web_user}'
|
||||
myCONF_WEB_PW='${web_password}'
|
||||
owner: root:root
|
||||
path: /root/tpot.conf
|
||||
permissions: '0600'
|
38
_deprecated/cloud/terraform/otc/.terraform.lock.hcl
generated
Normal file
38
_deprecated/cloud/terraform/otc/.terraform.lock.hcl
generated
Normal file
@ -0,0 +1,38 @@
|
||||
# This file is maintained automatically by "terraform init".
|
||||
# Manual edits may be lost in future updates.
|
||||
|
||||
provider "registry.terraform.io/hashicorp/random" {
|
||||
version = "3.1.0"
|
||||
constraints = "~> 3.1.0"
|
||||
hashes = [
|
||||
"h1:BZMEPucF+pbu9gsPk0G0BHx7YP04+tKdq2MrRDF1EDM=",
|
||||
"zh:2bbb3339f0643b5daa07480ef4397bd23a79963cc364cdfbb4e86354cb7725bc",
|
||||
"zh:3cd456047805bf639fbf2c761b1848880ea703a054f76db51852008b11008626",
|
||||
"zh:4f251b0eda5bb5e3dc26ea4400dba200018213654b69b4a5f96abee815b4f5ff",
|
||||
"zh:7011332745ea061e517fe1319bd6c75054a314155cb2c1199a5b01fe1889a7e2",
|
||||
"zh:738ed82858317ccc246691c8b85995bc125ac3b4143043219bd0437adc56c992",
|
||||
"zh:7dbe52fac7bb21227acd7529b487511c91f4107db9cc4414f50d04ffc3cab427",
|
||||
"zh:a3a9251fb15f93e4cfc1789800fc2d7414bbc18944ad4c5c98f466e6477c42bc",
|
||||
"zh:a543ec1a3a8c20635cf374110bd2f87c07374cf2c50617eee2c669b3ceeeaa9f",
|
||||
"zh:d9ab41d556a48bd7059f0810cf020500635bfc696c9fc3adab5ea8915c1d886b",
|
||||
"zh:d9e13427a7d011dbd654e591b0337e6074eef8c3b9bb11b2e39eaaf257044fd7",
|
||||
"zh:f7605bd1437752114baf601bdf6931debe6dc6bfe3006eb7e9bb9080931dca8a",
|
||||
]
|
||||
}
|
||||
|
||||
provider "registry.terraform.io/opentelekomcloud/opentelekomcloud" {
|
||||
version = "1.23.6"
|
||||
constraints = "~> 1.23.4"
|
||||
hashes = [
|
||||
"h1:B/1Md957jWaDgFqsJDzmJc75KwL0eC/PCVuZ8HV5xSc=",
|
||||
"zh:1aa79010869d082157fb44fc83c3bff4e40938ec0ca916f704d974c7f7ca39e4",
|
||||
"zh:3155b8366828ce50231f69962b55df1e2261ed63c44bb64e2c950dd68769df1b",
|
||||
"zh:4a909617aa96a6d8aead14f56996ad94e0a1cae9d28e8df1ddae19c2095ed337",
|
||||
"zh:4f71046719632b4b90f88d29d8ba88915ee6ad66cd9d7ebe84a7459013e5003a",
|
||||
"zh:67e4d10b2db79ad78ae2ec8d9dfac53c4721028f97f4436a7aa45e80b1beefd3",
|
||||
"zh:7f12541fc5a3513e5522ff2bd5fee17d1e67bfe64f9ef59d03863fc7389e12ce",
|
||||
"zh:86fadabfc8307cf6084a412ffc9c797ec94932d08bc663a3fcebf98101e951f6",
|
||||
"zh:98744b39c2bfe3e8e6f929f750a689971071b257f3f066f669f93c8e0b76d179",
|
||||
"zh:c363d41debb060804e2c6bd9cb50b4e8daa37362299e3ea74e187265cd85f2ca",
|
||||
]
|
||||
}
|
68
_deprecated/cloud/terraform/otc/main.tf
Normal file
68
_deprecated/cloud/terraform/otc/main.tf
Normal file
@ -0,0 +1,68 @@
|
||||
data "opentelekomcloud_images_image_v2" "debian" {
|
||||
name = "Standard_Debian_10_latest"
|
||||
}
|
||||
|
||||
resource "opentelekomcloud_networking_secgroup_v2" "secgroup_1" {
|
||||
name = var.secgroup_name
|
||||
description = var.secgroup_desc
|
||||
}
|
||||
|
||||
resource "opentelekomcloud_networking_secgroup_rule_v2" "secgroup_rule_1" {
|
||||
direction = "ingress"
|
||||
ethertype = "IPv4"
|
||||
remote_ip_prefix = "0.0.0.0/0"
|
||||
security_group_id = opentelekomcloud_networking_secgroup_v2.secgroup_1.id
|
||||
}
|
||||
|
||||
resource "opentelekomcloud_vpc_v1" "vpc_1" {
|
||||
name = var.vpc_name
|
||||
cidr = var.vpc_cidr
|
||||
}
|
||||
|
||||
resource "opentelekomcloud_vpc_subnet_v1" "subnet_1" {
|
||||
name = var.subnet_name
|
||||
cidr = var.subnet_cidr
|
||||
vpc_id = opentelekomcloud_vpc_v1.vpc_1.id
|
||||
|
||||
gateway_ip = var.subnet_gateway_ip
|
||||
dns_list = ["100.125.4.25", "100.125.129.199"]
|
||||
}
|
||||
|
||||
resource "random_id" "tpot" {
|
||||
byte_length = 6
|
||||
prefix = var.ecs_prefix
|
||||
}
|
||||
|
||||
resource "opentelekomcloud_ecs_instance_v1" "ecs_1" {
|
||||
name = random_id.tpot.b64_url
|
||||
image_id = data.opentelekomcloud_images_image_v2.debian.id
|
||||
flavor = var.ecs_flavor
|
||||
vpc_id = opentelekomcloud_vpc_v1.vpc_1.id
|
||||
|
||||
nics {
|
||||
network_id = opentelekomcloud_vpc_subnet_v1.subnet_1.id
|
||||
}
|
||||
|
||||
system_disk_size = var.ecs_disk_size
|
||||
system_disk_type = "SAS"
|
||||
security_groups = [opentelekomcloud_networking_secgroup_v2.secgroup_1.id]
|
||||
availability_zone = var.availability_zone
|
||||
key_name = var.key_pair
|
||||
user_data = templatefile("../cloud-init.yaml", { timezone = var.timezone, password = var.linux_password, tpot_flavor = var.tpot_flavor, web_user = var.web_user, web_password = var.web_password })
|
||||
}
|
||||
|
||||
resource "opentelekomcloud_vpc_eip_v1" "eip_1" {
|
||||
publicip {
|
||||
type = "5_bgp"
|
||||
}
|
||||
bandwidth {
|
||||
name = "bandwidth-${random_id.tpot.b64_url}"
|
||||
size = var.eip_size
|
||||
share_type = "PER"
|
||||
}
|
||||
}
|
||||
|
||||
resource "opentelekomcloud_compute_floatingip_associate_v2" "fip_1" {
|
||||
floating_ip = opentelekomcloud_vpc_eip_v1.eip_1.publicip.0.ip_address
|
||||
instance_id = opentelekomcloud_ecs_instance_v1.ecs_1.id
|
||||
}
|
11
_deprecated/cloud/terraform/otc/outputs.tf
Normal file
11
_deprecated/cloud/terraform/otc/outputs.tf
Normal file
@ -0,0 +1,11 @@
|
||||
output "Admin_UI" {
|
||||
value = "https://${opentelekomcloud_vpc_eip_v1.eip_1.publicip.0.ip_address}:64294"
|
||||
}
|
||||
|
||||
output "SSH_Access" {
|
||||
value = "ssh -p 64295 linux@${opentelekomcloud_vpc_eip_v1.eip_1.publicip.0.ip_address}"
|
||||
}
|
||||
|
||||
output "Web_UI" {
|
||||
value = "https://${opentelekomcloud_vpc_eip_v1.eip_1.publicip.0.ip_address}:64297"
|
||||
}
|
3
_deprecated/cloud/terraform/otc/provider.tf
Normal file
3
_deprecated/cloud/terraform/otc/provider.tf
Normal file
@ -0,0 +1,3 @@
|
||||
provider "opentelekomcloud" {
|
||||
cloud = "open-telekom-cloud"
|
||||
}
|
98
_deprecated/cloud/terraform/otc/variables.tf
Normal file
98
_deprecated/cloud/terraform/otc/variables.tf
Normal file
@ -0,0 +1,98 @@
|
||||
## cloud-init configuration ##
|
||||
variable "timezone" {
|
||||
default = "UTC"
|
||||
}
|
||||
|
||||
variable "linux_password" {
|
||||
#default = "LiNuXuSeRPaSs#"
|
||||
description = "Set a password for the default user"
|
||||
|
||||
validation {
|
||||
condition = length(var.linux_password) > 0
|
||||
error_message = "Please specify a password for the default user."
|
||||
}
|
||||
}
|
||||
|
||||
## Security Group ##
|
||||
variable "secgroup_name" {
|
||||
default = "sg-tpot"
|
||||
}
|
||||
|
||||
variable "secgroup_desc" {
|
||||
default = "Security Group for T-Pot"
|
||||
}
|
||||
|
||||
## Virtual Private Cloud ##
|
||||
variable "vpc_name" {
|
||||
default = "vpc-tpot"
|
||||
}
|
||||
|
||||
variable "vpc_cidr" {
|
||||
default = "192.168.0.0/16"
|
||||
}
|
||||
|
||||
## Subnet ##
|
||||
variable "subnet_name" {
|
||||
default = "subnet-tpot"
|
||||
}
|
||||
|
||||
variable "subnet_cidr" {
|
||||
default = "192.168.0.0/24"
|
||||
}
|
||||
|
||||
variable "subnet_gateway_ip" {
|
||||
default = "192.168.0.1"
|
||||
}
|
||||
|
||||
## Elastic Cloud Server ##
|
||||
variable "ecs_prefix" {
|
||||
default = "tpot-"
|
||||
}
|
||||
|
||||
variable "ecs_flavor" {
|
||||
default = "s3.medium.8"
|
||||
}
|
||||
|
||||
variable "ecs_disk_size" {
|
||||
default = "128"
|
||||
}
|
||||
|
||||
variable "availability_zone" {
|
||||
default = "eu-de-03"
|
||||
}
|
||||
|
||||
variable "key_pair" {
|
||||
#default = ""
|
||||
description = "Specify your SSH key pair"
|
||||
|
||||
validation {
|
||||
condition = length(var.key_pair) > 0
|
||||
error_message = "Please specify a Key Pair."
|
||||
}
|
||||
}
|
||||
|
||||
## Elastic IP ##
|
||||
variable "eip_size" {
|
||||
default = "100"
|
||||
}
|
||||
|
||||
## These will go in the generated tpot.conf file ##
|
||||
variable "tpot_flavor" {
|
||||
default = "STANDARD"
|
||||
description = "Specify your tpot flavor [STANDARD, HIVE, HIVE_SENSOR, INDUSTRIAL, LOG4J, MEDICAL, MINI, SENSOR]"
|
||||
}
|
||||
|
||||
variable "web_user" {
|
||||
default = "webuser"
|
||||
description = "Set a username for the web user"
|
||||
}
|
||||
|
||||
variable "web_password" {
|
||||
#default = "w3b$ecret"
|
||||
description = "Set a password for the web user"
|
||||
|
||||
validation {
|
||||
condition = length(var.web_password) > 0
|
||||
error_message = "Please specify a password for the web user."
|
||||
}
|
||||
}
|
13
_deprecated/cloud/terraform/otc/versions.tf
Normal file
13
_deprecated/cloud/terraform/otc/versions.tf
Normal file
@ -0,0 +1,13 @@
|
||||
terraform {
|
||||
required_version = ">= 0.13"
|
||||
required_providers {
|
||||
opentelekomcloud = {
|
||||
source = "opentelekomcloud/opentelekomcloud"
|
||||
version = "~> 1.23.4"
|
||||
}
|
||||
random = {
|
||||
source = "hashicorp/random"
|
||||
version = "~> 3.1.0"
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user