⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme.ldap

📁 功能强大的ftp服务器源代码
💻 LDAP
字号:
If you never heard about LDAP before, *DON'T* enable LDAP support inPure-FTPd. LDAP is useless if you don't have to manage many shared accounts.But well... if you want to learn about LDAP anyway, here's a good startingpoint: http://www.openldap.org/       ------------------------ LDAP SUPPORT ------------------------Since release 0.95, Pure-FTPd has a built-in support for LDAP directories.When LDAP is enabled, all account info is fetched from a central LDAPdirectory.To compile the server with LDAP support, you first have to build and installOpenLDAP. OpenLDAP is freely available from http://www.openldap.org/ andbinary packages are included in many major distributions. But if you choosea binary form, don't forget to also install the development packages if theyare available separately.Then, configure Pure-FTPd with --with-ldap and your favorite extra gadgets:    ./configure --with-ldap --with-cookie --with-throttling --with-ratiosIf your LDAP libraries are installed in a special path, you can specify itlike this:    ./configure --with-ldap=/usr/local/openldapIn this example, headers (ldap.h and lber.h files) will be searched in/usr/local/openldap/include, while related libraries will be searched in/usr/local/openldap/lib .Then, install the server as usual:                                 make install  ------------------------ LDAP CONFIGURATION FILE ------------------------    Before running the server, you have to create a configuration file. Why aconfiguration file instead of simple command-line options? you may ask.Because for security reasons, you may want to hide how to connect to yourLDAP server. And as command-line options can be discovered by local users(with 'ps auxwww' for instance), it's more secure to use a configurationfile for sensitive data. Keep the file only readable by root (chmod 600) .Here's a sample configuration file:LDAPServer ldap.c9x.orgLDAPPort   389LDAPBaseDN cn=Users,dc=c9x,dc=orgLDAPBindDN cn=Manager,dc=c9x,dc=orgLDAPBindPW r00tPaSsw0rDLDAPDefaultUID 500LDAPDefaultGID 100Well... the keywords should be self-explanatory, but here we go for somedetails anyway:- LDAPServer is the LDAP server name (hey!) . It defaults to 'localhost'.- LDAPPort is the connecton port. It defaults to 389, the standard port.- LDAPBaseDN is the search starting point for users accounts. Your tree musthave posixAccount objects under that node.- LDAPBindDN is the DN we should bind the server for simple authentication.If you don't need authentication (ie. anonymous users can browse that partof the LDAP directory), just remove that line.- LDAPBindPW is the plaintext password to bind the previous DN. Theconfiguration file should be only readable by root if you are usingLDAPBindDN/LDAPBindPW.- LDAPDefaultUID and LDAPDefaultGID are default values for objects withoutany entry for them.- LDAPFilter is the filter to use in order to find the object to authenticateagainst. The special sequence \L is replaced with the login of the user. Thedefault filter is (&(objectClass=posixAccount)(uid=\L)) .- LDAPHomeDir is the attribute to get the home directory ('homeDirectory' bydefault) .- LDAPVersion is the protocol version to use. Version 3 is recommended andneeded with OpenLDAP servers. It is the default.In fact, the only mandatory keyword is LDAPBaseDN. Other keywords areoptional and defaults are ok for local testing.Save the configuration file anywhere. Let's say /etc/pureftpd-ldap.conf .Then, you have to run the pure-ftpd command with '-l ldap:' (it's an 'ell'not a 'one') followed by the path of that configuration file. Here's anexample with tcpserver:tcpserver -DHRl0 0 21 /usr/local/bin/pure-ftpd -l ldap:/etc/pureftpd-ldap.conf &You can mix different authentication methods. For instance, if you want touse system (/etc/passwd) accounts when an account is not found in a LDAPdirectory, use -l ldap:/etc/pureftpd-ldap.conf -l unix      ------------------------ THE LDAP SCHEMA ------------------------Pure-FTPd uses the standard 'posixAccount' class to locate accounts. WithOpenLDAP, that class is defined in the 'nis' schema.FTP login names should match 'uid' attributes of 'posixAccount' instances.When an user logs in as 'joe', the following filter is used to locate Joe'saccount:                   (&(objectClass=posixAccount)(uid=joe))Here's a sample entry in LDIF format:dn: cn=Joe,dc=rtchat,dc=comobjectClass: posixAccountcn: Joeuid: joeuidNumber: 500gidNumber: 100homeDirectory: /home/joeuserPassword: {crypt}wl6AOU6KgWUz6'userPassword' is the hashed password, with the system 'crypt' function,MD5, SHA, SMD5 or SSHA digests. Modern LDAP clients should handle all,anyway (or get GQ from http://biot.com/gq/) .SSHA is believed to be the most secure one-way hashing method, but it's alsothe slowest and it can be time-consuming if you're accepting a lot ofusers.Please note that a login ('uid' field) can only contains common characters:A...Z, a...z, 0...9, -, ., _, space and ' . For security purposes, othercharacters are forbidden.If you don't want to use posixAccount objects, you can edit src/log_ldap.hto customize attribute names.  ----------- EXTENDED LDAP SCHEMA (QUOTAS, THROTTLING, RATIOS) ----------To enable quotas, download/upload rate throttling and/or download/uploadratios, an extended LDAP schema is needed.  This modified schema also allowsyou to completely enable and disable users' FTP access by simply changingthe "FTPStatus" field in their LDAP entry.Simply copy the included pureftpd.schema file to your OpenLDAP schemadirectory (/usr/local/etc/openldap/schema in this example) and add theappropriate line to your slapd.conf, like so:include         /usr/local/etc/openldap/pureftpd.schemaThis schema defines a new objectClass, PureFTPdUser, which contains the*OPTIONAL* status, quota, throttling and ratio fields as in the examplebelow:dn: uid=Ichiro,dc=gmo,dc=jpobjectClass: PureFTPdUserobjectClass: posixAccountcn: Ichirouid: IchirouidNumber: 888gidNumber: 888homeDirectory: /home/ichirouserPassword: {crypt}$1$w58NLo5z$NHhr6GzSPw0qxaxs3PAaK/FTPStatus: enabledFTPQuotaFiles: 50FTPQuotaMBytes: 10FTPDownloadBandwidth: 50FTPUploadBandwidth: 50FTPDownloadRatio: 5FTPUploadRatio: 1The example is mostly self-explanatory. FTPQuotaMBytes is the quota size inmegabytes. FTPDownloadBandwidth and FTPUploadBandwidth are in KB/sec.FTPStatus should be either "enabled" or "disabled". If the FTPStatus fieldexists and is set to anything except "enabled", the user will not bepermitted to log in. If the FTPStatus field does not exist, the user *WILL*be allowed to log in as normal, to allow LDAP users without the PureFTPdUserobjectClass.There are also optional FTPuid and FTPgid attributes. If present, they willoverride uidNumber and gidNumber values, so that you can have differentuid/gid mapping for FTP and for other services.Please note that all of the FTP* LDAP fields are optional for thePureFTPdUser objectClass. You can have a user with just FTPQuotaFiles andFTPQuotaMBytes set, for example, if you only wish to enforce a quota, butnot throttle the user's bandwidth or enforce ratios.Of course, you must make sure to enable the features you wish to use atcompile time (--with-quotas, --with-throttling, --with-ratios) .      ------------------------ ANONYMOUS USERS ------------------------If you want to accept anonymous users on your FTP server, you don't need tohave any 'ftp' user in the LDAP directory. But you need to have a system'ftp' account on the FTP server.        ------------------------ ROOT USERS ------------------------If an LDAP user entry has a root (0) uidNumber and/or gidNumber, Pure-FTPdwill refuse to log him in.Without this preventive restriction, if your LDAP server ever getscompromised, the attacker could also easily compromise the FTP server.          -Frank DENIS <j@pureftpd.org>.          -Ben Gertzfield <che@debian.org.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -