-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SECURITY: unit tests for Kubeclient::Config handling of ssl_options[:…
…verify_ssl] - Removed `insecure-skip-tls-verify: true` from most test configs (that was one of the reasons the bug went unnoticed, VERIFY_NONE was what the unit tests expected.) - Added new kubeconfig files + `Config` unit tests covering: - custom CA, omitted `insecure-skip-tls-verify` - custom CA, `insecure-skip-tls-verify: false` - custom CA, `insecure-skip-tls-verify: true` - no custom CA, omitted `insecure-skip-tls-verify` - no custom CA, `insecure-skip-tls-verify: false` - no custom CA, `insecure-skip-tls-verify: true`
- Loading branch information
Showing
12 changed files
with
175 additions
and
22 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: v1 | ||
clusters: | ||
- cluster: | ||
# Not defining custom `certificate-authority`. | ||
# Without it, the localhost cert should be rejected. | ||
server: https://localhost:6443 | ||
name: local | ||
contexts: | ||
- context: | ||
cluster: local | ||
namespace: default | ||
user: user | ||
name: Default | ||
current-context: Default | ||
kind: Config | ||
preferences: {} | ||
users: | ||
- name: user | ||
user: | ||
client-certificate: external-cert.pem | ||
client-key: external-key.rsa |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
apiVersion: v1 | ||
clusters: | ||
- cluster: | ||
# This is a silly configuration, skip-tls-verify makes CA data useless, but testing for completeness. | ||
certificate-authority: external-ca.pem | ||
server: https://localhost:6443 | ||
insecure-skip-tls-verify: true | ||
name: local | ||
contexts: | ||
- context: | ||
cluster: local | ||
namespace: default | ||
user: user | ||
name: Default | ||
current-context: Default | ||
kind: Config | ||
preferences: {} | ||
users: | ||
- name: user | ||
user: | ||
client-certificate: external-cert.pem | ||
client-key: external-key.rsa |
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,25 @@ | ||
apiVersion: v1 | ||
clusters: | ||
- cluster: | ||
server: https://localhost:6443 | ||
insecure-skip-tls-verify: true | ||
name: local | ||
contexts: | ||
- context: | ||
cluster: local | ||
namespace: default | ||
user: user | ||
name: Default | ||
current-context: Default | ||
kind: Config | ||
preferences: {} | ||
users: | ||
- name: user | ||
user: | ||
# Providing ANY credentials in `insecure-skip-tls-verify` mode is unwise due to MITM risk. | ||
# At least client certs are not as catastrophic as bearer tokens. | ||
# | ||
# This combination of insecure + client certs was once broken in kubernetes but | ||
# is meaningful since 2015 (https://github.com/kubernetes/kubernetes/pull/15430). | ||
client-certificate: external-cert.pem | ||
client-key: external-key.rsa |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
apiVersion: v1 | ||
clusters: | ||
- cluster: | ||
# Not defining custom `certificate-authority`. | ||
# Without it, the localhost cert should be rejected. | ||
server: https://localhost:6443 | ||
insecure-skip-tls-verify: false # Same as external-without-ca.kubeconfig but with explicit false here. | ||
name: local | ||
contexts: | ||
- context: | ||
cluster: local | ||
namespace: default | ||
user: user | ||
name: Default | ||
current-context: Default | ||
kind: Config | ||
preferences: {} | ||
users: | ||
- name: user | ||
user: | ||
client-certificate: external-cert.pem | ||
client-key: external-key.rsa |
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 @@ | ||
apiVersion: v1 | ||
clusters: | ||
- cluster: | ||
certificate-authority: external-ca.pem | ||
server: https://localhost:6443 | ||
insecure-skip-tls-verify: false # Same as external.kubeconfig but with explicit false here. | ||
name: local | ||
contexts: | ||
- context: | ||
cluster: local | ||
namespace: default | ||
user: user | ||
name: Default | ||
current-context: Default | ||
kind: Config | ||
preferences: {} | ||
users: | ||
- name: user | ||
user: | ||
client-certificate: external-cert.pem | ||
client-key: external-key.rsa |
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