|
发表于 2003-6-19 15:56:00
|
显示全部楼层
继续
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.example.com:389 tls=yes
# bindmethod=sasl saslmech=GSSAPI
# authcId=host/ldap-master.example.com@EXAMPLE.COM
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.example.com ldap://ldap-master.example.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 = *new*password* %n\n *new*password* %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/smbldap-tools-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
#
##############################################################################
#
# UID and GID starting at...
#
$UID_START = 1000;
$GID_START = 1000;
##############################################################################
#
# LDAP Configuration
#
##############################################################################
# Notes: to use to dual ldap servers backend for Samba, you must patch
# Samba with the dual-head patch from IDEALX. If not using this patch
# just use the same server for slaveLDAP and masterLDAP.
#
# Slave LDAP : needed for read operations
#
# Ex: $slaveLDAP = "127.0.0.1";
$slaveLDAP = "127.0.0.1";
#
# Master LDAP : needed for write operations
#
# Ex: $masterLDAP = "127.0.0.1";
$masterLDAP = "127.0.0.1";
#
# LDAP Suffix
#
# Ex: $suffix = "dc=IDEALX,dc=ORG";
$suffix = "dc=gzdomain,dc=com";
#
# Where are stored Users
#
# Ex: $usersdn = "ou=Users,$suffix"; for ou=Users,dc=IDEALX,dc=ORG
$usersou = q(Users);
$usersdn = "ou=$usersou,$suffix";
#
# Where are stored Computers
#
# Ex: $computersdn = "ou=Computers,$suffix"; for ou=Computers,dc=IDEALX,dc=ORG
$computersou = q(Computers);
$computersdn = "ou=$computersou,$suffix";
#
# Where are stored Groups
#
# Ex $groupsdn = "ou=Groups,$suffix"; for ou=Groups,dc=IDEALX,dc=ORG
$groupsou = q(Groups);
$groupsdn = "ou=$groupsou,$suffix";
#
# Default scope Used
#
$scope = "sub";
#
# Credential Configuration
#
# Bind DN used
# Ex: $binddn = "cn=Manager,$suffix"; for cn=Manager,dc=IDEALX,dc=org
$binddn = "cn=Manager,$suffix";
#
# Bind DN passwd used
# Ex: $bindpasswd = 'secret'; for 'secret'
$bindpasswd = "secret";
#
# Notes: if using dual ldap patch, you can specify to different configuration
# By default, we will use the same DN (so it will work for standard Samba
# release)
#
$slaveDN = $binddn;
$slavePw = $bindpasswd;
$masterDN = $binddn;
$masterPw = $bindpasswd;
##############################################################################
#
# Unix Accounts Configuration
#
##############################################################################
# Login defs
#
# Default Login Shell
#
# Ex: $_userLoginShell = q(/bin/bash);
$_userLoginShell = q(/bin/bash);
#
# Home directory prefix (without username)
#
#Ex: $_userHomePrefix = q(/home/);
$_userHomePrefix = q(/home/);
#
# Gecos
#
$_userGecos = q(System User);
#
# Default User (POSIX and Samba) GID
#
$_defaultUserGid = 100;
#
# Default Computer (Samba) GID
#
$_defaultComputerGid = 553;
#
# Skel dir
#
$_skeletonDir = q(/etc/skel);
##############################################################################
#
# SAMBA Configuration
#
##############################################################################
#
# The UNC path to home drives location without the username last extension
# (will be dynamically prepended)
# Ex: q(\\\\My-PDC-netbios-name\\homes) for \\My-PDC-netbios-name\homes
$_userSmbHome = q(\\\\proxy\\homes);
#
# The UNC path to profiles locations without the username last extension
# (will be dynamically prepended)
# Ex: q(\\\\My-PDC-netbios-name\\profiles) for \\My-PDC-netbios-name\profiles
$_userProfile = q(\\\\proxy\\profiles\\);
#
# The default Home Drive Letter mapping
# (will be automatically mapped at logon time if home directory exist)
# Ex: q(U for U:
$_userHomeDrive = q(Z;
#
# The default user netlogon script name
# if not used, will be automatically username.cmd
#
#$_userScript = q(startup.cmd); # make sure script file is edited under dos
##############################################################################
#
# SMBLDAP-TOOLS Configuration (default are ok for a RedHat)
#
##############################################################################
# Allows not to use smbpasswd (if $with_smbpasswd == 0 in smbldap_conf.pm) but
# prefer mkntpwd... most of the time, it's a wise choice :-)
$with_smbpasswd = 0;
$smbpasswd = "/usr/bin/smbpasswd";
$mk_ntpasswd = "/usr/local/sbin/mkntpwd";
$ldap_path = "/usr/bin";
$ldap_opts = "-x";
$ldapsearch = "$ldap_path/ldapsearch $ldap_opts -h $slaveLDAP -D '$slaveDN' -w '$slavePw'";
$ldapsearchnobind = "$ldap_path/ldapsearch $ldap_opts -h $slaveLDAP";
$ldapmodify = "$ldap_path/ldapmodify $ldap_opts -h $masterLDAP -D '$masterDN' -w '$masterPw'";
$ldappasswd = "$ldap_path/ldappasswd $ldap_opts -h $masterLDAP -D '$masterDN' -w '$masterPw'";
$ldapadd = "$ldap_path/ldapadd $ldap_opts -h $masterLDAP -D '$masterDN' -w '$masterPw'";
$ldapdelete = "$ldap_path/ldapdelete $ldap_opts -h $masterLDAP -D '$masterDN' -w '$masterPw'";
$ldapmodrdn = "$ldap_path/ldapmodrdn $ldap_opts -h $masterLDAP -D '$masterDN' -w '$masterPw'";
1;
# - The End
(这个你自己看着改吧,主要的地方自己注意一点)
15:这样应该差不多了,添加用户:
smbldap-useradd.pl -m testuser
smbldap-passwd testuser
删除用户:
smbldap-userdel.pl -r testuser
群组管理:
smbldap-groupadd.pl
smbldap-groupdel.pl
添加计算机帐号:
smbldap-useradd -w computer1
16:添加computer1(win2k系统)到samba gzdomain,
首先添加一个root帐号:
smbldap-useradd.pl -a -m -g 200 root
smbldap-usermod.pl -u 0 -g 0 root
smbldap-passwd root
这个牵涉到sid rid的问题,自己去了解
然后就按正常步骤加入gzdomain,用户就是刚刚建立的root帐号。
差不多了,可能有错误,不够详细,自己摸索看看,有兴趣的可以探讨。tacy_lee@yeah.net
本地系统登入认证没有使用ldap,要实现自己去修改/etc/pam.d/system-auth |
|