Skip to content

Commit

Permalink
Will exit on port binding failure (gophish#1635)
Browse files Browse the repository at this point in the history
  • Loading branch information
glennzw authored and jordan-wright committed Oct 29, 2019
1 parent 3227437 commit 28252bc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions controllers/phish.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,18 @@ func WithContactAddress(addr string) PhishingServerOption {
}

// Start launches the phishing server, listening on the configured address.
func (ps *PhishingServer) Start() error {
func (ps *PhishingServer) Start() {
if ps.config.UseTLS {
err := util.CheckAndCreateSSL(ps.config.CertPath, ps.config.KeyPath)
if err != nil {
log.Fatal(err)
return err
}
log.Infof("Starting phishing server at https://%s", ps.config.ListenURL)
return ps.server.ListenAndServeTLS(ps.config.CertPath, ps.config.KeyPath)
log.Fatal(ps.server.ListenAndServeTLS(ps.config.CertPath, ps.config.KeyPath))
}
// If TLS isn't configured, just listen on HTTP
log.Infof("Starting phishing server at http://%s", ps.config.ListenURL)
return ps.server.ListenAndServe()
log.Fatal(ps.server.ListenAndServe())
}

// Shutdown attempts to gracefully shutdown the server.
Expand Down
7 changes: 3 additions & 4 deletions controllers/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,21 @@ func NewAdminServer(config config.AdminServer, options ...AdminServerOption) *Ad
}

// Start launches the admin server, listening on the configured address.
func (as *AdminServer) Start() error {
func (as *AdminServer) Start() {
if as.worker != nil {
go as.worker.Start()
}
if as.config.UseTLS {
err := util.CheckAndCreateSSL(as.config.CertPath, as.config.KeyPath)
if err != nil {
log.Fatal(err)
return err
}
log.Infof("Starting admin server at https://%s", as.config.ListenURL)
return as.server.ListenAndServeTLS(as.config.CertPath, as.config.KeyPath)
log.Fatal(as.server.ListenAndServeTLS(as.config.CertPath, as.config.KeyPath))
}
// If TLS isn't configured, just listen on HTTP
log.Infof("Starting admin server at http://%s", as.config.ListenURL)
return as.server.ListenAndServe()
log.Fatal(as.server.ListenAndServe())
}

// Shutdown attempts to gracefully shutdown the server.
Expand Down

0 comments on commit 28252bc

Please sign in to comment.