diff options
| author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2024-06-04 17:42:44 +0000 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2024-06-04 17:44:50 +0000 |
| commit | e96da98e4038f5388596b4294ac3d8425b2dacb2 (patch) | |
| tree | cb0e734b7e216a5bd28308cdc6d5d4b6779b39f5 /recipes-extended/rootlesskit/rootlesskit_git.bb | |
| parent | aaad95b19197ce1655ceddbe7412d8536df94375 (diff) | |
| download | meta-virtualization-e96da98e4038f5388596b4294ac3d8425b2dacb2.tar.gz | |
rootlesskit: introduce linux-native fakeroo using user namespaces
see: https://github.com/rootless-containers/rootlesskit
---------
RootlessKit: Linux-native fakeroot using user namespaces
RootlessKit is a Linux-native implementation of 'fake root' using user_namespaces(7).
The purpose of RootlessKit is to run Docker and Kubernetes as an unprivileged user
(known as 'Rootless mode'), so as to protect the real root on the host from potential
container-breakout attacks.
---------
This is a building block for cross installation of containers and
rootless on-target execution.
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Diffstat (limited to 'recipes-extended/rootlesskit/rootlesskit_git.bb')
| -rw-r--r-- | recipes-extended/rootlesskit/rootlesskit_git.bb | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/recipes-extended/rootlesskit/rootlesskit_git.bb b/recipes-extended/rootlesskit/rootlesskit_git.bb new file mode 100644 index 00000000..26b4c57c --- /dev/null +++ b/recipes-extended/rootlesskit/rootlesskit_git.bb | |||
| @@ -0,0 +1,81 @@ | |||
| 1 | HOMEPAGE = "https://github.com/rootless-containers/rootlesskit" | ||
| 2 | SUMMARY = "RootlessKit: Linux-native fakeroot using user namespaces" | ||
| 3 | DESCRIPTION = "RootlessKit is a Linux-native implementation of 'fake root' using user_namespaces(7). \ | ||
| 4 | The purpose of RootlessKit is to run Docker and Kubernetes as an unprivileged user (known as 'Rootless mode'),\ | ||
| 5 | so as to protect the real root on the host from potential container-breakout attacks. \ | ||
| 6 | " | ||
| 7 | |||
| 8 | # generated with: | ||
| 9 | # scripts/oe-go-mod-autogen.py --repo https://github.com/rootless-containers/rootlesskit --rev c784875ba4ba4c5aaa256f98675fd543b087c900 | ||
| 10 | |||
| 11 | DEPENDS = " \ | ||
| 12 | go-md2man \ | ||
| 13 | rsync-native \ | ||
| 14 | " | ||
| 15 | # Specify the first two important SRCREVs as the format | ||
| 16 | SRCREV_FORMAT="rootless" | ||
| 17 | SRCREV_rootless = "d942cd5880099d8ce0fddeef051cad4894eba25e" | ||
| 18 | |||
| 19 | SRC_URI = "git://github.com/rootless-containers/rootlesskit;name=rootless;branch=master;protocol=https;destsuffix=${GO_SRCURI_DESTSUFFIX}" | ||
| 20 | |||
| 21 | include src_uri.inc | ||
| 22 | |||
| 23 | # patches and config | ||
| 24 | SRC_URI += "file://modules.txt \ | ||
| 25 | " | ||
| 26 | |||
| 27 | LICENSE = "Apache-2.0" | ||
| 28 | LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" | ||
| 29 | |||
| 30 | GO_IMPORT = "import" | ||
| 31 | |||
| 32 | S = "${WORKDIR}/git" | ||
| 33 | |||
| 34 | PV = "v2.1.0+git" | ||
| 35 | |||
| 36 | ROOTLESS_PKG = "github.com/rootless-containers/rootlesskit" | ||
| 37 | |||
| 38 | inherit go goarch | ||
| 39 | inherit systemd pkgconfig | ||
| 40 | |||
| 41 | do_configure[noexec] = "1" | ||
| 42 | |||
| 43 | EXTRA_OEMAKE = " \ | ||
| 44 | PREFIX=${prefix} BINDIR=${bindir} LIBEXECDIR=${libexecdir} \ | ||
| 45 | ETCDIR=${sysconfdir} TMPFILESDIR=${nonarch_libdir}/tmpfiles.d \ | ||
| 46 | SYSTEMDDIR=${systemd_unitdir}/system USERSYSTEMDDIR=${systemd_unitdir}/user \ | ||
| 47 | " | ||
| 48 | |||
| 49 | PACKAGECONFIG ?= "" | ||
| 50 | |||
| 51 | include relocation.inc | ||
| 52 | |||
| 53 | do_compile() { | ||
| 54 | |||
| 55 | cd ${S}/src/import | ||
| 56 | |||
| 57 | export GOPATH="$GOPATH:${S}/src/import/.gopath" | ||
| 58 | |||
| 59 | # Pass the needed cflags/ldflags so that cgo | ||
| 60 | # can find the needed headers files and libraries | ||
| 61 | export GOARCH=${TARGET_GOARCH} | ||
| 62 | export CGO_ENABLED="1" | ||
| 63 | export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}" | ||
| 64 | export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" | ||
| 65 | |||
| 66 | export GOFLAGS="-mod=vendor -trimpath ${PIEFLAG}" | ||
| 67 | |||
| 68 | # our copied .go files are to be used for the build | ||
| 69 | ln -sf vendor.copy vendor | ||
| 70 | # inform go that we know what we are doing | ||
| 71 | cp ${UNPACKDIR}/modules.txt vendor/ | ||
| 72 | |||
| 73 | oe_runmake GO=${GO} BUILDTAGS="${BUILDTAGS}" all | ||
| 74 | } | ||
| 75 | |||
| 76 | do_install() { | ||
| 77 | install -d "${D}${BIN_PREFIX}${base_bindir}" | ||
| 78 | for b in rootlessctl rootlesskit rootlesskit-docker-proxy; do | ||
| 79 | install -m 755 "${S}/src/import/bin/$b" "${D}${BIN_PREFIX}${base_bindir}" | ||
| 80 | done | ||
| 81 | } | ||
