歡迎您光臨本站 註冊首頁

Centos5.5+openldap+pure-ftpd+apache環境配置

←手機掃碼閱讀     火星人 @ 2014-03-03 , reply:0

Centos5.5+openldap+pure-ftpd+apache環境配置

Centos5.5+openldap+pure-ftpd+apache環境配置

                         之前本人寫過一篇CentOS5.5 apache+svn+ldap+ldapphpadmin配置方法

                         鏈接為http://bbs.linuxtone.org/thread-9366-1-1.html

                         ldap的配置方法請參考此貼

安裝pure-ftpd

tar -zxvf pure-ftpd-1.0.30.tar.gz
cd pure-ftpd-1.0.30.tar.gz
./configure --prefix=/usr/local/pure-ftpd \
--without-inetd \
--with-ldap \
--with-altlog \
--with-puredb \
--with-throttling \
--with-ratios \
--with-quotas \
--with-ftpwho \
--with-peruserlimits \
--with-language=english \
--with-tls \
--with-certfile=/usr/local/pure-ftpd/etc/pure-ftpd.pem \
--with-rfc2640

make && make install

cp ./pureftpd.schema /etc/openldap/schema/
mkdir /usr/local/pure-ftpd/etc
cp ./configuration-file/pure-ftpd.conf /usr/local/pure-ftpd/etc/
cp ./configuration-file/pure-config.pl /usr/local/pure-ftpd/sbin/
chmod 755 /usr/local/pure-ftpd/sbin/pure-config.pl
cp ./pureftpd-ldap.conf /etc/openldap/

把pure-ftpd加入系統服務
cd contrib/
vim redhat.init
修改次處
fullpath=/usr/local/pure-ftpd/sbin/$prog
$fullpath /usr/local/pure-ftpd/etc/pure-ftpd.conf --daemonize
   wq 保存推出
cp ./redhat.init /etc/rc.d/init.d/pftpd
chmod 755 /etc/rc.d/init.d/pftpd
chkconfig --add pftpd
chkconfig --level 3 pftpd

將pureftp.schema里的Issue,FTPState 的屬性改為了boolean型
log_ldap.c里沒有按schema的boolean型比較,而且用"enabled" 和 "disabled"
來作為FTPState的值來比較

修改後為
  attributetype ( 1.3.6.1.4.1.6981.11.3.7 NAME 'FTPStatus'
        DESC 'Account status: enabled or disabled'
        EQUALITY booleanMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE )

   接下來修改openldap的主配置文件使其支持pure-ftpd的驗證


vim /etc/openldap

include  /etc/openldap/schema/core.schema
include  /etc/openldap/schema/pureftpd.schema
include  /etc/openldap/schema/cosine.schema
include  /etc/openldap/schema/inetorgperson.schema
include  /etc/openldap/schema/nis.schema
include  /etc/openldap/schema/corba.schema
include  /etc/openldap/schema/dyngroup.schema
include  /etc/openldap/schema/java.schema
include  /etc/openldap/schema/misc.schema
include  /etc/openldap/schema/openldap.schema
include  /etc/openldap/schema/ppolicy.schema

下一步修改pure-ftpd的配置文件
vim /usr/local/pure-ftpd/etc/pure-ftpd.conf
NoAnonymous                 yes   不允許匿名用戶訪問只允許認證的用戶訪問


LDAPConfigFile /etc/openldap/pureftpd-ldap.conf  指定purefptd-ldap.conf的文件路徑

AnonymousCantUpload yes                          不允許匿名用戶上傳文件

CreateHomeDir               yes                  沒有目錄的情況下自動創建目錄(測試)



修改pureftpd-ldap.conf讓pure-ftpd去ldap伺服器去驗證用戶是否合法

vim /etc/openldap/pureftpd-ldap.conf
LDAPServer localhost
LDAPPort   389
LDAPBaseDN dc=ismole,dc=com
LDAPBindDN cn=Manager,dc=ismole,dc=com
LDAPBindPW *******這裡輸入Manager的密碼要求是明文的請注意!!!!!!

啟動服務
/usr/local/apache2/bin/apachectl -k start
service ldap start
service pftpd start

然後在ldap中添加一個用戶
vim /tmp/user.ldif
dn: uid=tom,ou=sys.list,dc=ismole,dc=com
uid: tom
cn: tom
objectClass: account
objectClass: posixAccount
objectClass: top
userPassword: {SSHA}Q4n0xXrCnOHM2dP8QE7C3vscNnfxXf8k
uidNumber: 100
gidNumber: 100
homeDirectory: /home/tom
wq 保存推出
ldapadd -x -D "cn=Manager,dc=ismole,dc=com" -W -f /tmp/users.ldif
這裡注意兩點1 就是uid和gid要大於100 我沒找到為什麼要這樣應該是許可權的問題
            2 就是ldap的目錄結構我重新設計了一下這裡以本機環境為主
然後輸入 Manager的密碼
顯示
Enter LDAP Password:
adding new entry "uid=tom,ou=dev,ou=sys.list,dc=ismole,dc=com"  就說明你添加用戶成功了

打開ftp軟體 輸入地址 用戶名 密碼就可以登陸ftp伺服器了

至此openldap 結合svn 和 ftp的服務就告一段落了
有問題的同學可以給我留言大家討論共同進步
後續我會陸續推出 結合ldap的其它相關服務

[火星人 ] Centos5.5+openldap+pure-ftpd+apache環境配置已經有860次圍觀

http://coctec.com/docs/service/show-post-1875.html