[Samba] Re: SAMBA3 + LDAP

mallapadi niranjan niranjan.ashok at gmail.com
Mon Dec 19 14:15:00 GMT 2005


Hi all


I have system with Redhat Enterprise Linux 4,
OpenLDAP version is 2.2.13
samba version is 3.0.10-1.4E

i have configured SAMBA PDC with LDAPSAM .
1). i am unable to join computer to domain with machin add  script in
smb.conf file,
but i am able to join the computer only when i add smbpasswd -a -m
<computer-name>

please let me know where i am wrong

*<the ldap.log file is below>*
###################################################################

Dec 19 19:28:46 testsystem slapd[6010]: conn=6 op=6 SRCH
base="ou=People,dc=msdpl,dc=com" scope=1 deref=0
filter="(&(objectClass=posixAccount)(uid=test1$))"

Dec 19 19:28:46 testsystem slapd[6010]: conn=6 op=6 SRCH attr=uid
userPassword uidNumber gidNumber cn homeDirectory loginShell gecos
description objectClass

Dec 19 19:28:46 testsystem slapd[6010]: <= bdb_equality_candidates: (uid)
index_param failed (18)

Dec 19 19:28:46 testsystem slapd[6010]: conn=6 op=6 SEARCH RESULT tag=101
err=0 nentries=0 text=

Dec 19 19:28:46 testsystem slapd[6010]: conn=6 op=7 SRCH
base="ou=People,dc=msdpl,dc=com" scope=1 deref=0
filter="(&(objectClass=posixAccount)(uid=test1$))"

Dec 19 19:28:46 testsystem slapd[6010]: conn=6 op=7 SRCH attr=uid
userPassword uidNumber gidNumber cn homeDirectory loginShell gecos
description objectClass

*Dec 19 19:28:46 testsystem slapd[6010]: <= bdb_equality_candidates: (uid)
index_param failed (18)*

Dec 19 19:28:46 testsystem slapd[6010]: conn=6 op=7 SEARCH RESULT tag=101
err=0 nentries=0 text=

Dec 19 19:28:46 testsystem slapd[6010]: conn=5 fd=10 closed

Dec 19 19:28:46 testsystem slapd[6010]: conn=6 fd=13 closed

 ###################################################################

I have been told that above error comes if the nss_ldap is not configured

The following is the ldap.conf file

###################################################################

# @(#)$Id: ldap.conf,v 1.34 2004/09/16 23:32:02 lukeh Exp $

#

# This is the configuration file for the LDAP nameservice

# switch library and the LDAP PAM module.

#

# PADL Software

# http://www.padl.com

#

# Your LDAP server. Must be resolvable without using LDAP.

# Multiple hosts may be specified, each separated by a

# space. How long nss_ldap takes to failover depends on

# whether your LDAP client library supports configurable

# network or connect timeouts (see bind_timelimit).

host testdomain.com

# The distinguished name of the search base.

base dc=msdpl,dc=com



# Another way to specify your LDAP server is to provide an

# uri with the server name. This allows to use

# Unix Domain Sockets to connect to a local LDAP Server.

#uri ldap://testdomain.com

#uri ldaps://127.0.0.1/

#uri ldapi://%2fvar%2frun%2fldapi_sock/

# Note: %2f encodes the '/' used as directory separator

# The LDAP version to use (defaults to 3

# if supported by client library)

#ldap_version 3

# The distinguished name to bind to the server with.

# Optional: default is to bind anonymously.

binddn cn=manager,dc=msdpl,dc=com

# The credentials to bind with.

# Optional: default is no credential.

bindpw secret

# The distinguished name to bind to the server with

# if the effective user ID is root. Password is

# stored in /etc/ldap.secret (mode 600)

rootbinddn cn=manager,dc=msdpl,dc=com

# The port.

# Optional: default is 389.

#port 389

# The search scope.

#scope sub

#scope one

#scope base

# Search timelimit

timelimit 15

# Bind/connect timelimit

#bind_timelimit 30

# Reconnect policy: hard (default) will retry connecting to

# the software with exponential backoff, soft will fail

# immediately.

#bind_policy hard

# Idle timelimit; client will close connections

# (nss_ldap only) if the server has not been contacted

# for the number of seconds specified below.

#idle_timelimit 3600

# Filter to AND with uid=%s

pam_filter objectclass=posixAccount

# The user ID attribute (defaults to uid)

pam_login_attribute uid

# Search the root DSE for the password policy (works

# with Netscape Directory Server)

#pam_lookup_policy yes

# Check the 'host' attribute for access control

# Default is no; if set to yes, and user has no

# value for the host attribute, and pam_ldap is

# configured for account management (authorization)

# then the user will not be allowed to login.

#pam_check_host_attr yes

# Check the 'authorizedService' attribute for access

# control

# Default is no; if set to yes, and the user has no

# value for the authorizedService attribute, and

# pam_ldap is configured for account management

# (authorization) then the user will not be allowed

# to login.

#pam_check_service_attr yes

# Group to enforce membership of

#pam_groupdn cn=PAM,ou=Groups,dc=example,dc=com

# Group member attribute

pam_member_attribute memberUID

# Specify a minium or maximum UID number allowed

#pam_min_uid 0

#pam_max_uid 0

# Template login attribute, default template user

# (can be overriden by value of former attribute

# in user's entry)

#pam_login_attribute userPrincipalName

#pam_template_login_attribute uid

#pam_template_login nobody

# HEADS UP: the pam_crypt, pam_nds_passwd,

# and pam_ad_passwd options are no

# longer supported.

#

# If you are using XAD, you can set pam_password

# to racf, ad, or exop. Make sure that you have

# SSL enabled.

# Do not hash the password at all; presume

# the directory server will do it, if

# necessary. This is the default.

#pam_password exop

# Hash password locally; required for University of

# Michigan LDAP server, and works with Netscape

# Directory Server if you're using the UNIX-Crypt

# hash mechanism and not using the NT Synchronization

# service.

pam_password md5

# Remove old password first, then update in

# cleartext. Necessary for use with Novell

# Directory Services (NDS)

#pam_password nds

# RACF is an alias for the above. For use with

# IBM RACF

#pam_password racf

# Update Active Directory password, by

# creating Unicode password and updating

# unicodePwd attribute.

#pam_password ad

# Use the OpenLDAP password change

# extended operation to update the password.

# Redirect users to a URL or somesuch on password

# changes.

#pam_password_prohibit_message Please visit http://internal to change your
password.

# RFC2307bis naming contexts

# Syntax:

# nss_base_XXX base?scope?filter

# where scope is {base,one,sub}

# and filter is a filter to be &'d with the

# default filter.

# You can omit the suffix eg:

# nss_base_passwd ou=People,

# to append the default base DN but this

# may incur a small performance impact.

nss_base_passwd ou=People,dc=msdpl,dc=com?one

#nss_base_passwd ou=Computer,dc=msdpl,dc=com?one

nss_base_shadow ou=People,dc=msdpl,dc=com?one

nss_base_group ou=Groups,dc=msdpl,dc=com?one

#nss_base_hosts ou=Hosts,dc=example,dc=com?one

#nss_base_services ou=Services,dc=example,dc=com?one

#nss_base_networks ou=Networks,dc=example,dc=com?one

#nss_base_protocols ou=Protocols,dc=example,dc=com?one

#nss_base_rpc ou=Rpc,dc=example,dc=com?one

#nss_base_ethers ou=Ethers,dc=example,dc=com?one

#nss_base_netmasks ou=Networks,dc=example,dc=com?ne

#nss_base_bootparams ou=Ethers,dc=example,dc=com?one

#nss_base_aliases ou=Aliases,dc=example,dc=com?one

#nss_base_netgroup ou=Netgroup,dc=msdpl,dc=com?one

# attribute/objectclass mapping

# Syntax:

#nss_map_attribute rfc2307attribute mapped_attribute

#nss_map_objectclass rfc2307objectclass mapped_objectclass

# configure --enable-nds is no longer supported.

# NDS mappings

#nss_map_attribute uniqueMember member

# Services for UNIX 3.5 mappings

#nss_map_objectclass posixAccount User

#nss_map_objectclass shadowAccount User

#nss_map_attribute uid msSFU30Name

#nss_map_attribute uniqueMember msSFU30PosixMember

#nss_map_attribute userPassword msSFU30Password

#nss_map_attribute homeDirectory msSFU30HomeDirectory

#nss_map_attribute homeDirectory msSFUHomeDirectory

#nss_map_objectclass posixGroup Group

#pam_login_attribute msSFU30Name

#pam_filter objectclass=User

#pam_password ad

# configure --enable-mssfu-schema is no longer supported.

# Services for UNIX 2.0 mappings

#nss_map_objectclass posixAccount User

#nss_map_objectclass shadowAccount user

#nss_map_attribute uid msSFUName

#nss_map_attribute uniqueMember posixMember

#nss_map_attribute userPassword msSFUPassword

#nss_map_attribute homeDirectory msSFUHomeDirectory

#nss_map_attribute shadowLastChange pwdLastSet

#nss_map_objectclass posixGroup Group

#nss_map_attribute cn msSFUName

#pam_login_attribute msSFUName

#pam_filter objectclass=User

#pam_password ad

# RFC 2307 (AD) mappings

#nss_map_objectclass posixAccount user

#nss_map_objectclass shadowAccount user

#nss_map_attribute uid sAMAccountName

#nss_map_attribute homeDirectory unixHomeDirectory

#nss_map_attribute shadowLastChange pwdLastSet

#nss_map_objectclass posixGroup group

#nss_map_attribute uniqueMember member

#pam_login_attribute sAMAccountName

#pam_filter objectclass=User

#pam_password ad

# configure --enable-authpassword is no longer supported

# AuthPassword mappings

#nss_map_attribute userPassword authPassword

# AIX SecureWay mappings

#nss_map_objectclass posixAccount aixAccount

#nss_base_passwd ou=aixaccount,?one

#nss_map_attribute uid userName

#nss_map_attribute gidNumber gid

#nss_map_attribute uidNumber uid

#nss_map_attribute userPassword passwordChar

#nss_map_objectclass posixGroup aixAccessGroup

#nss_base_group ou=aixgroup,?one

#nss_map_attribute cn groupName

#nss_map_attribute uniqueMember member

#pam_login_attribute userName

#pam_filter objectclass=aixAccount

#pam_password clear

# Netscape SDK LDAPS

#ssl on

# Netscape SDK SSL options

#sslpath /etc/ssl/certs/cert7.db

# OpenLDAP SSL mechanism

# start_tls mechanism uses the normal LDAP port, LDAPS typically 636

#ssl start_tls

#ssl on

# OpenLDAP SSL options

# Require and verify server certificate (yes/no)

# Default is "no"

#tls_checkpeer yes

# CA certificates for server certificate verification

# At least one of these are required if tls_checkpeer is "yes"

#tls_cacertfile /etc/ssl/ca.cert

#tls_cacertdir /etc/ssl/certs

# Seed the PRNG if /dev/urandom is not provided

#tls_randfile /var/run/egd-pool

# SSL cipher suite

# See man ciphers for syntax

#tls_ciphers TLSv1

# Client certificate and key

# Use these, if your server requires client authentication.

#tls_cert

#tls_key

# Disable SASL security layers. This is needed for AD.

#sasl_secprops maxssf=0

# Override the default Kerberos ticket cache location.

#krb5_ccname FILE:/etc/.ldapcache

# SASL mechanism for PAM authentication - use is experimental

# at present and does not support password policy control

#pam_sasl_mech DIGEST-MD5

ssl no

###################################################################

*my nsswitch.conf file*

##########################################################################

#

# /etc/nsswitch.conf

#

# An example Name Service Switch config file. This file should be

# sorted with the most-used services at the beginning.

#

# The entry '[NOTFOUND=return]' means that the search for an

# entry should stop if the search in the previous entry turned

# up nothing. Note that if the search failed due to some other reason

# (like no NIS server responding) then the search continues with the

# next entry.

#

# Legal entries are:

#

# nisplus or nis+ Use NIS+ (NIS version 3)

# nis or yp Use NIS (NIS version 2), also called YP

# dns Use DNS (Domain Name Service)

# files Use the local files

# db Use the local database (.db) files

# compat Use NIS on compat mode

# hesiod Use Hesiod for user lookups

# [NOTFOUND=return] Stop searching if not found so far

#

# To use db, put the "db" in front of "files" for entries you want to be

# looked up first in the databases

#

# Example:

#passwd: db files nisplus nis

#shadow: db files nisplus nis

#group: db files nisplus nis

passwd: files ldap

shadow: files ldap

group: files ldap

#hosts: db files nisplus nis dns

hosts: files dns wins

# Example - obey only what nisplus tells us...

#services: nisplus [NOTFOUND=return] files

#networks: nisplus [NOTFOUND=return] files

#protocols: nisplus [NOTFOUND=return] files

#rpc: nisplus [NOTFOUND=return] files

#ethers: nisplus [NOTFOUND=return] files

#netmasks: nisplus [NOTFOUND=return] files

bootparams: nisplus [NOTFOUND=return] files

ethers: files

netmasks: files

networks: files

protocols: files

rpc: files

services: files

netgroup: files

publickey: nisplus

automount: files

aliases: files nisplus

 ##########################################################################

i have written the following ACL's in slapd.conf file,

##########################################################################

#

# See slapd.conf(5) for details on configuration options.

# This file should NOT be world readable.

#

include /etc/openldap/schema/core.schema

include /etc/openldap/schema/cosine.schema

include /etc/openldap/schema/inetorgperson.schema

include /etc/openldap/schema/nis.schema

include /etc/openldap/schema/samba.schema

# Allow LDAPv2 client connections. This is NOT the default.

allow bind_v2

# Do not enable referrals until AFTER you have a working directory

# service AND an understanding of referrals.

#referral ldap://root.openldap.org

pidfile /var/run/slapd.pid

argsfile /var/run/slapd.args

# Load dynamic backend modules:

# modulepath /usr/sbin/openldap

# moduleload back_bdb.la

# moduleload back_ldap.la

# moduleload back_ldbm.la

# moduleload back_passwd.la

# moduleload back_shell.la

# The next three lines allow use of TLS for encrypting connections using a

# dummy test certificate which you can generate by changing to

# /usr/share/ssl/certs, running "make slapd.pem", and fixing permissions on

# slapd.pem so that the ldap user or group can read it. Your client software

# may balk at self-signed certificates, however.

# TLSCACertificateFile /usr/share/ssl/certs/ca-bundle.crt

# TLSCertificateFile /usr/share/ssl/certs/slapd.pem

# TLSCertificateKeyFile /usr/share/ssl/certs/slapd.pem

# Sample security restrictions

# Require integrity protection (prevent hijacking)

# Require 112-bit (3DES or better) encryption for updates

# Require 63-bit encryption for simple bind

# security ssf=1 update_ssf=112 simple_bind=64

# Sample access control policy:

# Root DSE: allow anyone to read it

# Subschema (sub)entry DSE: allow anyone to read it

# Other DSEs:

# Allow self write access

# Allow authenticated users read access

# Allow anonymous users to authenticate

# Directives needed to implement policy:

# access to dn.base="" by * read

# access to dn.base="cn=Subschema" by * read

# defaultaccess search

# access to * by * read

# access to dn.base="dc=msdpl,dc=com"

# attrs=uid by * read

# access to dn=".*,ou=People,dc=msdpl,dc=com"

# attrs=userPassword

# by self write

# by * auth

# by dn=".*,ou=Domain Admins,dc=msdpl,dc=com" write

#

# if no access controls are present, the default policy

# allows anyone and everyone to read anything but restricts

# updates to rootdn. (e.g., "access to * by * read")

#

# rootdn can always read and write EVERYTHING!

#######################################################################

# ldbm and/or bdb database definitions

#######################################################################

database bdb

suffix "dc=msdpl,dc=com"

rootdn "cn=manager,dc=msdpl,dc=com"

# Cleartext passwords, especially for the rootdn, should

# be avoided. See slappasswd(8) and slapd.conf(5) for details.

# Use of strong authentication encouraged.

rootpw secret

# rootpw {crypt}ijFYNcSNctBYg

# The database directory MUST exist prior to running slapd AND

# should only be accessible by the slapd and slap tools.

# Mode 700 recommended.

directory /var/lib/ldap

# Indices to maintain for this database

index objectClass eq,pres

index ou,cn,mail,surname,givenname eq,pres,sub

index loginShell eq,pres

index nisMapName,nisMapEntry eq,pres,sub

index displayName eq,pres,sub

index uidNumber eq

index gidNumber eq

index memberUID eq

index sambaSID eq

index sambaPrimaryGroupSID eq

index default sub

#access to dn.base="dc=msdpl,dc=com"

*access to attrs=sambaLMPassword,sambaNTPassword*

*by dn="uid=.*,ou=People,dc=msdpl,dc=com" write*

*by dn="uid=.*,ou=Domain Admins,dc=msdpl,dc=com" read*

*by * none*

*access to attr=userPassword*

*by dn="uid=.*,ou=People,dc=msdpl,dc=com" write*

*by self write*

*by anonymous auth*

*by * none*

*access to **

*by * read*

# Replicas of this database

#replogfile /var/lib/ldap/openldap-master-replog

#replica host=ldap-1.example.com:389 starttls=critical

# bindmethod=sasl saslmech=GSSAPI

# authcId=host/ldap-master.example.com at EXAMPLE.COM

###########################################################################

At last my smb.conf file is



##########################################################################

# This is the main Samba configuration file. You should read the

# smb.conf(5) manual page in order to understand the options listed

# here. Samba has a huge number of configurable options (perhaps too

# many!) most of which are not shown in this example

#

# Any line which starts with a ; (semi-colon) or a # (hash)

# is a comment and is ignored. In this example we will use a #

# for commentry and a ; for parts of the config file that you

# may wish to enable

#

# NOTE: Whenever you modify this file you should run the command "testparm"

# to check that you have not made any basic syntactic errors.

#

#======================= Global Settings
=====================================

[global]

workgroup = testdomain.com

netbios name = testsystem

server string = Domain Controller

hosts allow = 192.168.129. 192.168.130. 127.

security = user

encrypt passwords = yes

socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

interfaces = eth0, lo

bind interfaces only = yes

local master = Yes

os level = 65

domain master = yes

preferred master = yes

null passwords = no

hide unreadable = yes

hide dot files = yes

domain logons = yes

logon script = %U.bat

logon path =

logon drive = X:

logon home = \\medhapdc\%U

wins support = yes

name resolve order = wins lmhosts host bcast

dns proxy = no

time server = yes

log file = /var/log/samba/%m.log

max log size = 50

#unix password sync = Yes

#passwd program = /usr/local/sbin/smbldap-passwd -u %u

#passwd chat = *New*UNIX*password* %n\n *ReType*new*UNIX*password* %n\n
*passwd:*all*authentication*tokens*updated*successfully*

ldap passwd sync = yes

add user script = /usr/local/sbin/smbldap-useradd -m "%u"

delete user script = /usr/local/sbin/smbldap-userdel "%u"

add machine script = /usr/local/sbin/smbldap-useradd -w "%u"

add group script = /usr/local/sbin/smbldap-groupadd -p "%g"

add user to group script = /usr/local/sbin/smbldap-groupmod -m "%u" "%g"

delete user from group script = /usr/local/sbin/smbldap-groupmod -x "%u"
"%g"

set primary group script = /usr/local/sbin/smbldap-usermod -g '%g' '%u'

passdb backend = ldapsam:ldap://testdomain.com

ldap delete dn = Yes

ldap ssl = no

ldap suffix = dc=msdpl,dc=com

ldap admin dn = cn=manager,dc=msdpl,dc=com

ldap group suffix = ou=Groups

ldap user suffix = ou=People

ldap machine suffix = ou=Computers

ldap idmap suffix = ou=Idmap

idmap backend = ldap:ldap://testdomain.com

idmap uid = 10000-20000

idmap gid = 10000-20000

map acl inherit = yes

winbind use default domain = no

#============================ Share Definitions
==============================

template shell = /bin/false

[homes]

comment = Home Directories

path = /home/%U

browseable = no

writeable = yes

create mode = 0644

directory mask = 0755

# Un-comment the following and create the netlogon directory for Domain
Logons

[netlogon]

comment = Network Logon Service

path = /home/netlogon

guest ok = yes

browseable = no

write list = root

# Un-comment the following to provide a specific roving profile share

# the default is to use the user's home directory

# NOTE: If you have a BSD-style print system there is no need to

# specifically define each individual printer

[printers]

comment = All Printers

path = /var/spool/samba

browseable = no

# Set public = yes to allow user 'guest account' to print

guest ok = no

writable = no

printable = yes

# This one is useful for people to share files

;[tmp]

; comment = Temporary file space

; path = /tmp

; read only = no

; public = yes

# A publicly accessible directory, but read only, except for people in

# the "staff" group

;[public]

; comment = Public Stuff

; path = /home/samba

; public = yes

; read only = yes

; write list = @staff

# Other examples.

#

# A private printer, usable only by fred. Spool data will be placed in
fred's

# home directory. Note that fred must have write access to the spool
directory,

# wherever it is.

;[fredsprn]

; comment = Fred's Printer

; valid users = fred

; path = /homes/fred

; printer = freds_printer

; public = no

; writable = no

; printable = yes

# A private directory, usable only by fred. Note that fred requires write

# access to the directory.

;[fredsdir]

; comment = Fred's Service

; path = /usr/somewhere/private

; valid users = fred

; public = no

; writable = yes

; printable = no

# a service which has a different directory for each machine that connects

# this allows you to tailor configurations to incoming machines. You could

# also use the %u option to tailor it by user name.

# The %m gets replaced with the machine name that is connecting.

;[pchome]

; comment = PC Directories

; path = /usr/pc/%m

; public = no

; writable = yes

# A publicly accessible directory, read/write to all users. Note that all
files

# created in the directory by users will be owned by the default user, so

# any user with access can delete any other user's files. Obviously this

# directory must be writable by the default user. Another user could of
course

# be specified, in which case all files would be owned by that user instead.

;[public]

; path = /usr/somewhere/else/public

; public = yes

; only guest = yes

; writable = yes

; printable = no

# The following two entries demonstrate how to share a directory so that two

# users can place files there that will be owned by the specific users. In
this

# setup, the directory should be writable by both users and should have the

# sticky bit set on it to prevent abuse. Obviously this could be extended to

# as many users as required.

;[myshare]

; comment = Mary's and Fred's stuff

; path = /usr/somewhere/shared

; valid users = mary fred

; public = no

; writable = yes

; printable = no

; create mask = 0765

 ###########################################################################

please let me know , where i am wrong

Regards

Niranjan


More information about the samba mailing list