From 66e89aa383d8c48973355da9b0c5d1b6e1295906 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Mon, 15 Sep 2008 23:25:37 +0200 Subject: Fix redirect error msg to stderr. --- ldap/mkldapdb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ldap/mkldapdb') diff --git a/ldap/mkldapdb b/ldap/mkldapdb index 374e4cd..cade398 100755 --- a/ldap/mkldapdb +++ b/ldap/mkldapdb @@ -19,7 +19,7 @@ fi for var in basedn dnsdomain orgname backend; do if [ -z "`eval echo '$'$var`" ]; then - echo 2> "ERROR: Required variable '$var' missing. Exiting...!" + echo 1>&2 "ERROR: Required variable '$var' missing. Exiting...!" exit 1 fi done -- cgit v1.2.3 From 4c0b7e7eb7384499f4405badc4f7809c6e61d50d Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Mon, 15 Sep 2008 23:35:22 +0200 Subject: Grab orgname from /etc/local-ORG/orgname. --- ldap/mkldapdb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ldap/mkldapdb') diff --git a/ldap/mkldapdb b/ldap/mkldapdb index cade398..443ac44 100755 --- a/ldap/mkldapdb +++ b/ldap/mkldapdb @@ -13,8 +13,8 @@ checkpoint="checkpoint 512 30" backend="bdb" backendoptions="# For the Debian package we use 2MB as default but be sure to update this\n# value if you have plenty of RAM\ndbconfig set_cachesize 0 2097152 0\n\n# Sven Hartge reported that he had to set this value incredibly high\n# to get slapd running at all. See http:\/\/bugs.debian.org\/303057\n# for more information.\n\n# Number of objects that can be locked at the same time.\ndbconfig set_lk_max_objects 1500\n# Number of locks (both requested and granted)\ndbconfig set_lk_max_locks 1500\n# Number of lockers\ndbconfig set_lk_max_lockers 1500" -if [ -r /etc/local/org.conf ]; then - . /etc/local/org.conf +if [ -r /etc/local-ORG/orgname ]; then + orgname="$(head -n 1 /etc/local-ORG/orgname)" fi for var in basedn dnsdomain orgname backend; do -- cgit v1.2.3 From db6580949fecaa7c21315ab3e8055823b73dc548 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Mon, 15 Sep 2008 23:41:20 +0200 Subject: Add core horde config. --- ldap/db/base.ldif.in | 5 +++++ ldap/db/horde.ldif.in | 6 ++++++ ldap/mkldapdb | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 ldap/db/horde.ldif.in (limited to 'ldap/mkldapdb') diff --git a/ldap/db/base.ldif.in b/ldap/db/base.ldif.in index 8b9d263..2d1a0d6 100644 --- a/ldap/db/base.ldif.in +++ b/ldap/db/base.ldif.in @@ -5,6 +5,11 @@ objectClass: organization o: @DOMAIN@ dc: @ORG@ +dn: ou=DSA, @SUFFIX@ +objectclass: organizationalUnit +ou: DSA +description: Directory System Agent + dn: ou=people, @SUFFIX@ objectClass: organizationalUnit ou: people diff --git a/ldap/db/horde.ldif.in b/ldap/db/horde.ldif.in new file mode 100644 index 0000000..0e1bab0 --- /dev/null +++ b/ldap/db/horde.ldif.in @@ -0,0 +1,6 @@ +dn: cn=horde, ou=DSA, @SUFFIX@ +objectclass: organizationalRole +objectClass: top +objectClass: simpleSecurityObject +userPassword: superSecretPassword +cn: horde diff --git a/ldap/mkldapdb b/ldap/mkldapdb index 443ac44..ce9a8c6 100755 --- a/ldap/mkldapdb +++ b/ldap/mkldapdb @@ -29,7 +29,7 @@ tempdir=`mktemp -dt slapd.XXXXXX` cfgdir=/etc/ldap dbdir=/var/lib/ldap -for section in base; do +for section in base horde; do sed <"$masterdir/$section.ldif.in" >"$tempdir/$section.ldif" \ -e "s/@SUFFIX@/$basedn/g" \ -e "s/@DOMAIN@/$dnsdomain/g" \ -- cgit v1.2.3 From c21b3a4817945a608cc4ab5a28dff97b91c5346c Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Tue, 16 Sep 2008 00:02:54 +0200 Subject: Add core config (split out from base). --- ldap/db/base.ldif.in | 7 ------- ldap/db/core.ldif.in | 6 ++++++ ldap/mkldapdb | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) create mode 100644 ldap/db/core.ldif.in (limited to 'ldap/mkldapdb') diff --git a/ldap/db/base.ldif.in b/ldap/db/base.ldif.in index 2d1a0d6..31624a6 100644 --- a/ldap/db/base.ldif.in +++ b/ldap/db/base.ldif.in @@ -1,10 +1,3 @@ -dn: @SUFFIX@ -objectClass: top -objectClass: dcObject -objectClass: organization -o: @DOMAIN@ -dc: @ORG@ - dn: ou=DSA, @SUFFIX@ objectclass: organizationalUnit ou: DSA diff --git a/ldap/db/core.ldif.in b/ldap/db/core.ldif.in new file mode 100644 index 0000000..a9aa24f --- /dev/null +++ b/ldap/db/core.ldif.in @@ -0,0 +1,6 @@ +dn: @SUFFIX@ +objectClass: top +objectClass: dcObject +objectClass: organization +o: @DOMAIN@ +dc: @ORG@ diff --git a/ldap/mkldapdb b/ldap/mkldapdb index ce9a8c6..38b5617 100755 --- a/ldap/mkldapdb +++ b/ldap/mkldapdb @@ -29,7 +29,7 @@ tempdir=`mktemp -dt slapd.XXXXXX` cfgdir=/etc/ldap dbdir=/var/lib/ldap -for section in base horde; do +for section in core base horde; do sed <"$masterdir/$section.ldif.in" >"$tempdir/$section.ldif" \ -e "s/@SUFFIX@/$basedn/g" \ -e "s/@DOMAIN@/$dnsdomain/g" \ -- cgit v1.2.3 From 385b3843dcee09441e718318b2d5bcd9b57c67ff Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Tue, 16 Sep 2008 00:36:21 +0200 Subject: push data into DSA. --- ldap/mkldapdb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ldap/mkldapdb') diff --git a/ldap/mkldapdb b/ldap/mkldapdb index 38b5617..604b8ba 100755 --- a/ldap/mkldapdb +++ b/ldap/mkldapdb @@ -45,3 +45,11 @@ for db in passwd group; do ( cd /usr/share/migrationtools && ./migrate_passwd.pl "$tempdir/$db.dump" >"$tempdir/$db.ldif" ) done +#invoke-rc.d slapd stop +#slapadd -l "$tempdir/core.ldif" +#invoke-rc.d slapd start +#ldappasswd -x -h localhost -D "cn=admin,$basedn" -S -w supersecretpassword "cn=admin,$basedn" +for section in base horde; do + ldapadd -x -h localhost -D "cn=admin,$basedn" -f "$tempdir/$section.ldif" -W +done +ldappasswd -x -h localhost -D "cn=admin,$basedn" -S -W "cn=horde,ou=DSA,$basedn" -- cgit v1.2.3 From a5a0692af0038463fdf888cc55e1967b966d4b59 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Tue, 16 Sep 2008 01:05:08 +0200 Subject: Create slapd.conf, and drop unused vars. --- ldap/mkldapdb | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'ldap/mkldapdb') diff --git a/ldap/mkldapdb b/ldap/mkldapdb index 604b8ba..833827a 100755 --- a/ldap/mkldapdb +++ b/ldap/mkldapdb @@ -8,15 +8,14 @@ umask 066 basedn="`grep '^BASE\b' /etc/ldap/ldap.conf | sed -e 's/^BASE[[:space:]]\+//'`" dnsdomain="`dnsdomainname`" orgname="" -# Grab some defaults from /var/lib/dpkg/info/slapd.postinst -checkpoint="checkpoint 512 30" -backend="bdb" -backendoptions="# For the Debian package we use 2MB as default but be sure to update this\n# value if you have plenty of RAM\ndbconfig set_cachesize 0 2097152 0\n\n# Sven Hartge reported that he had to set this value incredibly high\n# to get slapd running at all. See http:\/\/bugs.debian.org\/303057\n# for more information.\n\n# Number of objects that can be locked at the same time.\ndbconfig set_lk_max_objects 1500\n# Number of locks (both requested and granted)\ndbconfig set_lk_max_locks 1500\n# Number of lockers\ndbconfig set_lk_max_lockers 1500" - if [ -r /etc/local-ORG/orgname ]; then orgname="$(head -n 1 /etc/local-ORG/orgname)" fi +# config defaults as of slapd 2.4.10-3 +backend="hdb" + +# Ensure all required values are properly resolved for var in basedn dnsdomain orgname backend; do if [ -z "`eval echo '$'$var`" ]; then echo 1>&2 "ERROR: Required variable '$var' missing. Exiting...!" @@ -24,20 +23,20 @@ for var in basedn dnsdomain orgname backend; do fi done +confskel=/usr/share/slapd/slapd.conf masterdir=/etc/local-COMMON/ldap/db tempdir=`mktemp -dt slapd.XXXXXX` -cfgdir=/etc/ldap -dbdir=/var/lib/ldap + +sed <"$confskel" >"$tempdir/slapd.conf" \ + -e "s/@BACKEND@/$backend/g" \ + -e "s/@SUFFIX@/$basedn/g" \ + -e "s/@ADMIN@/cn=admin,$basedn/g" for section in core base horde; do sed <"$masterdir/$section.ldif.in" >"$tempdir/$section.ldif" \ -e "s/@SUFFIX@/$basedn/g" \ -e "s/@DOMAIN@/$dnsdomain/g" \ - -e "s/@ORG@/$orgname/g" \ - -e "s/@ADMIN@/cn=admin,$basedn/g" \ - -e "s/@CHECKPOINT@/$checkpoint/g" \ - -e "s/@BACKEND@/$backend/g" \ - -e "s/@BACKENDOPTIONS@/$backendoptions/g" + -e "s/@ORG@/$orgname/g" done for db in passwd group; do -- cgit v1.2.3 From 65fa4c6f74141e00303f8db3d7fb6a130f85033e Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Tue, 16 Sep 2008 14:35:52 +0200 Subject: Make slapd.conf from snippets, and more... --- ldap/db/05_slapd.conf.in | 96 ++++++++++++++++++++++++++++++++++++++++++++++++ ldap/db/10_base.conf.in | 22 +++++++++++ ldap/db/30_cipux.conf.in | 3 ++ ldap/db/40_horde.conf.in | 5 +++ ldap/db/50_base.conf.in | 10 +++++ ldap/db/50_samba.conf.in | 4 ++ ldap/db/80_base.conf.in | 3 ++ ldap/db/95_slapd.conf.in | 14 +++++++ ldap/db/base.ldif.in | 80 ++++++++++++++++++++++++++++++++++++---- ldap/db/cipux.ldif.in | 6 +++ ldap/db/core.ldif.in | 2 +- ldap/db/horde.ldif.in | 11 ++++-- ldap/mkldapdb | 27 ++++++++++---- 13 files changed, 263 insertions(+), 20 deletions(-) create mode 100644 ldap/db/05_slapd.conf.in create mode 100644 ldap/db/10_base.conf.in create mode 100644 ldap/db/30_cipux.conf.in create mode 100644 ldap/db/40_horde.conf.in create mode 100644 ldap/db/50_base.conf.in create mode 100644 ldap/db/50_samba.conf.in create mode 100644 ldap/db/80_base.conf.in create mode 100644 ldap/db/95_slapd.conf.in create mode 100644 ldap/db/cipux.ldif.in (limited to 'ldap/mkldapdb') diff --git a/ldap/db/05_slapd.conf.in b/ldap/db/05_slapd.conf.in new file mode 100644 index 0000000..dde73b3 --- /dev/null +++ b/ldap/db/05_slapd.conf.in @@ -0,0 +1,96 @@ +# This is the main slapd configuration file. See slapd.conf(5) for more +# info on the configuration options. + +####################################################################### +# Global Directives: + +# Features to permit +#allow bind_v2 + +# Schema and objectClass definitions +include /etc/ldap/schema/core.schema +include /etc/ldap/schema/cosine.schema +include /etc/ldap/schema/nis.schema +include /etc/ldap/schema/inetorgperson.schema + +# Where the pid file is put. The init.d script +# will not stop the server if you change this. +pidfile /var/run/slapd/slapd.pid + +# List of arguments that were passed to the server +argsfile /var/run/slapd/slapd.args + +# Read slapd.conf(5) for possible values +loglevel none + +# Where the dynamically loaded modules are stored +modulepath /usr/lib/ldap +moduleload back_@BACKEND@ + +# The maximum number of entries that is returned for a search operation +sizelimit 500 + +# The tool-threads parameter sets the actual amount of cpu's that is used +# for indexing. +tool-threads 1 + +####################################################################### +# Specific Backend Directives for @BACKEND@: +# Backend specific directives apply to this backend until another +# 'backend' directive occurs +backend @BACKEND@ + +####################################################################### +# Specific Backend Directives for 'other': +# Backend specific directives apply to this backend until another +# 'backend' directive occurs +#backend + +####################################################################### +# Specific Directives for database #1, of type @BACKEND@: +# Database specific directives apply to this databasse until another +# 'database' directive occurs +database @BACKEND@ + +# The base of your directory in database #1 +suffix "@SUFFIX@" + +# rootdn directive for specifying a superuser on the database. This is needed +# for syncrepl. +# rootdn "cn=admin,@SUFFIX@" + +# Where the database file are physically stored for database #1 +directory "/var/lib/ldap" + +# The dbconfig settings are used to generate a DB_CONFIG file the first +# time slapd starts. They do NOT override existing an existing DB_CONFIG +# file. You should therefore change these settings in DB_CONFIG directly +# or remove DB_CONFIG and restart slapd for changes to take effect. + +# For the Debian package we use 2MB as default but be sure to update this +# value if you have plenty of RAM +dbconfig set_cachesize 0 2097152 0 + +# Sven Hartge reported that he had to set this value incredibly high +# to get slapd running at all. See http://bugs.debian.org/303057 for more +# information. + +# Number of objects that can be locked at the same time. +dbconfig set_lk_max_objects 1500 +# Number of locks (both requested and granted) +dbconfig set_lk_max_locks 1500 +# Number of lockers +dbconfig set_lk_max_lockers 1500 + +# Indexing options for database #1 +index objectClass eq + +# Save the time that the entry gets modified, for database #1 +lastmod on + +# Checkpoint the BerkeleyDB database periodically in case of system +# failure and to speed slapd shutdown. +checkpoint 512 30 + +# Where to store the replica logs for database #1 +# replogfile /var/lib/ldap/replog diff --git a/ldap/db/10_base.conf.in b/ldap/db/10_base.conf.in new file mode 100644 index 0000000..0781b3d --- /dev/null +++ b/ldap/db/10_base.conf.in @@ -0,0 +1,22 @@ +# Ensure read access to the base for things like +# supportedSASLMechanisms. Without this you may +# have problems with SASL not knowing what +# mechanisms are available and the like. +# Note that this is covered by the 'access to *' +# ACL below too but if you change that as people +# are wont to do you'll still need this if you +# want SASL (and possible other things) to work +# happily. +access to dn.base="" + by * read + +access to dn.subtree="cn=monitor" + by * read + +# The admin dn has full write access, everyone else +# needs further checking +access to dn.subtree="@SUFFIX@" + by dn.exact="cn=admin,@SUFFIX@" write + by group/groupOfUniqueNames/uniqueMember="cn=DSA,ou=Administrators,ou=Groups,ou=Access Control,@SUFFIX@" write + by group/groupOfUniqueNames/uniqueMember="cn=Replicants,ou=Groups,ou=Access Control,@SUFFIX@" write + by * break diff --git a/ldap/db/30_cipux.conf.in b/ldap/db/30_cipux.conf.in new file mode 100644 index 0000000..f20751f --- /dev/null +++ b/ldap/db/30_cipux.conf.in @@ -0,0 +1,3 @@ +access to dn.subtree="ou=CipUX,ou=SubSystems,@SUFFIX@" + by dn.exact=”uid=cipux,ou=System,ou=Entities,ou=SAM,@SUFFIX@" write + by * none break diff --git a/ldap/db/40_horde.conf.in b/ldap/db/40_horde.conf.in new file mode 100644 index 0000000..bbae52a --- /dev/null +++ b/ldap/db/40_horde.conf.in @@ -0,0 +1,5 @@ +# Horde +access to dn.sub="ou=People,ou=Entities,ou=SAM,@SUFFIX@" attrs=@hordePerson + by group="cn=DSA,ou=Administrators,ou=Access Control,@SUFFIX@" write + by group="cn=Horde,ou=Administrators,ou=Access Control,@SUFFIX@" write + by * none diff --git a/ldap/db/50_base.conf.in b/ldap/db/50_base.conf.in new file mode 100644 index 0000000..b7cd9ae --- /dev/null +++ b/ldap/db/50_base.conf.in @@ -0,0 +1,10 @@ +# The userPassword by default can be changed +# by the entry owning it if they are authenticated. +# Others should not be able to see it, except the +# admin entry below +access to dn.subtree="ou=SAM,@SUFFIX@" attrs=userpassword,shadowLastChange + by dn.exact="@ADMIN@" write + by dn.exact=”uid=cifsdc,ou=Entities,ou=Access Control,@SUFFIX@" write + by anonymous auth + by self write + by * none diff --git a/ldap/db/50_samba.conf.in b/ldap/db/50_samba.conf.in new file mode 100644 index 0000000..4eee5cd --- /dev/null +++ b/ldap/db/50_samba.conf.in @@ -0,0 +1,4 @@ +# Samba +access to dn.subtree="ou=SAM,@SUFFIX@" attrs=sambantpassword,sambalmpassword,sambapasswordhistory,sambabadpasswordcount,sambabadpasswordtme,sambapwdcanchange,sambapwdmustchange + by dn.exact=”uid=cifsdc,ou=Entities,ou=Access Control,@SUFFIX@" write + by * none diff --git a/ldap/db/80_base.conf.in b/ldap/db/80_base.conf.in new file mode 100644 index 0000000..2e7b571 --- /dev/null +++ b/ldap/db/80_base.conf.in @@ -0,0 +1,3 @@ +# Read access by default +access to * + by * read diff --git a/ldap/db/95_slapd.conf.in b/ldap/db/95_slapd.conf.in new file mode 100644 index 0000000..861511c --- /dev/null +++ b/ldap/db/95_slapd.conf.in @@ -0,0 +1,14 @@ +# For Netscape Roaming support, each user gets a roaming +# profile for which they have write access to +#access to dn=".*,ou=Roaming,o=morsnet" +# by dn="@ADMIN@" write +# by dnattr=owner write + +####################################################################### +# Specific Directives for database #2, of type 'other' (can be @BACKEND@ too): +# Database specific directives apply to this databasse until another +# 'database' directive occurs +#database + +# The base of your directory for database #2 +#suffix "dc=debian,dc=org" diff --git a/ldap/db/base.ldif.in b/ldap/db/base.ldif.in index 31624a6..88f4eaa 100644 --- a/ldap/db/base.ldif.in +++ b/ldap/db/base.ldif.in @@ -1,14 +1,78 @@ -dn: ou=DSA, @SUFFIX@ +dn: ou=Customers,@SUFFIX@ objectclass: organizationalUnit -ou: DSA -description: Directory System Agent +ou: Customers +description: Customers at @ORG@ -dn: ou=people, @SUFFIX@ +dn: ou=SubSystems,@SUFFIX@ +objectclass: organizationalUnit +ou: SubSystems + +dn: ou=Mail,ou=SubSystems,@SUFFIX@ +objectclass: organizationalUnit +ou: Mail + +dn: ou=SAM,@SUFFIX@ +objectclass: organizationalUnit +ou: SAM +description: Samba and NSS stuff + +dn: ou=Groups,ou=SAM,@SUFFIX@ +objectClass: organizationalUnit +ou: Groups +description: Groups at @ORG@ + +dn: ou=Hosts,ou=SAM,@SUFFIX@ +objectClass: organizationalUnit +ou: Hosts +description: Hosts at @ORG@ + +dn: ou=Services,ou=SAM,@SUFFIX@ +objectClass: organizationalUnit +ou: Hosts +description: System services at @ORG@ + +dn: ou=idMap,ou=SAM,@SUFFIX@ +objectClass: organizationalUnit +ou: idMap +description: Samba idmap subsystem + +dn: ou=Entities,ou=SAM,@SUFFIX@ objectClass: organizationalUnit -ou: people +ou: Entities +description: Human and non-human entities + +dn: ou=People,ou=Entities,ou=SAM,@SUFFIX@ +objectClass: organizationalUnit +ou: People description: Users in @ORG@ -dn: ou=group, @SUFFIX@ +dn: ou=System,ou=Entities,ou=SAM,@SUFFIX@ objectClass: organizationalUnit -ou: group -description: Groups at @ORG@ +ou: System +description: Non-human entities in @ORG@ + +dn: ou=Access Control,@SUFFIX@ +objectClass: organizationalUnit +ou: Access Control + +dn: ou=Groups,ou=Access Control,@SUFFIX@ +objectClass: organizationalUnit +ou: Groups + +dn: cn=Replicants,ou=Groups,ou=Access Control,@SUFFIX@ +objectClass: organizationalUnit +cn: Replicants + +dn: ou=Administrators,ou=Groups,ou=Access Control,@SUFFIX@ +objectClass: organizationalUnit +ou: Administrators + +dn: cn=DSA,ou=Administrators,ou=Groups,ou=Access Control,@SUFFIX@ +objectClass: organizationalUnit +cn: DSA +description: Directory System Agent administrators + +dn: ou=Entities,ou=Access Control,@SUFFIX@ +objectClass: organizationalUnit +ou: Entities +description: DSA-only entities diff --git a/ldap/db/cipux.ldif.in b/ldap/db/cipux.ldif.in new file mode 100644 index 0000000..cec5396 --- /dev/null +++ b/ldap/db/cipux.ldif.in @@ -0,0 +1,6 @@ +dn: uid=cipux,ou=System,ou=Entities,ou=SAM,@SUFFIX@ +objectClass: top +objectclass: account +objectClass: simpleSecurityObject +uid: cipux +userPassword: superSecretPassword diff --git a/ldap/db/core.ldif.in b/ldap/db/core.ldif.in index 38fbdbc..75ec4c6 100644 --- a/ldap/db/core.ldif.in +++ b/ldap/db/core.ldif.in @@ -5,7 +5,7 @@ objectClass: organization o: @DOMAIN@ dc: @ORG@ -dn: cn=admin, @SUFFIX@ +dn: cn=admin,@SUFFIX@ objectClass: simpleSecurityObject objectClass: organizationalRole cn: admin diff --git a/ldap/db/horde.ldif.in b/ldap/db/horde.ldif.in index 0e1bab0..0c28f79 100644 --- a/ldap/db/horde.ldif.in +++ b/ldap/db/horde.ldif.in @@ -1,6 +1,11 @@ -dn: cn=horde, ou=DSA, @SUFFIX@ -objectclass: organizationalRole +dn: uid=horde,ou=System,ou=Entities,ou=SAM,@SUFFIX@ objectClass: top +objectclass: account objectClass: simpleSecurityObject +uid: horde userPassword: superSecretPassword -cn: horde + +dn: cn=Horde,ou=Administrators,ou=Groups,ou=Access Control,@SUFFIX@ +objectClass: groupOfUniqueNames +cn: Horde +uniqueMember: uid=horde,ou=System,ou=Entities,ou=SAM,@SUFFIX@ diff --git a/ldap/mkldapdb b/ldap/mkldapdb index 833827a..697f7cd 100755 --- a/ldap/mkldapdb +++ b/ldap/mkldapdb @@ -23,16 +23,19 @@ for var in basedn dnsdomain orgname backend; do fi done -confskel=/usr/share/slapd/slapd.conf masterdir=/etc/local-COMMON/ldap/db tempdir=`mktemp -dt slapd.XXXXXX` -sed <"$confskel" >"$tempdir/slapd.conf" \ - -e "s/@BACKEND@/$backend/g" \ - -e "s/@SUFFIX@/$basedn/g" \ - -e "s/@ADMIN@/cn=admin,$basedn/g" +snippets="$(LANG=C find "$masterdir" -type f -name '*.conf.in' | sort)" +# concatenate files with an additional newline in between +# (perl could replace sed too, but multiline perl inside shell is ugly) +perl -e 'foreach (@ARGV) {print "\n" if $n; $n++; open (FH, $_); print while(); close FH;}' $snippets \ + | sed >>"$tempdir/slapd.conf" \ + -e "s/@BACKEND@/$backend/g" \ + -e "s/@SUFFIX@/$basedn/g" \ + -e "s/@ADMIN@/cn=admin,$basedn/g" -for section in core base horde; do +for section in core base cipux horde; do sed <"$masterdir/$section.ldif.in" >"$tempdir/$section.ldif" \ -e "s/@SUFFIX@/$basedn/g" \ -e "s/@DOMAIN@/$dnsdomain/g" \ @@ -48,7 +51,15 @@ done #slapadd -l "$tempdir/core.ldif" #invoke-rc.d slapd start #ldappasswd -x -h localhost -D "cn=admin,$basedn" -S -w supersecretpassword "cn=admin,$basedn" -for section in base horde; do +for section in base cipux horde; do ldapadd -x -h localhost -D "cn=admin,$basedn" -f "$tempdir/$section.ldif" -W done -ldappasswd -x -h localhost -D "cn=admin,$basedn" -S -W "cn=horde,ou=DSA,$basedn" +for section in cipux horde; do + ldappasswd -x -h localhost -D "cn=admin,$basedn" -S -W "uid=$section,ou=System,ou=Entities,ou=SAM,$basedn" +done +ldapmodify -x -h localhost -D "cn=admin,$basedn" -W < Date: Tue, 16 Sep 2008 21:29:02 +0200 Subject: Fix ldif files: group must contain member. --- ldap/db/base.ldif.in | 18 +++++++++++------- ldap/mkldapdb | 2 ++ 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'ldap/mkldapdb') diff --git a/ldap/db/base.ldif.in b/ldap/db/base.ldif.in index ee28e12..04e39d1 100644 --- a/ldap/db/base.ldif.in +++ b/ldap/db/base.ldif.in @@ -59,18 +59,22 @@ dn: ou=Groups,ou=Access Control,@SUFFIX@ objectClass: organizationalUnit ou: Groups -dn: cn=Replicants,ou=Groups,ou=Access Control,@SUFFIX@ -objectClass: groupOfUniqueNames -cn: Replicants +# Empty groups not permitted - create as needed instead +# +#dn: cn=Replicants,ou=Groups,ou=Access Control,@SUFFIX@ +#objectClass: groupOfUniqueNames +#cn: Replicants dn: ou=Administrators,ou=Groups,ou=Access Control,@SUFFIX@ objectClass: organizationalUnit ou: Administrators -dn: cn=DSA,ou=Administrators,ou=Groups,ou=Access Control,@SUFFIX@ -objectClass: groupOfUniqueNames -cn: DSA -description: Directory System Agent administrators +# Empty groups not permitted - create as needed instead +# +#dn: cn=DSA,ou=Administrators,ou=Groups,ou=Access Control,@SUFFIX@ +#objectClass: groupOfUniqueNames +#cn: DSA +#description: Directory System Agent administrators dn: ou=Entities,ou=Access Control,@SUFFIX@ objectClass: organizationalUnit diff --git a/ldap/mkldapdb b/ldap/mkldapdb index 697f7cd..7469f5d 100755 --- a/ldap/mkldapdb +++ b/ldap/mkldapdb @@ -57,6 +57,8 @@ done for section in cipux horde; do ldappasswd -x -h localhost -D "cn=admin,$basedn" -S -W "uid=$section,ou=System,ou=Entities,ou=SAM,$basedn" done + +# TODO: Write as function, and create group if not existing ldapmodify -x -h localhost -D "cn=admin,$basedn" -W < Date: Tue, 16 Sep 2008 21:35:05 +0200 Subject: Emit hint of object about to change password for. --- ldap/mkldapdb | 1 + 1 file changed, 1 insertion(+) (limited to 'ldap/mkldapdb') diff --git a/ldap/mkldapdb b/ldap/mkldapdb index 7469f5d..0e5e6b2 100755 --- a/ldap/mkldapdb +++ b/ldap/mkldapdb @@ -55,6 +55,7 @@ for section in base cipux horde; do ldapadd -x -h localhost -D "cn=admin,$basedn" -f "$tempdir/$section.ldif" -W done for section in cipux horde; do + echo "Securing $section..." ldappasswd -x -h localhost -D "cn=admin,$basedn" -S -W "uid=$section,ou=System,ou=Entities,ou=SAM,$basedn" done -- cgit v1.2.3 From a3a82a7f91fee07e89db8d28a888fe1d396b0d38 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Tue, 16 Sep 2008 21:54:41 +0200 Subject: ldif files: group member as DSA role (not SAM user). --- ldap/db/cipux.ldif.in | 6 +++--- ldap/db/horde.ldif.in | 8 ++++---- ldap/mkldapdb | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'ldap/mkldapdb') diff --git a/ldap/db/cipux.ldif.in b/ldap/db/cipux.ldif.in index cec5396..a7bd302 100644 --- a/ldap/db/cipux.ldif.in +++ b/ldap/db/cipux.ldif.in @@ -1,6 +1,6 @@ -dn: uid=cipux,ou=System,ou=Entities,ou=SAM,@SUFFIX@ +dn: cn=cipux,ou=Entities,ou=Access Control,@SUFFIX@ objectClass: top -objectclass: account +objectclass: organizationalRole objectClass: simpleSecurityObject -uid: cipux +cn: cipux userPassword: superSecretPassword diff --git a/ldap/db/horde.ldif.in b/ldap/db/horde.ldif.in index 0c28f79..00819ca 100644 --- a/ldap/db/horde.ldif.in +++ b/ldap/db/horde.ldif.in @@ -1,11 +1,11 @@ -dn: uid=horde,ou=System,ou=Entities,ou=SAM,@SUFFIX@ +dn: cn=horde,ou=Entities,ou=Access Control,@SUFFIX@ objectClass: top -objectclass: account +objectclass: organizationalRole objectClass: simpleSecurityObject -uid: horde +cn: horde userPassword: superSecretPassword dn: cn=Horde,ou=Administrators,ou=Groups,ou=Access Control,@SUFFIX@ objectClass: groupOfUniqueNames cn: Horde -uniqueMember: uid=horde,ou=System,ou=Entities,ou=SAM,@SUFFIX@ +uniqueMember: cn=horde,ou=Entities,ou=Access Control,@SUFFIX@ diff --git a/ldap/mkldapdb b/ldap/mkldapdb index 0e5e6b2..a1b0742 100755 --- a/ldap/mkldapdb +++ b/ldap/mkldapdb @@ -54,9 +54,9 @@ done for section in base cipux horde; do ldapadd -x -h localhost -D "cn=admin,$basedn" -f "$tempdir/$section.ldif" -W done -for section in cipux horde; do - echo "Securing $section..." - ldappasswd -x -h localhost -D "cn=admin,$basedn" -S -W "uid=$section,ou=System,ou=Entities,ou=SAM,$basedn" +for role in cipux horde; do + echo "Securing $role..." + ldappasswd -x -h localhost -D "cn=admin,$basedn" -S -W "cn=$role,ou=Entities,ou=Access Control,$basedn" done # TODO: Write as function, and create group if not existing @@ -64,5 +64,5 @@ ldapmodify -x -h localhost -D "cn=admin,$basedn" -W < Date: Tue, 16 Sep 2008 22:09:07 +0200 Subject: Fix create (not update) DSA group. --- ldap/mkldapdb | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'ldap/mkldapdb') diff --git a/ldap/mkldapdb b/ldap/mkldapdb index a1b0742..623a706 100755 --- a/ldap/mkldapdb +++ b/ldap/mkldapdb @@ -59,10 +59,17 @@ for role in cipux horde; do ldappasswd -x -h localhost -D "cn=admin,$basedn" -S -W "cn=$role,ou=Entities,ou=Access Control,$basedn" done -# TODO: Write as function, and create group if not existing -ldapmodify -x -h localhost -D "cn=admin,$basedn" -W < Date: Tue, 16 Sep 2008 22:24:20 +0200 Subject: Avoid space after comma in DN. --- ldap/mkldapdb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ldap/mkldapdb') diff --git a/ldap/mkldapdb b/ldap/mkldapdb index 623a706..2e0d34a 100755 --- a/ldap/mkldapdb +++ b/ldap/mkldapdb @@ -5,7 +5,7 @@ set -e umask 066 # Resolve some defaults from other system config -basedn="`grep '^BASE\b' /etc/ldap/ldap.conf | sed -e 's/^BASE[[:space:]]\+//'`" +basedn="`grep '^BASE\b' /etc/ldap/ldap.conf | sed -e 's/^BASE[[:space:]]\+//' -e 's/,[[:space:]]\+/,/g'`" dnsdomain="`dnsdomainname`" orgname="" if [ -r /etc/local-ORG/orgname ]; then -- cgit v1.2.3 From d65f58d1597e67b199ee3419cf017491f0a309ec Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Wed, 17 Sep 2008 09:04:06 +0200 Subject: Add horde admin to new SAM admin group with password write access. --- ldap/db/20_base.conf.in | 2 +- ldap/mkldapdb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'ldap/mkldapdb') diff --git a/ldap/db/20_base.conf.in b/ldap/db/20_base.conf.in index b7cd9ae..1d78c6a 100644 --- a/ldap/db/20_base.conf.in +++ b/ldap/db/20_base.conf.in @@ -4,7 +4,7 @@ # admin entry below access to dn.subtree="ou=SAM,@SUFFIX@" attrs=userpassword,shadowLastChange by dn.exact="@ADMIN@" write - by dn.exact=”uid=cifsdc,ou=Entities,ou=Access Control,@SUFFIX@" write + by group="cn=SAM,ou=Administrators,ou=Access Control,@SUFFIX@" write by anonymous auth by self write by * none diff --git a/ldap/mkldapdb b/ldap/mkldapdb index 2e0d34a..4e297c3 100755 --- a/ldap/mkldapdb +++ b/ldap/mkldapdb @@ -73,3 +73,13 @@ cn: DSA description: Directory System Agent administrators uniqueMember: cn=cipux,ou=Entities,ou=Access Control,$basedn EOF +ldapadd -x -h localhost -D "cn=admin,$basedn" -W <