Skip to content

Commit 6d18ba8

Browse files
authored
feat(fips): do not set insecure defaults in fips mode (#273)
make setinsecuredefaults a noop and use tls 1.2+ in fips mode
1 parent 4518e1e commit 6d18ba8

File tree

3 files changed

+55
-14
lines changed

3 files changed

+55
-14
lines changed

transport/tlscommon/versions_default.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,6 @@ var tlsProtocolVersions = map[string]TLSVersion{
5959
"TLSv1.3": TLSVersion13,
6060
}
6161

62-
// SetInsecureDefaults is currently a nop as the default versions have not changed.
63-
//
64-
// This function is used to avoid a breaking change on previous releases.
65-
// We plan on the default minimum versions list to exclude TLS1.1, and not allow TLS1.0 in a future library update.
66-
func SetInsecureDefaults() {
67-
TLSVersionMin = TLSVersion10
68-
TLSVersionDefaultMin = TLSVersion11
69-
TLSDefaultVersions = []TLSVersion{
70-
TLSVersion11,
71-
TLSVersion12,
72-
TLSVersion13,
73-
}
74-
}
75-
7662
// Intended for ECS's tls.version_protocol_field, which does not include
7763
// numeric version and should be lower case
7864
type TLSVersionDetails struct {
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Licensed to Elasticsearch B.V. under one or more contributor
2+
// license agreements. See the NOTICE file distributed with
3+
// this work for additional information regarding copyright
4+
// ownership. Elasticsearch B.V. licenses this file to you under
5+
// the Apache License, Version 2.0 (the "License"); you may
6+
// not use this file except in compliance with the License.
7+
// You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
//go:build requirefips
19+
20+
package tlscommon
21+
22+
func SetInsecureDefaults() {
23+
// noop, use secure defaults in fips
24+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Licensed to Elasticsearch B.V. under one or more contributor
2+
// license agreements. See the NOTICE file distributed with
3+
// this work for additional information regarding copyright
4+
// ownership. Elasticsearch B.V. licenses this file to you under
5+
// the Apache License, Version 2.0 (the "License"); you may
6+
// not use this file except in compliance with the License.
7+
// You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
//go:build !requirefips
19+
20+
package tlscommon
21+
22+
// This function is used to avoid a breaking change on previous releases.
23+
func SetInsecureDefaults() {
24+
TLSVersionMin = TLSVersion10
25+
TLSVersionDefaultMin = TLSVersion11
26+
TLSDefaultVersions = []TLSVersion{
27+
TLSVersion11,
28+
TLSVersion12,
29+
TLSVersion13,
30+
}
31+
}

0 commit comments

Comments
 (0)