diff --git a/srcpkgs/opendoas/INSTALL b/srcpkgs/opendoas/INSTALL new file mode 100644 index 00000000000..352dcde82cd --- /dev/null +++ b/srcpkgs/opendoas/INSTALL @@ -0,0 +1,8 @@ +# +# This script sets up correct perms for usr/bin/doas. +# +case "${ACTION}" in +post) + chmod 4111 usr/bin/doas + ;; +esac diff --git a/srcpkgs/opendoas/files/doas.pam b/srcpkgs/opendoas/files/doas.pam new file mode 100644 index 00000000000..981704abd97 --- /dev/null +++ b/srcpkgs/opendoas/files/doas.pam @@ -0,0 +1,6 @@ +#%PAM-1.0 +#auth sufficient pam_timestamp.so timestamp_timeout=300 verbose +#session optional pam_timestamp.so timestamp_timeout=300 +auth include system-auth +account include system-auth +session include system-auth diff --git a/srcpkgs/opendoas/patches/fixes.patch b/srcpkgs/opendoas/patches/fixes.patch new file mode 100644 index 00000000000..ea257de4b79 --- /dev/null +++ b/srcpkgs/opendoas/patches/fixes.patch @@ -0,0 +1,42 @@ +--- bsd.prog.mk ++++ bsd.prog.mk +@@ -14,7 +14,7 @@ libopenbsd.a: ${OPENBSD} + ${AR} -r $@ $? + + ${PROG}: ${OBJS} libopenbsd.a +- ${CC} ${CFLAGS} ${LDFLAGS} $^ -o $@ ++ ${CC} ${CFLAGS} $^ -o $@ ${LDFLAGS} + + install: ${PROG} ${PAM_DOAS} ${MAN} + mkdir -p -m 0755 ${DESTDIR}${BINDIR} +@@ -22,7 +22,6 @@ install: ${PROG} ${PAM_DOAS} ${MAN} + mkdir -p -m 0755 ${DESTDIR}${MANDIR}/man1 + mkdir -p -m 0755 ${DESTDIR}${MANDIR}/man5 + cp -f ${PROG} ${DESTDIR}${BINDIR} +- chown ${BINOWN}:${BINGRP} ${DESTDIR}${BINDIR}/${PROG} + chmod ${BINMODE} ${DESTDIR}${BINDIR}/${PROG} + cp ${PAM_DOAS} ${DESTDIR}${PAMDIR}/doas + chmod 0644 ${DESTDIR}${PAMDIR}/doas +--- doas.c ++++ doas.c +@@ -295,7 +295,9 @@ checkconfig(const char *confpath, int argc, char **argv, + { + struct rule *rule; + +- setresuid(uid, uid, uid); ++ if (setresuid(uid, uid, uid) != 0) ++ err(1, "can't setresuid"); ++ + parseconfig(confpath, 0); + if (!argc) + exit(0); +--- libopenbsd/openbsd.h ++++ libopenbsd/openbsd.h +@@ -3,7 +3,6 @@ + + #include + #include +-#include + + #include "readpassphrase.h" + diff --git a/srcpkgs/opendoas/template b/srcpkgs/opendoas/template new file mode 100644 index 00000000000..c6f0b6db953 --- /dev/null +++ b/srcpkgs/opendoas/template @@ -0,0 +1,26 @@ +# Template file for 'opendoas' +pkgname=opendoas +version=0.1 +revision=1 +wrksrc="OpenDoas-$version" +build_style=configure +conf_files="/etc/pam.d/doas" +hostmakedepends="bison" +makedepends="pam-devel" +short_desc="Portable OpenBSD doas to execute commands as another user" +maintainer="Duncaen " +license="BSD" +homepage="https://github.com/Duncaen/OpenDoas" +distfiles="https://github.com/Duncaen/OpenDoas/archive/v${version}.tar.gz" +checksum=468fb97307e4ac4c6b92931a2e315fd2b6201f7e82a4db25ec2aa6f6d8b3627e + +CFLAGS="-Wno-unused-result" + +pre_configure() { + cp ${FILESDIR}/doas.pam pam.d__doas__linux + export VERSION=$version BINGRP=root +} + +post_install() { + vlicense LICENSE +}