Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
Opensearch 2.11
Describe the issue:
I’m trying to setup client authentication with certificates, but I cannot get it to work.
E.g the command
curl -XGET -k -u 'admin:admin' 'https://localhost:9200/_opendistro/_security/api/ssl/certs?pretty'
fails with 403. Therefore I assume I have to use the admin_dn and I try with the admin user certificates
curl -XGET -k 'https://localhost:9200/_opendistro/_security/api/ssl/certs?pretty' --cert opensearch-admin.pem --key opensearch-admin-key.pem --cacert root-ca.pem
But I get 401.
The admin certificates are ok, I can use them locally in the node with the securityadmin.sh scripts. But using the same certificates with curl does not work.
How can I troubleshoot with the certificate authentication fails?
Configuration:
This is a deployment in K8s, and the nginx ingress is configured to pass the client certificate to the nodes.
I configured the client authentication to include
clientcert_auth_domain:
description: "Authenticate via SSL client certificates"
http_enabled: true
transport_enabled: true
order: 1
http_authenticator:
type: clientcert
challenge: false
config:
username_attribute: cn #optional, if omitted DN becomes username
authentication_backend:
type: noop
Relevant Logs or Screenshots:
I enabled audit debug and I see the failed login, with user ‘none’, but no more reason.
[2025-01-27T16:13:44,387][INFO ][o.o.s.a.s.DebugSink ] [opensearch-master-2] AUDIT_LOG: {
"audit_cluster_name" : "opensearch",
"audit_rest_request_params" : {
"pretty" : ""
},
"audit_node_name" : "opensearch-master-2",
"audit_rest_request_method" : "GET",
"audit_category" : "FAILED_LOGIN",
"audit_request_origin" : "REST",
"audit_node_id" : "NjeCF8q4S-OnIuYh",
"audit_request_layer" : "REST",
"audit_rest_request_path" : "/_plugins/_security/api/securityconfig",
"@timestamp" : "2025-01-27T16:13:44.387+00:00",
"audit_request_effective_user_is_admin" : false,
"audit_format_version" : 4,
"audit_request_remote_address" : "10.42.1.219",
"audit_node_host_address" : "10.42.2.120",
"audit_rest_request_headers" : {
"X-Request-ID" : [
"97c94e314b031a25aa7d33c5bb374d23"
],
"X-Forwarded-Host" : [
"opensearch-dev.k8s.lab.se"
],
"X-Forwarded-Proto" : [
"https"
],
"X-Forwarded-For" : [
"10.56.235.100"
],
"Host" : [
"opensearch-dev.k8s.lab.se"
],
"X-Forwarded-Port" : [
"443"
],
"X-Forwarded-Scheme" : [
"https"
],
"X-Real-IP" : [
"10.56.235.100"
],
"accept" : [
"*/*"
],
"user-agent" : [
"curl/7.76.1"
],
"X-Scheme" : [
"https"
]
},
"audit_request_effective_user" : "<NONE>",
"audit_node_host_name" : "10.42.2.120"