You are on page 1of 5

Mail server using postfix at fedora 8

Kasus :

/etc/hosts -127 diaktifkan

IP : 192.168.1.1 network : 192.168.1.0/24

Domain : net.id

Hostname(FQDN) : oscar.net.id

1. File named.conf (dicetak tebal perubahan) :

//
// named.caching-nameserver.conf
//
// Provided by Red Hat caching-nameserver package to configure the
// ISC BIND named(8) DNS server as a caching only nameserver
// (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration
files.
//
// DO NOT EDIT THIS FILE - use system-config-bind or an editor
// to create named.conf - edits to this file will be lost on
// caching-nameserver package upgrade.
//

options {
#listen-on port 53 { 127.0.0.1; };
#listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { localhost; 192.168.1.0/24;};
recursion yes;
allow-transfer { localhost; 192.168.1.0/24;};
allow-recursion { localhost; 192.168.1.0/24;};
};

controls { inet 127.0.0.1 allow { localhost; } keys {rndckey;};


};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};

view "internal" {
match-clients {
localhost;
192.168.1.0/24;
};

zone "." IN {
type hint;
file "named.ca";
};

zone "net.id" IN {
type master;
file "net.id.db";
allow-update { none; };
};

zone "1.168.192.in-addr.arpa" IN {
type master;
file "net.id.rev.db";
allow-update { none; };
};
zone "localhost.localdomain" IN {
type master;
file "named.localhost";
allow-update { none; };
};

zone "localhost" IN {
type master;
file "named.localhost";
allow-update { none; };
};

zone
"1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6
.arpa" IN {
type master;
file "named.loopback";
allow-update { none; };
};

zone "1.0.0.127.in-addr.arpa" IN {
type master;
file "named.loopback";
allow-update { none; };
};

zone "0.in-addr.arpa" IN {
type master;
file "named.empty";
allow-update { none; };
};
};
#include "/etc/named.rfc1912.zones";
include "/etc/rndc.key";

2. net.id.db, file zona forward


$TTL 86400
@ IN SOA oscar.net.id. root.oscar.net.id. (
2010150500 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)
IN NS oscar.net.id.
IN A 192.168.1.1
IN MX 20 mail.net.id.
oscar IN A 192.168.1.1
mail IN A 192.168.1.1
www IN A 192.168.1.1
ftp IN A 192.168.1.1

www.oscar.net.id. IN CNAME www.net.id.


ftp.oscar.net.id. IN CNAME ftp.net.id.
mail.oscar.net.id. IN CNAME mail.net.id.

3. net.id.rev.db
$TTL 86400
@ IN SOA oscar.net.id. root.oscar.net.id. (
2010150500 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)
@ IN NS oscar.net.id.
1 IN PTR oscar.net.id

4. Instalasi Potsfix
oscar#yum -y install postfix

[root@mail ~]#
vi /etc/postfix/main.cf
myhostname = oscar.net.id // line 70: specify hostname
mydomain = net.id // line 77: specify domain name
myorigin = $mydomain // line 93: tanda pagar dibuka
inet_interfaces = all // line 110: change

mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain // line 155: tambahkan


mynetworks = 192.168.1.0/24 // line 255: specify LAN
home_mailbox = Maildir/ // line 410: buka tanda pagar (use Maildir)
header_checks = regexp:/etc/postfix/header_checks // line 536: buka tanda pagar
body_checks = regexp:/etc/postfix/body_checks //tambahkan sekaligus buat filenya
message_size_limit = 5242880 // dipaling bawah tambahkan (limit an email 5M)
mailbox_size_limit = 104857600 // limit mailbox 100M
smtpd_sasl_auth_enable = yes // these 4 lines are for SMTP-Auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_mynetworks, permit_auth_destination,
permit_sasl_authenticated, reject

5. Edit file header_checks


oscar#vi /etc/postfix/header_checks
/^From:.*<#.*@.*>/ REJECT // add at the head of file
/^Return-Path:.*<#.*@.*>/ REJECT // reject empty address email
/^Received:/ IGNORE // hide Received section

6. Buat file body_checks


[root@oscar ~]# vi /etc/postfix/body_checks
/^(|[^>].*)example.com/ REJECT // reject email that includes example.com

7. Matikan sendmail default


[root@oscarl ~]#/etc/rc.d/init.d/sendmail stop
Shutting down sm-client: [ OK ]
Shutting down sendmail: [ OK ]

8. Matikan service sendmail


[root@oscar ~]# chkconfig sendmail off

9. Aktifkan MTA default


[root@oscar ~]# alternatives --config mta
There are 2 programs which provide 'mta'.
Selection Command
-----------------------------------------------
*+ 1 /usr/sbin/sendmail.sendmail

2 /usr/sbin/sendmail.postfix
Enter to keep the current selection[+], or type selection number: 2 // rubah yg dua
karena pake postfix

10. Jalankan Postfix


[root@oscar ~]# /etc/rc.d/init.d/postfix start
Starting postfix: [ OK ]

11. Jalankan sasl


[root@oscar ~]# /etc/rc.d/init.d/saslauthd start
Starting saslauthd: [ OK ]

12. Jalankan service postfix dan sasl otomatis


[root@oscar ~]#chkconfig postfix on
[root@mail ~]# chkconfig saslauthd on

13. Install Dovecot : Dovecot merupakan sebuah aplikasi yang dijalankan untuk mengikuti
protocol imap imaps pop3 pop3s. Dengan mempergunakan protokol tersebut, kita
dapat mengakses email yang ada di server. Sehingga kita dapat melakukan pengaksesan
email dimanapun juga dan kapan saja.
[root@oscar ~]# yum -y install dovecot
14. Konfigurasi Dovecot
[root@oscar ~]# vi /etc/dovecot.conf
protocols = imap imaps pop3 pop3s // line 20: buka pagar
mail_location = maildir:~/Maildir // line 209: buka pagar dan tambahkan sesaui yg
tadi (maildir

15. Jalankan Dovecot


[root@mail ~]# /etc/rc.d/init.d/dovecot start
Starting Dovecot Imap: [ OK ]

16. Jalankan service dovecot automatis


[root@oscar ~]# chkconfig dovecot on

17.

You might also like