http://flurdy.com/docs/postfix/#config-imap-dovecot
Setup the system time
http://repos.oostergo.net/6/postfix-2.11/
[root@server1 postfix]# date --set="26 May 2014 22:56:00"
Mon May 26 22:56:00 NPT 2014
Setting up D.N.S record Example 1
#yum install bind*
On centos 6.5 problem in starting named may occur to resolve follow below step:-
[root@mta1 ~]# service named start
Generating /etc/rndc.key: ..Stucks here
[root@mta1 ~]# rndc-confgen -a -r /dev/urandom
wrote key file "/etc/rndc.key"
#service named start
--------------------------------------------------------------------------------------------
#cat /etc/named.conf
...
.......
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
zone "blues.com" IN {
type master;
file "blues.com";
allow-update { none; };
};
zone "213.168.192.in-addr.arpa" IN {
type master;
file "192.168.213.zone";
allow-update { none; };
};
recursion no; #for testing in virtual enviroment
---------------------------------------------------------------------------------
Forward Zone 1
[root@localhost named]# cat blues.com
$TTL 1D ; time a RR may be cached(or saved) by another DNS server.
$ORIGIN blues.com.
@ IN SOA server1.blues.com. dnsadmin.blues.com (
2014130501 ; serial
1D ; refresh When the refreshvalue is reached, the slave name server for this zone will try to read the SOA RR from the zone master
1H ; retry Defines the retry interval in secondsif the slave fails to make contact with the zone master during a refresh cycle. Typical values are from 10 to 60 minutes.
1W ; expire Defines the time in seconds after which the zone records are assumed to be no longer authoritative
3H ) ; minimum
@ IN NS server1.blues.com.
@ IN MX 10 server1.blues.com.
server1.blues.com. IN A 192.168.213.10
Setting up D.N.S record Example 2
$TTL 1D ; time a RR may be cached(or saved) by another DNS server.
$ORIGIN sagarmatha.org.
@ IN SOA sagarmatha.org. dnsadmin.sagarmatha.org (
2014130502 ; serial
1D ; refresh When the refreshvalue is reached, the slave name server for this zone will try to read the SOA RR from the zone master
1H ; retry Defines the retry interval in secondsif the slave fails to make contact with the zone master during a refresh cycle. Typical values are from 10 to 60 minutes.
1W ; expire Defines the time in seconds after which the zone records are assumed to be no longer authoritative
3H ) ; minimum
@ IN NS server1.sagarmatha.org.
@ IN MX 10 server1.sagarmatha.org.
server1 IN A 192.168.213.10
sagarmatha.org. IN A 192.168.213.10
www IN CNAME server1.sagarmatha.org.
mail IN CNAME server1.sagarmatha.org.
Reverse Zone
[root@server1 named]# cat 192.168.213.zone
$TTL 1D
@ IN SOA server1.blues.com. dnsadmin.blues.com. (
2014130504 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
213.168.192.in-addr.arpa. IN NS server1.blues.com.
10 IN PTR server1.blues.com.
############
postfix aliases (mail will be redirected to users mentioned on list)
1)one to one
vim /etc/aliases
postmaster: root <=this is one to one where root is reciepient
2)one to many (or List alias)
sales: root,user12,user3 <=this is one to many where blue-highlighted items are recipients for group sales
3)include example:
support: :include:/etc/postfix/support_list.txt
4)File eg. abuse: /var/log/mail/abuse.mail <=mail will be appended to the target file (here the file is abuse.mail)
5)Pipes eg- help: |/usr/local/bin/sendhelp <=pipes allow another application or script take care of the mail.
Run #newaliases
after changing /etc/aliases
##############
local.forward File
any message destined to user1@exampledomain.com can be further redirected to another account or another acc. on another machine
First install the vacation program
youcan download the vacation binary here http://puias.math.ias.edu/data/puias/6/x86_64/os/Addons/vacation-1.2.7.0-7.puias6.x86_64.rpm
now in my case ,
[root@mailvm ~]# yum install vacation-1.2.7.0-7.puias6.x86_64.rpm
Transaction Test Succeeded
Running Transaction
Installing : vacation-1.2.7.0-7.puias6.x86_64 1/1
Verifying : vacation-1.2.7.0-7.puias6.x86_64 1/1 Installed:
vacation.x86_64 0:1.2.7.0-7.puias6
[root@mailvm ~]# which vacation
/usr/bin/vacation
Create a hidden file .vacation.msg and write your message on it :
[orange@mailvm ~]$ cat .vacation.msg
Hi !! I am on vacation
Create a hidden file .forward
[orange@mailvm ~]$ cat .forward
\orange, "|/usr/bin/vacation orange" #here orange is a local linux acc user
Note : the " \ "infront of "orange," will tell postfix not to do any further lookups for alias orange and
| will pipe the email to the vacation program to process
this notation \orange, "|/usr/bin/vacation orange" caues the vacation message sent back to user.
Initialize the vacation program
$ vacation -i
$ls -al
-rw-r--r--. 1 orange orange 12288 May 16 23:07 .vacation.db <=new file created after initializing vacation program.
all the messages that are sent to sender as response are stored and know when/who to respond ,mitigates DOS attacks
Now for demo:
ssh into your machine as "root" and send mail to user "orange" using mail or mutt here i used mutt
the message to the root appears like this
[root@mailvm Mail]# mutt
i:Exit -:PrevPg <Space>:NextPg v:View Attachm. d:Del r:Reply j:Next ?:Help
Date: Fri, 16 May 2014 23:18:39 +0545 (NPT)
From: orange@mailvm.fender.com
To: root@mailvm.fender.com
User-Agent: 1.2.7 http://vacation.sourceforge.net
Hi Iam on vacation leave
#sendmail -v user11@remotesystem.com
testing remote mail
Ctrl+d( to send)
Setup the system time
http://repos.oostergo.net/6/postfix-2.11/
[root@server1 postfix]# date --set="26 May 2014 22:56:00"
Mon May 26 22:56:00 NPT 2014
Setting up D.N.S record Example 1
#yum install bind*
On centos 6.5 problem in starting named may occur to resolve follow below step:-
[root@mta1 ~]# service named start
Generating /etc/rndc.key: ..Stucks here
[root@mta1 ~]# rndc-confgen -a -r /dev/urandom
wrote key file "/etc/rndc.key"
#service named start
--------------------------------------------------------------------------------------------
#cat /etc/named.conf
...
.......
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
zone "blues.com" IN {
type master;
file "blues.com";
allow-update { none; };
};
zone "213.168.192.in-addr.arpa" IN {
type master;
file "192.168.213.zone";
allow-update { none; };
};
recursion no; #for testing in virtual enviroment
---------------------------------------------------------------------------------
Forward Zone 1
[root@localhost named]# cat blues.com
$TTL 1D ; time a RR may be cached(or saved) by another DNS server.
$ORIGIN blues.com.
@ IN SOA server1.blues.com. dnsadmin.blues.com (
2014130501 ; serial
1D ; refresh When the refreshvalue is reached, the slave name server for this zone will try to read the SOA RR from the zone master
1H ; retry Defines the retry interval in secondsif the slave fails to make contact with the zone master during a refresh cycle. Typical values are from 10 to 60 minutes.
1W ; expire Defines the time in seconds after which the zone records are assumed to be no longer authoritative
3H ) ; minimum
@ IN NS server1.blues.com.
@ IN MX 10 server1.blues.com.
server1.blues.com. IN A 192.168.213.10
Setting up D.N.S record Example 2
Forward Zone 2
[root@localhost named]# vim sagarmatha.org $TTL 1D ; time a RR may be cached(or saved) by another DNS server.
$ORIGIN sagarmatha.org.
@ IN SOA sagarmatha.org. dnsadmin.sagarmatha.org (
2014130502 ; serial
1D ; refresh When the refreshvalue is reached, the slave name server for this zone will try to read the SOA RR from the zone master
1H ; retry Defines the retry interval in secondsif the slave fails to make contact with the zone master during a refresh cycle. Typical values are from 10 to 60 minutes.
1W ; expire Defines the time in seconds after which the zone records are assumed to be no longer authoritative
3H ) ; minimum
@ IN NS server1.sagarmatha.org.
@ IN MX 10 server1.sagarmatha.org.
server1 IN A 192.168.213.10
sagarmatha.org. IN A 192.168.213.10
www IN CNAME server1.sagarmatha.org.
mail IN CNAME server1.sagarmatha.org.
Reverse Zone
[root@server1 named]# cat 192.168.213.zone
$TTL 1D
@ IN SOA server1.blues.com. dnsadmin.blues.com. (
2014130504 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
213.168.192.in-addr.arpa. IN NS server1.blues.com.
10 IN PTR server1.blues.com.
############
postfix aliases (mail will be redirected to users mentioned on list)
1)one to one
vim /etc/aliases
postmaster: root <=this is one to one where root is reciepient
2)one to many (or List alias)
sales: root,user12,user3 <=this is one to many where blue-highlighted items are recipients for group sales
3)include example:
support: :include:/etc/postfix/support_list.txt
4)File eg. abuse: /var/log/mail/abuse.mail <=mail will be appended to the target file (here the file is abuse.mail)
5)Pipes eg- help: |/usr/local/bin/sendhelp <=pipes allow another application or script take care of the mail.
Run #newaliases
after changing /etc/aliases
##############
local.forward File
any message destined to user1@exampledomain.com can be further redirected to another account or another acc. on another machine
First install the vacation program
youcan download the vacation binary here http://puias.math.ias.edu/data/puias/6/x86_64/os/Addons/vacation-1.2.7.0-7.puias6.x86_64.rpm
now in my case ,
[root@mailvm ~]# yum install vacation-1.2.7.0-7.puias6.x86_64.rpm
Transaction Test Succeeded
Running Transaction
Installing : vacation-1.2.7.0-7.puias6.x86_64 1/1
Verifying : vacation-1.2.7.0-7.puias6.x86_64 1/1 Installed:
vacation.x86_64 0:1.2.7.0-7.puias6
[root@mailvm ~]# which vacation
/usr/bin/vacation
Create a hidden file .vacation.msg and write your message on it :
[orange@mailvm ~]$ cat .vacation.msg
Hi !! I am on vacation
Create a hidden file .forward
[orange@mailvm ~]$ cat .forward
\orange, "|/usr/bin/vacation orange" #here orange is a local linux acc user
Note : the " \ "infront of "orange," will tell postfix not to do any further lookups for alias orange and
| will pipe the email to the vacation program to process
this notation \orange, "|/usr/bin/vacation orange" caues the vacation message sent back to user.
Initialize the vacation program
$ vacation -i
$ls -al
-rw-r--r--. 1 orange orange 12288 May 16 23:07 .vacation.db <=new file created after initializing vacation program.
all the messages that are sent to sender as response are stored and know when/who to respond ,mitigates DOS attacks
Now for demo:
ssh into your machine as "root" and send mail to user "orange" using mail or mutt here i used mutt
the message to the root appears like this
[root@mailvm Mail]# mutt
i:Exit -:PrevPg <Space>:NextPg v:View Attachm. d:Del r:Reply j:Next ?:Help
Date: Fri, 16 May 2014 23:18:39 +0545 (NPT)
From: orange@mailvm.fender.com
To: root@mailvm.fender.com
User-Agent: 1.2.7 http://vacation.sourceforge.net
Hi Iam on vacation leave
#sendmail -v user11@remotesystem.com
testing remote mail
Ctrl+d( to send)
- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
#cd /var/spool/postfix/maildrop
messages are dropped in maildrop using postfix compatible command called sendmail with/out postfix master process need not necessary to run
pickup process (usr/libexec/pickup)spawned by master program feeds locally submitted message to cleanup process(takes care of addressing task like
from: to: fqdn check etc)
message is then moved to qmgr process(deliver message using localmailing or localmailing and smtp)
# cat /etc/nsswitch.conf
this file contains directives which dictates order in which name resolution occurs
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - myorigin / masquerading
-- -- -- -- -- -- -- -- -- --
Define outbound envelope information [masquerading] not header information
$mydomain=example1.com
$myorigin=$mydomain
$myorigin is used for masquerading
-- -- ---- -- ---- -- ---- -- ---- -- ---- -- ---- -- ---- -- ---- -- ---- -- ---- -- ---- -- ---- -- ---- -- --
note: mail routing is based on header information.
#service postfix reload
check for new mail check duration
user123@mailserver1.example.com$ set | grep -i mail
MAIL=/var/mail/user123
MAILCHECK=60 ;;mailcheck is 60 seconds
" canonical maps "
@For -- Local users
Types :
(rewriting at cleanup process and trivial rewrite process is done)
canonical map will alter <envelope from> and <envelope to> addresses which are heading out of the machine to recipient.
vim /etc/postfix/canonical
#any message "from" user "apple" should be re written to "applefruit" and david to david.baekham
apple applefruit
david david.beckham
#vim /etc/postfix/main.cf
[ type : / location ]
canonical_maps = hash:/etc/postfix/canonical
#postmap /etc/postfix/canonical // this will generate (hash database) canonical.db file
note: postmap requires berkley library pkg's
@ with --> canonical_maps
{for inbound emaild}
#tail /var/log/maillog
May 26 18:46:21 mailvm postfix/pickup[1129]: EA2E0FF660: uid=501 from=<apple>
May 26 18:46:21 mailvm postfix/cleanup[1272]: EA2E0FF660: message-id=<20140526130121.GB1212@mailvm.urgens.com>
May 26 18:46:21 mailvm postfix/qmgr[1130]: EA2E0FF660: from=<applefruit@urgens.com>, size=433, nrcpt=1 (queue active)
May 26 18:46:22 mailvm postfix/local[1274]: EA2E0FF660: to=<root@mailvm.urgens.com>, relay=local, delay=0.11, delays=0.08/0.03/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
May 26 18:46:22 mailvm postfix/qmgr[1130]: EA2E0FF660: removed
#changing /etc/aliases
.;;[user] is equivalent to local user dean ;;
sales: user1,root,managersales
applefruit: apple
save/exit
#new aliases
@/etc/postfix/main.cf
-- -- -- -- -- -- -- - - - -- -- - - -- -- - - - -- - - - - - - - - -- -- -- - - - -
Summary
-- -- - -- -- -- - -- -- - -- -- - - -- -- - -- - -- - - -- -- -- - -- - - - -- - - -
#canonical_maps = hash:/etc/postfix/canonical //will effect sender/receiver
#sender_canonical_maps=hash:/etc/postfix/canonical //will effect only sender part , rcpt portion is untouched
#recipient_canonical_maps=hash:/etc/postfix/canonical //will effect only recipient part,sender portion is untouched
-----
with sender_canonical_maps .
From applefruit@urgens.com Mon May 26 23:36:02 2014
Return-Path: <applefruit@urgens.com>
X-Original-To: apple@mailvm.urgens.com
Delivered-To: apple@mailvm.urgens.com
Received: by mailvm.urgens.com (Postfix, from userid 501)
id 30BE4FF6A0; Mon, 26 May 2014 23:36:02 +0545 (NPT)
Date: Mon, 26 May 2014 23:36:02 +0545
From: applefruit@urgens.com
To: apple@mailvm.urgens.com
Subject: sender canonical test
Message-ID: <20140526175102.GA1574@mailvm.urgens.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.20 (2009-12-10)
with recipient_canonical_maps
From apple@urgens.com Mon May 26 23:39:42 2014
Return-Path: <apple@urgens.com>
X-Original-To: apple@mailvm.urgens.com
Delivered-To: applefruit@urgens.com
Received: by mailvm.urgens.com (Postfix, from userid 501)
id 31346FF683; Mon, 26 May 2014 23:39:42 +0545 (NPT)
Date: Mon, 26 May 2014 23:39:42 +0545
From: apple@mailvm.urgens.com
To: applefruit@urgens.com
Subject: reciepient canonical test
Message-ID: <20140526175442.GB1574@mailvm.urgens.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.20 (2009-12-10)
Notice the envelope and header parts ...
#cd /var/spool/postfix/maildrop
messages are dropped in maildrop using postfix compatible command called sendmail with/out postfix master process need not necessary to run
pickup process (usr/libexec/pickup)spawned by master program feeds locally submitted message to cleanup process(takes care of addressing task like
from: to: fqdn check etc)
message is then moved to qmgr process(deliver message using localmailing or localmailing and smtp)
# cat /etc/nsswitch.conf
this file contains directives which dictates order in which name resolution occurs
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - myorigin / masquerading
-- -- -- -- -- -- -- -- -- --
Define outbound envelope information [masquerading] not header information
$mydomain=example1.com
$myorigin=$mydomain
$myorigin is used for masquerading
-- -- ---- -- ---- -- ---- -- ---- -- ---- -- ---- -- ---- -- ---- -- ---- -- ---- -- ---- -- ---- -- ---- -- --
note: mail routing is based on header information.
#service postfix reload
check for new mail check duration
user123@mailserver1.example.com$ set | grep -i mail
MAIL=/var/mail/user123
MAILCHECK=60 ;;mailcheck is 60 seconds
" canonical maps "
- #canonical_maps = hash:/etc/postfix/canonical //will effect sender/receiver
- #sender_canonical_maps=hash:/etc/postfix/canonical //will effect only sender part , rcpt portion is untouched
- #recipient_canonical_maps=hash:/etc/postfix/canonical //will effect only recipient part,sender portion is untouched
(rewriting at cleanup process and trivial rewrite process is done)
canonical map will alter <envelope from> and <envelope to> addresses which are heading out of the machine to recipient.
vim /etc/postfix/canonical
#any message "from" user "apple" should be re written to "applefruit" and david to david.baekham
apple applefruit
david david.beckham
#vim /etc/postfix/main.cf
[ type : / location ]
canonical_maps = hash:/etc/postfix/canonical
#postmap /etc/postfix/canonical // this will generate (hash database) canonical.db file
note: postmap requires berkley library pkg's
@ with --> canonical_maps
{for inbound emaild}
#tail /var/log/maillog
May 26 18:46:21 mailvm postfix/pickup[1129]: EA2E0FF660: uid=501 from=<apple>
May 26 18:46:21 mailvm postfix/cleanup[1272]: EA2E0FF660: message-id=<20140526130121.GB1212@mailvm.urgens.com>
May 26 18:46:21 mailvm postfix/qmgr[1130]: EA2E0FF660: from=<applefruit@urgens.com>, size=433, nrcpt=1 (queue active)
May 26 18:46:22 mailvm postfix/local[1274]: EA2E0FF660: to=<root@mailvm.urgens.com>, relay=local, delay=0.11, delays=0.08/0.03/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
May 26 18:46:22 mailvm postfix/qmgr[1130]: EA2E0FF660: removed
#changing /etc/aliases
.;;[user] is equivalent to local user dean ;;
sales: user1,root,managersales
applefruit: apple
save/exit
#new aliases
@/etc/postfix/main.cf
-- -- -- -- -- -- -- - - - -- -- - - -- -- - - - -- - - - - - - - - -- -- -- - - - -
Summary
-- -- - -- -- -- - -- -- - -- -- - - -- -- - -- - -- - - -- -- -- - -- - - - -- - - -
#canonical_maps = hash:/etc/postfix/canonical //will effect sender/receiver
#sender_canonical_maps=hash:/etc/postfix/canonical //will effect only sender part , rcpt portion is untouched
#recipient_canonical_maps=hash:/etc/postfix/canonical //will effect only recipient part,sender portion is untouched
-----
with sender_canonical_maps .
From applefruit@urgens.com Mon May 26 23:36:02 2014
Return-Path: <applefruit@urgens.com>
X-Original-To: apple@mailvm.urgens.com
Delivered-To: apple@mailvm.urgens.com
Received: by mailvm.urgens.com (Postfix, from userid 501)
id 30BE4FF6A0; Mon, 26 May 2014 23:36:02 +0545 (NPT)
Date: Mon, 26 May 2014 23:36:02 +0545
From: applefruit@urgens.com
To: apple@mailvm.urgens.com
Subject: sender canonical test
Message-ID: <20140526175102.GA1574@mailvm.urgens.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.20 (2009-12-10)
with recipient_canonical_maps
From apple@urgens.com Mon May 26 23:39:42 2014
Return-Path: <apple@urgens.com>
X-Original-To: apple@mailvm.urgens.com
Delivered-To: applefruit@urgens.com
Received: by mailvm.urgens.com (Postfix, from userid 501)
id 31346FF683; Mon, 26 May 2014 23:39:42 +0545 (NPT)
Date: Mon, 26 May 2014 23:39:42 +0545
From: apple@mailvm.urgens.com
To: applefruit@urgens.com
Subject: reciepient canonical test
Message-ID: <20140526175442.GB1574@mailvm.urgens.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.20 (2009-12-10)
Notice the envelope and header parts ...

No comments:
Post a Comment