Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support sni and skipverify option for etcd tls #2850

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions api/conf/conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ conf:
key_file: "" # Path of your self-signed client side key
cert_file: "" # Path of your self-signed client side cert
ca_file: "" # Path of your self-signed ca cert, the CA is used to sign callers' certificates
# sni: "" # The SNI for etcd TLS requests
# skipverify: false # Verify the etcd certificate when establishing a TLS connection with etcd
# prefix: /apisix # apisix config's prefix in etcd, /apisix by default
log:
error_log:
Expand Down
8 changes: 5 additions & 3 deletions api/internal/conf/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ var (
)

type MTLS struct {
CaFile string `mapstructure:"ca_file"`
CertFile string `mapstructure:"cert_file"`
KeyFile string `mapstructure:"key_file"`
CaFile string `mapstructure:"ca_file"`
CertFile string `mapstructure:"cert_file"`
KeyFile string `mapstructure:"key_file"`
ServerName string `mapstructure:"sni"`
SkipVerify bool `mapstructure:"skipverify"`
}

type Etcd struct {
Expand Down
2 changes: 2 additions & 0 deletions api/internal/core/storage/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ func InitETCDClient(etcdConf *conf.Etcd) error {
CertFile: etcdConf.MTLS.CertFile,
KeyFile: etcdConf.MTLS.KeyFile,
TrustedCAFile: etcdConf.MTLS.CaFile,
ServerName: etcdConf.MTLS.ServerName,
InsecureSkipVerify: etcdConf.MTLS.SkipVerify,
}
tlsConfig, err := tlsInfo.ClientConfig()
if err != nil {
Expand Down