hst: rename net and abstract fields
All checks were successful
Test / Create distribution (push) Successful in 34s
Test / Sandbox (push) Successful in 2m12s
Test / Hakurei (push) Successful in 3m8s
Test / Hpkg (push) Successful in 4m2s
Test / Sandbox (race detector) (push) Successful in 4m25s
Test / Hakurei (race detector) (push) Successful in 5m3s
Test / Flake checks (push) Successful in 1m22s

This makes more sense and matches the container library.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
Ophestra 2025-08-18 16:47:23 +09:00
parent 5db0714072
commit a3988c1a77
Signed by: cat
SSH Key Fingerprint: SHA256:gQ67O0enBZ7UdZypgtspB2FDM1g3GVw8nX0XSdcFw8Q
12 changed files with 39 additions and 33 deletions

View File

@ -98,7 +98,8 @@ func printShowInstance(
}
writeFlag("userns", params.Userns)
writeFlag("devel", params.Devel)
writeFlag("net", params.Net)
writeFlag("net", params.HostNet)
writeFlag("abstract", params.HostAbstract)
writeFlag("device", params.Device)
writeFlag("tty", params.Tty)
writeFlag("mapuid", params.MapRealUID)

View File

@ -41,7 +41,7 @@ func Test_printShowInstance(t *testing.T) {
Groups: video, dialout, plugdev
Data: /var/lib/hakurei/u0/org.chromium.Chromium
Hostname: localhost
Flags: userns devel net device tty mapuid autoetc
Flags: userns devel net abstract device tty mapuid autoetc
Root: /var/lib/hakurei/base/org.debian (2)
Etc: /etc/
Path: /run/current-system/sw/bin/chromium
@ -120,7 +120,7 @@ App
Groups: video, dialout, plugdev
Data: /var/lib/hakurei/u0/org.chromium.Chromium
Hostname: localhost
Flags: userns devel net device tty mapuid autoetc
Flags: userns devel net abstract device tty mapuid autoetc
Root: /var/lib/hakurei/base/org.debian (2)
Etc: /etc/
Path: /run/current-system/sw/bin/chromium
@ -267,7 +267,8 @@ App
"seccomp_compat": true,
"devel": true,
"userns": true,
"net": true,
"host_net": true,
"host_abstract": true,
"tty": true,
"multiarch": true,
"env": {
@ -415,7 +416,8 @@ App
"seccomp_compat": true,
"devel": true,
"userns": true,
"net": true,
"host_net": true,
"host_abstract": true,
"tty": true,
"multiarch": true,
"env": {
@ -617,7 +619,8 @@ func Test_printPs(t *testing.T) {
"seccomp_compat": true,
"devel": true,
"userns": true,
"net": true,
"host_net": true,
"host_abstract": true,
"tty": true,
"multiarch": true,
"env": {

View File

@ -26,9 +26,9 @@ type appInfo struct {
// passed through to [hst.Config]
Userns bool `json:"userns,omitempty"`
// passed through to [hst.Config]
Net bool `json:"net,omitempty"`
HostNet bool `json:"net,omitempty"`
// passed through to [hst.Config]
Abstract bool `json:"abstract,omitempty"`
HostAbstract bool `json:"abstract,omitempty"`
// passed through to [hst.Config]
Device bool `json:"dev,omitempty"`
// passed through to [hst.Config]
@ -85,14 +85,14 @@ func (app *appInfo) toHst(pathSet *appPathSet, pathname *container.Absolute, arg
Groups: app.Groups,
Container: &hst.ContainerConfig{
Hostname: formatHostname(app.Name),
Devel: app.Devel,
Userns: app.Userns,
Net: app.Net,
Abstract: app.Abstract,
Device: app.Device,
Tty: app.Tty || flagDropShell,
MapRealUID: app.MapRealUID,
Hostname: formatHostname(app.Name),
Devel: app.Devel,
Userns: app.Userns,
HostNet: app.HostNet,
HostAbstract: app.HostAbstract,
Device: app.Device,
Tty: app.Tty || flagDropShell,
MapRealUID: app.MapRealUID,
Filesystem: []hst.FilesystemConfigJSON{
{FilesystemConfig: &hst.FSBind{Source: pathSet.nixPath.Append("store"), Target: pathNixStore}},
{FilesystemConfig: &hst.FSBind{Source: pathSet.metaPath, Target: hst.AbsTmp.Append("app")}},

View File

@ -45,7 +45,7 @@ func withNixDaemon(
Container: &hst.ContainerConfig{
Hostname: formatHostname(app.Name) + "-" + action,
Userns: true, // nix sandbox requires userns
Net: net,
HostNet: net,
SeccompFlags: seccomp.AllowMultiarch,
Tty: dropShell,
Filesystem: []hst.FilesystemConfigJSON{

View File

@ -78,9 +78,9 @@ type (
// allow userns creation in container
Userns bool `json:"userns,omitempty"`
// share host net namespace
Net bool `json:"net,omitempty"`
HostNet bool `json:"host_net,omitempty"`
// share abstract unix socket scope
Abstract bool `json:"abstract,omitempty"`
HostAbstract bool `json:"host_abstract,omitempty"`
// allow dangerous terminal I/O
Tty bool `json:"tty,omitempty"`
// allow multiarch

View File

@ -79,7 +79,8 @@ func Template() *Config {
Hostname: "localhost",
Devel: true,
Userns: true,
Net: true,
HostNet: true,
HostAbstract: true,
Device: true,
WaitDelay: -1,
SeccompFlags: seccomp.AllowMultiarch,

View File

@ -90,7 +90,8 @@ func TestTemplate(t *testing.T) {
"seccomp_compat": true,
"devel": true,
"userns": true,
"net": true,
"host_net": true,
"host_abstract": true,
"tty": true,
"multiarch": true,
"env": {

View File

@ -27,7 +27,7 @@ var testCasesNixos = []sealTestCase{
Shell: m("/run/current-system/sw/bin/zsh"),
Container: &hst.ContainerConfig{
Userns: true, Net: true, MapRealUID: true, Env: nil, AutoEtc: true,
Userns: true, HostNet: true, MapRealUID: true, Env: nil, AutoEtc: true,
Filesystem: []hst.FilesystemConfigJSON{
f(&hst.FSBind{Source: m("/bin")}),
f(&hst.FSBind{Source: m("/usr/bin/")}),

View File

@ -32,8 +32,8 @@ func newContainer(s *hst.ContainerConfig, os sys.State, prefix string, uid, gid
SeccompFlags: s.SeccompFlags,
SeccompPresets: s.SeccompPresets,
RetainSession: s.Tty,
HostNet: s.Net,
HostAbstract: s.Abstract,
HostNet: s.HostNet,
HostAbstract: s.HostAbstract,
// the container is canceled when shim is requested to exit or receives an interrupt or termination signal;
// this behaviour is implemented in the shim

View File

@ -238,11 +238,11 @@ func (seal *outcome) finalise(ctx context.Context, sys sys.State, config *hst.Co
}
conf := &hst.ContainerConfig{
Userns: true,
Net: true,
Abstract: true,
Tty: true,
AutoEtc: true,
Userns: true,
HostNet: true,
HostAbstract: true,
Tty: true,
AutoEtc: true,
AutoRoot: container.AbsFHSRoot,
RootFlags: container.BindWritable,

View File

@ -131,14 +131,14 @@ in
wait_delay
devel
userns
net
abstract
device
tty
multiarch
env
;
map_real_uid = app.mapRealUid;
host_net = app.hostNet;
host_abstract = app.hostAbstract;
filesystem =
let

View File

@ -179,10 +179,10 @@ in
tty = mkEnableOption "access to the controlling terminal";
multiarch = mkEnableOption "multiarch kernel-level support";
net = mkEnableOption "network access" // {
hostNet = mkEnableOption "share host net namespace" // {
default = true;
};
abstract = mkEnableOption "abstract unix domain socket access";
hostAbstract = mkEnableOption "share abstract unix socket scope";
nix = mkEnableOption "nix daemon access";
mapRealUid = mkEnableOption "mapping to priv-user uid";