Skip to content

Commit 871493c

Browse files
feat: allow the use of insecure cipher suits (#492)
if configured by user to support older devices. addresses device-management-toolkit/console#445 Co-authored-by: Ganesh Raikhelkar <[email protected]>
1 parent f7fe59e commit 871493c

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed

pkg/wsman/client/types.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ import (
77

88
// Parameters struct defines the connection settings for wsman client.
99
type Parameters struct {
10-
Target string
11-
Username string
12-
Password string
13-
UseDigest bool
14-
UseTLS bool
15-
SelfSignedAllowed bool
16-
LogAMTMessages bool
17-
Transport http.RoundTripper
18-
IsRedirection bool
19-
PinnedCert string
20-
TlsConfig *tls.Config
10+
Target string
11+
Username string
12+
Password string
13+
UseDigest bool
14+
UseTLS bool
15+
SelfSignedAllowed bool
16+
LogAMTMessages bool
17+
Transport http.RoundTripper
18+
IsRedirection bool
19+
PinnedCert string
20+
TlsConfig *tls.Config
21+
AllowInsecureCipherSuites bool
2122
}

pkg/wsman/client/wsman.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ import (
2121
"sync"
2222
"time"
2323

24-
"github.com/sirupsen/logrus"
25-
2624
"github.com/open-amt-cloud-toolkit/go-wsman-messages/v2/pkg/amterror"
25+
"github.com/sirupsen/logrus"
2726
)
2827

2928
const (
@@ -127,6 +126,21 @@ func NewWsman(cp Parameters) *Target {
127126
config = res.tlsConfig
128127
} else {
129128
config = &tls.Config{InsecureSkipVerify: cp.SelfSignedAllowed}
129+
130+
if cp.AllowInsecureCipherSuites {
131+
defaultCipherSuites := tls.CipherSuites()
132+
config.CipherSuites = make([]uint16, 0, len(defaultCipherSuites)+3)
133+
134+
for _, suite := range defaultCipherSuites {
135+
config.CipherSuites = append(config.CipherSuites, suite.ID)
136+
}
137+
// add the weak cipher suites
138+
config.CipherSuites = append(config.CipherSuites,
139+
tls.TLS_RSA_WITH_AES_128_GCM_SHA256,
140+
tls.TLS_RSA_WITH_AES_128_CBC_SHA,
141+
tls.TLS_RSA_WITH_AES_256_CBC_SHA,
142+
)
143+
}
130144
}
131145
}
132146

0 commit comments

Comments
 (0)