Installation
Installing Gophish from Source
One of the major benefits of having written gophish in the Go programming language is that it is extremely simple to build from source. All you will need is the Go language and a C compiler (such as gcc).
To install gophish, simply run go get github.com/gophish/gophish
. This downloads gophish into your $GOPATH
.
Next, navigate to $GOPATH/src/github.com/gophish/gophish
and run the command go build
. This builds a gophish binary in the current directory.
There are some settings that are configurable via a file called config.json, located in the gophish root directory. Here are some of the options that you can set to your preferences:
By default, the phish_server.listen_url
is configured to listen on all interfaces. This means that if the host Gophish is running on is exposed to the Internet (such as running on a VPS), the phishing server will be exposed to the Internet.
If you also want the admin server to be accessible over the Internet, you will need to change the entry for the admin_server.listen_url
to 0.0.0.0:3333
.
Creating SSL Certificate and Private Keys
We can start the certificate and key generation process with the following command:
Then, all we have to do is answer the CSR process that asks for details such as country, state, etc. Since this is a local self-signed cert, these won’t matter too much to us.
This creates two files, gophish.key and gophish.crt. After moving these files into the gophish root directory (in the same folder as config.json), we can have the following in our config.json file:
Now when we launch gophish, you’ll connect to the admin server over HTTPS and accept the self-signed certificate warning.
The default database in Gophish is SQLite. This is perfectly functional, but some environments may benefit from leveraging a more robust database such as MySQL.
Support for Mysql has been added as of 0.3-dev. To setup Gophish for Mysql, a couple extra steps are needed.
Update
First, change the entries in config.json
to match your deployment:
Example:
Gophish uses a datetime format that is incompatible with MySQL >= 5.7. To fix this, Add the following lines to the bottom of /etc/mysql/mysql.cnf
:
The above settings are the default modes for MySQL, but with NO_ZERO_IN_DATE and NO_ZERO_DATE removed.
Create the Database
The last step you’ll need to do to leverage Mysql is to create the gophish
database. To do this, log into mysql and run the command
.
After that, you’ll be good to go!
Running Gophish
Now that you have gophish installed, you’re ready to run the software. To launch gophish, simply open a command shell and navigate to the directory the gophish binary is located.
Then, execute the gophish binary. You will see some informational output showing both the admin and phishing web servers starting up, as well as the database being created. This output will tell you the port numbers you can use to connect to the web interfaces.
To run Gophish as a service in Linux distributions, you will need to setup a service script. You can refer to for an example implementation.