Making client authentication mode configurable
This commit is contained in:
parent
052fccdc98
commit
9e619fc020
2 changed files with 29 additions and 3 deletions
|
@ -40,6 +40,7 @@ func LoadConfig(path string) error {
|
|||
|
||||
viper.SetDefault("tls_letsencrypt_cache_dir", "/var/www/.cache")
|
||||
viper.SetDefault("tls_letsencrypt_challenge_type", "HTTP-01")
|
||||
viper.SetDefault("tls_client_auth_mode", "disabled")
|
||||
|
||||
viper.SetDefault("ip_prefix", "100.64.0.0/10")
|
||||
|
||||
|
@ -80,6 +81,12 @@ func LoadConfig(path string) error {
|
|||
!strings.HasPrefix(viper.GetString("server_url"), "https://") {
|
||||
errorText += "Fatal config error: server_url must start with https:// or http://\n"
|
||||
}
|
||||
|
||||
auth_mode := viper.GetString("tls_client_auth_mode")
|
||||
if (auth_mode != "disabled" && auth_mode != "enforced"){
|
||||
errorText += "Invalid tls_client_auth_mode supplied. Accepted values: disabled, enforced."
|
||||
}
|
||||
|
||||
if errorText != "" {
|
||||
//nolint
|
||||
return errors.New(strings.TrimSuffix(errorText, "\n"))
|
||||
|
@ -251,6 +258,7 @@ func getHeadscaleConfig() headscale.Config {
|
|||
|
||||
TLSCertPath: absPath(viper.GetString("tls_cert_path")),
|
||||
TLSKeyPath: absPath(viper.GetString("tls_key_path")),
|
||||
TLSClientAuthMode: viper.GetString("tls_client_auth_mode"),
|
||||
|
||||
DNSConfig: dnsConfig,
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue