MCPcopy Create free account
hub / github.com/apache/mesos / authorizeTask

Method authorizeTask

src/slave/slave.cpp:9694–9722  ·  view source on GitHub ↗

As a principle, we do not need to re-authorize actions that have already been authorized by the master. However, we re-authorize the RUN_TASK action on the agent even though the master has already authorized it because: a) in cases where hosts have heterogeneous user-account configurations, it makes sense to set the ACL on the agent instead of on the master b) compared to other actions such as kil

Source from the content-addressed store, hash-verified

9692// framework, it's a greater security risk if malicious tasks are launched
9693// as a superuser on the agent.
9694Future<bool> Slave::authorizeTask(
9695 const TaskInfo& task,
9696 const FrameworkInfo& frameworkInfo)
9697{
9698 if (authorizer.isNone()) {
9699 return true;
9700 }
9701
9702 // Authorize the task.
9703 authorization::Request request;
9704
9705 if (frameworkInfo.has_principal()) {
9706 request.mutable_subject()->set_value(frameworkInfo.principal());
9707 }
9708
9709 request.set_action(authorization::RUN_TASK);
9710
9711 authorization::Object* object = request.mutable_object();
9712
9713 object->mutable_task_info()->CopyFrom(task);
9714 object->mutable_framework_info()->CopyFrom(frameworkInfo);
9715
9716 LOG(INFO)
9717 << "Authorizing framework principal '"
9718 << (frameworkInfo.has_principal() ? frameworkInfo.principal() : "ANY")
9719 << "' to launch task " << task.task_id();
9720
9721 return authorizer.get()->authorized(request);
9722}
9723
9724
9725Future<bool> Slave::authorizeSandboxAccess(

Callers

nothing calls this directly

Calls 5

principalMethod · 0.80
CopyFromMethod · 0.80
isNoneMethod · 0.45
authorizedMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected