由 kinston 在 06-17-2003 13:34 发表:
有哪位大虾有配置samba+openldap作为PDC的经验
有哪位大虾有配置samba+openldap作为PDC的经验。。能否教小弟一把。。急用!!
由 tacy_lee 在 06-17-2003 13:58 发表:
回复: 有哪位大虾有配置samba+openldap作为PDC的经验
> quote:
>
> * * *
>
> 最初由 kinston 发表
>
> 有哪位大虾有配置samba+openldap作为PDC的经验。。能否教小弟一把。。急用!!
>
> * * *
贴一配置给你,具体怎么做自己试试了
Linux config files
Ldap.conf
Base.ldif
Slapd.conf
Named.conf
Smb.conf
LDAP.CONF
$OpenLDAP: pkg/ldap/libraries/libldap/ldap.conf,v 1.4.8.6 2000/09/05 17:54:38 kurt Exp $
LDAP Defaults
See ldap.conf(5) for details
This file should be world readable but not world writable.
#BASE dc=example, dc=com
#URI ldap://ldap.andsky.com ldap://ldap-master.andsky.com:666
#SIZELIMIT 12
#TIMELIMIT 15
#DEREF never
HOST 127.0.0.1
BASE dc=gzdomain,dc=com
Base.ldif
dn: dc=gzdomain,dc=com
objectClass: domain
dc: gzdomain
dn: ou=Groups,dc=gzdomain,dc=com
objectClass: top
objectClass: organizationalUnit
ou: Groups
description: System Groups
dn: ou=Users,dc=gzdomain,dc=com
objectClass: top
objectClass: organizationalUnit
ou: Users
description: Users of the Organization
dn: ou=Computers,dc=gzdomain,dc=com
objectClass: top
objectClass: organizationalUnit
ou: Computers
description: Windows Domain Computers
dn: cu=Domain Admins,ou=Groups,dc=gzdomain,dc=com
objectClass: posixGroup
gidNumber: 200
cn: Domain Admins
memberUid: administrator
description: Windows Domain Users
dn: cn=Domain Users,ou=Groups,dc=gzdomain,dc=com
objectClass: posixGroup
gidNumber: 201
cn: Domain Users
description: Windows Domain Users
dn: cn=Domain Guests,ou=Groups,dc=gzdomain,dc=com
objectClass: posixGroup
gidNumber: 202
cn: Domain Guests
description: Windows Domain Guests Users
dn: cn=Administraotrs,ou=Groups,dc=gzdomain,dc=com
description: Members can fully administer the computer/domain
objectClass: posixGroup
gidNumber: 220
cn: Administrators
description: Windows Domain Members can fully administer the computer/domain
dn: cn=Users,ou=Groups,dc=gzdomain,dc=com
description:Ordinary users
objectClass: posixGroup
gidNumber: 221
cn: Users
description: Windows Domain Ordinary users
dn: cn=Guests,ou=Groups,dc=gzdomain,dc=com
description: Users granted guest access to the computer/domain
objectClass: posixGroup
gidNumber: 222
cn: Guests
memberUid:nobody
description: Windows Domain Users granted guest access to the computer/domain
dn: cn=Power Users,ou=Groups,dc=gzdomain,dc=com
description: Members can share directories and printers
objectClass: posixGroup
gidNumber: 223
cn: Power users
description: Windows Domain Members can share directories and printers
dn: cn=Account Operators,ou=Groups,dc=gzdomain,dc=com
objectClass: posixGroup
gidNumber: 224
cn: Account Operators
description: Windows Domain Users to manipulate users accounts
dn: cn=Server Operators,ou=Groups,dc=gzdomain,dc=com
objectClass: posixGroup
gidNumber: 225
cn: Server Operators
description: Windows Domain Server Operators
dn: cn=Print Operators,ou=Groups,dc=gzdomain,dc=com
objectClass: posixGroup
gidNumber: 226
cn: Print Operators
description: Windows Domain Print Operators
dn: cn=Backup Operators,ou=Groups,dc=gzdomain,dc=com
objectClass: posixGroup
gidNumber: 227
cn: Backup Operators
description: Windows Domain Members can bypass file security to back up files
dn: cn=Replicator,ou=Groups,dc=gzdomain,dc=com
description: Supports file replication in a domain
objectClass: posixGroup
gidNumber: 228
cn: Replicator
description: Windows Domain Supports file replication in a domain
Slapd.conf
$OpenLDAP: pkg/ldap/servers/slapd/slapd.conf,v 1.8.8.7 2001/09/27 20:00:31 kurt Exp $
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
include /etc/openldap/schema/redhat/rfc822-MailMember.schema
include /etc/openldap/schema/redhat/autofs.schema
include /etc/openldap/schema/redhat/kerberosobject.schema
Define global ACLs to disable default read access.
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
Create a replication log in /var/lib/ldap for use by slurpd.
#replogfile /var/lib/ldap/master-slapd.replog
Load dynamic backend modules:
modulepath /usr/sbin/openldap
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 connections using a dummy test
certificate, but you should generate a proper certificate 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.
TLSCertificateFile /usr/share/ssl/certs/slapd.pem
TLSCertificateKeyFile /usr/share/ssl/certs/slapd.pem
TLSCACertificateFile /usr/share/ssl/certs/ca-bundle.crt
Sample Access Control
Allow read access of root DSE
Allow self write access
Allow authenticated users read access
Allow anonymous users to authenticate
#access to dn="" by * read
#access to *
by self write
by users read
by anonymous auth
if no access controls are present, the default is:
Allow read by all
rootdn can always write!
#######################################################################
ldbm database definitions
#######################################################################
database ldbm
suffix "dc=gzdomain,dc=com"
#suffix "o=My Organization Name,c=US"
rootdn "cn=Manager,dc=gzdomain,dc=com"
#rootdn "cn=Manager,o=My Organization Name,c=US"
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/tools. Mode 700 recommended.
directory /var/lib/ldap
Indices to maintain
index objectClass,uid,uidNumber,gidNumber,memberUid eq
index cn,mail,surname,givenname eq,subinitial
Replicas to which we should propagate changes
#replica host=ldap-1.andsky.com:389 tls=yes
bindmethod=sasl saslmech=GSSAPI
authcId=host/[email protected]
Smb.conf
[global]
workgroup = gzdomain
netbios name = proxy
server string = samba server
hosts allow = 192.168.1. 192.168.2. 127.
log file = /var/log/samba/%m.log
max log size = 0
security = USER
encrypt passwords = yes
passwd program = /usr/local/sbin/smbldap-passwd.pl -o %u
passwd chat = newpassword* %n\n newpassword* %n\n successfully
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
domain master = yes
local master = yes
os level = 255
preferred master = yes
domain logons = yes
wins server = 192.168.1.1
ldap suffix = "dc=gzdomain,dc=com"
ldap admin dn = "cn=Manager,dc=gzdomain,dc=com"
ldap port = 389
ldap server = 127.0.0.1
ldap ssl = no
;add user script = /usr/local/sbin/smbldap-useradd.pl -w %u
;domain admin group = " @"Domain Admins" "
dns proxy = no
#============================ Share Definitions ==============================
[homes]
comment = Home Directories
browseable = no
writeable = yes
valid users = %S
create mode = 0777
directory mode = 0777
由 kinston 在 06-18-2003 08:14 发表:
能具体分析一下吗?因为openldap是第一次接触。。有些重要设置不知道是什么意思?
由 tacy_lee 在 06-18-2003 10:48 发表:
> quote:
>
> * * *
>
> 最初由 kinston 发表
>
> 能具体分析一下吗?因为openldap是第一次接触。。有些重要设置不知道是什么意思?
>
> * * *
一起探讨以下 
安装samba2.2.x openldap2.0.x
1:我假设的具体环境,redhat9.0,要建立域gzdomain,PDC名字proxy
2:缺省状态下,redhat9.0安装的SAMBA不支持LDAP,你需要重新编译,推荐你直接编译src.rpm包,具体的操做自己试试看,加上--with-ldapsam,我假设你用的是samba-2.2.8a-1.src.rpm。.
3:确认你安装了openldap-2.0.27-8,openldap-servers-2.0.27-8,openldap-clients-2.0.27-8,在redhat9.0光盘中.
晚点再继续。。。
由 tacy_lee 在 06-19-2003 15:56 发表:
继续
4:vi /etc/openldap/slapd.conf
具体要修改的地方就自己看看了:
$OpenLDAP: pkg/ldap/servers/slapd/slapd.conf,v 1.8.8.7 2001/09/27 20:00:31 kurt Exp $
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
include /etc/openldap/schema/redhat/rfc822-MailMember.schema
include /etc/openldap/schema/redhat/autofs.schema
include /etc/openldap/schema/redhat/kerberosobject.schema
Define global ACLs to disable default read access.
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
Create a replication log in /var/lib/ldap for use by slurpd.
#replogfile /var/lib/ldap/master-slapd.replog
Load dynamic backend modules:
modulepath /usr/sbin/openldap
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 connections using a dummy test
certificate, but you should generate a proper certificate 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.
TLSCertificateFile /usr/share/ssl/certs/slapd.pem
TLSCertificateKeyFile /usr/share/ssl/certs/slapd.pem
TLSCACertificateFile /usr/share/ssl/certs/ca-bundle.crt
Sample Access Control
Allow read access of root DSE
Allow self write access
Allow authenticated users read access
Allow anonymous users to authenticate
#access to dn="" by * read
#access to *
by self write
by users read
by anonymous auth
if no access controls are present, the default is:
Allow read by all
rootdn can always write!
#######################################################################
ldbm database definitions
#######################################################################
database ldbm
suffix "dc=gzdomain,dc=com"
#suffix "o=My Organization Name,c=US"
rootdn "cn=Manager,dc=gzdomain,dc=com"
#rootdn "cn=Manager,o=My Organization Name,c=US"
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/tools. Mode 700 recommended.
directory /var/lib/ldap
Indices to maintain
index objectClass,uid,uidNumber,gidNumber,memberUid eq
index cn,mail,surname,givenname eq,subinitial
Replicas to which we should propagate changes
#replica host=ldap-1.andsky.com:389 tls=yes
bindmethod=sasl saslmech=GSSAPI
authcId=host/[email protected]
5:vi /etc/openldap/ldap.conf
$OpenLDAP: pkg/ldap/libraries/libldap/ldap.conf,v 1.4.8.6 2000/09/05 17:54:38 kurt Exp $
LDAP Defaults
See ldap.conf(5) for details
This file should be world readable but not world writable.
#BASE dc=example, dc=com
#URI ldap://ldap.andsky.com ldap://ldap-master.andsky.com:666
#SIZELIMIT 12
#TIMELIMIT 15
#DEREF never
HOST 127.0.0.1
BASE dc=gzdomain,dc=com
6:开始你的LDAP SERVER
/etc/init.d/ldap start
7:建立一个/etc/openldap/domain.ldif文件
dn: dc=gzdomain,dc=com
objectClass: domain
dc: gzdomain
dn: ou=Groups,dc=gzdomain,dc=com
objectClass: top
objectClass: organizationalUnit
ou: Groups
description: System Groups
dn: ou=Users,dc=gzdomain,dc=com
objectClass: top
objectClass: organizationalUnit
ou: Users
description: Users of the Organization
dn: ou=Computers,dc=gzdomain,dc=com
objectClass: top
objectClass: organizationalUnit
ou: Computers
description: Windows Domain Computers
dn: cu=Domain Admins,ou=Groups,dc=gzdomain,dc=com
objectClass: posixGroup
gidNumber: 200
cn: Domain Admins
memberUid: administrator
description: Windows Domain Users
dn: cn=Domain Users,ou=Groups,dc=gzdomain,dc=com
objectClass: posixGroup
gidNumber: 201
cn: Domain Users
description: Windows Domain Users
dn: cn=Domain Guests,ou=Groups,dc=gzdomain,dc=com
objectClass: posixGroup
gidNumber: 202
cn: Domain Guests
description: Windows Domain Guests Users
dn: cn=Administraotrs,ou=Groups,dc=gzdomain,dc=com
description: Members can fully administer the computer/domain
objectClass: posixGroup
gidNumber: 220
cn: Administrators
description: Windows Domain Members can fully administer the computer/domain
dn: cn=Users,ou=Groups,dc=gzdomain,dc=com
description:Ordinary users
objectClass: posixGroup
gidNumber: 221
cn: Users
description: Windows Domain Ordinary users
dn: cn=Guests,ou=Groups,dc=gzdomain,dc=com
description: Users granted guest access to the computer/domain
objectClass: posixGroup
gidNumber: 222
cn: Guests
memberUid:nobody
description: Windows Domain Users granted guest access to the computer/domain
dn: cn=Power Users,ou=Groups,dc=gzdomain,dc=com
description: Members can share directories and printers
objectClass: posixGroup
gidNumber: 223
cn: Power users
description: Windows Domain Members can share directories and printers
dn: cn=Account Operators,ou=Groups,dc=gzdomain,dc=com
objectClass: posixGroup
gidNumber: 224
cn: Account Operators
description: Windows Domain Users to manipulate users accounts
dn: cn=Server Operators,ou=Groups,dc=gzdomain,dc=com
objectClass: posixGroup
gidNumber: 225
cn: Server Operators
description: Windows Domain Server Operators
dn: cn=Print Operators,ou=Groups,dc=gzdomain,dc=com
objectClass: posixGroup
gidNumber: 226
cn: Print Operators
description: Windows Domain Print Operators
dn: cn=Backup Operators,ou=Groups,dc=gzdomain,dc=com
objectClass: posixGroup
gidNumber: 227
cn: Backup Operators
description: Windows Domain Members can bypass file security to back up files
dn: cn=Replicator,ou=Groups,dc=gzdomain,dc=com
description: Supports file replication in a domain
objectClass: posixGroup
gidNumber: 228
cn: Replicator
description: Windows Domain Supports file replication in a domain
9:建立你的库:
#ldapadd -x -h localhost -D "cn=manager,dc=gzdomain,dc=com" -f base.ldif -W
系统提示你输入密码,例子中的密码为secret
10:如果一切正常,你不会看到错误信息
11:配置samba smb.conf内容
[global]
workgroup = gzdomain
netbios name = proxy
server string = samba server
hosts allow = 192.168.1. 192.168.2. 127.
log file = /var/log/samba/%m.log
max log size = 0
security = USER
encrypt passwords = yes
passwd program = /usr/local/sbin/smbldap-passwd.pl -o %u
passwd chat = newpassword* %n\n newpassword* %n\n successfully
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
domain master = yes
local master = yes
os level = 255
preferred master = yes
domain logons = yes
wins server = 192.168.1.1
ldap suffix = "dc=gzdomain,dc=com"
ldap admin dn = "cn=Manager,dc=gzdomain,dc=com"
ldap port = 389
ldap server = 127.0.0.1
ldap ssl = no
;add user script = /usr/local/sbin/smbldap-useradd.pl -w %u
;domain admin group = " @"Domain Admins" "
dns proxy = no
#============================ Share Definitions ==============================
[homes]
comment = Home Directories
browseable = no
writeable = yes
valid users = %S
create mode = 0777
directory mode = 0777
(只是例子,没有实用意义)
12:启动你的samba /etc/init.d/smb start
13:LDAP管理工具很多,下面一个也比较简单:
http://samba.idealx.org/dist/redhat...-0.7-2.i386.rpm
下载,安装
14:修改/usr/local/sbin/smbldap_conf.pm
#!/usr/bin/perl
use strict;
package smbldap_conf;
$Id: smbldap_conf.pm,v 1.14 2002/06/01 04:30:48 olem Exp $
smbldap-tools.conf : Q & D configuration file for smbldap-tools
This code was developped by IDEALX ( http://IDEALX.org/ ) and
contributors (their names can be found in the CONTRIBUTORS file).
Copyright (C) 2001-2002 IDEALX
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
Purpose :
. be the configuration file for all smbldap-tools scripts
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS
$UID_START $GID_START $smbpasswd $slaveLDAP $masterLDAP
$with_smbpasswd $mk_ntpasswd
$ldap_path $ldap_opts $ldapsearch $ldapsearchnobind
$ldapmodify $ldappasswd $ldapadd $ldapdelete $ldapmodrdn
$suffix $usersdn $computersdn
$groupsdn $scope $binddn $bindpasswd
$slaveDN $slavePw $masterDN $masterPw
$_userLoginShell $_userHomePrefix $_userGecos
$_defaultUserGid $_defaultComputerGid
$_skeletonDir $_userSmbHome
$_userProfile $_userHomeDrive
$_userScript $usersou $computersou $groupsou
);
use Exporter;
$VERSION = 1.00;
@ISA = qw(Exporter);
@EXPORT = qw(
$UID_START $GID_START $smbpasswd $slaveLDAP $masterLDAP
$with_smbpasswd $mk_ntpasswd
$ldap_path $ldap_opts $ldapsearch $ldapsearchnobind $ldapmodify $ldappasswd
$ldapadd $ldapdelete $ldapmodrdn $suffix $usersdn
$computersdn $groupsdn $scope $binddn $bindpasswd
$slaveDN $slavePw $masterDN $masterPw
$_userLoginShell $_userHomePrefix $_userGecos
$_defaultUserGid $_defaultComputerGid $_skeletonDir
$_userSmbHome $_userProfile $_userHomeDrive $_userScript
$usersou $computersou $groupsou
);
##############################################################################
General Configuration
##########