Skip to content

Commit

Permalink
yes
Browse files Browse the repository at this point in the history
  • Loading branch information
David Cooke committed Sep 23, 2020
1 parent fad884b commit 6757ea7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
3 changes: 3 additions & 0 deletions assets/templates/docker-compose.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ services:
- EMAIL_SERVER={{.EmailServer}}
- EMAIL_USER={{.EmailUser}}
- EMAIL_PASS={{.EmailPass}}
{{if .EmailSSL}}
- EMAIL_SSL=1
{{end}}
{{end}}
labels:
- traefik.enable=true
Expand Down
23 changes: 18 additions & 5 deletions cmd/install/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type options struct {
EmailServer string
EmailUser string
EmailPass string
EmailSSL bool
}

var installShellFlag = flag.Bool("shell", false, "Whether to install Shell")
Expand All @@ -46,13 +47,13 @@ var eventNameFlag = flag.String("eventname", "", "The name of the event")
var frontendURLFlag = flag.String("frontendurl", "", "The public URL of your shell instance")
var apiDomainFlag = flag.String("apidomain", "", "The public URL of your core instance")
var userEmailFlag = flag.String("email", "", "The email sent to LetsEncrypt for certificate provisioning")
var emailModeFlag = flag.String("emailmode", "smtp", "How emails should be sent - SMTP, SES or Sendgrid")
var AWSAccessKeyIdFlag = flag.String("awsaccesskeyid", "", "AWS Acess Key ID (For mail)")
var AWSSecretAccessKeyFlag = flag.String("awsaccesskeysecret", "", "AWS Secret Access Key (For mail)")
var sendgridApiKeyFlag = flag.String("sendgridapikey", "", "Sendgrid API Key")
var emailServerFlag = flag.String("smtpserver", "", "SMTP Server")
var emailUserFlag = flag.String("smtpuser", "", "SMTP User")
var emailPassFlag = flag.String("smptpass", "", "SMTP Password")
var emailPassFlag = flag.String("smtpass", "", "SMTP Password")
var emailSSLFlag = flag.Bool("smtpssl", false, "SMTP SSL")
var useWatchtowerFlag = flag.Bool("usewatchtower", false, "Whether to use Watchtower to auto-update RACTF.")
var andromedaIPFlag = flag.String("andromedaip", "", "IP users access challenges through")

Expand Down Expand Up @@ -168,12 +169,24 @@ func main() {
installOptions.EmailServer = mustPromptStringIfNotDefault("SMTP Server?", stringValidator, *emailServerFlag)
installOptions.EmailUser = mustPromptStringIfNotDefault("SMTP Username?", stringValidator, *emailUserFlag)
installOptions.EmailPass = mustPromptStringIfNotDefault("SMTP Password?", stringValidator, *emailPassFlag)
//Is this a bad idea? Almost certainly, but it's 3am and I'm not figuring out a better way
if !(*installShellFlag || *installCoreFlag || *installAndromedaFlag) {
sslPrompt := promptui.Prompt{
Label: fmt.Sprintf("%s", Yellow("Use SSL for SMTP?")),
IsConfirm: true,
}
ssl, err := sslPrompt.Run()
if err != nil {
fmt.Println(promptError)
return
}
installOptions.EmailSSL = ssl == "Y"
} else {
installOptions.EmailSSL = *emailSSLFlag
}
}
}

if installOptions.EmailMode == "AWS" {
}

installOptions.SecretKey = GenerateRandomString(64)
installOptions.AndromedaKey = GenerateRandomString(64)
installOptions.UseWatchtower = *useWatchtowerFlag
Expand Down
2 changes: 1 addition & 1 deletion cmd/install/pkged.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6757ea7

Please sign in to comment.