View | Details | Raw Unified | Return to bug 29000 | Differences between
and this patch

Collapse All | Expand All

(-)univention-samba4/96univention-samba4.inst (-10 / +35 lines)
 Lines 459-464    Link Here 
459
{
459
{
460
	local name="$1"
460
	local name="$1"
461
	local sid="$2"
461
	local sid="$2"
462
	local position="$3"
462
463
463
	shift 2
464
	shift 2
464
	
465
	
 Lines 471-482    Link Here 
471
		test -z "$bindpwd" && bindpwd="$(cat /etc/ldap.secret)"
472
		test -z "$bindpwd" && bindpwd="$(cat /etc/ldap.secret)"
472
473
473
		udm groups/group create "$@" --ignore_exists --option=posix \
474
		udm groups/group create "$@" --ignore_exists --option=posix \
474
				--position "cn=Builtin,$ldap_base" \
475
				--position "$position,$ldap_base" \
475
				--set name="$name" \
476
				--set name="$name" \
476
				--set adGroupType="-2147483643"
477
				--set adGroupType="-2147483643"
477
478
478
		echo ldapmodify -x -D "$binddn" -w "$bindpwd"
479
		echo ldapmodify -x -D "$binddn" -w "$bindpwd"
479
		echo "dn: cn=$name,cn=Builtin,$ldap_base
480
		echo "dn: cn=$name,$position,$ldap_base
480
changetype: modify
481
changetype: modify
481
add: objectClass
482
add: objectClass
482
objectClass: sambaGroupMapping
483
objectClass: sambaGroupMapping
 Lines 488-494    Link Here 
488
sambaGroupType: 2" | ldapmodify -x -D "$binddn" -w "$bindpwd" 
489
sambaGroupType: 2" | ldapmodify -x -D "$binddn" -w "$bindpwd" 
489
		
490
		
490
		if [ "$name" = "Authenticated Users" ]; then
491
		if [ "$name" = "Authenticated Users" ]; then
491
			udm groups/group modify "$@" --dn "cn=$name,cn=Builtin,$ldap_base" \
492
			udm groups/group modify "$@" --dn "cn=$name,$position,$ldap_base" \
492
				--append nestedGroup="cn=DC Slave Hosts,cn=groups,$ldap_base" \
493
				--append nestedGroup="cn=DC Slave Hosts,cn=groups,$ldap_base" \
493
				--append nestedGroup="cn=Windows Hosts,cn=groups,$ldap_base"
494
				--append nestedGroup="cn=Windows Hosts,cn=groups,$ldap_base"
494
		fi
495
		fi
 Lines 497-507    Link Here 
497
498
498
create_pseudo_groups ()
499
create_pseudo_groups ()
499
{
500
{
500
	_create_group_with_special_sid "Authenticated Users" "S-1-5-11" "$@"
501
	_create_group_with_special_sid "Authenticated Users" "S-1-5-11" "cn=Builtin" "$@"
501
	_create_group_with_special_sid "World Authority" "S-1-1" "$@"
502
	_create_group_with_special_sid "World Authority" "S-1-1" "cn=Builtin" "$@"
502
	_create_group_with_special_sid "Everyone" "S-1-1-0" "$@"
503
	_create_group_with_special_sid "Everyone" "S-1-1-0" "cn=Builtin" "$@"
503
	_create_group_with_special_sid "Null Authority" "S-1-0" "$@"
504
	_create_group_with_special_sid "Null Authority" "S-1-0" "cn=Builtin" "$@"
504
	_create_group_with_special_sid "Nobody" "S-1-0-0" "$@"
505
	_create_group_with_special_sid "Nobody" "S-1-0-0" "cn=Builtin" "$@"
506
	_create_group_with_special_sid "Enterprise Domain Controllers" "S-1-5-9" "cn=groups" "$@"
507
	# _create_group_with_special_sid "Remote Interactive Logon" "S-1-5-14" "cn=Builtin" "$@"
508
	# _create_group_with_special_sid "SChannel Authentication" "S-1-5-64-14" "cn=Builtin" "$@"
509
	# _create_group_with_special_sid "Digest Authentication" "S-1-5-64-21" "cn=Builtin" "$@"
510
	# _create_group_with_special_sid "Terminal Server User" "S-1-5-13" "cn=Builtin" "$@"
511
	# _create_group_with_special_sid "NTLM Authentication" "S-1-5-64-10" "cn=Builtin" "$@"
512
	# _create_group_with_special_sid "Other Organization" "S-1-5-1000" "cn=Builtin" "$@"
513
	# _create_group_with_special_sid "This Organization" "S-1-5-15" "cn=Builtin" "$@"
514
	# _create_group_with_special_sid "Anonymous Logon" "S-1-5-7" "cn=Builtin" "$@"
515
	# _create_group_with_special_sid "Network Service" "S-1-5-20" "cn=Builtin" "$@"
516
	# _create_group_with_special_sid "Creator Group" "S-1-3-1" "cn=Builtin" "$@"
517
	# _create_group_with_special_sid "Creator Owner" "S-1-3-0" "cn=Builtin" "$@"
518
	# _create_group_with_special_sid "Local Service" "S-1-5-19" "cn=Builtin" "$@"
519
	# _create_group_with_special_sid "Owner Rights" "S-1-3-4" "cn=Builtin" "$@"
520
	# _create_group_with_special_sid "Interactive" "S-1-5-4" "cn=Builtin" "$@"
521
	# _create_group_with_special_sid "Restricted" "S-1-5-12" "cn=Builtin" "$@"
522
	# _create_group_with_special_sid "Network" "S-1-5-2" "cn=Builtin" "$@"
523
	# _create_group_with_special_sid "Service" "S-1-5-6" "cn=Builtin" "$@"
524
	# _create_group_with_special_sid "Dialup" "S-1-5-1" "cn=Builtin" "$@"
525
	# _create_group_with_special_sid "System" "S-1-5-18" "cn=Builtin" "$@"
526
	# _create_group_with_special_sid "Batch" "S-1-5-3" "cn=Builtin" "$@"
527
	# _create_group_with_special_sid "Proxy" "S-1-5-8" "cn=Builtin" "$@"
528
	# _create_group_with_special_sid "IUSR" "S-1-5-17" "cn=Builtin" "$@"
529
	# _create_group_with_special_sid "Self" "S-1-5-10" "cn=Builtin" "$@"
505
}
530
}
506
531
507
### --- END helper functions ---
532
### --- END helper functions ---
 Lines 673-678    Link Here 
673
698
674
	fi
699
	fi
675
700
701
	create_pseudo_groups "$@"
702
676
	if [ $JS_LAST_EXECUTED_VERSION -lt 6 ]; then
703
	if [ $JS_LAST_EXECUTED_VERSION -lt 6 ]; then
677
		## add server to Enterprise Domain Controllers group if it exists
704
		## add server to Enterprise Domain Controllers group if it exists
678
		if univention-ldapsearch -x sambaSID='S-1-5-9' cn | grep -q '^cn:'; then
705
		if univention-ldapsearch -x sambaSID='S-1-5-9' cn | grep -q '^cn:'; then
 Lines 819-826    Link Here 
819
	univention-config-registry unset create/home/share
846
	univention-config-registry unset create/home/share
820
fi
847
fi
821
848
822
create_pseudo_groups "$@"
823
824
/etc/init.d/samba-ad-dc restart
849
/etc/init.d/samba-ad-dc restart
825
850
826
# To prevent a DRS replication conflict: 
851
# To prevent a DRS replication conflict: 
(-)univention-samba4/lib/base.sh (-23 lines)
 Lines 75-103    Link Here 
75
	%EOF
75
	%EOF
76
}
76
}
77
77
78
create_Enterprise_Domain_Controllers() {
79
	## Note: This is actually joinscript code, but needs to be put here, to be called also from
80
	##       univention-s4-connector.postinst because the joinscript version could not be increased
81
	##       for the errata update.
82
	## Note: S4 Connector currently does not synchronize it to the Samba4 foreignSecurityPrincipal
83
	##       having the same builtin SID. Additionally it should be put to the group/ignorelist,
84
	##       as it would cause rejects.
85
	##
86
	## attempt to create group with correct builtin SID
87
	if /usr/share/univention-samba4/scripts/create_group_Enterprise_Domain_Controllers.py "$@"; then
88
89
		## update local group cache
90
		. /usr/share/univention-lib/ucr.sh
91
		is_ucr_true nss/group/cachefile
92
		if [ $? != 1 ]; then	## $? = 2 would indicate an unset variable.
93
			if is_ucr_true nss/group/cachefile/check_member; then
94
				option='--check_member'
95
			fi
96
			/usr/lib/univention-pam/ldap-group-to-file.py "${option[@]}"
97
		fi
98
	fi
99
}
100
101
remove_non_samba4_dc_srv_records() {
78
remove_non_samba4_dc_srv_records() {
102
79
103
	ldif=$(univention-ldapsearch -LLLx "(&(objectClass=univentionDomainController)(univentionService=Samba 4))" cn associatedDomain | ldapsearch-wrapper)
80
	ldif=$(univention-ldapsearch -LLLx "(&(objectClass=univentionDomainController)(univentionService=Samba 4))" cn associatedDomain | ldapsearch-wrapper)
(-)univention-samba4/scripts/create_group_Enterprise_Domain_Controllers.py (-122 lines)
 Lines 1-122    Link Here 
1
#!/usr/bin/python2.6
2
#
3
# Copyright 2013 Univention GmbH
4
#
5
# http://www.univention.de/
6
#
7
# All rights reserved.
8
#
9
# The source code of this program is made available
10
# under the terms of the GNU Affero General Public License version 3
11
# (GNU AGPL V3) as published by the Free Software Foundation.
12
#
13
# Binary versions of this program provided by Univention to you as
14
# well as other copyrighted, protected or trademarked materials like
15
# Logos, graphics, fonts, specific documentations and configurations,
16
# cryptographic keys etc. are subject to a license agreement between
17
# you and Univention and not subject to the GNU AGPL V3.
18
#
19
# In the case you use this program under the terms of the GNU AGPL V3,
20
# the program is provided in the hope that it will be useful,
21
# but WITHOUT ANY WARRANTY; without even the implied warranty of
22
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
# GNU Affero General Public License for more details.
24
#
25
# You should have received a copy of the GNU Affero General Public
26
# License with the Debian GNU/Linux or Univention distribution in file
27
# /usr/share/common-licenses/AGPL-3; if not, see
28
# <http://www.gnu.org/licenses/>.
29
30
import sys
31
import univention.admin.allocators
32
import univention.admin.uldap
33
from optparse import OptionParser, OptionValueError
34
from univention.config_registry import ConfigRegistry
35
36
from optparse import (OptionParser,BadOptionError,AmbiguousOptionError)
37
38
class PassThroughOptionParser(OptionParser):
39
	"""
40
	An unknown option pass-through implementation of OptionParser.
41
42
	When unknown arguments are encountered, bundle with largs and try again,
43
	until rargs is depleted.  
44
45
	sys.exit(status) will still be called if a known argument is passed
46
	incorrectly (e.g. missing arguments or bad argument types, etc.)		
47
	"""
48
	def _process_args(self, largs, rargs, values):
49
		while rargs:
50
			try:
51
				OptionParser._process_args(self,largs,rargs,values)
52
			except (BadOptionError,AmbiguousOptionError), e:
53
				largs.append(e.opt_str)
54
55
def create_group_Enterprise_Domain_Controllers(lo):
56
57
	position = univention.admin.uldap.position(lo.base)
58
59
	sambaSID = "S-1-5-9"
60
	groupName = "Enterprise Domain Controllers"
61
	groupDN = "cn=%s,cn=groups,%s" % (groupName, lo.base)
62
63
	alloc = []
64
	try:
65
		uid = univention.admin.allocators.request(lo, position, 'groupName', value=groupName)
66
		alloc.append(("groupName",groupName))
67
	except univention.admin.uexceptions.noLock, e:
68
		univention.admin.allocators.release(lo, position, 'groupName', groupName)
69
		print "Group already exists"
70
		sys.exit(1)
71
72
	ldap_filter = "(&(univentionService=Samba 4)(objectClass=univentionDomainController))"
73
	s4dc_dnlist = lo.searchDn(ldap_filter, lo.base)
74
	s4dc_uidlist = [ "%s$" % univention.admin.uldap.explodeDn(s4dcdn, 1)[0] for s4dcdn in s4dc_dnlist ]
75
76
	gidNumber = univention.admin.allocators.request(lo, position, 'gidNumber')
77
	alloc.append(("gidNumber",gidNumber))
78
79
	ocs = ["top", "posixGroup", "univentionGroup", "sambaGroupMapping", "univentionObject"]
80
	al = [("objectClass", ocs)]
81
	al.append(("gidNumber", [gidNumber]))
82
	al.append(("sambaSID", [sambaSID]))
83
	al.append(("sambaGroupType", ["5"]))
84
	al.append(("uniqueMember", s4dc_dnlist))
85
	al.append(("memberUid", s4dc_uidlist))
86
	al.append(("univentionObjectType", "groups/group"))
87
	try:
88
		lo.add(groupDN, al)
89
	except Exception, err:
90
		print "Exception:", err
91
		for i, j in alloc:
92
			univention.admin.allocators.release(lo, position, i, j)
93
	for i, j in alloc:
94
		univention.admin.allocators.confirm(lo, position, i, j)
95
96
if __name__ == "__main__":
97
	parser = PassThroughOptionParser()
98
	parser.add_option("--binddn", dest="binddn")
99
	parser.add_option("--bindpwd", dest="bindpw")
100
	parser.add_option("--bindpwdfile", dest="bindpwdfile")
101
	opts, args = parser.parse_args()
102
	
103
	ucr = ConfigRegistry()
104
	ucr.load()
105
106
	if not opts.binddn:
107
		try:
108
			opts.bindpw = open('/etc/ldap.secret').read().rstrip('\n')
109
			opts.binddn = "cn=admin,%s" % ucr['ldap/base']
110
		except IOError:
111
			fatal('Could not read /etc/ldap.secret')
112
113
	if opts.bindpwdfile and not opts.bindpw:
114
		opts.bindpw = open(opts.bindpwdfile, 'r').read().strip()
115
116
	try:
117
		lo = univention.admin.uldap.access(host=ucr['ldap/master'], port=int(ucr.get('ldap/master/port', '7389')), base=ucr['ldap/base'], binddn=opts.binddn, bindpw=opts.bindpw, start_tls=2)
118
	except Exception, e:
119
		print "Error during uldap.access: ", str(e)
120
		sys.exit(1)
121
122
	create_group_Enterprise_Domain_Controllers(lo)
(-)univention-s4-connector/97univention-s4-connector.inst (-3 lines)
 Lines 149-157    Link Here 
149
149
150
	/etc/init.d/univention-s4-connector restart
150
	/etc/init.d/univention-s4-connector restart
151
151
152
	## Note: This group is created only once (usually during initial join) by the host providing the S4 Connector service
153
	create_Enterprise_Domain_Controllers "$@"
154
155
	univention-config-registry set dns/backend=samba4
152
	univention-config-registry set dns/backend=samba4
156
	if [ -x /etc/init.d/bind9 ]; then
153
	if [ -x /etc/init.d/bind9 ]; then
157
		/etc/init.d/bind9 restart
154
		/etc/init.d/bind9 restart

Return to bug 29000