diff options
Diffstat (limited to 'system/pledge')
-rw-r--r-- | system/pledge/README | 17 | ||||
-rw-r--r-- | system/pledge/pledge.SlackBuild | 86 | ||||
-rw-r--r-- | system/pledge/pledge.info | 10 | ||||
-rw-r--r-- | system/pledge/slack-desc | 19 |
4 files changed, 132 insertions, 0 deletions
diff --git a/system/pledge/README b/system/pledge/README new file mode 100644 index 0000000000..03786d47c8 --- /dev/null +++ b/system/pledge/README @@ -0,0 +1,17 @@ +pledge (OpenBSD command and syscall implementation for Linux) + +pledge is a port of OpenBSD's syscall to Linux by Justine Tunney. +This script builds a shared library (to be injected via LD_PRELOAD) +and a command line utility to restrict program execution privileges +and limit parameters such as maximum niceness, cpu time, virtual +memory, file descriptors, child processes, and individual file sizes. + +For more info, see: https://justine.lol/pledge/ + https://github.com/jart/pledge + +NOTES: +* pledge doesn't support 32-bit x86 +* pledge help is available via the -h option +* to run pledge at glibc executable load time: + strace -vff bash -c \ + '_PLEDGE=4194303,0 LD_PRELOAD=/usr/lib64/pledge/sandbox.so ls' diff --git a/system/pledge/pledge.SlackBuild b/system/pledge/pledge.SlackBuild new file mode 100644 index 0000000000..d7b4ea6c9f --- /dev/null +++ b/system/pledge/pledge.SlackBuild @@ -0,0 +1,86 @@ +#!/bin/bash + +# Slackware build script for pledge + +# Original author 2023 Juan M. Lasca <email removed> +# Modified and now maintained by B. Watson <urchlay@slackware.uk> + +# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. + +# 20240221 bkw: BUILD=2 +# - Take over maintenance +# - Relicense as WTFPL (per mailing list) +# - Fix minor grammar/spelling issues in README and slack-desc + +cd $(dirname $0) ; CWD=$(pwd) + +PRGNAM=pledge +VERSION=${VERSION:-20230908_8693ebe} +COMMIT=8693ebe15a30bd4235165ad72a469da29ca067cf +BUILD=${BUILD:-2} +TAG=${TAG:-_SBo} +PKGTYPE=${PKGTYPE:-tgz} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" + exit 0 +fi + +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +elif [ "$ARCH" = "aarch64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$COMMIT +tar xvf $CWD/$PRGNAM-$COMMIT.tar.gz +cd $PRGNAM-$COMMIT +chown -R root:root . +find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} + -o \ + \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} + + +make CFLAGS="$SLKCFLAGS" + +LIB=$PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM +mkdir -p $LIB $PKG/usr/bin +install -s -m0755 o/pledge o/sandbox.so $LIB +ln -s ../lib$LIBDIRSUFFIX/$PRGNAM/pledge $PKG/usr/bin + +PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION +mkdir -p $PKGDOC +cp -a README.md LICENSE $PKGDOC +cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE diff --git a/system/pledge/pledge.info b/system/pledge/pledge.info new file mode 100644 index 0000000000..0ff564b850 --- /dev/null +++ b/system/pledge/pledge.info @@ -0,0 +1,10 @@ +PRGNAM="pledge" +VERSION="20230908_8693ebe" +HOMEPAGE="https://justine.lol/pledge/" +DOWNLOAD="UNSUPPORTED" +MD5SUM="" +DOWNLOAD_x86_64="https://github.com/jart/pledge/archive/8693ebe/pledge-8693ebe15a30bd4235165ad72a469da29ca067cf.tar.gz" +MD5SUM_x86_64="f0414cbb1c6553c891afb8bae61595a3" +REQUIRES="" +MAINTAINER="B. Watson" +EMAIL="urchlay@slackware.uk" diff --git a/system/pledge/slack-desc b/system/pledge/slack-desc new file mode 100644 index 0000000000..2cb8b45ddf --- /dev/null +++ b/system/pledge/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +pledge: pledge (OpenBSD command and syscall implementation for Linux) +pledge: +pledge: pledge is a port of OpenBSD's syscall to Linux by Justine Tunney. +pledge: This script builds a shared library (to be injected via LD_PRELOAD) +pledge: and a command line utility to restrict program execution privileges +pledge: and limit parameters such as maximum niceness, cpu time, virtual +pledge: memory, file descriptors, child processes, and individual file sizes. +pledge: +pledge: For more info, see: https://justine.lol/pledge/ +pledge: https://github.com/jart/pledge +pledge: |