Cara Membuat Virtual Mail, FTP Hosting dengan iRedMail dan Pure-FTPd
Selasa, 14 Januari 2020

Bagi anda IT administrator, dan menggunakan Linux server sebagai platform perusahaan anda, maka anda membutuhkan solusi instan ini, iRedMail adalah sebuah shell script yang akan membantu anda dengan mudah men deploy solusi email dengan fitur yang full dengan waktu kurang dari 2 menit. Semenjak iRedMail mencapai versi 0.5, kini program powefull ini telah mensupport Debian 5.0.1 dan Ubuntu 8.04 & Ubuntu 9.04 (keduanya untuk platform i386 dan x86_64). iRedMail kali ini telah mensupport OpenLDAP dan MySQL sebagai backends untuk menyimpan virtual domain dan user.
OpenLDAP yang menjadi backend dari iRedMail akan memudahkan anda untuk mengintegrasikan semua jenis aplikasi. guide berikut ini memperlihatkan anda bagaimana mengintegrasikan pure-ftpd kedalam iRedMail ldap backend pada CentOS 5.x, password akan disimpan didalam ldap dan anda dapat merubah password melalui webmail. Tutorial menguji berdasarkan CentOS 5.3, dengan pilihan setting minimum pada CentOS 5.3, install iRedMail 0.5 RC2 dan pilih OpenLDAP sebagai backend, seperti yang ada pada tutorial berikut ini:
- iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV, SpamAssassin, Amavisd (Debian 5.0.1)
- iRedMail: Build A Full-Featured Mail Server With LDAP, Postfix, RoundCube, Dovecot, ClamAV,SpamAssassin, DKIM, SPF On CentOS 5.x
1. Install Pure-FTPd
Anda dapat menggunakan rpmforge yum repository untuk menginstall pure-ftpd.
1
2
| rpm -Uhv http: //apt .sw.be /redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0 .3.6-1.el5.rf.i386.rpm # <-- untuk i386 rpm -Uhv http: //apt .sw.be /redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0 .3.6-1.el5.rf.x86_64.rpm # <-- untuk x86_64 |
Install pure-ftpd:
1
| yum install pure-ftpd |
2. Konfigurasi Pure-FTPd
Konfigurasi Default :
- /etc/pure-ftpd/pure-ftpd.conf
- /etc/pure-ftpd/pureftpd-ldap.conf
Setting di /etc/pure-ftpd/pure-ftpd.conf
Pastikan anda membuat opsi CreateHomeDir dan LDAPConfigFile sudah aktif dengan bentuk seperti ini:
Pastikan anda membuat opsi CreateHomeDir dan LDAPConfigFile sudah aktif dengan bentuk seperti ini:
1
2
3
4
5
| vi /etc/pure-ftpd/pure-ftpd .conf CreateHomeDir yes LDAPConfigFile /etc/pure-ftpd/pureftpd-ldap .conf Set cn=vmail password |
vmail password dibentuk secara random saat dilakukan instalasi iredmail. anda dapat menemukan password ini pada direktori:
- /etc/postfix/ldap_virtual_mailbox_domains.cf:
- vi /etc/postfix/ldap_virtual_mailbox_domains.cf
1
2
| bind_dn = cn=vmail, dc =example, dc =com bind_pw = kZ6uB29mViWKWI9lOH3cGnF7z3Dw3B #cn=vmail password |
Konfigurasi LDAP setting di /etc/pure-ftpd/pureftpd-ldap.conf
1
2
3
4
5
6
7
8
9
10
11
| vi /etc/pure-ftpd/pureftpd-ldap .conf LDAPServer localhost LDAPPort 389 LDAPBaseDN o=domains, dc =example, dc =com LDAPBindDN cn=vmail, dc =example, dc =com LDAPBindPW kZ6uB29mViWKWI9lOH3cGnF7z3Dw3B #cn=vmail password LDAPDefaultUID 500 # <- UID of 'vmail' user. LDAPDefaultGID 500 # <- GID of 'vmail' user. LDAPFilter (&(objectClass=PureFTPdUser)(mail=L)(FTPStatus=enabled)) LDAPHomeDir FTPHomeDir # <- This is new attribute, we will add it |
3. Konfigurasi LDAP
Setting struktur schema
Ada 2 cara menemukan pureftpd schema yang anda dapat pilih salah satu
- Download schema yang telah di modifikasi oleh iredmail.
- Dapatkan schema yang berada pada paket pure-ftpd-1.0.22 dan rubah.
Download the schema yang sudah dimodif iredmail:
1
| wget http: //iredmail .googlecode.com /hg/extra/pureftpd .schema -P /etc/openldap/schema/ |
Dapatkan schema dari pure-ftpd-1.0.22:
1
2
3
4
| cd /tmp/ wget http: //download .pureftpd.org /pub/pure-ftpd/releases/pure-ftpd-1 .0.22. tar .bz2 tar xjf pure-ftpd-1.0.22. tar .bz2 cp pure-ftpd-1.0.22 /pureftpd .schema /etc/openldap/schema/ |
Rubah /etc/openldap/schema/pureftpd.schema
Kita hanya perlu menambahkan 1 buah attribut ‘FTPHomeDir’ sebelum mendefinisikan objectclass yang tersimpan di direktori user.
Kita hanya perlu menambahkan 1 buah attribut ‘FTPHomeDir’ sebelum mendefinisikan objectclass yang tersimpan di direktori user.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| vi /etc/openldap/schema/pureftpd .schema attributetype ( 1.3.6.1.4.1.6981.11.3.9 NAME 'FTPgid' DESC 'System uid (overrides gidNumber if present)' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) # Add new attributetype FTPHomeDir. attributetype ( 1.3.6.1.4.1.6981.11.3.10 NAME 'FTPHomeDir' DESC 'FTP directory' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) ## New Pure-FTPd object type objectclass ( 1.3.6.1.4.1.6981.11.2.3 NAME 'PureFTPdUser' DESC 'PureFTPd user with optional quota, throttling and ratio' SUP top AUXILIARY # <-- Add this line. MAY ( FTPStatus $ FTPQuotaFiles $ FTPQuotaMBytes $ FTPUploadRatio $ FTPDownloadRatio $ FTPUploadBandwidth $ FTPDownloadBandwidth $ |
Rubah /etc/openldap/slapd.conf
1
| vi /etc/openldap/slapd .conf |
masukan pureftpd.schema setelah iredmail.schema:
1
2
3
| include /etc/openldap/schema/iredmail .schema include /etc/openldap/schema/pureftpd .schema # <-- Add this line. FTPuid $ FTPgid $ FTPHomeDir ) ) # <-- Add $ FTPHomeDir |
Tambahkan index untuk attribute dari pureftpd.schema:
1
2
3
4
5
6
7
8
9
10
11
12
13
| # Default index. # index objectClass eq ,pres index ou,cn,mail,surname,givenname,telephoneNumber eq ,pres,sub index uidNumber,gidNumber,loginShell eq ,pres index uid,memberUid eq ,pres,sub index nisMapName,nisMapEntry eq ,pres,sub # <-- Add the below #Index for FTP attrs. index FTPQuotaFiles,FTPQuotaMBytes eq ,pres index FTPUploadRatio,FTPDownloadRatio eq ,pres index FTPUploadBandwidth,FTPDownloadBandwidth eq ,pres |
4. Buat FTP Home Dir
FTP data akan disimpan di /home/ftp/. buatlah /home/ftp/, dimana owner di set sebagai root.
1
2
3
| mkdir /home/ftp/ ls -dl /home/ftp drwxr-xr-x 3 root root 4096 Jun 7 20:18 /home/ftp/ |
5. Restart OpenLDAP service untuk mengaktifkan pureftpd.schema
1
2
| /etc/init .d /ldap restart /etc/init .d /pure-ftpd restart |
Cek kalau pure-ftpd sudah running:
1
2
3
4
5
| netstat -ntlp | grep pure-ftpd tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 2062 /pure-ftpd (SERVER) tcp 0 0 :::21 :::* LISTEN 2062 /pure-ftpd (SERVER) index FTPStatus,FTPuid,FTPgid, |