token-validator: Don't use hardcoded tsig anymore

This commit is contained in:
nemunaire 2021-02-13 18:31:52 +01:00
parent 8a3160da10
commit 331192ccbe
2 changed files with 34 additions and 21 deletions

View file

@ -59,12 +59,25 @@ func StripPrefix(prefix string, h http.Handler) http.Handler {
}
func main() {
if v, exists := os.LookupEnv("ADLIN_NS_HOST"); exists {
ControlSocket = v
}
if v, exists := os.LookupEnv("ADLIN_TSIG_NAME"); exists {
tsigName = v
}
if v, exists := os.LookupEnv("ADLIN_TSIG_SECRET"); exists {
tsigSecret = v
}
var bind = flag.String("bind", ":8081", "Bind port/socket")
var dsn = flag.String("dsn", adlin.DSNGenerator(), "DSN to connect to the MySQL server")
flag.StringVar(&baseURL, "baseurl", baseURL, "URL prepended to each URL")
flag.StringVar(&adlin.SharedSecret, "sharedsecret", "adelina", "secret used to communicate with remote validator")
flag.StringVar(&AuthorizedKeysLocation, "authorizedkeyslocation", AuthorizedKeysLocation, "File for allowing user to SSH to the machine")
flag.StringVar(&SshPiperLocation, "sshPiperLocation", SshPiperLocation, "Directory containing directories for sshpiperd")
flag.StringVar(&ControlSocket, "ns-host", ControlSocket, "Host:port of the nameserver to use")
flag.StringVar(&tsigName, "tsig-name", tsigName, "TSIG name to use to contact NS")
flag.StringVar(&tsigSecret, "tsig-secret", tsigSecret, "TSIG secret to use to contact NS")
var dummyauth = flag.Bool("dummyauth", false, "don't perform password check")
flag.Parse()