diff --git a/install b/install index a78a4bf..5110186 100755 --- a/install +++ b/install @@ -579,6 +579,7 @@ config_boulder() { mkdir -p "cmd/mail-tester" cp $cloneDir/mail-tester.go cmd/mail-tester/main.go + perl -i -p0e "s/(\n\t\"github.com\/letsencrypt\/boulder\/cmd\")/\t_ \"github.com\/letsencrypt\/boulder\/cmd\/mail-tester\"\n\t\1/igs" cmd/boulder/main.go &>>$installLog sudo -u labca -H patch -p1 < $cloneDir/patches/db_migrations.patch &>>$installLog cp sa/_db/migrations/20210223140000_CombinedSchema.sql "$boulderLabCADir/.backup/" diff --git a/mail-tester.go b/mail-tester.go index 3658f21..7e23c18 100644 --- a/mail-tester.go +++ b/mail-tester.go @@ -1,4 +1,4 @@ -package main +package notmain import ( "flag" @@ -25,19 +25,38 @@ args: type config struct { Mailer struct { cmd.ServiceConfig - cmd.DBConfig + DB cmd.DBConfig cmd.SMTPConfig From string Subject string + CertLimit int + NagTimes []string + // How much earlier (than configured nag intervals) to + // send reminders, to account for the expected delay + // before the next expiration-mailer invocation. + NagCheckInterval string + // Path to a text/template email template + EmailTemplate string + + Frequency cmd.ConfigDuration + + TLS cmd.TLSConfig + SAService *cmd.GRPCClientConfig + DNSTries int DNSResolvers []string + // Path to a file containing a list of trusted root certificates for use + // during the SMTP connection (as opposed to the gRPC connections). + SMTPTrustedRootFile string + Features map[string]bool } Syslog cmd.SyslogConfig + Beeline cmd.BeelineConfig Common struct { DNSResolver string @@ -54,13 +73,13 @@ func main() { configFile := flag.String("config", "", "File path to the configuration file for this service") flag.Parse() - args := flag.Args() - recipient := args[0] - if len(os.Args) <= 3 || *configFile == "" { usage() } + args := flag.Args() + recipient := args[0] + var c config err := cmd.ReadConfigFile(*configFile, &c) cmd.FailOnError(err, "Reading JSON config file into config structure") @@ -126,3 +145,7 @@ func main() { err = mailClient.SendMail(recipients, "Test Email from LabCA", "Test sending email from the LabCA server") cmd.FailOnError(err, "mail-tester has failed") } + +func init() { + cmd.RegisterCommand("mail-tester", main) +}