Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ let package = Package(
.library(name: "ContainerizationOS", targets: ["ContainerizationOS"]),
.library(name: "ContainerizationExtras", targets: ["ContainerizationExtras"]),
.library(name: "ContainerizationArchive", targets: ["ContainerizationArchive"]),
.library(name: "ContainerizationSeccomp", targets: ["ContainerizationSeccomp"]),
.executable(name: "cctl", targets: ["cctl"]),
],
dependencies: [
Expand Down Expand Up @@ -264,5 +265,18 @@ let package = Package(
.target(
name: "CShim"
),
.target(
name: "ContainerizationSeccomp",
dependencies: [
"ContainerizationOCI"
]
),
.testTarget(
name: "ContainerizationSeccompTests",
dependencies: [
"ContainerizationSeccomp",
"ContainerizationOCI",
]
),
]
)
5 changes: 5 additions & 0 deletions Sources/Containerization/LinuxContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public final class LinuxContainer: Container, Sendable {
public var sockets: [UnixSocketConfiguration] = []
/// The mounts for the container.
public var mounts: [Mount] = LinuxContainer.defaultMounts()
/// Seccomp profile for system call filtering.
public var seccomp: SeccompProfile?
/// The DNS configuration for the container.
public var dns: DNS?
/// The hosts to add to /etc/hosts for the container.
Expand All @@ -90,6 +92,7 @@ public final class LinuxContainer: Container, Sendable {
interfaces: [any Interface] = [],
sockets: [UnixSocketConfiguration] = [],
mounts: [Mount] = LinuxContainer.defaultMounts(),
seccomp: SeccompProfile? = nil,
dns: DNS? = nil,
hosts: Hosts? = nil,
virtualization: Bool = false,
Expand All @@ -105,6 +108,7 @@ public final class LinuxContainer: Container, Sendable {
self.interfaces = interfaces
self.sockets = sockets
self.mounts = mounts
self.seccomp = seccomp
self.dns = dns
self.hosts = hosts
self.virtualization = virtualization
Expand Down Expand Up @@ -356,6 +360,7 @@ public final class LinuxContainer: Container, Sendable {

// Linux toggles.
spec.linux?.sysctl = config.sysctl
spec.linux?.seccomp = config.seccomp?.toOCI(effectiveCapabilities: config.process.capabilities.effective)

// If the rootfs was requested as read-only, set it in the OCI spec.
// We let the OCI runtime remount as ro, instead of doing it originally.
Expand Down
3 changes: 3 additions & 0 deletions Sources/Containerization/LinuxPod.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ public final class LinuxPod: Sendable {
public var sysctl: [String: String] = [:]
/// The mounts for the container.
public var mounts: [Mount] = LinuxContainer.defaultMounts()
/// Seccomp profile for system call filtering.
public var seccomp: SeccompProfile?
/// The Unix domain socket relays to setup for the container.
public var sockets: [UnixSocketConfiguration] = []
/// The DNS configuration for the container.
Expand Down Expand Up @@ -230,6 +232,7 @@ public final class LinuxPod: Sendable {

// Linux toggles
spec.linux?.sysctl = config.sysctl
spec.linux?.seccomp = config.seccomp?.toOCI(effectiveCapabilities: config.process.capabilities.effective)

// If the rootfs was requested as read-only, set it in the OCI spec.
// We let the OCI runtime remount as ro, instead of doing it originally.
Expand Down
Loading
Loading