A W.I.P. collection of Ansible Playbooks that deploy the gophish application, including the provision of hosts and DNS records using Terraform.
Will configure the following items to a existing host:
- Installs any needed roles locally with ansible-galaxy.
- Installs any needed packages for Ansible management.
- Update installed packages to latest version.
- Setup Firewall (allows in 22, 80, 443)
- Create user for gophish service.
- Update the hostname.
- Postfix for mail relay.
- Selfsigned SSL certs.
- NGINX for phishlets.
- Logrotate for gophish.
- Install gophish as a service.
-
Ensure Ansible is installed.
-
Update the inventory file
- Point to your IP.
- Set the correct SSH key.
- Set the correct SSH user.
-
Update
defaults/main.yml- Set
domainto your root domain. - Set
server_hostnameto the desired server hostname. - Set
server_phishlet_hostnameto the desired name NGINX will proxy to gophish for phishlets. - Update if desired, user and group created to run gophish as
gophish_service_accountandgophish_service_account_group
- Set
-
Run Playbook
ansible-playbook main.yml --inventory inventory.yml
-
Login to gophish
ssh -L 3333:127.0.0.1:3333 user@ip- Use your favorite browser and open https://localhost:3333
- Login using the credentials given to you by the ansible output.
Will create a fresh ubuntu 20.04 droplet and configure the following things:
- Generates unique SSH keys for each deployment.
- Setup basic DNS with CloudFlare.
- Setup up a DigitalOcean Project.
- Setup up a DigitalOcean Firewall that
- allows in 22 from
"0.0.0.0/0", "::/0" - allows 80, 443 in from CloudFlare IP ranges.
- allows in 22 from
- Setup up a DigitalOcean Droplet.
- Installs any needed roles locally with ansible-galaxy.
- Installs any needed packages for Ansible management.
- Update installed packages to latest version.
- Setup Firewall (allows in 22, 80 ,443)
- Create user for gophish service.
- Update the hostname.
- Postfix for mail relay.
- Selfsigned SSL certs (for fallback).
- NGINX for phishlets.
- Generate Certificates with certbot and setup auto renewal.
- Logrotate for gophish.
- Install gophish as a service.
-
Ensure Ansible and Terraform are installed.
-
Copy
defaults/main.example.ymltodefaults/main.yml- Set the correct SSH key folder. (
sshkey_folder) - Set the correct contact mail for certbot (
cerbot_contact_mail) - Set the name for the VPS (
vps_name) - Set
domainto your root domain. - Set
server_hostnameto the desired server hostname. - Set
server_phishlet_hostnameto the desired name NGINX will proxy to gophish for phishlets. - Update if desired, user and group created to run gophish as
gophish_service_accountandgophish_service_account_group - Other vars should work as is.
- Set the correct SSH key folder. (
-
Copy
defaults/secrets.example.ymltodefaults/secrets.yml- Update
cf_api_tokento your CloudFlare API token (https://dash.cloudflare.com/profile/api-tokens).- Account Settings -> Read
- All zones
- Zone -> Read
- DNS -> Edit
- Update
cf_zone_idto your CloudFlare Zone ID. (https://dash.cloudflare.com/\*id\*/\*domain_name\*) - Update
do_tokento your DigitalOcean token (https://cloud.digitalocean.com/account/api/tokens). - OPTIONAL BUT RECOMMENDED: Encrypt the
secret.ymlfile with Ansible Vault.
- Update
-
Not all Terraform variables are currently 'made available' as Ansible variables. For now they can be overwritten by updating
terraform_playbooks\terraform\variables.tf. -
Deploy and configure the infrastucture
ansible-playbook main.yml
-
Login to gophish
ssh -L 3333:127.0.0.1:3333 user@ip- Use your favorite browser and open https://localhost:3333
- Login using the credentials given to you by the ansible output.
-
Destroy the infrastructure
ansible-playbook main.yml --tags=destroy
Will create a fresh ubuntu 20.04 droplet and configure the following things:
- Generates unique SSH keys for each deployment.
- Setup basic DNS with CloudFlare.
- Setup up a hetzer VPS with correct Reverse DNS.
- Installs any needed roles locally with ansible-galaxy.
- Installs any needed packages for Ansible management.
- Update installed packages to latest version.
- Setup Firewall (allows in 22, 80, 443)
- Create user for gophish service.
- Update the hostname.
- Postfix for mail relay.
- Selfsigned SSL certs (for fallback).
- NGINX for phishlets.
- Generate Certificates with certbot and setup auto renewal.
- Logrotate for gophish.
- Install gophish as a service.
-
Ensure Ansible and Terraform are installed.
-
Copy
defaults/main.example.ymltodefaults/main.yml- Set the correct SSH key folder. (
sshkey_folder) - Set the correct contact mail for certbot (
cerbot_contact_mail) - Set the name for the vps (
vps_name) - Set
domainto your root domain. - Set
server_hostnameto the desired server hostname. - Set
server_phishlet_hostnameto the desired name NGINX will proxy to gophish for phishlets. - Update if desired, user and group created to run gophish as
gophish_service_accountandgophish_service_account_group - Other vars should work as is.
- Set the correct SSH key folder. (
-
Copy
defaults/secrets.example.ymltodefaults/secrets.yml- Update
cf_api_tokento your CloudFlare API token (https://dash.cloudflare.com/profile/api-tokens).- Account Settings -> Read
- All zones
- Zone -> Read
- DNS -> Edit
- Update
cf_zone_idto your CloudFlare Zone ID. (https://dash.cloudflare.com/\*id\*/\*domain_name\*) - Update
hetzer_tokento your hetzer API token (https://console.hetzner.cloud/projects/\*id\*/security/tokens). - OPTIONAL BUT RECOMMENDED: Encrypt the
secret.ymlfile with Ansible Vault.
- Update
-
Not all Terraform variables are currently 'made available' as Ansible variables. For now they can be overwritten by updating
terraform_playbooks\terraform\variables.tf. -
Deploy and configure the infrastucture
ansible-playbook main.yml
-
Login to gophish
ssh -L 3333:127.0.0.1:3333 user@ip- Use your favorite browser and open https://localhost:3333
- Login using the credentials given to you by the ansible output.
-
Destroy the infrastructure
ansible-playbook main.yml --tags=destroy