Allow to set the hostname sent to the SMTP server with the HELO command for mail notification (#165)

This commit is contained in:
CrazyMax
2020-08-28 22:01:46 +02:00
parent 6196db1538
commit b0f4f42213
3 changed files with 6 additions and 0 deletions

View File

@@ -22,6 +22,7 @@ Notifications can be sent through SMTP.
| `port`[^1] | `25` | SMTP server port |
| `ssl` | `false` | SSL defines whether an SSL connection is used. Should be false in most cases since the auth mechanism should use STARTTLS |
| `insecureSkipVerify` | `false` | Controls whether a client verifies the server's certificate chain and hostname |
| `localName` | `localhost` | Hostname sent to the SMTP server with the HELO command |
| `username` | | SMTP username |
| `usernameFile` | | Use content of secret file as SMTP username if `username` not defined |
| `password` | | SMTP password |
@@ -34,6 +35,7 @@ Notifications can be sent through SMTP.
* `DIUN_NOTIF_MAIL_PORT`
* `DIUN_NOTIF_MAIL_SSL`
* `DIUN_NOTIF_MAIL_INSECURESKIPVERIFY`
* `DIUN_NOTIF_MAIL_LOCALNAME`
* `DIUN_NOTIF_MAIL_USERNAME`
* `DIUN_NOTIF_MAIL_USERNAMEFILE`
* `DIUN_NOTIF_MAIL_PASSWORD`

View File

@@ -75,6 +75,7 @@ func TestLoadFile(t *testing.T) {
Port: 25,
SSL: utl.NewFalse(),
InsecureSkipVerify: utl.NewFalse(),
LocalName: "localhost",
From: "diun@example.com",
To: "webmaster@example.com",
},
@@ -371,6 +372,7 @@ func TestLoadMixed(t *testing.T) {
Port: 25,
SSL: utl.NewFalse(),
InsecureSkipVerify: utl.NewTrue(),
LocalName: "localhost",
From: "diun@foo.com",
To: "webmaster@foo.com",
},

View File

@@ -10,6 +10,7 @@ type NotifMail struct {
Port int `yaml:"port,omitempty" json:"port,omitempty" validate:"required,min=1"`
SSL *bool `yaml:"ssl,omitempty" json:"ssl,omitempty" validate:"required"`
InsecureSkipVerify *bool `yaml:"insecureSkipVerify,omitempty" json:"insecureSkipVerify,omitempty" validate:"required"`
LocalName string `yaml:"localName,omitempty" json:"localName,omitempty" validate:"omitempty"`
Username string `yaml:"username,omitempty" json:"username,omitempty" validate:"omitempty"`
UsernameFile string `yaml:"usernameFile,omitempty" json:"usernameFile,omitempty" validate:"omitempty,file"`
Password string `yaml:"password,omitempty" json:"password,omitempty" validate:"omitempty"`
@@ -31,4 +32,5 @@ func (s *NotifMail) SetDefaults() {
s.Port = 25
s.SSL = utl.NewFalse()
s.InsecureSkipVerify = utl.NewFalse()
s.LocalName = "localhost"
}