mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 12:14:48 +00:00
qemu: Add credentials to qemu Cmd
add credentials to the command attribute Fixes #2444 Signed-off-by: Feng Wang <feng.wang@databricks.com>
This commit is contained in:
parent
3c64244cbb
commit
3a9a67499f
16
qemu/qemu.go
16
qemu/qemu.go
@ -2439,6 +2439,13 @@ type Config struct {
|
|||||||
// Ctx is the context used when launching qemu.
|
// Ctx is the context used when launching qemu.
|
||||||
Ctx context.Context
|
Ctx context.Context
|
||||||
|
|
||||||
|
// User ID.
|
||||||
|
Uid uint32
|
||||||
|
// Group ID.
|
||||||
|
Gid uint32
|
||||||
|
// Supplementary group IDs.
|
||||||
|
Groups []uint32
|
||||||
|
|
||||||
// Name is the qemu guest name
|
// Name is the qemu guest name
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
@ -2898,8 +2905,15 @@ func LaunchQemu(config Config, logger QMPLog) (string, error) {
|
|||||||
ctx = context.Background()
|
ctx = context.Background()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
attr := syscall.SysProcAttr{}
|
||||||
|
attr.Credential = &syscall.Credential{
|
||||||
|
Uid: config.Uid,
|
||||||
|
Gid: config.Gid,
|
||||||
|
Groups: config.Groups,
|
||||||
|
}
|
||||||
|
|
||||||
return LaunchCustomQemu(ctx, config.Path, config.qemuParams,
|
return LaunchCustomQemu(ctx, config.Path, config.qemuParams,
|
||||||
config.fds, nil, logger)
|
config.fds, &attr, logger)
|
||||||
}
|
}
|
||||||
|
|
||||||
// LaunchCustomQemu can be used to launch a new qemu instance.
|
// LaunchCustomQemu can be used to launch a new qemu instance.
|
||||||
|
Loading…
Reference in New Issue
Block a user