mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-07 12:11:43 +00:00
Presence of bearer token should cancel exec action
If a bearer token is present in a request, the exec credential plugin should accept that as the chosen method of authentication. Judging by an [earlier comment in exec.go](c18bc7e9f7/staging/src/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go (L217)
), this was already intended. This would however not work since UpdateTransportConfig would set the GetCert callback which would then get called by the transport, triggering the exec plugin action even with a token present in the request. See linked issue for further details.
See #87369 for further details.
Signed-off-by: Anders Eknert <anders.eknert@bisnode.com>
This commit is contained in:
@@ -452,6 +452,22 @@ function kube::util::test_openssl_installed {
|
||||
OPENSSL_BIN=$(command -v openssl)
|
||||
}
|
||||
|
||||
# Query the API server for client certificate authentication capabilities
|
||||
function kube::util::test_client_certificate_authentication_enabled {
|
||||
local output
|
||||
kube::util::test_openssl_installed
|
||||
|
||||
output=$(echo \
|
||||
| "${OPENSSL_BIN}" s_client -connect "127.0.0.1:${SECURE_API_PORT}" 2> /dev/null \
|
||||
| grep -A3 'Acceptable client certificate CA names')
|
||||
|
||||
if [[ "${output}" != *"/CN=127.0.0.1"* ]] && [[ "${output}" != *"CN = 127.0.0.1"* ]]; then
|
||||
echo "API server not configured for client certificate authentication"
|
||||
echo "Output of from acceptable client certificate check: ${output}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# creates a client CA, args are sudo, dest-dir, ca-id, purpose
|
||||
# purpose is dropped in after "key encipherment", you usually want
|
||||
# '"client auth"'
|
||||
|
Reference in New Issue
Block a user