Skip to content
This repository was archived by the owner on Mar 10, 2026. It is now read-only.

Commit 9e40f34

Browse files
committed
fix: add server_name in mtls config
1 parent 8197e94 commit 9e40f34

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

config/manager_config.default.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ in_cluster = false
102102

103103
[mtls]
104104
enable = false
105+
server_name = "localhost"
105106
cert_pem = """
106107
-----BEGIN CERTIFICATE-----
107108
YOUR_MANAGER_CERTIFICATE_HERE

config/manager_config.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ type ManageConfig struct {
4343
// CertPem and KeyPem are the service's own certificate/key pair signed by the private CA.
4444
// CAPem is the private CA certificate used to verify the peer's certificate.
4545
type MTLSConfig struct {
46-
Enable bool `mapstructure:"enable"`
47-
CertPem SecretValue `mapstructure:"cert_pem"`
48-
KeyPem SecretValue `mapstructure:"key_pem"`
49-
CAPem SecretValue `mapstructure:"ca_pem"`
46+
Enable bool `mapstructure:"enable"`
47+
ServerName string `mapstructure:"server_name"`
48+
CertPem SecretValue `mapstructure:"cert_pem"`
49+
KeyPem SecretValue `mapstructure:"key_pem"`
50+
CAPem SecretValue `mapstructure:"ca_pem"`
5051
}
5152

5253
type MongoDBConfig struct {
@@ -80,9 +81,7 @@ type K8SConfig struct {
8081
IsInCluster bool `mapstructure:"in_cluster"`
8182
}
8283

83-
var (
84-
managerCfg *ManageConfig
85-
)
84+
var managerCfg *ManageConfig
8685

8786
func GetManagerConfig() *ManageConfig {
8887
return managerCfg

manager/client/deicison_maker.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ func NewDecisionMakerClient(keyConfig config.KeyConfig, mtlsCfg config.MTLSConfi
3636
Certificates: []tls.Certificate{cert},
3737
RootCAs: caPool,
3838
MinVersion: tls.VersionTLS12,
39+
ServerName: mtlsCfg.ServerName,
3940
}
4041

4142
defaultTransport, ok := http.DefaultTransport.(*http.Transport)

0 commit comments

Comments
 (0)