Add process cap support to add process rpc
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
a46c45d05d
commit
44d6a60e7e
4 changed files with 151 additions and 123 deletions
|
@ -73,7 +73,7 @@ func (s *apiServer) AddProcess(ctx context.Context, r *types.AddProcessRequest)
|
|||
Env: r.Env,
|
||||
Cwd: r.Cwd,
|
||||
}
|
||||
setPlatformRuntimeProcessSpecUserFields(r.User, process)
|
||||
setPlatformRuntimeProcessSpecUserFields(r, process)
|
||||
|
||||
if r.Id == "" {
|
||||
return nil, fmt.Errorf("container id cannot be empty")
|
||||
|
|
|
@ -248,12 +248,20 @@ func setUserFieldsInProcess(p *types.Process, oldProc specs.ProcessSpec) {
|
|||
Gid: oldProc.User.GID,
|
||||
AdditionalGids: oldProc.User.AdditionalGids,
|
||||
}
|
||||
p.Capabilities = oldProc.Capabilities
|
||||
p.ApparmorProfile = oldProc.ApparmorProfile
|
||||
p.SelinuxLabel = oldProc.SelinuxLabel
|
||||
p.NoNewPrivileges = oldProc.NoNewPrivileges
|
||||
}
|
||||
|
||||
func setPlatformRuntimeProcessSpecUserFields(r *types.User, process *specs.ProcessSpec) {
|
||||
func setPlatformRuntimeProcessSpecUserFields(r *types.AddProcessRequest, process *specs.ProcessSpec) {
|
||||
process.User = ocs.User{
|
||||
UID: r.Uid,
|
||||
GID: r.Gid,
|
||||
AdditionalGids: r.AdditionalGids,
|
||||
UID: r.User.Uid,
|
||||
GID: r.User.Gid,
|
||||
AdditionalGids: r.User.AdditionalGids,
|
||||
}
|
||||
process.Capabilities = r.Capabilities
|
||||
process.ApparmorProfile = r.ApparmorProfile
|
||||
process.SelinuxLabel = r.SelinuxLabel
|
||||
process.NoNewPrivileges = r.NoNewPrivileges
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue