diff options
Diffstat (limited to 'source4/setup')
-rwxr-xr-x | source4/setup/provision | 36 | ||||
-rw-r--r-- | source4/setup/provision.smb.conf.dc | 6 | ||||
-rw-r--r-- | source4/setup/provision.smb.conf.member | 6 | ||||
-rw-r--r-- | source4/setup/provision.smb.conf.standalone | 6 | ||||
-rw-r--r-- | source4/setup/provision_templates.ldif | 4 | ||||
-rw-r--r-- | source4/setup/provision_users.ldif | 2 | ||||
-rwxr-xr-x | source4/setup/tests/blackbox_provision.sh | 5 | ||||
-rwxr-xr-x | source4/setup/upgrade.py | 12 |
8 files changed, 33 insertions, 44 deletions
diff --git a/source4/setup/provision b/source4/setup/provision index 033d2491f2..629bfa10e0 100755 --- a/source4/setup/provision +++ b/source4/setup/provision @@ -30,9 +30,7 @@ import samba from auth import system_session import samba.getopt as options -import param from samba.provision import (provision, - provision_paths_from_lp, FILL_FULL, FILL_NT4SYNC, FILL_DRS) @@ -90,7 +88,7 @@ parser.add_option("--ldap-backend-type", type="choice", metavar="LDAP-BACKEND-TY parser.add_option("--aci", type="string", metavar="ACI", help="An arbitary LDIF fragment, particularly useful to loading a backend ACI value into a target LDAP server. You must provide at least a realm and domain") parser.add_option("--server-role", type="choice", metavar="ROLE", - choices=["domain controller", "member server"], + choices=["domain controller", "dc", "member server", "member", "standalone"], help="Set server role to provision for (default standalone)") parser.add_option("--partitions-only", help="Configure Samba's partitions, but do not modify them (ie, join a BDC)", action="store_true") @@ -112,27 +110,17 @@ if opts.realm is None or opts.domain is None: parser.print_usage() sys.exit(1) -# cope with an initially blank smb.conf -private_dir = None -lp = sambaopts.get_loadparm() -if opts.targetdir is not None: - if not os.path.exists(opts.targetdir): - os.mkdir(opts.targetdir) - private_dir = os.path.join(opts.targetdir, "private") - if not os.path.exists(private_dir): - os.mkdir(private_dir) - lp.set("private dir", os.path.abspath(private_dir)) - lp.set("lock dir", os.path.abspath(opts.targetdir)) -lp.set("realm", opts.realm) -lp.set("workgroup", opts.domain) -lp.set("server role", opts.server_role or "domain controller") +smbconf = sambaopts.get_loadparm_path() if opts.aci is not None: print "set ACI: %s" % opts.aci -paths = provision_paths_from_lp(lp, opts.realm.lower()) -if sambaopts.get_loadparm_path() is not None: - paths.smbconf = sambaopts.get_loadparm_path() +if opts.server_role == "dc": + server_role = "domain controller" +elif opts.server_role == "member": + server_role = "member server" +else: + server_role = opts.server_role creds = credopts.get_credentials() @@ -146,9 +134,9 @@ if opts.blank: elif opts.partitions_only: samdb_fill = FILL_DRS -provision(lp, setup_dir, message, paths, - system_session(), creds, - samdb_fill=samdb_fill, realm=opts.realm, +provision(setup_dir, message, + system_session(), creds, smbconf=smbconf, targetdir=opts.targetdir, + samdb_fill=samdb_fill, realm=opts.realm, domain=opts.domain, domainguid=opts.domain_guid, domainsid=opts.domain_sid, policyguid=opts.policy_guid, hostname=opts.host_name, hostip=opts.host_ip, hostguid=opts.host_guid, @@ -156,7 +144,7 @@ provision(lp, setup_dir, message, paths, krbtgtpass=opts.krbtgtpass, machinepass=opts.machinepass, dnspass=opts.dnspass, root=opts.root, nobody=opts.nobody, nogroup=opts.nogroup, wheel=opts.wheel, users=opts.users, - aci=opts.aci, serverrole=opts.server_role, + aci=opts.aci, serverrole=server_role, ldap_backend=opts.ldap_backend, ldap_backend_type=opts.ldap_backend_type) diff --git a/source4/setup/provision.smb.conf.dc b/source4/setup/provision.smb.conf.dc index 5b8e141cbf..ad06be4301 100644 --- a/source4/setup/provision.smb.conf.dc +++ b/source4/setup/provision.smb.conf.dc @@ -1,8 +1,10 @@ [globals] netbios name = ${HOSTNAME} - workgroup = ${DOMAIN_CONF} - realm = ${REALM_CONF} + workgroup = ${DOMAIN} + realm = ${REALM} server role = ${SERVERROLE} + ${PRIVATEDIR_LINE} + ${LOCKDIR_LINE} [netlogon] path = ${NETLOGONPATH} diff --git a/source4/setup/provision.smb.conf.member b/source4/setup/provision.smb.conf.member index bc37d4f3d3..0d742fb903 100644 --- a/source4/setup/provision.smb.conf.member +++ b/source4/setup/provision.smb.conf.member @@ -1,5 +1,7 @@ [globals] netbios name = ${HOSTNAME} - workgroup = ${DOMAIN_CONF} - realm = ${REALM_CONF} + workgroup = ${DOMAIN} + realm = ${REALM} server role = ${SERVERROLE} + ${PRIVATEDIR_LINE} + ${LOCKDIR_LINE} diff --git a/source4/setup/provision.smb.conf.standalone b/source4/setup/provision.smb.conf.standalone index bc37d4f3d3..0d742fb903 100644 --- a/source4/setup/provision.smb.conf.standalone +++ b/source4/setup/provision.smb.conf.standalone @@ -1,5 +1,7 @@ [globals] netbios name = ${HOSTNAME} - workgroup = ${DOMAIN_CONF} - realm = ${REALM_CONF} + workgroup = ${DOMAIN} + realm = ${REALM} server role = ${SERVERROLE} + ${PRIVATEDIR_LINE} + ${LOCKDIR_LINE} diff --git a/source4/setup/provision_templates.ldif b/source4/setup/provision_templates.ldif index cc0ab212cd..8f4ed08252 100644 --- a/source4/setup/provision_templates.ldif +++ b/source4/setup/provision_templates.ldif @@ -27,7 +27,7 @@ lastLogoff: 0 lastLogon: 0 pwdLastSet: 0 primaryGroupID: 513 -accountExpires: -1 +accountExpires: 9223372036854775807 logonCount: 0 dn: CN=TemplateTrustingDomain,CN=Templates @@ -39,7 +39,7 @@ badPasswordTime: 0 lastLogoff: 0 lastLogon: 0 primaryGroupID: 513 -accountExpires: -1 +accountExpires: 9223372036854775807 logonCount: 0 dn: CN=TemplateGroup,CN=Templates diff --git a/source4/setup/provision_users.ldif b/source4/setup/provision_users.ldif index 4b053d9166..5a24e07492 100644 --- a/source4/setup/provision_users.ldif +++ b/source4/setup/provision_users.ldif @@ -5,7 +5,7 @@ description: Built-in account for administering the computer/domain userAccountControl: 66048 objectSid: ${DOMAINSID}-500 adminCount: 1 -accountExpires: -1 +accountExpires: 9223372036854775807 sAMAccountName: Administrator isCriticalSystemObject: TRUE sambaPassword:: ${ADMINPASS_B64} diff --git a/source4/setup/tests/blackbox_provision.sh b/source4/setup/tests/blackbox_provision.sh index 0aed7bb8b7..83c045e40d 100755 --- a/source4/setup/tests/blackbox_provision.sh +++ b/source4/setup/tests/blackbox_provision.sh @@ -27,7 +27,10 @@ testit() { return $status } -testit "simple" $PYTHON ./setup/provision $CONFIGURATION --domain=FOO --realm=foo.example.com --targetdir=$PREFIX/simple +testit "simple-default" $PYTHON ./setup/provision $CONFIGURATION --domain=FOO --realm=foo.example.com --targetdir=$PREFIX/simple-default +testit "simple-dc" $PYTHON ./setup/provision $CONFIGURATION --server-role="dc" --domain=FOO --realm=foo.example.com --targetdir=$PREFIX/simple-dc +testit "simple-member" $PYTHON ./setup/provision $CONFIGURATION --server-role="member" --domain=FOO --realm=foo.example.com --targetdir=$PREFIX/simple-member +testit "simple-standalone" $PYTHON ./setup/provision $CONFIGURATION --server-role="standalone" --domain=FOO --realm=foo.example.com --targetdir=$PREFIX/simple-standalone reprovision() { $PYTHON ./setup/provision $CONFIGURATION --domain=FOO --realm=foo.example.com --targetdir="$PREFIX/reprovision" diff --git a/source4/setup/upgrade.py b/source4/setup/upgrade.py index 960cd1b9e2..569b179544 100755 --- a/source4/setup/upgrade.py +++ b/source4/setup/upgrade.py @@ -50,7 +50,6 @@ else: samba3 = Samba3(libdir, smbconf) from samba.upgrade import upgrade_provision -from samba.provision import provision_paths_from_lp message("Provisioning\n") @@ -59,13 +58,6 @@ if setup_dir is None: setup_dir = "setup" creds = credopts.get_credentials() -lp = sambaopts.get_loadparm() -if opts.targetdir is not None: - if not os.path.exists(opts.targetdir): - os.mkdir(opts.targetdir) - lp.set("private dir", os.path.abspath(opts.targetdir)) - lp.set("lock dir", os.path.abspath(opts.targetdir)) -paths = provision_paths_from_lp(lp, "") -paths.smbconf = sambaopts.get_loadparm_path() + upgrade_provision(samba3, setup_dir, message, credentials=creds, session_info=system_session(), - lp=lp, paths=paths) + smbconf=sambaopts.get_loadparm_path(), targetdir=opts.targetdir) |