VPS-Docker-For-Pentest – Create A VPS On Google Cloud Platform Or Digital Ocean Easily With The Docker For Pentest
Make a VPS on Google Cloud Platform or Digital Ocean conveniently with the docker for pentest included to launch the evaluation to the concentrate on.
Needs
- Terraform put in
- Ansible put in
- SSH private and public keys
- Google Cloud Platform or Electronic Ocean account.
1.- Clone the repository
git clone --depth 1 https://github.com/aaaguirrep/vps-docker-for-pentest.git vps
cd vps
2.- Credentials
- Create credentials folder.
mkdir qualifications
For Google Cloud Platform
- Build a new project.
- Build company account with “Compute Admin” position and obtain a essential in json format in qualifications folder.
- Rename the important to pentest.json
- Enable “Compute Motor API” for the challenge.
For Digital Ocean
- Develop a Personalized entry tokens with publish authorization and copy it. See Tutorial
SSH Private and General public keys
- Inside credentials folder run
ssh-keygen -t rsa -f pentest
in the terminal. Vacant passphrase is alright. - It creates two files: personal and community key.
3.- Terraform
Google Cloud Platform
- Enter to gcp folder and modify the up coming benefit:
- In key.tf file modify the undertaking price with your challenge-id.
- Run the up coming commands:
# Initialize terraform supplier
$ terraform init
Terraform has been successfully initialized!
# Create the assets
$ terraform implement -car-approve
Use comprehensive! Means: 3 additional, improved, ruined.
Outputs:
external_ip = x.x.x.x
- Duplicate the external_ip value
Be aware: The occasion kind and the area applied are: n1-common-1 and us-central1. You can modify the values on server.tf and primary.tf
Demo
Electronic Ocean
- Enter to electronic-ocean folder
- With the personalized accessibility token copied operate
export TF_VAR_do_token="Personal_Access_Token_Below"
- Operate the next commands:
# Initialize terraform service provider
$ terraform init
Terraform has been correctly initialized!
# Create the means
$ terraform use -auto-approve
Implement comprehensive! Methods: 3 additional, changed, ruined.
Outputs:
exterior_ip = x.x.x.x
- Duplicate the external_ip price
Observe: The droplet form and the location employed are: s-2vcpu-4gb and nyc3. You can modify the values on server.tf and variables.tf
Demo
4.- Ansible
- Enter to ansible folder
- In hosts.yaml adjust the x.x.x.x by external_ip value copied.
- Operate the up coming command:
$ ansible-playbook playbook.yaml
Process [Configuration finished] *******************************************************
okay: [x.x.x.x] =>
"msg": "Technique configured appropriately."
Demo
5.- Obtain to VPS
- In gcp or electronic-ocean folder run the subsequent command. Modify x.x.x.x by exterior_ip price copied.
# Obtain to VPS
$ ssh pentest@x.x.x.x -i ../qualifications/pentest
Demo
6.- Ruin the VPS
- In gcp or digital-ocean folder operate the subsequent command.
# Demolish the useful resource
$ terraform ruin -automobile-approve
Notice: For Electronic Ocean, if you dont have a default VPC produced in the area applied it displays an mistake to ruin the VPC but no challenge, it will demolish the some others means.