Virtual Mail And FTP Hosting With iRedMail And Pure-FTPd On FreeBSD - Page 2
5 Restart OpenLDAP service to make pureftpd.schema work
# /usr/local/etc/rc.d/slapd restart
Stopping slapd.
Waiting for PIDS: 89782.
Starting slapd.
# /usr/local/etc/rc.d/pure-ftpd restart
pureftpd not running? (check /var/run/pure-ftpd.pid).
Starting pureftpd.
Running: /usr/local/sbin/pure-ftpd -g/var/run/pure-ftpd.pid
-A -lldap:/usr/local/etc/pureftpd-ldap.conf -j -c50 -B -C8 -D
-fftp -H -I15 -L10000:8 -m4 -s -U133:022 -u100 -k99 -Z
Make sure pure-ftpd is running:
mail# /usr/local/etc/rc.d/pure-ftpd status
pureftpd is running as pid 99905.
6 Add LDAP Attributes And Values For New Users
You can use the iredmail tools to quickly create a new user including the PureFTP attributes and values.
cd /root/iRedMail-0.6.0-beta2/tools
vi create_mail_user_OpenLDAP.sh
LDAP_SUFFIX="dc=example,dc=com" # <- Change the LDAP suffix BINDPW='passwd' # <- The user cn=manager,dc=example,dc=com password PUREFTPD_INTEGRATION='YES' # <- Change form NO to YES,enable the pureftp integration |
Run the script to create the users user1 and user2. By default, the default password is same as the user name.
bash create_mail_user_OpenLDAP.sh example.com user1 user2
adding new entry "ou=Users,domainName=example.com,o=domains,dc=example,dc=com"
ldapadd: Already exists (68)
adding new entry "ou=Groups,domainName=example.com,o=domains,dc=example,dc=com"
ldapadd: Already exists (68)
adding new entry "ou=Aliases,domainName=example.com,o=domains,dc=example,dc=com"
ldapadd: Already exists (68)
adding new entry "[email protected],ou=Users,domainName=example.com,o=domains,dc=example,dc=com"
adding new entry "[email protected],ou=Users,domainName=example.com,o=domains,dc=example,dc=com"
7 Testing
You can use a Windows FTP client or the Linux ftp client lftp for testing.
lftp localhost
lftp localhost:~> debug 4
lftp localhost:~> login [email protected] user1 # <-- input the username and password
lftp [email protected]@localhost:~> ls
---- Connecting to localhost (127.0.0.1) port 21
<--- 220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
<--- 220-You are user number 1 of 50 allowed.
<--- 220-Local time is now 13:49. Server port: 21.
<--- 220-IPv6 connections are also welcome on this server.
<--- 220 You will be disconnected after 15 minutes of inactivity.
<--- 211-Extensions supported:
<--- EPRT
<--- IDLE
<--- MDTM
<--- SIZE
<--- REST STREAM
<--- MLST type*;size*;sizd*;modify*;UNIX.mode*;UNIX.uid*;UNIX.gid*;unique*;
<--- MLSD
<--- AUTH TLS
<--- PBSZ
<--- PROT
<--- UTF8
<--- ESTA
<--- PASV
<--- EPSV
<--- SPSV
<--- ESTP
<--- 211 End.
<--- 500 This security scheme is not implemented
<--- 200 OK, UTF-8 enabled
<--- 200 MLST OPTS type;size;sizd;modify;UNIX.mode;UNIX.uid;UNIX.gid;unique;
<--- 331 User [email protected] OK. Password required
<--- 230-Your bandwidth usage is restricted
<--- 230-User [email protected] has group access to: vmail
<--- 230-You must respect a 1:5 (UL/DL) ratio
<--- 230-OK. Current restricted directory is /
<--- 230-0 files used (0%) - authorized: 50 files
<--- 230 0 Kbytes used (0%) - authorized: 10240 Kb
<--- 257 "/" is your current location
<--- 227 Entering Passive Mode (127,0,0,1,219,31)
<--- 150 Accepted data connection
drwxr-xr-x 2 1002 vmail 512 Jan 31 13:49 .
drwxr-xr-x 2 1002 vmail 512 Jan 31 13:49 ..
-rw------- 1 1002 vmail 0 Jan 31 13:49 .ftpquota
<--- 226-Options: -a -l
<--- 226 3 matches total
8 Troubleshooting
Eable ldap logging, edit /usr/local/etc/openldap/slapd.conf:
loglevel 256 # <-- change from 0 to 256
|
Restart pure-ftpd, syslog, and openldap:
/usr/local/etc/rc.d/pure-ftpd restart
/etc/rc.d/syslogd restart
/usr/local/etc/rc.d/slapd restart
Monitor /var/log/pureftpd.log and /var/log/openldap.log for troubleshooting:
tail -0f /var/log/openldap.log
# tail -0f /var/log/openldap.log
Feb 3 04:11:59 mail slapd[993]: conn=1002 fd=10 ACCEPT from IP=127.0.0.1:54551 (IP=0.0.0.0:389)
Feb 3 04:11:59 mail slapd[993]: conn=1002 op=0 BIND dn="cn=vmail,dc=example,dc=com" method=128
Feb 3 04:11:59 mail slapd[993]: conn=1002 op=0 BIND dn="cn=vmail,dc=example,dc=com" mech=SIMPLE ssf=0
Feb 3 04:11:59 mail slapd[993]: conn=1002 op=0 RESULT tag=97 err=0 text=
Feb 3 04:11:59 mail slapd[993]: conn=1002 op=1
SRCH base="o=domains,dc=example,dc=com" scope=2 deref=0
filter="(&(objectClass=PureFTPdUser)([email protected])(FTPStatus=enabled))"
Feb 3 04:11:59 mail slapd[993]: conn=1002 op=1
SRCH attr=FTPHomeDir uidNumber FTPuid gidNumber FTPgid userPassword
loginShell FTPStatus FTPQuotaFiles FTPQuotaMBytes FTPDownloadRatio
FTPUploadRatio FTPDownloadBandwidth FTPUploadBandwidth
Feb 3 04:11:59 mail slapd[993]: conn=1002 op=1 SEARCH RESULT tag=101 err=0 nentries=1 text=
Feb 3 04:11:59 mail slapd[993]: conn=1002 op=2 UNBIND
Feb 3 04:11:59 mail slapd[993]: conn=1002 fd=10 closed
tail -0f /var/log/xferlog
# tail -0f /var/log/xferlog
Jan 31 13:38:15 mail pure-ftpd: ([email protected]) [INFO] New connection from 127.0.0.1
Jan 31 13:38:15 mail pure-ftpd: ([email protected]) [INFO] [email protected] is now logged in
9 Links
- Discussion forum: http://www.iredmail.org/forum/
- Project home page: http://code.google.com/p/iredmail/
- /usr/local/etc/pureftpd-ldap.conf sample files: click here