getThreadContext().putTransient(ConfigConstants.SG_ACTION_NAME, task.getAction()); && !task.getAction().equals("internal:transport/handshake") && (task.getAction().startsWith("internal:") || task.getAction().contains("["))) { auditLog.logMissingPrivileges(task.getAction(), request, task); log.error("Internal or shard requests ("+task.getAction()+") not allowed from a non-server node for transport type "+transportChannel.getChannelType()); transportChannel.sendResponse(new ElasticsearchSecurityException( "Internal or shard requests not allowed from a non-server node for transport type "+transportChannel.getChannelType())); Exception ex = new ElasticsearchSecurityException( "No SSL client certificates found for transport type "+transportChannel.getChannelType()+". Search Guard needs the Search Guard SSL plugin to be installed"); auditLog.logSSLException(request, ex, task.getAction(), task); log.error("No SSL client certificates found for transport type "+transportChannel.getChannelType()+". Search Guard needs the Search Guard SSL plugin to be installed"); transportChannel.sendResponse(ex); auditLog.logBadHeaders(request, task.getAction(), task); log.error(exception); transportChannel.sendResponse(exception); if((user = backendRegistry.authenticate(request, principal, task, task.getAction())) == null) { org.apache.logging.log4j.ThreadContext.remove("user"); if(task.getAction().equals(WhoAmIAction.NAME)) { super.messageReceivedDecorate(request, handler, transportChannel, task); return; if(task.getAction().equals("cluster:monitor/nodes/liveness") || task.getAction().equals("internal:transport/handshake")) {
/** * Build a proper {@link TaskInfo} for this task. */ protected final TaskInfo taskInfo(String localNodeId, String description, Status status) { return new TaskInfo(new TaskId(localNodeId, getId()), getType(), getAction(), description, status, startTime, System.nanoTime() - startTimeNanos, this instanceof CancellableTask, parentTask, headers); }
@Override protected void processTasks(ListTasksRequest request, Consumer<Task> operation) { if (request.getWaitForCompletion()) { long timeoutNanos = waitForCompletionTimeout(request.getTimeout()); operation = operation.andThen(task -> { if (task.getAction().startsWith(ListTasksAction.NAME)) { // It doesn't make sense to wait for List Tasks and it can cause an infinite loop of the task waiting // for itself or one of its child tasks return; } taskManager.waitForTaskCompletion(task, timeoutNanos); }); } super.processTasks(request, operation); }
public boolean match(Task task) { if (getActions() != null && getActions().length > 0 && Regex.simpleMatch(getActions(), task.getAction()) == false) { return false; } if (getTaskId().isSet()) { if(getTaskId().getId() != task.getId()) { return false; } } if (parentTaskId.isSet()) { if (parentTaskId.equals(task.getParentTaskId()) == false) { return false; } } return true; } }
/** * Build a proper {@link TaskInfo} for this task. */ protected final TaskInfo taskInfo(String localNodeId, String description, Status status) { return new TaskInfo(new TaskId(localNodeId, getId()), getType(), getAction(), description, status, startTime, System.nanoTime() - startTimeNanos, this instanceof CancellableTask, parentTask, headers); }
/** * Build a proper {@link TaskInfo} for this task. */ protected final TaskInfo taskInfo(String localNodeId, String description, Status status) { return new TaskInfo(new TaskId(localNodeId, getId()), getType(), getAction(), description, status, startTime, System.nanoTime() - startTimeNanos, this instanceof CancellableTask, parentTask); }
/** * Build a proper {@link TaskInfo} for this task. */ protected final TaskInfo taskInfo(String localNodeId, String description, Status status) { return new TaskInfo(new TaskId(localNodeId, getId()), getType(), getAction(), description, status, startTime, System.nanoTime() - startTimeNanos, this instanceof CancellableTask, parentTask, headers); }
@Override public void accept(Task t) { operation.accept(t); while (System.nanoTime() - timeoutTime < 0) { Task task = taskManager.getTask(t.getId()); if (task == null) { return; } if (task.getAction().startsWith(ListTasksAction.NAME)) { // It doesn't make sense to wait for List Tasks and it can cause an infinite loop of the task waiting // for itself of one of its child tasks return; } try { Thread.sleep(WAIT_FOR_COMPLETION_POLL.millis()); } catch (InterruptedException e) { throw new ElasticsearchException("Interrupted waiting for completion of [{}]", e, t); } } throw new ElasticsearchTimeoutException("Timed out waiting for completion of [{}]", t); } });
@Override protected void processTasks(ListTasksRequest request, Consumer<Task> operation) { if (request.getWaitForCompletion()) { long timeoutNanos = waitForCompletionTimeout(request.getTimeout()); operation = operation.andThen(task -> { if (task.getAction().startsWith(ListTasksAction.NAME)) { // It doesn't make sense to wait for List Tasks and it can cause an infinite loop of the task waiting // for itself or one of its child tasks return; } taskManager.waitForTaskCompletion(task, timeoutNanos); }); } super.processTasks(request, operation); }
@Override protected void processTasks(ListTasksRequest request, Consumer<Task> operation) { if (request.getWaitForCompletion()) { long timeoutNanos = waitForCompletionTimeout(request.getTimeout()); operation = operation.andThen(task -> { if (task.getAction().startsWith(ListTasksAction.NAME)) { // It doesn't make sense to wait for List Tasks and it can cause an infinite loop of the task waiting // for itself or one of its child tasks return; } taskManager.waitForTaskCompletion(task, timeoutNanos); }); } super.processTasks(request, operation); }
@Override protected void processTasks(ListTasksRequest request, Consumer<Task> operation) { if (request.getWaitForCompletion()) { long timeoutNanos = waitForCompletionTimeout(request.getTimeout()); operation = operation.andThen(task -> { if (task.getAction().startsWith(ListTasksAction.NAME)) { // It doesn't make sense to wait for List Tasks and it can cause an infinite loop of the task waiting // for itself or one of its child tasks return; } taskManager.waitForTaskCompletion(task, timeoutNanos); }); } super.processTasks(request, operation); }
/** * Build a version of the task status you can throw over the wire and back * to the user. * * @param node * the node this task is running on * @param detailed * should the information include detailed, potentially slow to * generate data? */ public TaskInfo taskInfo(DiscoveryNode node, boolean detailed) { String description = null; Task.Status status = null; if (detailed) { description = getDescription(); status = getStatus(); } return new TaskInfo(node, getId(), getType(), getAction(), description, status, startTime, System.nanoTime() - startTimeNanos, parentTask); }
getThreadContext().putTransient(ConfigConstants.SG_ACTION_NAME, task.getAction()); && !task.getAction().equals("internal:transport/handshake") && (task.getAction().startsWith("internal:") || task.getAction().contains("["))) { auditLog.logMissingPrivileges(task.getAction(), request, task); log.error("Internal or shard requests ("+task.getAction()+") not allowed from a non-server node for transport type "+transportChannel.getChannelType()); transportChannel.sendResponse(new ElasticsearchSecurityException( "Internal or shard requests not allowed from a non-server node for transport type "+transportChannel.getChannelType())); Exception ex = new ElasticsearchSecurityException( "No SSL client certificates found for transport type "+transportChannel.getChannelType()+". Search Guard needs the Search Guard SSL plugin to be installed"); auditLog.logSSLException(request, ex, task.getAction(), task); log.error("No SSL client certificates found for transport type "+transportChannel.getChannelType()+". Search Guard needs the Search Guard SSL plugin to be installed"); transportChannel.sendResponse(ex); auditLog.logBadHeaders(request, task.getAction(), task); log.error(exception); transportChannel.sendResponse(exception); if((user = backendRegistry.authenticate(request, principal, task, task.getAction())) == null) { org.apache.logging.log4j.ThreadContext.remove("user"); if(task.getAction().equals(WhoAmIAction.NAME)) { super.messageReceivedDecorate(request, handler, transportChannel, task); return; if(task.getAction().equals("cluster:monitor/nodes/liveness") || task.getAction().equals("internal:transport/handshake")) {
public boolean match(Task task) { if (getActions() != null && getActions().length > 0 && Regex.simpleMatch(getActions(), task.getAction()) == false) { return false; } if (getTaskId().isSet()) { if(getTaskId().getId() != task.getId()) { return false; } } if (parentTaskId.isSet()) { if (parentTaskId.equals(task.getParentTaskId()) == false) { return false; } } return true; } }
public boolean match(Task task) { if (getActions() != null && getActions().length > 0 && Regex.simpleMatch(getActions(), task.getAction()) == false) { return false; } if (getTaskId().isSet()) { if(getTaskId().getId() != task.getId()) { return false; } } if (parentTaskId.isSet()) { if (parentTaskId.equals(task.getParentTaskId()) == false) { return false; } } return true; } }
public boolean match(Task task) { if (getActions() != null && getActions().length > 0 && Regex.simpleMatch(getActions(), task.getAction()) == false) { return false; } if (getTaskId().isSet()) { if(getTaskId().getId() != task.getId()) { return false; } } if (parentTaskId.isSet()) { if (parentTaskId.equals(task.getParentTaskId()) == false) { return false; } } return true; } }
public boolean match(Task task) { if (getActions() != null && getActions().length > 0 && Regex.simpleMatch(getActions(), task.getAction()) == false) { return false; } if (getTaskId().isSet()) { if(getTaskId().getId() != task.getId()) { return false; } } if (parentTaskId.isSet()) { if (parentTaskId.equals(task.getParentTaskId()) == false) { return false; } } return true; } }