How to install GoPhish on Ubuntu

GoPhish is an open-source, web-based phishing simulation framework that security teams use to run authorized phishing campaigns against their own employees. It lets organizations design phishing emails and matching landing pages, send those messages as part of controlled campaigns, and track who received the email, who opened it, who clicked links, and who submitted data to a landing page. The platform also provides reporting and metrics so teams can measure risk areas and training effectiveness, and it exposes an API for automation and integration with other tools.

Typical uses include employee security awareness training, red-team or purple-team exercises that are authorized and controlled, measuring whether click rates improve after training, and identifying departments or workflows that need targeted education. Important ethical and legal considerations apply: only run GoPhish on systems and people you are explicitly authorized to test, since running phishing campaigns without consent can be illegal and harmful. It’s best to have written authorization, a clear policy and off-ramp for distressed users, and a remediation plan for those who fall for tests. Avoid harvesting real credentials or storing them on landing pages — use simulated inputs instead.

How to install GoPhish on Ubuntu 24.04

				
					apt install wget
cd .. #Change directory to root
mkdir opt
cd opt
wget https://github.com/gophish/gophish/releases/download/v0.12.1/gophish-v0.12.1-linux-64bit.zip

unzip gophish-v0.12.1-linux-64bit.zip

nano config.json

<!-- Change to the following -->

"admin_server": {
                "listen_url": "0.0.0.0:3333",
                "use_tls": true,
                "cert_path": "gophish_admin.crt",
                "key_path": "gophish_admin.key",
                "trusted_origins": []

<!-- End of change -->

chmod +x gophish

./gophish

Look for Password 

Go to public IP of your VPS

https://IP-Address-of-VPS:3333

User: admin
Password: (Provided when running ./gophish command)
				
			

Enable SSL Cert

				
					<!-- Create a dedicated user -->
sudo useradd -r -s /usr/sbin/nologin -m -d /nonexistent gophish || true
sudo chown -R root:root /opt/gophish
sudo chmod -R 755 /opt/gophish
sudo chmod +x /opt/gophish


<!-- Create a systemd service - Make sure correct Working and Exec is selected-->
sudo tee /etc/systemd/system/gophish.service > /dev/null <<'EOF'
[Unit]
Description=GoPhish phishing server
After=network.target

[Service]
Type=simple
User=gophish
WorkingDirectory=/opt/gophish
ExecStart=/opt/gophish/gophish
Restart=on-failure

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable --now gophish
sudo systemctl status gophish --no-pager



<!-- Point your domain URL your GoPhish IP Address -->

sudo apt update
sudo apt install snapd -y
sudo snap install core; sudo snap refresh core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot

sudo systemctl stop gophish      # or otherwise stop gophish process
sudo certbot certonly --standalone -d example.com
sudo systemctl start gophish

<!-- Configure GoPhish to use the cert  -->

nano config.json

"phish_server": {
  "listen_url": "0.0.0.0:443",
  "use_tls": true,
  "cert_path": "/etc/letsencrypt/live/yourdomain.com/fullchain.pem",
  "key_path": "/etc/letsencrypt/live/yourdomain.com/privkey.pem"
}

sudo chgrp gophish /etc/letsencrypt/live/example.com
sudo chmod 750 /etc/letsencrypt/live/example.com

sudo systemctl restart gophish

<!-- Renewal -->
sudo certbot renew --deploy-hook "systemctl restart gophish"










sudo nano /etc/systemd/system/gophish.service

<!-- Start of file -->

[Unit]
Description=Gophish phishing server
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/opt/gophish
ExecStart=/opt/gophish/gophish
Restart=on-failure

[Install]
WantedBy=multi-user.target

<!-- End of file -->

sudo systemctl daemon-reload
sudo systemctl enable --now gophish
sudo systemctl status gophish

<!-- Obtain Cert -->

sudo systemctl stop gophish
sudo certbot certonly --standalone -d yourdomain.com -m you@yourdomain.com --agree-tos --no-eff-email

<!-- certs created at /etc/letsencrypt/live/yourdomain.com/ -->

sudo systemctl start gophish



sudo systemctl restart gophish
sudo journalctl -u gophish -n 200 --no-pager

<!-- Make sure permissions allow GoPhish to read certs -->

sudo useradd -r -s /usr/sbin/nologin gophish
sudo chown -R root:root /etc/letsencrypt/live/yourdomain.com
sudo usermod -aG root gophish
sudo chmod 640 /etc/letsencrypt/live/yourdomain.com/privkey.pem

sudo nano /usr/local/sbin/gophish-reload-after-certbot.sh

<!-- Start of file -->

#!/bin/bash
# restart gophish after certbot successfully renews certificate
systemctl is-active --quiet gophish && systemctl restart gophish
exit 0

 <!-- End of file -->

sudo chmod +x /usr/local/sbin/gophish-reload-after-certbot.sh

sudo certbot renew --deploy-hook "/usr/local/sbin/gophish-reload-after-certbot.sh"


				
			

Leave a Reply

Your email address will not be published. Required fields are marked *