OpenLDAP應用之帳號集中管理

前言:最近在網上找了很多關於LDAP的文檔(感謝廣大網友的無私奉獻),借鑑這些文檔順利完成了關於OpenLDAP帳號集中管理的配置,寫下如下內容,方便以後回顧.
Linux 發行版中提供的 OpenLDAP 軟件按照一個C/S模型實現了輕量級目錄訪問協議(LDAP)。LDAP 的設計目的是提供一種有效的方法來查找和管理信息。OpenLDAP 軟件和包提供了創建目錄信息樹(一個主要進行讀操作的數據庫)的工具。如何存儲用戶的帳號信息,並修改身份驗證服務來使用 LDAP 獲取所需要的信息。內部細節並不重要,因爲這些工具可以將數據庫的內容以文本格式(LDAP 數據交換格式,LDIF)呈現在您的面前。
LDAP 信息被組織成屬性和值的組合,稱爲 條目(entry)。條目可能會具有必須的屬性或可選屬性。一個條目的屬性必須要遵循 /etc/openldap/schema/ 模式文件中定義的規則。規則包含在條目的 objectclass 屬性中。看一下下面的關係,我們可以看出 posixAccount objectclass 中包含了密碼文件條目的信息(posixAccount userPassword 是文件條目的 base64 編碼)。
LDAP 目錄條目和 Linux 密碼文件之間的關係
配置 LDAP 服務器:
1,軟件包的安裝:
[root@station1 ~]# rpm -qa | grep openldap
openldap-2.3.43-3.el5          #包含 OpenLDAP 配置文件、庫和文檔
openldap-clients-2.3.43-3.el5  #包含客戶端程序,用來訪問和修改 OpenLDAP 目錄
openldap-servers-2.3.43-3.el5  #包含 slapd 和 slurpd 服務器、遷移腳本和相關文件
[root@station1 ~]#

2,OpenLDAP 相關程序簡介:
守護進程:
slapd:主 LDAP 服務器
slurpd:負責與複製 LDAP 服務器保持同步的服務器
對網絡上的目錄進行操作的客戶端程序:
ldapadd:打開一個到 LDAP 服務器的連接,綁定、修改或增加條目
ldapsearch:打開一個到 LDAP 服務器的連接,綁定並使用指定的參數進行搜索
對本地系統上的數據庫進行操作的幾個程序:
slapadd:將以 LDAP 目錄交換格式(LDIF)指定的條目添加到 LDAP 數據庫中
slapcat:打開 LDAP 數據庫,並將對應的條目輸出爲 LDIF 格式

OpenLDAP 的主要服務器配置文件是 /etc/openldap/slapd.conf。
slapd.conf 文件中包括一系列全局配置選項,它們作爲一個整體應用到 slapd 上面,後面是包含數據庫特有信息的數據庫後端定義。如果一行內容是以空格開始的,就認爲它是上一行的延續。空行和以 “#” 字符開頭的註釋行都會被忽略。

3,全局配置信息段的設置:
信息被組織成屬性和值的組合,稱爲條目。條目屬性必須遵循的規則是使用 objectclass 專用屬性進行組織的,
可以在 /etc/openldap/schema/ 模式文件中找到。
對於身份驗證來說,需要使用在 nis.schema 中定義的 posixAccount 和 shadowAccount
如下:
[root@station1 ~]# vim /etc/openldap/slapd.conf
include         /etc/openldap/schema/nis.schema
[root@station1 ~]# vim /etc/openldap/schema/nis.schema
# Object Class Definitions

objectclass ( 1.3.6.1.1.1.2.0 NAME 'posixAccount'
        DESC 'Abstraction of an account with POSIX attributes'
        SUP top AUXILIARY
        MUST ( cn $ uid $ uidNumber $ gidNumber $ homeDirectory )
        MAY ( userPassword $ loginShell $ gecos $ description ) )

objectclass ( 1.3.6.1.1.1.2.1 NAME 'shadowAccount'
        DESC 'Additional attributes for shadow passwords'
        SUP top AUXILIARY
        MUST uid
        MAY ( userPassword $ shadowLastChange $ shadowMin $
              shadowMax $ shadowWarning $ shadowInactive $
              shadowExpire $ shadowFlag $ description ) )
設置日誌選項:
[root@station1 ~]# vim /etc/openldap/slapd.conf
loglevel 296  #日誌級別累加:296 = 256 日誌連接/操作/結果 + 32 搜索過濾器處理 + 8 連接管理如果想要設置更詳細的日誌 man slapd.conf查看loglevel相關說明。
日誌信息會被記錄到 syslogd LOG_LOCAL4 機制中。還需要將下面的內容添加到 /etc/syslog.conf 中,並讓 syslogd 重新讀取自己的配置文件:
#save OpenLDAP log
local4.*                  /var/log/ldap.log
[root@station1 ~]# /etc/init.d/syslog restart
Shutting down kernel logger:                               [  OK  ]
Shutting down system logger:                               [  OK  ]
Starting system logger:                                    [  OK  ]
Starting kernel logger:                                    [  OK  ]
[root@station1 ~]#

設置訪問控制策略access:
access to attrs=shadowLastChange,userPassword
      by self write
      by * auth

access to *
      by * read

access 行定義了誰可以訪問目錄中的內容。我們希望用戶可以修改自己的密碼,並更新自己的 shadow 信息來反映密碼的變化。希望身份驗證程序能夠檢索用戶的密碼。還希望用戶能夠讀取所有其他條目。注意密碼條目是不可讀的,shadow 屬性的惟一用處就是管理密碼的過期問題。

設置database :
database  bdb
suffix  "dc=example,dc=com"
rootdn  "cn=Manager,dc=example,dc=com"
directory /var/lib/ldap
rootpw {MD5}mdjJOTAM6xcRKq2HWRTEDw==
使用新的bdb後端數據庫:
指定後端數據庫需要響應的查詢的 DN 前綴,根前綴應該從自己的網絡域名構建出來(唯一性)。
指定管理 DN,它不用於訪問控制或限制數據庫的操作。也不需要在目錄中爲這個 DN 指定一個條目。
爲具有 rootpw 密碼的管理員使用 DN 可以跳過 ACL 規則中的所有訪問控制(密碼admin,可直接寫明文rootpw admin)。
[root@station1 ~]# echo rootpw `slappasswd -h {MD5}` >> /etc/openldap/slapd.conf
New password:
Re-enter new password:
[root@station1 ~]#
[root@station1 ~]# cp /etc/openldap/DB_CONFIG.example /var/lib/ldap/DB_CONFIG -p

4,配置服務器來使用ldap工具,
例如 ldapadd 和 ldapsearch。ldap 客戶端工具的配置文件是 /etc/openldap/ldap.conf 要在 ldap 服務器上運行這些工具,只需要將該行修改成下面的內容:
#vim /etc/openldap/ldap.conf
BASE dc=example, dc=com
5,設置啓動腳本在級別 2,3 和 5 時啓動 LDAP:
[root@station1 ~]# chkconfig ldap on
[root@station1 ~]# /etc/init.d/ldap start
Checking configuration files for slapd:  config file testing succeeded
                                                           [  OK  ]
Starting slapd:                                            [  OK  ]
[root@station1 ~]# netstat -antulp | grep slapd
tcp        0      0 0.0.0.0:389                 0.0.0.0:*                   LISTEN      6326/slapd
tcp        0      0 :::389                      :::*                        LISTEN      6326/slapd
[root@station1 ~]#

6,遷移用戶和密碼信息
Red Hat 所提供的 openldap-servers 包包含 PADL Software Pty Ltd. 公司的MigrationTools 工具。使用這些工具將數據從 Linux 系統文件(例如/etc/group 和/etc/password)轉換成LDAP LDIF 格式(數據庫信息的一種文本格式的表示)這種格式是行界定、冒號分隔的屬性-值對。有一組 Perl 腳本被安裝到/usr/share/openldap/migration/ 中執行遷移。這些 Perl 腳本的配置信息包含在migrate_common.ph 文件的開頭.這裏只需要修改命名前綴的變量來使用條目的識別名.如下所示:
[root@station1 ~]# cd /usr/share/openldap/migration/
[root@station1 migration]# vim migrate_common.ph
# Default base
$DEFAULT_BASE = "dc=example,dc=com";
創建根項,併爲Group 和 People 等創建下一級的組織單元:
[root@station1 migration]# ./migrate_base.pl > base.ldif
[root@station1 migration]# vim base.ldif
[root@station1 migration]# cat base.ldif
dn: dc=example,dc=com
dc: example
objectClass: top
objectClass: domain

dn: ou=People,dc=example,dc=com
ou: People
objectClass: top
objectClass: organizationalUnit

dn: ou=Group,dc=example,dc=com
ou: Group
objectClass: top
objectClass: organizationalUnit
使用ldapadd 插入條目:
在LDAP 服務器上,使用 OpenLDAP 客戶端工具 ldapadd 將以下條目插入到數據庫中。簡單身份驗證必須要使用 -x 選項指定。在 slapd.conf 中定義的 rootdn 身份驗證識別名是 “cn=Manager,dc=example,dc=com”。對於簡單身份驗證來說,必須使用密碼。選項 -W 強制提示輸入密碼。這個密碼就是在 slapd.conf 文件中指定的rootpw 參數的值。 -f 選項指定包含這些條目的 LDIF 文件:
[root@station1 migration]# ldapadd -x -D "cn=Manager,dc=example,dc=com" -W -f base.ldif
Enter LDAP Password:
adding new entry "dc=example,dc=com"

adding new entry "ou=People,dc=example,dc=com"

adding new entry "ou=Group,dc=example,dc=com"

[root@station1 migration]#

從 /etc/group 中遷移 ldapuser 組:
[root@station1 migration]# grep ldapuser /etc/group > group.in
[root@station1 migration]# ./migrate_group.pl group.in > group.ldif
[root@station1 migration]# cat group.ldif
dn: cn=ldapuser,ou=Group,dc=example,dc=com
objectClass: posixGroup
objectClass: top
cn: ldapuser
userPassword: {crypt}x
gidNumber: 503

[root@station1 migration]# ldapadd -x -D "cn=Manager,dc=example,dc=com" -W -f group.ldif
Enter LDAP Password:
adding new entry "cn=ldapuser,ou=Group,dc=example,dc=com"

[root@station1 migration]#

從 /etc/passwd 中遷移 ldaptest 用戶:
[root@station1 migration]# grep ldaptest /etc/passwd > passwd.in
[root@station1 migration]# ./migrate_passwd.pl passwd.in > passwd.ldif
[root@station1 migration]# ldapadd -x -D "cn=Manager,dc=example,dc=com" -W -f passwd.ldif
Enter LDAP Password:
adding new entry "uid=ldaptest,ou=People,dc=example,dc=com"

[root@station1 migration]#

7,查看OpenLDAP數據庫:
[root@station1 migration]# ldapsearch -x
# extended LDIF
#
# LDAPv3
# base <> with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#

# example.com
dn: dc=example,dc=com
dc: example
objectClass: top
objectClass: domain

# People, example.com
dn: ou=People,dc=example,dc=com
ou: People
objectClass: top
objectClass: organizationalUnit

# Group, example.com
dn: ou=Group,dc=example,dc=com
ou: Group
objectClass: top
objectClass: organizationalUnit

# ldapuser, Group, example.com
dn: cn=ldapuser,ou=Group,dc=example,dc=com
objectClass: posixGroup
objectClass: top
cn: ldapuser
gidNumber: 503

# ldaptest, People, example.com
dn: uid=ldaptest,ou=People,dc=example,dc=com
uid: ldaptest
cn: ldaptest
objectClass: account
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
shadowMax: 99999
shadowWarning: 7
loginShell: /bin/bash
uidNumber: 503
gidNumber: 503
homeDirectory: /home/ldaptest

# search result
search: 2
result: 0 Success

# numResponses: 6
# numEntries: 5
[root@station1 migration]#
配置LDAP 客戶端:
nss_ldap-226-6:包括兩個 LDAP 訪問客戶端:nss_ldap 和 pam_ldap
nss_ldap 是一組C 庫擴展,它允許LDAP 目錄服務器用作一個用戶和組信息的主源
pam_ldap 是一個 Linux-PAM 模塊,它支持身份驗證功能LDAP 身份驗證要想正確地工作,需要配置兩個服務:系統命名服務和身份驗證服務。
系統命名服務(NSS)需要配置爲使用 LDAP 來解析諸如用戶和組帳號之類的資源。例如,在運行命令 ls -l 時,如果某個文件 inode 給出文件的所有者是 “user 501”,那麼命名服務就需要將“uid 501” 解析成用戶名,並在 ls 命令輸出結果中輸出。通常來說,這是通過查找 /etc/passwd 文件中的所有用戶帳號實現的。由於用戶現在都存儲在 LDAP 目錄中,因此係統需要配置成同時對 passwd 文件和 LDAP 目錄中的帳號進行解析。這種功能是通過 /usr/lib/libnss_ldap.so 庫提供的。
身份驗證服務是實際向 LDAP 驗證用戶身份的服務。可插入身份驗證模塊(PAM)提供了本地 Linux 身份驗證服務。下面我們將配置 PAM 先對本地的 /etc/passwd 文件檢查用戶帳號,然後再對 LDAP 服務器進行檢查。PAM LDAP 模塊可以用來將身份驗證重定向到 LDAP 目錄上。/lib/security/pam_ldap.so PAM 模塊提供了 LDAP 身份驗證功能。身份驗證本身是由 PAM 程序執行的,它從身份驗證候選機制中獲取用戶名,將其綁定到 OpenLDAP 服務器上,檢索與這個 uid 條目(用戶名條目)相關的 DN;從身份驗證候選機制中獲取密碼,然後使用這個 DN 和密碼試圖將其綁定到 OpenLDAP服務器上。如果綁定成功,PAM 會報告說這個用戶已經成功通過了 pam_ldap.so 提供的身份驗證測試。根據 PAM 的配置不同,在用戶看到命令行提示符之前可能會執行其他測試。
方法一:
[root@mail ~]# authconfig-tui
用戶測試:
[root@mail ~]# su - ldaptest
su: warning: cannot change directory to /home/ldaptest: No such file or directory
-bash-3.2$
可以正常登錄,只不過本地沒有ldaptest用戶的環境變量,至於這個問題的解決,與我前面的寫的
NIS的方法相同,利用autofs解決。

方法二:
編輯客戶端LDAP 配置文件 /etc/ldap.conf
[root@mail ~]# vim /etc/ldap.conf
host station1.example.com
base dc=example,dc=com
ssl off
修改 /etc/nsswitch.conf、/etc/sysconfig/authconfig 和 /etc/pam.d/system-auth。
[root@mail ~]# vim /etc/nsswitch.conf  (修改以下內容)
passwd:     files ldap
shadow:     files ldap
group:      files ldap
[root@mail ~]# vim /etc/sysconfig/authconfig
[root@mail ~]# grep yes < /etc/sysconfig/authconfig
USELDAPAUTH=yes
USESHADOW=yes
USELDAP=yes
USELOCAUTHORIZE=yes
USECRACKLIB=yes
[root@mail ~]# vim /etc/pam.d/system-auth
#%PAM-1.0
# This file is auto-generated.
# User changes will be destroyed the next time authconfig is run.
auth        required      pam_env.so
auth        sufficient    pam_unix.so nullok try_first_pass
auth        requisite     pam_succeed_if.so uid >= 500 quiet
auth        sufficient    pam_ldap.so use_first_pass
auth        required      pam_deny.so

account     required      pam_unix.so broken_shadow
account     sufficient    pam_localuser.so
account     sufficient    pam_succeed_if.so uid < 500 quiet
account     [default=bad success=ok user_unknown=ignore] pam_ldap.so
account     required      pam_permit.so

password    requisite     pam_cracklib.so try_first_pass retry=3
password    sufficient    pam_unix.so md5 shadow nullok try_first_pass use_authtok
password    sufficient    pam_ldap.so use_authtok
password    required      pam_deny.so

session     optional      pam_keyinit.so revoke
session     required      pam_limits.so
session     [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session     required      pam_unix.so
session     optional      pam_ldap.so
~                                       
[root@mail ~]# su - ldaptest
su: warning: cannot change directory to /home/ldaptest: No such file or directory
-bash-3.2$

配置複製LDAP:

主LDAP設置:
[root@station1 ~]# /etc/init.d/ldap stop
[root@station1 ~]# vim /etc/openldap/slapd.conf
##Replicas
replogfile /var/lib/ldap/replog
replica host=virt1.example.com:389
        binddn="cn=Manager,dc=example,dc=com"
        credentials=admin
        bindmethod=simple
[root@station1 ~]# /etc/init.d/ldap start
Checking configuration files for slapd:  config file testing succeeded
                                                           [  OK  ]
Starting slapd:                                            [  OK  ]
Starting slurpd:                                           [  OK  ]
導出數據庫:
[root@station1 ~]# ldapsearch -x > database.ldif
[root@station1 ~]#

從LDAP配置:
[root@virt1 ~]# yum -y install openldap openldap-clients openldap-servers
[root@virt1 ~]# scp station1:/root/database.ldif .
The authenticity of host 'station1 (192.168.1.254)' can't be established.
RSA key fingerprint is 2e:4f:b5:7b:15:32:e0:f9:f6:dc:72:ec:2b:09:84:fd.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'station1,192.168.1.254' (RSA) to the list of known hosts.
root@station1's password:
database.ldif                                                                           100% 3149     3.1KB/s   00:00   
[root@virt1 ~]#
[root@virt1 ~]# cp /etc/openldap/DB_CONFIG.example /var/lib/ldap/DB_CONFIG -p
導入數據庫:
[root@virt1 ~]# ldapadd -x -D "cn=Manager,dc=example,dc=com" -W -f database.ldif
Enter LDAP Password:
adding new entry "dc=example,dc=com"

adding new entry "ou=People,dc=example,dc=com"

adding new entry "ou=Group,dc=example,dc=com"

adding new entry "uid=user1,ou=People,dc=example,dc=com"

adding new entry "uid=user2,ou=People,dc=example,dc=com"

adding new entry "uid=user3,ou=People,dc=example,dc=com"

adding new entry "uid=user4,ou=People,dc=example,dc=com"

adding new entry "uid=user5,ou=People,dc=example,dc=com"

adding new entry "uid=user6,ou=People,dc=example,dc=com"

adding new entry "cn=user1,ou=Group,dc=example,dc=com"

adding new entry "cn=user2,ou=Group,dc=example,dc=com"

adding new entry "cn=user3,ou=Group,dc=example,dc=com"

adding new entry "cn=user4,ou=Group,dc=example,dc=com"

adding new entry "cn=user5,ou=Group,dc=example,dc=com"

adding new entry "cn=user6,ou=Group,dc=example,dc=com"

ldapadd: no DN specified
[root@virt1 ~]# vim /etc/openldap/slapd.conf

updatedn "cn=Manager,dc=example,dc=com"
updateref ldap://station1.example.com:389

[root@virt1 ~]# /etc/init.d/ldap start
Checking configuration files for slapd:  config file testing succeeded
                                                           [  OK  ]
Starting slapd:                                            [  OK  ]

[root@virt1 ~]#
[root@station1 ~]# /etc/init.d/ldap start
Checking configuration files for slapd:  config file testing succeeded
                                                           [  OK  ]
Starting slapd:                                            [  OK  ]
Starting slurpd:
測試:
[root@station1 migration]# ldapadd -x -D "cn=Manager,dc=example,dc=com" -W -f passwd.ldif
Enter LDAP Password:
adding new entry "uid=admin1,ou=People,dc=example,dc=com"

[root@station1 migration]# ldapadd -x -D "cn=Manager,dc=example,dc=com" -W -f group.ldif
Enter LDAP Password:
adding new entry "cn=admin1,ou=Group,dc=example,dc=com"

[root@station1 migration]#
[root@station1 ~]# tail -f /var/lib/ldap/replog
replica: virt1.example.com:389
time: 1275633007
dn: uid=admin1,ou=People,dc=example,dc=com
changetype: add
uid: admin1
cn: admin1
objectClass: account
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
userPassword:: e2NyeXB0fSQxJFlIL2dGdnFIJG5LNkR0R2lJc1kwUW1jSUNnUXJ3OTA=
shadowLastChange: 14764
shadowMax: 99999
shadowWarning: 7
loginShell: /bin/bash
uidNumber: 511
gidNumber: 512
homeDirectory: /home/admin1
structuralObjectClass: account
entryUUID: 5d185f0a-03ee-102f-862d-e17e784787d4
creatorsName: cn=Manager,dc=example,dc=com
createTimestamp: 20100604063007Z
entryCSN: 20100604063007Z#000000#00#000000
modifiersName: cn=Manager,dc=example,dc=com
modifyTimestamp: 20100604063007Z

tail: /var/lib/ldap/replog: file truncated
replica: virt1.example.com:389
time: 1275633030
dn: cn=admin1,ou=Group,dc=example,dc=com
changetype: add
objectClass: posixGroup
objectClass: top
cn: admin1
userPassword:: e2NyeXB0fXg=
gidNumber: 512
structuralObjectClass: posixGroup
entryUUID: 6a896468-03ee-102f-862e-e17e784787d4
creatorsName: cn=Manager,dc=example,dc=com
createTimestamp: 20100604063030Z
entryCSN: 20100604063030Z#000000#00#000000
modifiersName: cn=Manager,dc=example,dc=com
modifyTimestamp: 20100604063030Z

tail: /var/lib/ldap/replog: file truncated
[root@virt1 ldap]# tail /var/log/ldap.log
Jun  4 14:35:04 virt1 slapd[8765]: conn=2 op=5 RESULT tag=105 err=0 text=
Jun  4 14:35:04 virt1 slapd[8765]: daemon: activity on 1 descriptor
Jun  4 14:35:04 virt1 slapd[8765]: daemon: activity on:
Jun  4 14:35:04 virt1 slapd[8765]:  12r
Jun  4 14:35:04 virt1 slapd[8765]: 
Jun  4 14:35:04 virt1 slapd[8765]: daemon: read active on 12
Jun  4 14:35:04 virt1 slapd[8765]: daemon: epoll: listen=7 active_threads=0 tvp=NULL
Jun  4 14:35:04 virt1 slapd[8765]: daemon: epoll: listen=8 active_threads=0 tvp=NULL
Jun  4 14:35:04 virt1 slapd[8765]: conn=2 op=6 ADD dn="cn=admin1,ou=Group,dc=example,dc=com"
Jun  4 14:35:04 virt1 slapd[8765]: conn=2 op=6 RESULT tag=105 err=0 text=
[root@virt1 ldap]#

配置TLS:
[root@station1 ~]# openssl genrsa -out slapdkey.pem
Generating RSA private key, 512 bit long modulus
.++++++++++++
..................++++++++++++
e is 65537 (0x10001)
[root@station1 ~]# openssl req -new -x509 -key slapdkey.pem -nodes -out slapdcert.pem
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:CN
State or Province Name (full name) [Hubei]:
Locality Name (eg, city) [Wuhan]:
Organization Name (eg, company) [lwh, Ltd.]:
Organizational Unit Name (eg, section) []:ldap
Common Name (eg, your name or your server's hostname) []:station1.example.com
Email Address []:[email protected]
[root@station1 ~]#
[root@station1 ~]# cp slapdkey.pem /etc/openldap/slapdkey.pem
[root@station1 ~]# cp slapdcert.pem /etc/openldap/slapdcert.pem
[root@station1 ~]# chown ldap:ldap /etc/openldap/slapdkey.pem
[root@station1 ~]# chown ldap:ldap /etc/openldap/slapdcert.pem
[root@station1 ~]# chmod 400 /etc/openldap/slapdkey.pem
[root@station1 ~]# chmod 400 /etc/openldap/slapdcert.pem
[root@station1 ~]# cp /etc/pki/tls/cert.pem /etc/openldap/cacerts/cacert.pem
[root@station1 ~]# chown ldap:ldap /etc/openldap/cacerts/cacert.pem
[root@station1 ~]# vim /etc/openldap/slapd.conf

 TLSCipherSuite HIGH:MEDIUM:+SSLv2
 TLSCACertificateFile /etc/openldap/cacerts/cacert.pem
 TLSCertificateFile /etc/openldap/slapdcert.pem
 TLSCertificateKeyFile /etc/openldap/slapdkey.pem

[root@station1 openldap]# /etc/init.d/ldap restart
Stopping slapd:                                            [  OK  ]
Stopping slurpd:                                           [  OK  ]
Checking configuration files for slapd:  config file testing succeeded
                                                           [  OK  ]
Starting slapd:                                            [  OK  ]
Starting slurpd:                                           [  OK  ]

[root@station1 openldap]# netstat -antulp | grep slap
tcp        0      0 0.0.0.0:389                 0.0.0.0:*                   LISTEN      7114/slapd         
tcp        0      0 0.0.0.0:636                 0.0.0.0:*                   LISTEN      7114/slapd         
tcp        0      0 :::389                      :::*                        LISTEN      7114/slapd         
tcp        0      0 :::636                      :::*                        LISTEN      7114/slapd         
[root@station1 openldap]#

 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章