Ftp

配置 proftpd 和 mod_ldap.c 查詢不起作用 - 有什麼想法嗎?

  • October 19, 2017

我正在嘗試在 Active Directory 基礎上獲取 ProFTPD 到 LDAP 身份驗證。我仍然無法弄清楚我的配置可能有什麼問題,因為執行 LDAP 查詢ldapsearch似乎很好

配置文件

/etc/proftpd.conf

# This is the ProFTPD configuration file
ServerName                      "FTP and Ldap"
ServerType                      standalone
ServerAdmin                     nicolas@domain.com.br
AuthOrder                       mod_ldap.c
LoadModule                      mod_ldap.c
DefaultServer                   on
ShowSymlinks                    on
RootLogin                       off
UseIPv6                         off
AllowLogSymlinks                on
IdentLookups                    off
UseReverseDNS                   off
Umask                           077
User                            ftp
Group                           ftp
DefaultRoot                     /home/ftp/%u/
DefaultChDir                    ftp
RequireValidShell               off
UseFtpUsers                     off
SystemLog                       /var/log/proftpd/proftpd.log
TransferLog                     /var/log/proftpd/xferlog
DefaultTransferMode             binary

<IfModule mod_ldap.c>
       LDAPServer                      domaincontroller.domain.net
       LDAPAttr                        uid sAMAccountName
       LDAPDNInfo                      cn=linux.ldap,ou=users,ou=resources,dc=domain,dc=net password
       LDAPAuthBinds                   on
       LDAPDoAuth                      on "dc=domain,dc=net" (&(sAMAccountName=%v)(objectclass=User))
       LDAPQueryTimeout                15

       LDAPGenerateHomedir             on
       LDAPGenerateHomedirPrefix       /home/ftp

       #uid e guid of the local global user
       LDAPDefaultUID                  14
       LDAPDefaultGID                  50
       LDAPForceDefaultUID             on
       LDAPForceDefaultGID             on
</IfModule>

<Directory /*>
       AllowOverwrite                  on
</Directory>

Proftpd -nd10 ->“搜尋失敗”

在調試級別為 10 的情況下執行 proftpd,我在與我的使用者 ( nicolas) 進行身份驗證時得到了這些日誌:

proftpd -nd10


dispatching CMD command 'PASS (hidden)' to mod_auth
mod_ldap/2.8.22: generated filter dc=domain,dc=net from template dc=domain,dc=net and value nicolas
mod_ldap/2.8.22: generated filter (&(sAMAccountName=nicolas)(objectclass=User)) from template (&(sAMAccountName=%v)(objectclass=User)) and value nicolas
mod_ldap/2.8.22: attempting connection to ldap://domaincontroller.domain.net/
mod_ldap/2.8.22: set protocol version to 3
mod_ldap/2.8.22: connected to ldap://domaincontroller.domain.net/
mod_ldap/2.8.22: successfully bound as cn=linux.ldap,ou=users,ou=resources,dc=domain,dc=net password
mod_ldap/2.8.22: set dereferencing to 0
mod_ldap/2.8.22: set query timeout to 15s
mod_ldap/2.8.22: pr_ldap_search(): LDAP search failed: Operations error

ldapsearch 工作

ldapsearch另一方面工作得很好:

[root@ftp2 ~]# ldapsearch -x -W -D "cn=linux.ldap,ou=users,ou=resources,dc=domain,dc=net" -h domaincontroller.domain.net -b "dc=domain,dc=net" -LLL "(SAMAccountName=nicolas)"
Enter LDAP Password: 

dn: CN=Nicolas XXXXXXX,OU=XXXXXXX,OU=XXXXXXX,OU=XXXXXXX,DC=XXXXXXX,DC=XXXXXXX
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: user
cn: Nicolas XXXXXXX
sn: XXXXXXX
description:XXXXXXX
givenName: XXXXXXX
distinguishedName:

有什麼線索嗎?

為此,URL 必須符合RFC 2255,並且使用 Proftpd 查詢僅在它們被 OU 過濾時才有效。這些查詢在 LDAP 根級別不起作用。

LDAPServer ldap://domaincontroller.domain.net:389/??sub

組織統一:

LDAPDoAuth on "OU=OFFICE,dc=domain,dc=net" (&(sAMAccountName=%v)(objectclass=User))

目錄裡面的Umask。限制只是為了安全

<Directory />
Umask 022 022
AllowOverwrite on
       <Limit MKD XMKD CDUP XCUP CWD XCWD RMD XRMD>
       DenyAll
       </Limit>
</Directory>

引用自:https://unix.stackexchange.com/questions/79049