经过几天的尝试,终于将 PureFtpd 与 OpenLDAP 集成好了。

集成所需要的版本 如题:

PureFTPd 1.0.21
OpenLDAP 2.3.20

先说一下这种集成的需求根据,我在公司里部署了LDAP服务器,作为公司各个应用的认证服务器,以实现单点登录。FTP服务器的用户和认证也需要与LDAP服务器集成。

OpenLDAP的安装网上已经有很多例子和文档了,这里就不多说了。重点需要注意的是 PureFTPd的编译安装,PureFTPd的安装网上和该软件包里的README文档也说得很仔细了,但与OpenLDAP2.3.10集成有问题。

主要有2个问题,都与FTPState有关:
(1)pureftp.schema里的Issue,FTPState 的属性改为了boolean型,schema的语法有个错误。
(2)log_ldap.c里没有按schema的boolean型比较,而且用"enabled" 和 "disabled" 来作为FTPState的值来比较。

修正这两个问题,集成就没问题了。

编译PureFTPd 如下:

# ./configure --with-ldap=/usr/local/openldap --with-quotas --with-throttling --with-ratios

# make; make check; make install;

然后没配置好 pureftpd-ldap.conf 启动PureFtpd就可以了。

相关文件如下:

pureftpd.schema

PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装attributetype ( 1.3.6.1.4.1.6981.11.3.7 NAME 'FTPStatus'
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装        DESC 'Account status: enabled or disabled'
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装        EQUALITY booleanMatch
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装        SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE )

pure-ftpd.conf

PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装# LDAP configuration file (see README.LDAP)
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装LDAPConfigFile                /usr/local/etc/pureftpd-ldap.conf

pureftpd-ldap.conf

PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装# Optional : name of the LDAP server. Default : localhost
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装LDAPServer your_ldap_hostname
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装# Optional : server port. Default : 389
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装LDAPPort   389
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装# Mandatory : the base DN to search accounts from. No default.
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装LDAPBaseDN ou=ftp,dc=your_company
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装# Optional : who we should bind the server as.
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装#            Default : binds anonymously
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装LDAPBindDN cn=admin,dc=your_company
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装# Password if we don't bind anonymously
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装# This configuration file should be only readable by root
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装LDAPBindPW password
PureFtpd 1.0.21 + OpenLDAP 2.3.20 安装

可以配置为关闭匿名访问。

启动PureFTPd

# pure-config.pl pure-ftpd.conf

登录即可

相关文章:

  • 2022-01-13
  • 2021-12-03
  • 2021-08-12
  • 2021-06-07
  • 2021-12-06
  • 2022-12-23
猜你喜欢
  • 2021-12-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-27
  • 2022-02-15
  • 2021-07-22
相关资源
相似解决方案