Implementing Linux Domain
If you need domain but you needn't Group Policy, you may set up domain by the help of Linux.
Ingredients are: Ubuntu Server 9.04, Samba и OpenLDAP.
Update your system and install software:
# sudo su
# aptitude update
# aptitude upgrade
# aptitude install slapd ldap-utils db4.2-util samba smbclient samba-doc smbldap-tools ldap-auth-client
I don't like new Ubuntu OpenLDAP configuration type, so I rolled back to the classical type.
You should edit file /etc/default/slapd :
...
SLAPD_CONF=/etc/ldap/slapd.conf
...
Copy Samba scheme into ldap directory:
# gunzip /usr/share/doc/samba-doc/examples/LDAP/samba.schema.gz
# cp -v /usr/share/doc/samba-doc/examples/LDAP/samba.schema /etc/ldap/schema
Generate LDAP admin password:
# slappasswd
Configure Openldap:
# nano /etc/ldap/slapd.conf
# Remember to replace suffix "dc=ubuntudom,dc=org" with your domain name
# Change the rootpw entry with the results from slappaswd (Must match the same you pasted on init.ldif)
# /etc/ldap/slapd.conf
# 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
include /etc/ldap/schema/samba.schema
include /etc/ldap/schema/misc.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 0
# Where the dynamically loaded modules are stored
modulepath /usr/lib/ldap
moduleload back_bdb
# 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 bdb:
# Backend specific directives apply to this backend until another
# 'backend' directive occurs
backend bdb
#checkpoint 512 30
#######################################################################
# Specific Backend Directives for 'other':
# Backend specific directives apply to this backend until another
# 'backend' directive occurs
#backend <other>
#######################################################################
# Specific Directives for database #1, of type bdb:
# Database specific directives apply to this databasse until another
# 'database' directive occurs
database bdb
# The base of your directory in database #1
suffix "dc=ubuntudom,dc=org"
# rootdn directive for specifying a superuser on the database. This is needed
# for syncrepl.
rootdn "cn=admin,dc=ubuntudom,dc=org"
rootpw {SSHA}iPFTqrtwr3yT3XGQot2wxCuuljKA9vMU
# Where the database file are physically stored for database #1
directory "/var/lib/ldap"
# 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, pres
index ou,cn,sn,mail,givenname eq,pres,sub
index uidNumber,gidNumber,memberUid eq,pres
index loginShell eq,pres
index uniqueMember eq,pres
index uid pres,sub,eq
index displayName pres,sub,eq
index sambaSID eq
index sambaPrimaryGroupSID eq
index sambaDomainName eq
index default sub
#index uid pres,eq,sub
# Save the time that the entry gets modified, for database #1
lastmod on
# Where to store the replica logs for database #1
# replogfile /var/lib/ldap/replog
# 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
# These access lines apply to database #1 only
access to attrs=userPassword,shadowLastChange
by dn="cn=admin,dc=ubuntudom,dc=org" write
by anonymous auth
by self write
by * none
# 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
# The admin dn has full write access, everyone else
# can read everything.
access to *
by dn="cn=admin,dc=ubuntudom,dc=org" write
by * read
Now We need to add some users and groups into database. I'll transfer it from my old linux PDC.
For initial installations you can add your data as shown here: http://ubuntuforums.org/showthread.php?t=1184288&highlight=ubuntu+9.04+pdc.
Do it on old PDC:
# /etc/init.d/slapd stop
# slapcat -v -l master.ldif
# scp master.ldif suparoot@newdc:/home/suparoot
Do it on a new PDC:
# /etc/init.d/slapd stop
# rm -rf /var/lib/ldap/*
# slapadd -v -l /home/suparoot/master.ldif
# chown -R openldap:openldap /var/lib/ldap
# /etc/init.d/slapd start
The next command will show you the content of Your database:
# ldapsearch -xLLL -b «dc=ubuntudom»
Configure Samba:
# mkdir -v -p /var/lib/samba/netlogon
# chmod 775 /var/lib/samba/netlogon
# nano /etc/samba/smb.conf
[global]
# Domain name ..
workgroup = UBUNTUDOM
# Server name - as seen by Windows PCs ..
netbios name = PDC
server string = Domain Controller
# Be a PDC ..
domain logons = Yes
domain master = Yes
preferred master = yes
# Be a WINS server ..
wins support = Yes
obey pam restrictions = Yes
dns proxy = No
os level = 255
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
pam password change = Yes
# Allows users on WinXP PCs to change their password when they press Ctrl-Alt-Del
unix password sync = no
ldap passwd sync = yes
# Printing from PCs will go via CUPS ..
#load printers = yes
#printing = cups
#printcap name = cups
load printers = no
show add printer wizard = no
printcap name = /dev/null
disable spoolss = yes
# Use LDAP for Samba user accounts and groups ..
passdb backend = ldapsam:ldap://localhost
# This must match init.ldif ..
ldap suffix = dc=ubuntudom,dc=org
# The password for cn=admin MUST be stored in /etc/samba/secrets.tdb
# This is done by running 'sudo smbpasswd -w'.
ldap admin dn = cn=admin,dc=ubuntudom,dc=org
# 4 OUs that Samba uses when creating user accounts, computer accounts, etc.
# (Because we are using smbldap-tools, call them 'Users', 'Computers', etc.)
ldap machine suffix = ou=Computers
ldap user suffix = ou=SambaUsers
ldap group suffix = ou=SambaGroups
ldap idmap suffix = ou=SambaGroups
# Samba and LDAP server are on the same server in this example.
ldap ssl = no
# Scripts for Samba to use if it creates users, groups, etc.
add user script = /usr/sbin/smbldap-useradd -m '%u'
delete user script = /usr/sbin/smbldap-userdel %u
add group script = /usr/sbin/smbldap-groupadd -p '%g'
delete group script = /usr/sbin/smbldap-groupdel '%g'
add user to group script = /usr/sbin/smbldap-groupmod -m '%u' '%g'
delete user from group script = /usr/sbin/smbldap-groupmod -x '%u' '%g'
set primary group script = /usr/sbin/smbldap-usermod -g '%g' '%u'
add machine script = /usr/sbin/smbldap-useradd -w '%u'
# Values used when a new user is created ..
# (Note: '%L' does not work properly with smbldap-tools 0.9.4-1)
logon drive =
logon home =
logon path =
logon script = logon.bat
# This is required for Windows XP client ..
server signing = auto
server schannel = Auto
[netlogon]
comment = Network Logon Service
path = /var/lib/samba/netlogon
admin users = root
guest ok = Yes
browseable = Yes
writable = Yes
Add Samba admin's password:
# /etc/init.d/samba restart
# smbpasswd -W
...
# /etc/init.d/samba restart
Configure smbldap-tools — utilities for ldap data manipulating.
At first, get our PDC SID:
# net getlocalsid
Configure smbldap-tools
# gunzip /usr/share/doc/smbldap-tools/configure.pl.gz
# chmod +x /usr/share/doc/smbldap-tools/configure.pl
# cd /usr/share/doc/smbldap-tools/
# ./configure.pl
Add common groups:
# smbldap-populate
Reindex database:
# etc/init.d/slapd stop
# slapindex
# chown openldap:openldap /var/lib/ldap/*
# /etc/init.d/slapd start
Add admins into database and check it:
# smbldap-useradd -a -m -P alexander
# /usr/sbin/smbldap-groupmod -m 'alexander' 'Administrators'
# /usr/sbin/smbldap-groupmod -m 'root' 'Administrators'
# smbldap-groupshow Administrators
# smbldap-usershow alexander
# getent group
# getent passwd
