diff --git a/cmd/frostfs-adm/internal/modules/morph/helper/n3client.go b/cmd/frostfs-adm/internal/modules/morph/helper/n3client.go index 55449b435..e62a21b3f 100644 --- a/cmd/frostfs-adm/internal/modules/morph/helper/n3client.go +++ b/cmd/frostfs-adm/internal/modules/morph/helper/n3client.go @@ -2,6 +2,7 @@ package helper import ( "context" + "crypto/tls" "errors" "fmt" "time" @@ -60,9 +61,23 @@ func GetN3Client(v *viper.Viper) (Client, error) { if endpoint == "" { return nil, errors.New("missing endpoint") } + + var cfg *tls.Config + if rootCAs := v.GetStringSlice("tls.trusted_ca_list"); len(rootCAs) != 0 { + certFile := v.GetString("tls.certificate") + keyFile := v.GetString("tls.key") + + tlsConfig, err := rpcclient.TLSClientConfig(rootCAs, certFile, keyFile) + if err != nil { + return nil, err + } + + cfg = tlsConfig + } c, err := rpcclient.New(ctx, endpoint, rpcclient.Options{ MaxConnsPerHost: maxConnsPerHost, RequestTimeout: requestTimeout, + TLSClientConfig: cfg, }) if err != nil { return nil, err