Skip to content

Commit

Permalink
Replace Secure mode with UseSMTPS and AllowInsecureAuth options
Browse files Browse the repository at this point in the history
  • Loading branch information
mback2k committed Dec 21, 2018
1 parent 416d206 commit 5eee2de
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ The following YAML file is an example configuration with one virtual host:
```
Address: "localhost:25"
Domain: "localhost"
Secure: true
LetsEncrypt:
Agreed: true
Contact: [email protected]
Challenge: http
ChallengePort: 80
Expand Down
22 changes: 12 additions & 10 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,27 @@ type configVHost struct {
}

type config struct {
Address string
Domain string
Secure bool
LetsEncrypt *configAcmeLe
MaxIdleSeconds int
MaxMessageBytes int
MaxRecipients int
VirtualHosts []*configVHost
HeaderKeys []string
Address string
Domain string
UseSMTPS bool
LetsEncrypt *configAcmeLe
MaxIdleSeconds int
MaxMessageBytes int
MaxRecipients int
AllowInsecureAuth bool
VirtualHosts []*configVHost
HeaderKeys []string
}

func loadConfig() (*config, error) {
vpr := viper.GetViper()
vpr.SetDefault("Secure", false)
vpr.SetDefault("UseSMTPS", false)
vpr.SetDefault("LetsEncrypt.Agreed", false)
vpr.SetDefault("LetsEncrypt.Challenge", "http")
vpr.SetDefault("MaxIdleSeconds", 300)
vpr.SetDefault("MaxMessageBytes", 10240000)
vpr.SetDefault("MaxRecipients", 50)
vpr.SetDefault("AllowInsecureAuth", false)
vpr.SetDefault("HeaderKeys", defaultHeaderKeys)
vpr.SetConfigName("smtp-dkim-signer")
vpr.AddConfigPath("/etc/smtp-dkim-signer/")
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func setupServer() (*smtp.Server, bool) {
log.Fatal(err)
}
}
return server, cfg.Secure
return server, cfg.UseSMTPS
}

func main() {
Expand Down
2 changes: 1 addition & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func makeServer(cfg *config, be *backend) *smtp.Server {
s.MaxIdleSeconds = cfg.MaxIdleSeconds
s.MaxMessageBytes = cfg.MaxMessageBytes
s.MaxRecipients = cfg.MaxRecipients
s.AllowInsecureAuth = !cfg.Secure
s.AllowInsecureAuth = cfg.AllowInsecureAuth
return s
}

Expand Down

0 comments on commit 5eee2de

Please sign in to comment.