-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Description
I'm setting up a new instance of gophish using the newly released 0.5.0, and seem to be running into a strange issue when using MySQL as a database backend. The first run works as expected, but if I try to kill and start gophish again, it attempts to create the admin user again, and fails with a duplicate key error. If I manually delete the admin user from the database, then I can rerun it again fine.
First run:
./gophish
2018/01/30 15:33:28 worker.go:26: Background Worker Started Successfully - Waiting for Campaigns
goose: migrating db environment 'production', current version: 0, target: 20171208201932
OK 20160118194630_init.sql
OK 20160131153104_0.1.2_add_event_details.sql
OK 20160211211220_0.1.2_add_ignore_cert_errors.sql
OK 20160217211342_0.1.2_create_from_col_results.sql
OK 20160225173824_0.1.2_capture_credentials.sql
OK 20160227180335_0.1.2_store-smtp-settings.sql
OK 20160317214457_0.2_redirect_url.sql
OK 20160605210903_0.2_campaign_scheduling.sql
OK 20161202153627_AttachmentFix.sql
OK 20170104231222_0.2_result_statuses.sql
OK 20170219122503_0.2.1_email_headers.sql
OK 20170828220440_0.4_utc_dates.sql
OK 20171027213457_0.4.1_maillogs.sql
OK 20171208201932_0.4.1_next_send_date.sql
2018/01/30 15:33:28 gophish.go:115: Starting phishing server at http://127.0.0.1:8080
2018/01/30 15:33:28 gophish.go:102: Starting admin server at http://127.0.0.1:3333
And everything works as expected. After killing it with "Ctrl+c" and rerunning:
./gophish
2018/01/30 15:33:49 worker.go:26: Background Worker Started Successfully - Waiting for Campaigns
goose: no migrations to run. current version: 20171208201932
2018/01/30 15:33:49 models.go:126: Error 1062: Duplicate entry 'admin' for key 'username'
2018/01/30 15:33:49 gophish.go:77: Error 1062: Duplicate entry 'admin' for key 'username'
config.json:
{
"admin_server" : {
"listen_url" : "127.0.0.1:3333",
"use_tls" : false,
"cert_path" : "gophish_admin.crt",
"key_path" : "gophish_admin.key"
},
"phish_server" : {
"listen_url" : "127.0.0.1:8080",
"use_tls" : false,
"cert_path" : "example.crt",
"key_path": "example.key"
},
"db_name" : "mysql",
"db_path" : "gophish:<redacted>@(:3306)/gophish?charset=utf8&parseTime=True&loc=UTC",
"migrations_prefix" : "db/db_"
}
AuditeMarlow
Metadata
Metadata
Assignees
Labels
No labels