Skip to content

Commit 9a4dd12

Browse files
author
Aiden Keating
committed
Add certificatePinning key to https
1 parent f1b29b9 commit 9a4dd12

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

pkg/cmd/clientConfig.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ kubectl plugin mobile get clientconfig`,
141141
if err != nil {
142142
return errors.Wrap(err, "Could not append HTTPS configuration for services")
143143
}
144-
outputJSON.Https = servicePinningHashes
144+
outputJSON.Https.CertificatePinning = servicePinningHashes
145145
}
146146

147147
if err := ccc.Out.Render("get"+cmd.Name(), outputType(cmd.Flags()), outputJSON); err != nil {

pkg/cmd/convert.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
package cmd
1616

1717
import (
18-
"strings"
19-
"k8s.io/client-go/pkg/api/v1"
2018
"crypto/sha256"
2119
"crypto/tls"
2220
"crypto/x509"
2321
"encoding/base64"
2422
"fmt"
2523
"github.com/pkg/errors"
24+
"k8s.io/client-go/pkg/api/v1"
2625
"net/url"
26+
"strings"
2727
)
2828

2929
func isClientConfigKey(key string) bool {

pkg/cmd/types.go

+10-6
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ type SecretConvertor interface {
7171

7272
//ServiceConfigs are collection of configurations for services in a specific namespace
7373
type ServiceConfigs struct {
74-
Version int `json:"version"`
75-
ClusterName string `json:"clusterName"`
76-
Namespace string `json:"namespace"`
77-
ClientID string `json:"clientId,omitempty"`
78-
Services []*ServiceConfig `json:"services"`
79-
Https []*CertificatePinningHash `json:"https,omitempty"`
74+
Version int `json:"version"`
75+
ClusterName string `json:"clusterName"`
76+
Namespace string `json:"namespace"`
77+
ClientID string `json:"clientId,omitempty"`
78+
Services []*ServiceConfig `json:"services"`
79+
Https HttpsConfig `json:"https,omitempty"`
8080
}
8181

8282
//ServiceConfig is the configuration for a specific service
@@ -88,6 +88,10 @@ type ServiceConfig struct {
8888
Config map[string]interface{} `json:"config"`
8989
}
9090

91+
type HttpsConfig struct {
92+
CertificatePinning []*CertificatePinningHash `json:"certificatePinning,omitempty"`
93+
}
94+
9195
type CertificatePinningHash struct {
9296
Host string `json:"host"`
9397
CertificateHash string `json:"certificateHash"`

0 commit comments

Comments
 (0)