Compare commits
2 Commits
c9eeafbbf0
...
2cf3077c07
Author | SHA1 | Date | |
---|---|---|---|
2cf3077c07 | |||
e4801d0e23 |
@ -7,6 +7,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"runtime"
|
"runtime"
|
||||||
@ -14,6 +15,7 @@ import (
|
|||||||
. "syscall"
|
. "syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"hakurei.app/container/landlock"
|
||||||
"hakurei.app/container/seccomp"
|
"hakurei.app/container/seccomp"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -92,6 +94,8 @@ type (
|
|||||||
RetainSession bool
|
RetainSession bool
|
||||||
// Do not [syscall.CLONE_NEWNET].
|
// Do not [syscall.CLONE_NEWNET].
|
||||||
HostNet bool
|
HostNet bool
|
||||||
|
// Scope abstract UNIX domain sockets using LANDLOCK_SCOPE_ABSTRACT_UNIX_SOCKET.
|
||||||
|
ScopeAbstract bool
|
||||||
// Retain CAP_SYS_ADMIN.
|
// Retain CAP_SYS_ADMIN.
|
||||||
Privileged bool
|
Privileged bool
|
||||||
}
|
}
|
||||||
@ -185,6 +189,12 @@ func (p *Container) Start() error {
|
|||||||
"prctl(PR_SET_NO_NEW_PRIVS):")
|
"prctl(PR_SET_NO_NEW_PRIVS):")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if p.ScopeAbstract {
|
||||||
|
if err := landlock.ScopeAbstract(); err != nil {
|
||||||
|
log.Fatalf("could not scope abstract unix sockets: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
msg.Verbose("starting container init")
|
msg.Verbose("starting container init")
|
||||||
if err := p.cmd.Start(); err != nil {
|
if err := p.cmd.Start(); err != nil {
|
||||||
return msg.WrapErr(err, err.Error())
|
return msg.WrapErr(err, err.Error())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user