forked from maistra/istio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/release-1.6' into MAISTRA-1898
- Loading branch information
Showing
164 changed files
with
3,391 additions
and
4,549 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
ea4c40d055ee4388a5697abd2bc0dafec5f4bb08 | ||
758a07d2c3884ec331764d34a5c4f7ab8afbae5c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
galley/pkg/config/analysis/analyzers/destinationrule/ca-certificates.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// Copyright Istio Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package destinationrule | ||
|
||
import ( | ||
"istio.io/api/networking/v1alpha3" | ||
|
||
"istio.io/istio/galley/pkg/config/analysis" | ||
"istio.io/istio/galley/pkg/config/analysis/msg" | ||
"istio.io/istio/pkg/config/resource" | ||
"istio.io/istio/pkg/config/schema/collection" | ||
"istio.io/istio/pkg/config/schema/collections" | ||
) | ||
|
||
// CaCertificateAnalyzer checks if CaCertificate is set in case mode is SIMPLE/MUTUAL | ||
type CaCertificateAnalyzer struct{} | ||
|
||
var _ analysis.Analyzer = &CaCertificateAnalyzer{} | ||
|
||
func (c *CaCertificateAnalyzer) Metadata() analysis.Metadata { | ||
return analysis.Metadata{ | ||
Name: "destinationrule.CaCertificateAnalyzer", | ||
Description: "Checks if caCertificates is set when TLS mode is SIMPLE/MUTUAL", | ||
Inputs: collection.Names{ | ||
collections.IstioNetworkingV1Alpha3Destinationrules.Name(), | ||
}, | ||
} | ||
} | ||
|
||
func (c *CaCertificateAnalyzer) Analyze(ctx analysis.Context) { | ||
ctx.ForEach(collections.IstioNetworkingV1Alpha3Destinationrules.Name(), func(r *resource.Instance) bool { | ||
c.analyzeDestinationRule(r, ctx) | ||
return true | ||
}) | ||
} | ||
|
||
func (c *CaCertificateAnalyzer) analyzeDestinationRule(r *resource.Instance, ctx analysis.Context) { | ||
dr := r.Message.(*v1alpha3.DestinationRule) | ||
drNs := r.Metadata.FullName.Namespace | ||
drName := r.Metadata.FullName.String() | ||
mode := dr.GetTrafficPolicy().GetTls().GetMode() | ||
|
||
if mode == v1alpha3.ClientTLSSettings_SIMPLE || mode == v1alpha3.ClientTLSSettings_MUTUAL { | ||
if dr.GetTrafficPolicy().GetTls().GetCaCertificates() == "" { | ||
ctx.Report(collections.IstioNetworkingV1Alpha3Destinationrules.Name(), msg.NewNoServerCertificateVerificationDestinationLevel(r, drName, | ||
drNs.String(), mode.String(), dr.GetHost())) | ||
} | ||
} | ||
portSettings := dr.TrafficPolicy.GetPortLevelSettings() | ||
|
||
for _, p := range portSettings { | ||
mode = p.GetTls().GetMode() | ||
if mode == v1alpha3.ClientTLSSettings_SIMPLE || mode == v1alpha3.ClientTLSSettings_MUTUAL { | ||
if p.GetTls().GetCaCertificates() == "" { | ||
ctx.Report(collections.IstioNetworkingV1Alpha3Destinationrules.Name(), msg.NewNoServerCertificateVerificationPortLevel(r, drName, | ||
drNs.String(), mode.String(), dr.GetHost(), p.GetPort().String())) | ||
} | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
galley/pkg/config/analysis/analyzers/testdata/destinationrule-compound-mutual-simple.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
# No caCertificates when mode is simple at destination level and MUTUAL at port level | ||
apiVersion: networking.istio.io/v1alpha3 | ||
kind: DestinationRule | ||
metadata: | ||
name: db-mtls | ||
spec: | ||
host: mydbserver.prod.svc.cluster.local | ||
trafficPolicy: | ||
tls: | ||
mode: SIMPLE | ||
clientCertificate: /etc/certs/myclientcert.pem | ||
privateKey: /etc/certs/client_private_key.pem | ||
portLevelSettings: | ||
- port: | ||
number: 443 | ||
tls: | ||
mode: MUTUAL | ||
clientCertificate: /etc/certs/myclientcert.pem | ||
privateKey: /etc/certs/client_private_key.pem | ||
sni: my-nginx.mesh-external.svc.cluster.local |
20 changes: 20 additions & 0 deletions
20
galley/pkg/config/analysis/analyzers/testdata/destinationrule-compound-simple-mutual.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# No caCertificates when mode is simple at destination level | ||
apiVersion: networking.istio.io/v1alpha3 | ||
kind: DestinationRule | ||
metadata: | ||
name: db-mtls | ||
spec: | ||
host: mydbserver.prod.svc.cluster.local | ||
trafficPolicy: | ||
tls: | ||
mode: MUTUAL | ||
clientCertificate: /etc/certs/myclientcert.pem | ||
privateKey: /etc/certs/client_private_key.pem | ||
portLevelSettings: | ||
- port: | ||
number: 443 | ||
tls: | ||
mode: SIMPLE | ||
clientCertificate: /etc/certs/myclientcert.pem | ||
privateKey: /etc/certs/client_private_key.pem | ||
sni: my-nginx.mesh-external.svc.cluster.local |
12 changes: 12 additions & 0 deletions
12
galley/pkg/config/analysis/analyzers/testdata/destinationrule-mutual-destination.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# No caCertificates when mode is mutual at destination level | ||
apiVersion: networking.istio.io/v1alpha3 | ||
kind: DestinationRule | ||
metadata: | ||
name: db-mtls | ||
spec: | ||
host: mydbserver.prod.svc.cluster.local | ||
trafficPolicy: | ||
tls: | ||
mode: MUTUAL | ||
clientCertificate: /etc/certs/myclientcert.pem | ||
privateKey: /etc/certs/client_private_key.pem |
16 changes: 16 additions & 0 deletions
16
galley/pkg/config/analysis/analyzers/testdata/destinationrule-mutual-port.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# No caCertificates when mode is mutual at port level | ||
apiVersion: networking.istio.io/v1alpha3 | ||
kind: DestinationRule | ||
metadata: | ||
name: db-mtls | ||
spec: | ||
host: mydbserver.prod.svc.cluster.local | ||
trafficPolicy: | ||
portLevelSettings: | ||
- port: | ||
number: 443 | ||
tls: | ||
mode: MUTUAL | ||
clientCertificate: /etc/certs/myclientcert.pem | ||
privateKey: /etc/certs/client_private_key.pem | ||
sni: my-nginx.mesh-external.svc.cluster.local |
12 changes: 12 additions & 0 deletions
12
galley/pkg/config/analysis/analyzers/testdata/destinationrule-simple-destination.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# No caCertificates when mode is simple at destination level | ||
apiVersion: networking.istio.io/v1alpha3 | ||
kind: DestinationRule | ||
metadata: | ||
name: db-tls | ||
spec: | ||
host: mydbserver.prod.svc.cluster.local | ||
trafficPolicy: | ||
tls: | ||
mode: SIMPLE | ||
clientCertificate: /etc/certs/myclientcert.pem | ||
privateKey: /etc/certs/client_private_key.pem |
16 changes: 16 additions & 0 deletions
16
galley/pkg/config/analysis/analyzers/testdata/destinationrule-simple-port.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# No caCertificates when mode is simple at port level | ||
apiVersion: networking.istio.io/v1alpha3 | ||
kind: DestinationRule | ||
metadata: | ||
name: db-tls | ||
spec: | ||
host: mydbserver.prod.svc.cluster.local | ||
trafficPolicy: | ||
portLevelSettings: | ||
- port: | ||
number: 443 | ||
tls: | ||
mode: SIMPLE | ||
clientCertificate: /etc/certs/myclientcert.pem | ||
privateKey: /etc/certs/client_private_key.pem | ||
sni: my-nginx.mesh-external.svc.cluster.local |
22 changes: 22 additions & 0 deletions
22
galley/pkg/config/analysis/analyzers/testdata/destinationrule-with-ca.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# caCertificates when mode is mutual at destination level and simple at port level | ||
apiVersion: networking.istio.io/v1alpha3 | ||
kind: DestinationRule | ||
metadata: | ||
name: db-mtls | ||
spec: | ||
host: mydbserver.prod.svc.cluster.local | ||
trafficPolicy: | ||
tls: | ||
mode: MUTUAL | ||
clientCertificate: /etc/certs/myclientcert.pem | ||
privateKey: /etc/certs/client_private_key.pem | ||
caCertificates: /etc/certs/root.pem | ||
portLevelSettings: | ||
- port: | ||
number: 443 | ||
tls: | ||
mode: SIMPLE | ||
clientCertificate: /etc/certs/myclientcert.pem | ||
privateKey: /etc/certs/client_private_key.pem | ||
caCertificates: /etc/certs/root.pem | ||
sni: my-nginx.mesh-external.svc.cluster.local |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.