Output an error when a user runs headscale without noise_private_key_path defined

This commit is contained in:
Juan Font Alonso 2022-08-14 12:35:14 +02:00
parent 281ae59b5a
commit ade1b73779
2 changed files with 6 additions and 2 deletions

View File

@ -28,12 +28,12 @@ func initConfig() {
if cfgFile != "" {
err := headscale.LoadConfig(cfgFile, true)
if err != nil {
log.Fatal().Caller().Err(err)
log.Fatal().Caller().Err(err).Msgf("Error loading config file %s", cfgFile)
}
} else {
err := headscale.LoadConfig("", false)
if err != nil {
log.Fatal().Caller().Err(err)
log.Fatal().Caller().Err(err).Msgf("Error loading config")
}
}

View File

@ -184,6 +184,10 @@ func LoadConfig(path string, isFile bool) error {
errorText += "Fatal config error: set either tls_letsencrypt_hostname or tls_cert_path/tls_key_path, not both\n"
}
if !viper.IsSet("noise_private_key_path") {
errorText += "Fatal config error: headscale now requires a new `noise_private_key_path` field in the config file for the Tailscale v2 protocol\n"
}
if (viper.GetString("tls_letsencrypt_hostname") != "") &&
(viper.GetString("tls_letsencrypt_challenge_type") == tlsALPN01ChallengeType) &&
(!strings.HasSuffix(viper.GetString("listen_addr"), ":443")) {