Debian Etch上的Mandriva目录服务器

Mandriva目录服务器在Debian Etch上

版本1.1
作者:Oliver Meyer <o [dot] meyer [at] projektfarm [dot] de>

本文介绍如何在Debian Etch上设置Mandriva Directory Server(MDS) 。 所产生的系统为中小型公司提供了一个功能齐全的办公室服务器 - 通过基于网络的Mandriva管理控制台(MMC)轻松管理。

主要特点

  • 通过MMC轻松管理
  • 系统范围的OpenLDAP集成
  • SAMBA主域控制器(PDC)
  • Postfix Mailserver与Dovecot,Amavis,Spamassassin和ClamAV(POP3 / IMAP / SSL / TLS /配额)
  • BIND DNS服务器
  • ISC DHCP服务器
  • Squid Web代理与SquidGuard

这个howto是一个没有任何保证的实用指南 - 它不包括理论背景。 建立这样的系统有许多方法 - 这就是我选择的方式。

前言

这个howto是相当复杂的。 请你花时间阅读,并仔细阅读。 最小的方差可能会导致您的设置无法正常工作。

1准备

1.1基本系统

建立一个标准的debian蚀刻系统并进行更新。 我为以下配置使用了以下配置以及可供我们订阅者使用的附加虚拟机:

主机名: server1.example.com
SAMBA域: 示例
IP: 192.168.0.100
网关: 192.168.0.2
所有密码: youcl

1.2主机名

编辑主机文件 - 将主机名分配给服务器IP。

vi /etc/hosts

它应该是这样的:

127.0.0.1       localhost.localdomain   localhost
192.168.0.100   server1.example.com     server1

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

之后将主机名插入主机名文件...

echo server1.example.com > /etc/hostname

...并重启系统。

reboot

当系统重新启动时,两个命令的输出...

hostname

...和...

hostname -f

... 应该:

server1.example.com

1.3文件系统ACL

为了使SAMBA能够在Linux服务器和Windows客户端之间映射文件系统ACL,您需要将ACL支持添加到相应的安装点。

vi /etc/fstab

将选项“ acl ”添加到要存储SAMBA目录的安装点,SAMBA用户将拥有自己的家。 在我的情况下,它是“ / ” - 内容应如下所示:

# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
/dev/sda1       /               ext3    defaults,acl,errors=remount-ro 0       1
/dev/sda5       none            swap    sw              0       0
/dev/hdc        /media/cdrom0   udf,iso9660 user,noauto     0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto  0       0

然后重新装载挂载点以获取更改效果。

mount -o remount /

如果一切顺利,命令...

mount -l

...应该显示相应的安装点的选项“ acl ”:

/dev/sda1 on / type ext3 (rw,acl,errors=remount-ro)

2存储库

2.1 MDS

MDS存储库提供与MDS相关的软件包,还提供了bind9和dhcp3的修补软件包。

vi /etc/apt/sources.list

将以下行添加到文件。

# MDS repository
deb http://mds.mandriva.org/pub/mds/debian etch main

2.2 Debian Volatile

Debian Volatile存储库为ClamAV&Spamassassin提供了比标准debian存储库更新的软件包。

vi /etc/apt/sources.list

将以下行添加到文件中。

# Debian Volatile
deb http://volatile.debian.org/debian-volatile etch/volatile main contrib non-free

2.3 Debian Backports

Debian Backports存储库为dovecot提供了更新的软件包。

vi /etc/apt/sources.list

将以下行添加到文件中。

# Debian Etch Backports
deb http://www.backports.org/debian etch-backports main

之后刷新apt。

apt-get update

3需要的包装

3.1安装

安装此设置所需的软件包。

apt-get install mmc-web-base mmc-web-mail mmc-web-network mmc-web-proxy mmc-web-samba mmc-agent python-mmc-plugins-tools python-mmc-base python-mmc-mail python-mmc-network python-mmc-proxy python-mmc-samba postfix postfix-ldap sasl2-bin libsasl2 libsasl2-modules amavisd-new libdbd-ldap-perl libnet-ph-perl libnet-snpp-perl libnet-telnet-perl lzop nomarch zoo clamav clamav-daemon gzip bzip2 unzip unrar-free unzoo arj spamassassin libnet-dns-perl razor pyzor dcc-client slapd ldap-utils libnss-ldap libpam-ldap dhcp3-server dhcp3-server-ldap bind9 samba smbclient smbldap-tools cupsys cupsys-client foomatic-db-engine foomatic-db foomatic-db-hpijs foomatic-db-gutenprint foomatic-filters foomatic-filters-ppds fontconfig hpijs-ppds linuxprinting.org-ppds

标准debian存储库中的实际dovecot-packages与LDAP结合使用,所以您必须使用Debian Backports的dovecot-packages。

apt-get install -t etch-backports dovecot-common dovecot-imapd dovecot-pop3d

如果要使用HP​​打印机,建议您安装更多的软件包。

apt-get install hplip libusb-dev python-dev python-reportlab libcupsys2-dev libjpeg62-dev libsnmp9-dev lsb-core

3.2配置

在安装新的软件包时,您会被问到几个问题 - 请如下回答。

3.2.1 LDAP

输入LDAP管理员的密码并进行确认。 ( youcl

3.2.2 Samba

输入您的域名。 ( 实施例
当您询问是否应将smb.conf修改为使用DHCP中的WINS设置时,请选择“ ”。

3.2.3 Postfix

选择“ Internet站点 ”作为一般配置类型。
输入“ server1.example.com ”作为邮件名称。

3.2.4 Libnss-LDAP

输入“ ldap://127.0.0.1/ ”作为LDAP服务器URI。
输入“ dc = example,dc = com ”作为搜索库的名称。
选择LDAP版本。 ( 3
输入“ cn = admin,dc = example,dc = com ”作为root的LDAP帐户。
输入LDAP管理员的密码。 ( youcl

3.2.5 Libpam-LDAP

当询问本地根是否应该是数据库管理员时,选择“ ”。
当您询问LDAP数据库是否需要登录时,请选择“ ”。
输入“ cn = admin,dc = example,dc = com ”作为root的LDAP帐户。
输入LDAP管理员的密码。 ( youcl

4 LDAP配置

4.1模式文件

首先将MMC,邮件,SAMBA,打印机,DNS和DHCP的架构文件复制到LDAP架构目录中。

cp /usr/share/doc/python-mmc-base/contrib/ldap/mmc.schema /etc/ldap/schema/
cp /usr/share/doc/python-mmc-base/contrib/ldap/mail.schema /etc/ldap/schema/
zcat /usr/share/doc/python-mmc-base/contrib/ldap/samba.schema.gz > /etc/ldap/schema/samba.schema
zcat /usr/share/doc/python-mmc-base/contrib/ldap/printer.schema.gz > /etc/ldap/schema/printer.schema
zcat /usr/share/doc/python-mmc-base/contrib/ldap/dnszone.schema.gz > /etc/ldap/schema/dnszone.schema
zcat /usr/share/doc/python-mmc-base/contrib/ldap/dhcp.schema.gz > /etc/ldap/schema/dhcp.schema

接下来将模式文件包含到LDAP配置中

vi /etc/ldap/slapd.conf

在inetorgperson模式之后包含模式文件。

include /etc/ldap/schema/mmc.schema
include /etc/ldap/schema/samba.schema
include /etc/ldap/schema/printer.schema
include /etc/ldap/schema/mail.schema
include /etc/ldap/schema/dnszone.schema
include /etc/ldap/schema/dhcp.schema

启用schemacheck(在包含的模式文件下面)。

schemacheck on

4.2基本配置

在此步骤中,您将需要加密形式(SSHA)中的ldap管理员密码(您在第3步中的软件包安装期间定义) - 因此我们加密它。

slappasswd -s %ldap_admin_password%

例如:

slappasswd -s youcl

输出应如下所示:

{SSHA}kPd9OeiwGx4lyZUiQ2NFmzXV0JWyLV9A

请注意并继续 - 打开LDAP服务器配置文件。

vi /etc/ldap/slapd.conf

使用LDAP管理员(rootdn)的条目搜索已注释的行...

# rootdn "cn=admin,dc=example,dc=com"

...并评论。 之后,直接在下面添加一条新行。 您必须输入您在此步骤开始时生成的加密ldap管理员密码。

rootpw %encrypted_ldap_admin_password%

例如:

rootpw {SSHA}kPd9OeiwGx4lyZUiQ2NFmzXV0JWyLV9A

接下来我们必须修改数据库的索引选项。 搜索以下条目:

# Indexing options for database #1

删除下面的行...

index objectClass eq

...并插入以下行:

index objectClass,uidNumber,gidNumber eq
index cn,sn,uid,displayName pres,sub,eq
index memberUid,mail,givenname eq,subinitial
index sambaSID,sambaPrimaryGroupSID,sambaDomainName eq
index zoneName,relativeDomainName eq
index dhcpHWAddress,dhcpClassData eq

现在将SAMBA添加到数据库的访问列表中。 搜索以下行:

access to attrs=userPassword,shadowLastChange

改变它看起来像这样:

access to attrs=userPassword,sambaLMPassword,sambaNTPassword

此时,LDAP服务器配置文件应如下所示:

# 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/mmc.schema
include         /etc/ldap/schema/samba.schema
include         /etc/ldap/schema/printer.schema
include         /etc/ldap/schema/mail.schema
include         /etc/ldap/schema/dnszone.schema
include         /etc/ldap/schema/dhcp.schema

schemacheck     on

# 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=example,dc=com"

# rootdn directive for specifying a superuser on the database. This is needed
# for syncrepl.
rootdn          "cn=admin,dc=example,dc=com"
rootpw          {SSHA}kPd9OeiwGx4lyZUiQ2NFmzXV0JWyLV9A

# 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,uidNumber,gidNumber                  eq
index      cn,sn,uid,displayName                            pres,sub,eq
index      memberUid,mail,givenname                         eq,subinitial
index      sambaSID,sambaPrimaryGroupSID,sambaDomainName    eq
index      zoneName,relativeDomainName                 	    eq 
index      dhcpHWAddress,dhcpClassData                      eq

# 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,sambaLMPassword,sambaNTPassword
        by dn="cn=admin,dc=example,dc=com" 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=example,dc=com" write
        by * read

# For Netscape Roaming support, each user gets a roaming
# profile for which they have write access to
#access to dn=".*,ou=Roaming,o=morsnet"
#        by dn="cn=admin,dc=example,dc=com" write
#        by dnattr=owner write

#######################################################################
# Specific Directives for database #2, of type 'other' (can be bdb too):
# Database specific directives apply to this databasse until another
# 'database' directive occurs
#database        <other>

# The base of your directory for database #2
#suffix         "dc=debian,dc=org"

此外,您必须编辑LDAP配置文件。

vi /etc/ldap/ldap.conf

添加以下行:

主机127.0.0.1
base dc = example,dc = com

之后重新启动LDAP服务器。

/etc/init.d/slapd restart
赞(52) 打赏
未经允许不得转载:优客志 » 系统运维
分享到:

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏