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的其它相关服务
页:
[1]