NetBSD Problem Report #31959
From ghen@telenet.be Mon Oct 31 18:29:32 2005
Return-Path: <ghen@telenet.be>
Received: from adicia.telenet-ops.be (adicia.telenet-ops.be [195.130.132.56])
by narn.netbsd.org (Postfix) with ESMTP id 8353463B900
for <gnats-bugs@gnats.NetBSD.org>; Mon, 31 Oct 2005 18:29:31 +0000 (UTC)
Message-Id: <200510311737.j9VHbo5Z005438@localhost.>
Date: Mon, 31 Oct 2005 18:37:50 +0100 (CET)
From: Geert Hendrickx <ghen@telenet.be>
Reply-To: Geert Hendrickx <ghen@telenet.be>
To: gnats-bugs@netbsd.org
Subject: make databases/openldap run as non-root
X-Send-Pr-Version: 3.95
>Number: 31959
>Category: pkg
>Synopsis: make databases/openldap run as non-root
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: ghen
>State: closed
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Mon Oct 31 18:30:00 +0000 2005
>Closed-Date: Wed May 31 18:30:57 +0000 2006
>Last-Modified: Wed May 31 18:30:57 +0000 2006
>Originator: Geert Hendrickx
>Release: NetBSD 2.1
>Organization:
>Environment:
System: NetBSD mantis 2.1 NetBSD 2.1 (MANTIS) #0: Fri Oct 28 15:48:15 CEST 2005 geert@mantis:/cvs/obj/sys/arch/i386/compile/MANTIS i386
Architecture: i386
Machine: i386
>Description:
OpenLDAP can perfectly run as non-root. The patch below makes it run as an unprivileged user.
>How-To-Repeat:
>Fix:
Index: Makefile
===================================================================
RCS file: /pub/NetBSD-CVS/pkgsrc/databases/openldap/Makefile,v
retrieving revision 1.102
diff -u -r1.102 Makefile
--- Makefile 26 Oct 2005 15:08:13 -0000 1.102
+++ Makefile 31 Oct 2005 17:33:29 -0000
@@ -18,11 +18,18 @@
GNU_CONFIGURE= yes
TEST_TARGET= test
+LDAP_USER?= ldap
+LDAP_GROUP?= ldap
+
+PKG_GROUPS= ${LDAP_GROUP}
+PKG_USERS= ${LDAP_USER}:${LDAP_GROUP}::LDAP\ user:${OPENLDAP_VARDIR}
+
MAKE_ENV+= LIBMODE=${LIBMODE}
OPENLDAP_ETCDIR= ${PKG_SYSCONFDIR}/openldap
OPENLDAP_MODULEDIR= ${PREFIX}/lib/openldap
OPENLDAP_VARDIR= ${VARBASE}/openldap
FILES_SUBST+= OPENLDAP_ETCDIR=${OPENLDAP_ETCDIR:Q}
+FILES_SUBST+= LDAP_USER=${LDAP_USER}
.include "../../mk/bsd.prefs.mk"
.include "options.mk"
@@ -54,8 +61,8 @@
# SLAPD (stackable) overlays
CONFIGURE_ARGS+= --enable-overlays
-OPENLDAP_FILEPERMS= ${ROOT_USER} ${ROOT_GROUP} 0600
-OPENLDAP_DIRPERMS= ${ROOT_USER} ${ROOT_GROUP} 0700
+OPENLDAP_FILEPERMS= ${LDAP_USER} ${LDAP_GROUP} 0600
+OPENLDAP_DIRPERMS= ${LDAP_USER} ${LDAP_GROUP} 0700
USE_PKGINSTALL= yes
EGDIR= ${PREFIX}/share/examples/openldap
Index: files/slapd.sh
===================================================================
RCS file: /pub/NetBSD-CVS/pkgsrc/databases/openldap/files/slapd.sh,v
retrieving revision 1.7
diff -u -r1.7 slapd.sh
--- files/slapd.sh 26 Oct 2005 15:08:13 -0000 1.7
+++ files/slapd.sh 31 Oct 2005 17:33:29 -0000
@@ -12,6 +12,7 @@
name="slapd"
rcvar=${name}
command="@PREFIX@/libexec/${name}"
+command_args="-u @LDAP_USER@"
required_files="@OPENLDAP_ETCDIR@/${name}.conf"
load_rc_config $name
Index: files/slurpd.sh
===================================================================
RCS file: /pub/NetBSD-CVS/pkgsrc/databases/openldap/files/slurpd.sh,v
retrieving revision 1.3
diff -u -r1.3 slurpd.sh
--- files/slurpd.sh 26 Oct 2005 15:08:13 -0000 1.3
+++ files/slurpd.sh 31 Oct 2005 17:33:29 -0000
@@ -12,6 +12,7 @@
name="slurpd"
rcvar=${name}
command="@PREFIX@/libexec/${name}"
+command_args="-u @LDAP_USER@"
required_files="@OPENLDAP_ETCDIR@/slapd.conf"
required_vars="slapd"
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: pkg-manager->jlam
Responsible-Changed-By: recht@netbsd.org
Responsible-Changed-When: Mon, 31 Oct 2005 22:17:25 +0000
Responsible-Changed-Why:
over to maintainer
Responsible-Changed-From-To: jlam->joerg
Responsible-Changed-By: ghen@netbsd.org
Responsible-Changed-When: Thu, 16 Mar 2006 13:52:30 +0000
Responsible-Changed-Why:
joerg is the new maintainer.
From: Adrian Portelli <adrianp@stindustries.net>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/31959 (make databases/openldap run as non-root)
Date: Sat, 18 Mar 2006 13:21:24 +0000
Hi,
Just a few quick point for anyone that decides to address this PR:
OpenLDAP's slapd (at least in openldap-2.3.11nb1) also supports the use
of -g to specify a group to run as. If we are going to create the ldap
group (as the patch does) we should change the line in slapd.sh to:
command_args="-u @LDAP_USER@ -g @LDAP_GROUP@"
In addition to this:
FILES_SUBST+= LDAP_GROUP=${LDAP_GROUP}
would probably be needed as well.
Also OpenLDAP's slurpd (at least in openldap-2.3.11) does not support -u
or -g.
adrian.
From: Geert Hendrickx <ghen@telenet.be>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: pkg/31959 (make databases/openldap run as non-root)
Date: Sat, 18 Mar 2006 16:04:28 +0100
On Sat, Mar 18, 2006 at 01:25:01PM +0000, Adrian Portelli wrote:
> OpenLDAP's slapd (at least in openldap-2.3.11nb1) also supports the use
> of -g to specify a group to run as. If we are going to create the ldap
> group (as the patch does) we should change the line in slapd.sh to:
>
> command_args="-u @LDAP_USER@ -g @LDAP_GROUP@"
The -u ${USER} option also runs it as the ${USER}'s primary group by
default. -g ${GROUP} is only useful if you want to run it under a
different group.
> Also OpenLDAP's slurpd (at least in openldap-2.3.11) does not support -u
> or -g.
Oh, sorry, didn't notice that (I don't run slurpd).
Geert
From: Geert Hendrickx <ghen@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: PR/31959 CVS commit: pkgsrc/databases/openldap-server
Date: Wed, 31 May 2006 18:18:36 +0000 (UTC)
Module Name: pkgsrc
Committed By: ghen
Date: Wed May 31 18:18:36 UTC 2006
Update of /cvsroot/pkgsrc/databases/openldap-server
In directory ivanova.netbsd.org:/tmp/cvs-serv13664
Log Message:
Import databases/openldap-server, formerly a part of databases/openldap but
now split off. This package contains only the slapd and slurpd servers.
Please note that both slapd and slurpd now run unprivileged by default (as
slapd:ldap and slurpd:ldap, respectively). An upgrade scenaria is described
in MESSAGE. This change addresses PR pkg/31959.
Status:
Vendor Tag: TNF
Release Tags: pkgsrc-base
N pkgsrc/databases/openldap-server/DESCR
N pkgsrc/databases/openldap-server/Makefile
N pkgsrc/databases/openldap-server/PLIST
N pkgsrc/databases/openldap-server/options.mk
N pkgsrc/databases/openldap-server/MESSAGE
No conflicts created by this import
Responsible-Changed-From-To: joerg->ghen
Responsible-Changed-By: ghen@netbsd.org
Responsible-Changed-When: Wed, 31 May 2006 18:30:57 +0000
Responsible-Changed-Why:
New MAINTAINER.
State-Changed-From-To: open->closed
State-Changed-By: ghen@netbsd.org
State-Changed-When: Wed, 31 May 2006 18:30:57 +0000
State-Changed-Why:
Fixed now that openldap-server is a package on its own.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.