From 64c5e54c64fc376efba8d78c0d3a0fdd976f4186 Mon Sep 17 00:00:00 2001 From: Jordan Wright Date: Sat, 9 Jun 2018 18:17:22 -0500 Subject: [PATCH] Added a contact_address entry in config.json to support transparency efforts (ref #1057). Also added a warning in the case where a contact address isn't provided, and fixed the JSON formatting of the configuration. --- config.json | 27 ++++++++++++++------------- config/config.go | 8 ++++++++ 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/config.json b/config.json index 44c07c0b..e05eade4 100644 --- a/config.json +++ b/config.json @@ -1,17 +1,18 @@ { - "admin_server" : { - "listen_url" : "127.0.0.1:3333", - "use_tls" : true, - "cert_path" : "gophish_admin.crt", - "key_path" : "gophish_admin.key" + "admin_server": { + "listen_url": "127.0.0.1:3333", + "use_tls": true, + "cert_path": "gophish_admin.crt", + "key_path": "gophish_admin.key" }, - "phish_server" : { - "listen_url" : "0.0.0.0:80", - "use_tls" : false, - "cert_path" : "example.crt", + "phish_server": { + "listen_url": "0.0.0.0:80", + "use_tls": false, + "cert_path": "example.crt", "key_path": "example.key" }, - "db_name" : "sqlite3", - "db_path" : "gophish.db", - "migrations_prefix" : "db/db_" -} + "db_name": "sqlite3", + "db_path": "gophish.db", + "migrations_prefix": "db/db_", + "contact_address": "" +} \ No newline at end of file diff --git a/config/config.go b/config/config.go index 62d0c184..342fab5c 100644 --- a/config/config.go +++ b/config/config.go @@ -31,6 +31,7 @@ type Config struct { DBPath string `json:"db_path"` MigrationsPath string `json:"migrations_prefix"` TestFlag bool `json:"test_flag"` + ContactAddress string `json:"contact_address"` } // Conf contains the initialized configuration struct @@ -52,4 +53,11 @@ func LoadConfig(filepath string) { Conf.MigrationsPath = Conf.MigrationsPath + Conf.DBName // Explicitly set the TestFlag to false to prevent config.json overrides Conf.TestFlag = false + + // Print a warning if a contact address isn't provided + // (see: https://github.com/gophish/gophish/issues/1057) + if Conf.ContactAddress == "" { + log.Warnf("No contact address has been configured.") + log.Warnf("Please consider adding a contact_address entry in your config.json") + } }