mirror of
https://github.com/outbackdingo/labca.git
synced 2026-01-28 02:19:31 +00:00
63 lines
1.7 KiB
Diff
63 lines
1.7 KiB
Diff
diff --git a/cmd/notify-mailer/main.go b/cmd/notify-mailer/main.go
|
|
index f4a25a78..68b23dc7 100644
|
|
--- a/cmd/notify-mailer/main.go
|
|
+++ b/cmd/notify-mailer/main.go
|
|
@@ -38,6 +38,7 @@ type mailer struct {
|
|
destinations []recipient
|
|
targetRange interval
|
|
sleepInterval time.Duration
|
|
+ pa *policy.AuthorityImpl
|
|
}
|
|
|
|
// interval defines a range of email addresses to send to, alphabetically.
|
|
@@ -147,7 +148,7 @@ func (m *mailer) run() error {
|
|
m.log.Debugf("skipping %q: out of target range")
|
|
continue
|
|
}
|
|
- if err := policy.ValidEmail(address); err != nil {
|
|
+ if err := m.pa.ValidEmail(address); err != nil {
|
|
m.log.Infof("skipping %q: %s", address, err)
|
|
continue
|
|
}
|
|
@@ -410,7 +411,9 @@ func main() {
|
|
cmd.PasswordConfig
|
|
cmd.SMTPConfig
|
|
Features map[string]bool
|
|
+ cmd.HostnamePolicyConfig
|
|
}
|
|
+ PA cmd.PAConfig
|
|
Syslog cmd.SyslogConfig
|
|
}
|
|
configFile := flag.String("config", "", "File containing a JSON config.")
|
|
@@ -464,6 +467,14 @@ func main() {
|
|
end: *end,
|
|
}
|
|
|
|
+ // Validate PA config and set defaults if needed
|
|
+ cmd.FailOnError(cfg.PA.CheckChallenges(), "Invalid PA configuration")
|
|
+
|
|
+ pa, err := policy.New(cfg.PA.Challenges)
|
|
+ cmd.FailOnError(err, "Failed to create PA")
|
|
+ err = pa.SetHostnamePolicyFile(cfg.NotifyMailer.HostnamePolicyFile)
|
|
+ cmd.FailOnError(err, "Failed to load HostnamePolicyFile")
|
|
+
|
|
var mailClient bmail.Mailer
|
|
if *dryRun {
|
|
log.Infof("Doing a dry run.")
|
|
@@ -477,6 +488,7 @@ func main() {
|
|
cfg.NotifyMailer.Username,
|
|
smtpPassword,
|
|
nil,
|
|
+ nil,
|
|
*address,
|
|
log,
|
|
metrics.NoopRegisterer,
|
|
@@ -494,6 +506,7 @@ func main() {
|
|
emailTemplate: template,
|
|
targetRange: targetRange,
|
|
sleepInterval: *sleep,
|
|
+ pa: pa,
|
|
}
|
|
|
|
err = m.run()
|