Rest run as denied t roles= uri= request body= – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 6.8-6.8

Briefly, this error occurs when a user tries to execute a REST API request in Elasticsearch without the necessary permissions. The user’s role doesn’t have the required privileges to perform the requested operation. To resolve this issue, you can either grant the necessary permissions to the user’s role or use a user with a role that already has the required permissions. Alternatively, you can modify the Elasticsearch security settings to allow the operation, but this should be done cautiously to avoid potential security risks.

This guide will help you check for common problems that cause the log ” {}[rest] [run_as_denied]\t{}; {}; roles=[{}]; uri=[{}]; request_body=[{}]{} ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin.

Log Context

Log “{}[rest] [run_as_denied]\t{}; {}; roles=[{}]; uri=[{}]; request_body=[{}]{}” classname is DeprecatedLoggingAuditTrail.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

        if (events.contains(RUN_AS_DENIED)
                && (eventFilterPolicyRegistry.ignorePredicate().test(new AuditEventMetaInfo(Optional.of(authentication.getUser());
                        Optional.of(effectiveRealmName(authentication)); Optional.of(authorizationInfo); Optional.empty())) == false)) {
            final String[] roleNames = (String[]) authorizationInfo.asMap().get(LoggingAuditTrail.PRINCIPAL_ROLES_FIELD_NAME);
            if (includeRequestBody) {
                logger.info("{}[rest] [run_as_denied]\t{}; {}; roles=[{}]; uri=[{}]; request_body=[{}]{}"; localNodeInfo.prefix;
                        hostAttributes(request); runAsSubject(authentication); arrayToCommaDelimitedString(roleNames); request.uri();
                        restRequestContent(request); opaqueId());
            } else {
                logger.info("{}[rest] [run_as_denied]\t{}; {}; roles=[{}]; uri=[{}]{}"; localNodeInfo.prefix; hostAttributes(request);
                        runAsSubject(authentication); arrayToCommaDelimitedString(roleNames); request.uri(); opaqueId());

 

How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?