git: 72413ce51bda - main - sysutils/oddjob: Add new Port

Jochen Neumeister <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.ports
Message-ID <6a7d8753.3e2f3.29f446fa__20628.5264737502$1786611564$gmane$org@gitrepo.freebsd.org>
The branch main has been updated by joneum:

URL: https://cgit.FreeBSD.org/ports/commit/?id=72413ce51bdad09f65daecc5ddb13c5aae245959

commit 72413ce51bdad09f65daecc5ddb13c5aae245959
Author:     Jochen Neumeister <[email protected]>
AuthorDate: 2026-08-13 05:52:04 +0000
Commit:     Jochen Neumeister <[email protected]>
CommitDate: 2026-08-13 08:58:47 +0000

    sysutils/oddjob: Add new Port
    
    oddjob is a D-Bus service (oddjobd) that runs a fixed set of privileged
    jobs on behalf of unprivileged client applications. FreeIPA uses it for
    oddjob-mkhomedir, which creates a user's home directory on first login.
    The port disables the systemd, sysvinit, Python and SELinux features
    that do not apply on FreeBSD and ships a native rc script.
    
    WWW: https://codeberg.org/freeipa/oddjob
    
    Sponsored by:   Netzkommune GmbH
    
    Required for: FreeIPA server port
---
 sysutils/Makefile                         |  1 +
 sysutils/oddjob/Makefile                  | 34 +++++++++++++++++++++++++++++++
 sysutils/oddjob/distinfo                  |  3 +++
 sysutils/oddjob/files/oddjobd.in          | 21 +++++++++++++++++++
 sysutils/oddjob/files/patch-src_oddjobd.c | 24 ++++++++++++++++++++++
 sysutils/oddjob/pkg-descr                 |  8 ++++++++
 sysutils/oddjob/pkg-message               | 15 ++++++++++++++
 sysutils/oddjob/pkg-plist                 | 19 +++++++++++++++++
 8 files changed, 125 insertions(+)

diff --git a/sysutils/Makefile b/sysutils/Makefile
index 0665152881d2..a7081b73cbea 100644
--- a/sysutils/Makefile
+++ b/sysutils/Makefile
@@ -830,6 +830,7 @@
     SUBDIR += obliterate
     SUBDIR += oc
     SUBDIR += ocijail
+    SUBDIR += oddjob
     SUBDIR += odo
     SUBDIR += ohmu
     SUBDIR += omnibackup
diff --git a/sysutils/oddjob/Makefile b/sysutils/oddjob/Makefile
new file mode 100644
index 000000000000..73a07c890293
--- /dev/null
+++ b/sysutils/oddjob/Makefile
@@ -0,0 +1,34 @@
+PORTNAME=	oddjob
+DISTVERSION=	0.34.7
+CATEGORIES=	sysutils
+MASTER_SITES=	https://codeberg.org/freeipa/oddjob/archive/
+
+MAINTAINER=	[email protected]
+COMMENT=	D-Bus service that runs privileged jobs for client applications
+WWW=		https://codeberg.org/freeipa/oddjob
+
+LICENSE=	BSD3CLAUSE
+LICENSE_FILE=	${WRKSRC}/COPYING
+
+LIB_DEPENDS=	libdbus-1.so:devel/dbus \
+		libxml2.so:textproc/libxml2
+
+USES=		autoreconf gmake libtool pkgconfig
+USE_RC_SUBR=	oddjobd
+GNU_CONFIGURE=	yes
+CONFIGURE_ARGS=	--disable-static \
+		--disable-systemd \
+		--disable-sysvinit \
+		--without-python \
+		--without-selinux-labels \
+		--without-selinux-acls \
+		--disable-xml-docs
+
+WRKSRC=		${WRKDIR}/oddjob
+
+# sanity.sh is plain POSIX sh; drop the upstream /bin/bash shebang (which does
+# not exist on FreeBSD and fails stage-qa) in favour of /bin/sh.
+post-patch:
+	@${REINPLACE_CMD} -e '1s|/bin/bash|/bin/sh|' ${WRKSRC}/src/sanity.sh
+
+.include <bsd.port.mk>
diff --git a/sysutils/oddjob/distinfo b/sysutils/oddjob/distinfo
new file mode 100644
index 000000000000..8d7dcad053ed
--- /dev/null
+++ b/sysutils/oddjob/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1786374008
+SHA256 (oddjob-0.34.7.tar.gz) = 53d1024eeac6637af899367c862d3b68c3a64ff73691ca617cdacc3e8c9b311a
+SIZE (oddjob-0.34.7.tar.gz) = 100320
diff --git a/sysutils/oddjob/files/oddjobd.in b/sysutils/oddjob/files/oddjobd.in
new file mode 100644
index 000000000000..c91606dab58e
--- /dev/null
+++ b/sysutils/oddjob/files/oddjobd.in
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# PROVIDE: oddjobd
+# REQUIRE: dbus
+# KEYWORD: shutdown
+
+. /etc/rc.subr
+
+name="oddjobd"
+desc="oddjob D-Bus privileged helper daemon"
+rcvar="oddjobd_enable"
+
+command="%%PREFIX%%/sbin/oddjobd"
+pidfile="/var/run/${name}.pid"
+command_args="-p ${pidfile}"
+
+load_rc_config "${name}"
+
+: ${oddjobd_enable:="NO"}
+
+run_rc_command "$1"
diff --git a/sysutils/oddjob/files/patch-src_oddjobd.c b/sysutils/oddjob/files/patch-src_oddjobd.c
new file mode 100644
index 000000000000..f50dce946389
--- /dev/null
+++ b/sysutils/oddjob/files/patch-src_oddjobd.c
@@ -0,0 +1,24 @@
+--- src/oddjobd.c.orig	2026-08-10 15:02:29 UTC
++++ src/oddjobd.c
+@@ -34,6 +34,7 @@
+ #include <sys/socket.h>
+ #include <sys/stat.h>
+ #include <sys/wait.h>
++#include <signal.h>
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <fnmatch.h>
+@@ -2985,7 +2986,12 @@ main(int argc, char **argv)
+ 
+ 	/* Open a connection to the message bus. */
+ 	check_selinux_applicable();
+-	ctx = oddjob_dbus_listeners_new(options.bus, globals.selinux_enabled);
++	ctx = oddjob_dbus_listeners_new(options.bus,
++#ifdef SELINUX_ACLS
++				       globals.selinux_enabled);
++#else
++				       FALSE);
++#endif
+ 	if (ctx == NULL) {
+ 		fprintf(stderr, "Error connecting to D-Bus!\n");
+ 		return 2;
diff --git a/sysutils/oddjob/pkg-descr b/sysutils/oddjob/pkg-descr
new file mode 100644
index 000000000000..91461b743dfa
--- /dev/null
+++ b/sysutils/oddjob/pkg-descr
@@ -0,0 +1,8 @@
+oddjob is a D-Bus service which performs particular tasks for clients that
+connect to it and issue requests over the system message bus.  Each task is
+run by a helper started by the oddjobd daemon under a configurable set of
+access controls, so unprivileged clients can trigger specific privileged
+operations without being granted broad privileges.
+
+FreeIPA uses oddjob to run privileged server-side helpers (AD trust setup,
+SID configuration and replica connection checks).
diff --git a/sysutils/oddjob/pkg-message b/sysutils/oddjob/pkg-message
new file mode 100644
index 000000000000..e9d15591473a
--- /dev/null
+++ b/sysutils/oddjob/pkg-message
@@ -0,0 +1,15 @@
+[
+{ type: install
+  message: <<EOM
+oddjob installed a D-Bus system policy.  Reload the system message bus so
+oddjobd is allowed to claim its bus name:
+
+	service dbus reload
+
+To run the daemon standalone (FreeIPA starts it for you via ipactl):
+
+	sysrc oddjobd_enable=YES
+	service oddjobd start
+EOM
+}
+]
diff --git a/sysutils/oddjob/pkg-plist b/sysutils/oddjob/pkg-plist
new file mode 100644
index 000000000000..4c449c68c985
--- /dev/null
+++ b/sysutils/oddjob/pkg-plist
@@ -0,0 +1,19 @@
+bin/oddjob_request
+etc/dbus-1/system.d/oddjob-mkhomedir.conf
+etc/dbus-1/system.d/oddjob.conf
+etc/oddjobd.conf
+etc/oddjobd.conf.d/oddjobd-introspection.conf
+etc/oddjobd.conf.d/oddjobd-mkhomedir.conf
+lib/security/pam_oddjob_mkhomedir.so
+libexec/oddjob/mkhomedir
+libexec/oddjob/sanity.sh
+sbin/oddjobd
+share/man/man1/oddjob_request.1.gz
+share/man/man5/oddjob-mkhomedir.conf.5.gz
+share/man/man5/oddjob.conf.5.gz
+share/man/man5/oddjobd-introspection.conf.5.gz
+share/man/man5/oddjobd-mkhomedir.conf.5.gz
+share/man/man5/oddjobd.conf.5.gz
+share/man/man8/oddjobd.8.gz
+share/man/man8/pam_oddjob_mkhomedir.8.gz
+@dir %%ETCDIR%%
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.