Skip to content

Commit

Permalink
TLS InsecureSkipVerify option added to sendMail
Browse files Browse the repository at this point in the history
  • Loading branch information
Koodt authored and MaineK00n committed Apr 5, 2024
1 parent 5d5dcd5 commit e9df5ca
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 17 deletions.
19 changes: 10 additions & 9 deletions config/smtpconf.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ import (

// SMTPConf is smtp config
type SMTPConf struct {
SMTPAddr string `toml:"smtpAddr,omitempty" json:"-"`
SMTPPort string `toml:"smtpPort,omitempty" valid:"port" json:"-"`
User string `toml:"user,omitempty" json:"-"`
Password string `toml:"password,omitempty" json:"-"`
From string `toml:"from,omitempty" json:"-"`
To []string `toml:"to,omitempty" json:"-"`
Cc []string `toml:"cc,omitempty" json:"-"`
SubjectPrefix string `toml:"subjectPrefix,omitempty" json:"-"`
Enabled bool `toml:"-" json:"-"`
SMTPAddr string `toml:"smtpAddr,omitempty" json:"-"`
SMTPPort string `toml:"smtpPort,omitempty" valid:"port" json:"-"`
TLSInsecureSkipVerify bool `toml:"tlsInsecureSkipVerify,omitempty" json:"-"`
User string `toml:"user,omitempty" json:"-"`
Password string `toml:"password,omitempty" json:"-"`
From string `toml:"from,omitempty" json:"-"`
To []string `toml:"to,omitempty" json:"-"`
Cc []string `toml:"cc,omitempty" json:"-"`
SubjectPrefix string `toml:"subjectPrefix,omitempty" json:"-"`
Enabled bool `toml:"-" json:"-"`
}

func checkEmails(emails []string) (errs []error) {
Expand Down
3 changes: 2 additions & 1 deletion reporter/email.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ func (e *emailSender) sendMail(smtpServerAddr, message string) (err error) {
emailConf := e.conf
//TLS Config
tlsConfig := &tls.Config{
ServerName: emailConf.SMTPAddr,
ServerName: emailConf.SMTPAddr,
InsecureSkipVerify: emailConf.TLSInsecureSkipVerify,
}
switch emailConf.SMTPPort {
case "465":
Expand Down
15 changes: 8 additions & 7 deletions subcmds/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,14 @@ func printConfigToml(ips []string) (err error) {
# https://vuls.io/docs/en/config.toml.html#email-section
#[email]
#smtpAddr = "smtp.example.com"
#smtpPort = "587"
#user = "username"
#password = "password"
#from = "from@example.com"
#to = ["to@example.com"]
#cc = ["cc@example.com"]
#smtpAddr = "smtp.example.com"
#smtpPort = "587"
#tlsInsecureSkipVerify = false
#user = "username"
#password = "password"
#from = "from@example.com"
#to = ["to@example.com"]
#cc = ["cc@example.com"]
#subjectPrefix = "[vuls]"
# https://vuls.io/docs/en/config.toml.html#http-section
Expand Down

0 comments on commit e9df5ca

Please sign in to comment.