git: 2820df617d13 - main - security/opendoas: new port: portable version of OpenBSD's doas

From: Vladimir Druzenko <vvd_at_FreeBSD.org>
Date: Sun, 09 Jun 2024 19:00:30 UTC
The branch main has been updated by vvd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2820df617d130919c37d103de14a6cff58732fa8

commit 2820df617d130919c37d103de14a6cff58732fa8
Author:     Cathal O'Grady <fierceinbattle@gmail.com>
AuthorDate: 2024-06-09 18:29:29 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2024-06-09 18:29:29 +0000

    security/opendoas: new port: portable version of OpenBSD's doas
    
    This is not an official port/project from OpenBSD!
    OpenBSD doas does not support persist option for non OpenBSD systems,
    OpenDoas originally made for Linux and MacOS does support this.
    This port includes a patch for the OpenDoas to supports persist on FreeBSD.
    This commit adds the OpenDoas as an alternative to sudo that supports persist.
    
    PR:             279598
    Approved by:    Cathal O'Grady <fierceinbattle@gmail.com> (maintainer)
---
 security/Makefile                         |  1 +
 security/opendoas/Makefile                | 39 +++++++++++++++++++++++++++++++
 security/opendoas/distinfo                |  7 ++++++
 security/opendoas/files/patch-GNUmakefile | 11 +++++++++
 security/opendoas/pkg-descr               |  3 +++
 security/opendoas/pkg-plist               |  3 +++
 6 files changed, 64 insertions(+)

diff --git a/security/Makefile b/security/Makefile
index 9e464693ad71..b5069078f876 100644
--- a/security/Makefile
+++ b/security/Makefile
@@ -430,6 +430,7 @@
     SUBDIR += openconnect-gui
     SUBDIR += opencryptoki
     SUBDIR += openct
+    SUBDIR += opendoas
     SUBDIR += openfhe
     SUBDIR += openfortivpn
     SUBDIR += openiked
diff --git a/security/opendoas/Makefile b/security/opendoas/Makefile
new file mode 100644
index 000000000000..50b3c489b64f
--- /dev/null
+++ b/security/opendoas/Makefile
@@ -0,0 +1,39 @@
+PORTNAME=	opendoas
+DISTVERSIONPREFIX=	v
+DISTVERSION=	6.8.2
+CATEGORIES=	security
+DISTNAME=	opendoas
+
+PATCH_SITES=	https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/
+# pam: always print pam_conv messages to stderr:
+# https://github.com/Duncaen/OpenDoas/issues/95
+PATCHFILES+=	b96106b7e34ac591ae78b1684e9be3a265122463.patch:-p1
+# Added freebsd support for timestamp (persist):
+# https://github.com/Duncaen/OpenDoas/pull/127
+PATCHFILES+=	97218322213274eb24ab633e09478075b2282ab3.patch:-p1
+
+MAINTAINER=	fierceinbattle@gmail.com
+COMMENT=	Port of OpenDoas: a portable version of OpenBSD's doas
+WWW=		https://github.com/Duncaen/OpenDoas
+
+LICENSE=	OPENDOAS
+LICENSE_NAME=	OPENDOAS
+LICENSE_FILE=	${WRKSRC}/LICENSE
+LICENSE_PERMS=	auto-accept dist-mirror pkg-mirror
+
+USES=		gmake
+USE_GITHUB=	yes
+GH_ACCOUNT=	Duncaen
+GH_PROJECT=	OpenDoas
+
+HAS_CONFIGURE=	yes
+CONFIGURE_ARGS=	--sysconfdir=${LOCALBASE}/etc \
+		--with-timestamp \
+		--without-shadow
+
+MAKEFILE=	GNUmakefile
+
+post-install:
+	${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/doas
+
+.include <bsd.port.mk>
diff --git a/security/opendoas/distinfo b/security/opendoas/distinfo
new file mode 100644
index 000000000000..9d1b96f51643
--- /dev/null
+++ b/security/opendoas/distinfo
@@ -0,0 +1,7 @@
+TIMESTAMP = 1717955807
+SHA256 (Duncaen-OpenDoas-v6.8.2_GH0.tar.gz) = 6da058a0e70b7543bc60624389b0b00b686189ec933828c522bf8b2600495a67
+SIZE (Duncaen-OpenDoas-v6.8.2_GH0.tar.gz) = 32430
+SHA256 (b96106b7e34ac591ae78b1684e9be3a265122463.patch) = fef9f90a5eda5e9b76c507253a843bf7a7a02d4b85c579f27265d9a8c61522e8
+SIZE (b96106b7e34ac591ae78b1684e9be3a265122463.patch) = 666
+SHA256 (97218322213274eb24ab633e09478075b2282ab3.patch) = 2017e00deb68a00e7601211037f44c018b88fcf0f7929f9f9cb6fa72fae8febd
+SIZE (97218322213274eb24ab633e09478075b2282ab3.patch) = 2217
diff --git a/security/opendoas/files/patch-GNUmakefile b/security/opendoas/files/patch-GNUmakefile
new file mode 100644
index 000000000000..14aa4a085bb7
--- /dev/null
+++ b/security/opendoas/files/patch-GNUmakefile
@@ -0,0 +1,11 @@
+--- GNUmakefile.orig	2022-01-26 16:01:11 UTC
++++ GNUmakefile
+@@ -21,7 +21,7 @@ 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}
++	#chown ${BINOWN}:${BINGRP} ${DESTDIR}${BINDIR}/${PROG}
+ 	chmod ${BINMODE} ${DESTDIR}${BINDIR}/${PROG}
+ 	[ -n "${PAM_DOAS}" ] && cp ${PAM_DOAS} ${DESTDIR}${PAMDIR}/doas || true
+ 	[ -n "${PAM_DOAS}" ] && chmod 0644 ${DESTDIR}${PAMDIR}/doas || true
diff --git a/security/opendoas/pkg-descr b/security/opendoas/pkg-descr
new file mode 100644
index 000000000000..4ea00a53f81d
--- /dev/null
+++ b/security/opendoas/pkg-descr
@@ -0,0 +1,3 @@
+This is a port of OpenDoas, which in itself is a port of OpenBSD's doas for
+Linux and MacOS. OpenDoas unlike OpenBSD's doas supports persist on FreeBSD
+(and Linux + MacOS).
diff --git a/security/opendoas/pkg-plist b/security/opendoas/pkg-plist
new file mode 100644
index 000000000000..2e8b7cdf8a12
--- /dev/null
+++ b/security/opendoas/pkg-plist
@@ -0,0 +1,3 @@
+bin/doas
+share/man/man1/doas.1.gz
+share/man/man5/doas.conf.5.gz