<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>alexalmazan.com</title>
    <link>http://alexalmazan.com/</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>atypical typo tech rhelish</description>
    <item>
      <title>Postfix SPF</title>
      <description>&lt;p&gt;This article is to ouline the specifics for implementing &lt;span class="caps"&gt;SPF&lt;/span&gt; policy framework for Postfix provided in Redhat Enterprise Linux (es4/es5).&lt;/p&gt;


	&lt;p&gt;1.) First install all the necessary perl modules via &lt;span class="caps"&gt;RPM&lt;/span&gt; that you will require:&lt;/p&gt;


	&lt;p&gt;http://dag.wieers.com/rpm/packages/perl-Net-Address-IPv4-Local/
http://dag.wieers.com/rpm/packages/perl-NetAddr-IP/
http://dag.wieers.com/rpm/packages/perl-Mail-SPF/&lt;/p&gt;


	&lt;p&gt;(additional RPMs may be required) 
I would recommend that you refrain from installing via &lt;span class="caps"&gt;CPAN&lt;/span&gt; as a mix of &lt;span class="caps"&gt;RPM&lt;/span&gt; installed and &lt;span class="caps"&gt;CPAN&lt;/span&gt; installed modules can lead to issues in the future.&lt;/p&gt;


2.) Obtain and install the &lt;span class="caps"&gt;SPF&lt;/span&gt; perl script
&lt;pre&gt;
cd /usr/src
wget http://www.openspf.org/blobs/postfix-policyd-spf-perl-2.001.tar.gz
tar xvfz postfix-policyd-spf-perl-2.001.tar.gz
cd postfix-policyd-spf-perl-2.001
cp postfix-policyd-spf-perl /usr/libexec/postfix/postfix-policyd-spf-perl
chomd o+x /usr/libexec/postfix/postfix-policyd-spf-perl
&lt;/pre&gt;

Ensure that you set the script to executable, or errors such as these are recieved
&lt;pre&gt;
warning: command /usr/bin/perl exit status 2
postfix/smtpd: warning: premature end-of-input on private/policy while reading input attribute name
&lt;/pre&gt;

3.)Next, edit the postfix configuration file &amp;#8217;/etc/postfix/master.cf&amp;#8217;  This line should be appended to the end of the configuration.
&lt;pre&gt;
policy  unix  -       n       n       -       -       spawn
        user=nobody argv=/usr/bin/perl /usr/lib/postfix/policyd-spf-perl
&lt;/pre&gt;

4.)Next open /etc/postfix/main.cf and find the directive &amp;#8220;smtpd_recipient_restrictions&amp;#8221; You should have reject_unauth_destination in that directive, and right after reject_unauth_destination add &amp;#8216;check_policy_service unix:private/policy&amp;#8217;
&lt;pre&gt;
smtpd_recipient_restrictions =permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination,check_policy_service unix:private/policy
&lt;/pre&gt;
&lt;strong&gt;&lt;span style="color:red;"&gt;important&lt;/span&gt;&lt;/strong&gt; ensure that you specify &amp;#8220;check_policy_service&amp;#8221; &lt;strong&gt;&lt;span style="color:red;"&gt;&lt;span class="caps"&gt;AFTER&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt; &amp;#8220;reject_unauth_destination&amp;#8221; or else you will have an open relay!</description>
      <pubDate>Wed, 30 Jul 2008 08:18:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:f56e00b0-381c-4b4c-91c8-9137577b8729</guid>
      <author>aalmazan@rackspace.com (alex almazan)</author>
      <link>http://alexalmazan.com/articles/2008/07/30/postfix-spf</link>
      <category>Mail Server Tips &amp; Tricks</category>
    </item>
    <item>
      <title>Plesk TLS</title>
      <description>The following syntax will help determine any issues with the  certificates loaded for &lt;span class="caps"&gt;TLS&lt;/span&gt;:
&lt;del&gt;-&lt;/del&gt;
&lt;pre&gt;
openssl s_client -connect 127.0.0.1:25 -starttls smtp -debug
&lt;/pre&gt;

	&lt;p&gt;Your mileage will vary&lt;/p&gt;</description>
      <pubDate>Mon, 21 Jul 2008 03:21:22 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:4b35147f-8340-42b9-9492-be1642824f1f</guid>
      <author>aalmazan@rackspace.com (alex almazan)</author>
      <link>http://alexalmazan.com/articles/2008/07/21/plesk-tls</link>
      <category>Plesk Tips &amp; Tricks</category>
      <category>Mail Server Tips &amp; Tricks</category>
    </item>
    <item>
      <title>EXT3 online resize</title>
      <description>&lt;p&gt;Introduction of an additional drive into a &lt;span class="caps"&gt;RAID&lt;/span&gt; array to expand capacity requires additional steps in the OS to expand the partition without data  loss.&lt;/p&gt;


	&lt;p&gt;First, fdisk the device and delete the &amp;#8220;EXTENDED&amp;#8221; partition that you are looking to resize, in this instance partition 4.&lt;/p&gt;


&lt;pre&gt;
[root@app1 ~]# fdisk /dev/sda

The number of cylinders for this disk is set to 53309.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sda: 438.4 GB, 438489317376 bytes
255 heads, 63 sectors/track, 53309 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14         274     2096482+  83  Linux
/dev/sda3             275         405     1052257+  82  Linux swap
/dev/sda4             406       35539   282213855    5  Extended
/dev/sda5             406       35539   282213823+  83  Linux
Command (m for help): d
Partition number (1-5): 4

Command (m for help): p

Disk /dev/sda: 438.4 GB, 438489317376 bytes
255 heads, 63 sectors/track, 53309 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14         274     2096482+  83  Linux
/dev/sda3             275         405     1052257+  82  Linux swap
&lt;/pre&gt;
Once this has been removed the partition should be re-created as extended, then a primary partition introduced
&lt;pre&gt;
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
e
Selected partition 4
First cylinder (406-53309, default 406): 
Using default value 406
Last cylinder or +size or +sizeM or +sizeK (406-53309, default 53309): 
Using default value 53309

Command (m for help): p

Disk /dev/sda: 438.4 GB, 438489317376 bytes
255 heads, 63 sectors/track, 53309 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14         274     2096482+  83  Linux
/dev/sda3             275         405     1052257+  82  Linux swap
/dev/sda4             406       53309   424951380    5  Extended
&lt;/pre&gt;
Now introduce a primary partition on the extended

&lt;strong&gt;&lt;span style="color:red;"&gt;&lt;span class="caps"&gt;NOTICE&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;- The cylinder in use of the removed partition should be noted as the subsequent introduction of the new partition will require this detail in order to preserve the data
&lt;pre&gt;
Command (m for help): n
First cylinder (406-53309, default 406): 
Using default value 406
Last cylinder or +size or +sizeM or +sizeK (406-53309, default 53309): 
Using default value 53309

Command (m for help): p

Disk /dev/sda: 438.4 GB, 438489317376 bytes
255 heads, 63 sectors/track, 53309 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14         274     2096482+  83  Linux
/dev/sda3             275         405     1052257+  82  Linux swap
/dev/sda4             406       53309   424951380    5  Extended
/dev/sda5             406       53309   424951348+  83  Linux
&lt;/pre&gt;
write the changes and exit
&lt;pre&gt;
Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

&lt;/pre&gt;
A reboot of the system is required.

The final step is &amp;#8216;ext2online&amp;#8217; of &amp;#8217;/&amp;#8217;
&lt;pre&gt;
[root@app1 ~]# ext2online /
ext2online v1.1.18 - 2001/03/18 for EXT2FS 0.5b
&lt;/pre&gt;

Partition expanded from this:
&lt;pre&gt;
[root@app1 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda5             265G  256G  9.9G  97% /
/dev/sda1              99M   12M   82M  13% /boot
none                  2.0G     0  2.0G   0% /dev/shm
/dev/sda2             2.0G   53M  1.9G   3% /tmp
&lt;/pre&gt;
to this
&lt;pre&gt;
[root@app1 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda5             399G  227G  173G  57% /
/dev/sda1              99M   12M   82M  13% /boot
none                  2.0G     0  2.0G   0% /dev/shm
/dev/sda2             2.0G   52M  1.9G   3% /tmp
&lt;/pre&gt;</description>
      <pubDate>Tue, 03 Jun 2008 01:32:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:13bae53a-d323-454f-9633-2628a714a1a6</guid>
      <author>aalmazan@rackspace.com (alex almazan)</author>
      <link>http://alexalmazan.com/articles/2008/06/03/ext3-online-resize</link>
      <category>Linux Tips &amp; Tricks</category>
      <category>ext2online</category>
    </item>
    <item>
      <title>IPTables and libwrap</title>
      <description>&lt;p&gt;&lt;strong&gt;&lt;span style="color:green;"&gt;Secruing Services&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;&lt;span style="color:red;"&gt;&lt;span class="caps"&gt;NOTE&lt;/span&gt;&lt;/span&gt; choose the easiest otions first such as TCPwrappers to control service connections.&lt;/p&gt;


&lt;pre&gt;
/etc/hosts.allow
/etc/hosts.deny
&lt;/pre&gt;

	&lt;p&gt;man page syntax identical:&lt;/p&gt;


basic syntax is :
&lt;daemon&gt;: &lt;client&gt;

ex. to allow ssh connections for &lt;span class="caps"&gt;SSH&lt;/span&gt;
&lt;pre&gt;
sshd: 192.168.2.200
&lt;/pre&gt;

	&lt;p&gt;These files are parse in the following order:&lt;/p&gt;


	&lt;table&gt;
		&lt;tr&gt;
			&lt;td&gt;/etc/hosts.allow&lt;/td&gt;
			&lt;td&gt;If the configuration of this file permits the requested connection, the connection is immediately allowed&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;/etc/hosts.deny&lt;/td&gt;
			&lt;td&gt;If the configuration of this file does not permit the requested connection, the connection is immediately refused.&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt;




	&lt;p&gt;&lt;span style="color:red;"&gt;&lt;span class="caps"&gt;TCP&lt;/span&gt; wrappers&lt;/span&gt; can &lt;span style="color:red;"&gt;only&lt;/span&gt; be run on packages &lt;span style="color:red;"&gt;compiled agains libwrap&lt;/span&gt;. &lt;span style="color:blue;"&gt;ldd&lt;/span&gt; can
be used to check if it has been compiled against libwrap.&lt;/p&gt;


	&lt;p&gt;example for checking  with &amp;#8216;ldd&amp;#8217;&lt;/p&gt;


&lt;pre&gt;
[root@station home]# ldd /usr/sbin/sendmail.sendmail |grep wrap
        libwrap.so.0 =&amp;gt; /usr/lib/libwrap.so.0 (0x006a8000)
&lt;/pre&gt;

portmap is another service , but it is a bit convoluted:
&lt;pre&gt;
[root@station home]# strings /sbin/portmap |grep hosts
hosts_access_verbose
hosts_allow_table
hosts_deny_table
/etc/hosts.allow
/etc/hosts.deny
&lt;/pre&gt;

	&lt;p&gt;here are others configured against libwrap:&lt;/p&gt;


	&lt;p&gt;ssh,sendmail,xinetd,vsftpd,stunnel
&lt;del&gt;-&lt;/del&gt;
Two choices when configuring hosts.allow|deny in the following example.
permit connections for vsftp from 10.1.1.1, but block from
10.0.0.0/255.0.0.0&lt;/p&gt;


	&lt;p&gt;you can make seperate entries in both:&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;hosts.deny&lt;/strong&gt;&lt;/p&gt;


&lt;pre&gt;
vsftpd: 10.0.0.0/255.0.0.0
&lt;/pre&gt;

	&lt;p&gt;&lt;strong&gt;hosts.allow&lt;/strong&gt;&lt;/p&gt;


&lt;pre&gt;
vsftpd: 10.1.1.1
&lt;/pre&gt;

	&lt;p&gt;Or you can add this to just the deny file as suggested with the keyword&lt;/p&gt;


	&lt;p&gt;&amp;#8216;EXCEPT&amp;#8217;&lt;/p&gt;


&lt;pre&gt;
# hosts.deny    This file describes the names of the hosts which are
#               *not* allowed to use the local INET services, as decided
#               by the '/usr/sbin/tcpd' server.
#
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow.  In particular
# you should know that NFS uses portmap!
#vsftpd: 10.0.0.0/255.0.0.0
vsftpd: 10.0.0.0/255.0.0.0 EXCEPT 10.1.1.1
&lt;/pre&gt;

	&lt;p&gt;&amp;#8216;ALL&amp;#8217; can be used in the config as the service or the connecting source:&lt;/p&gt;


&lt;pre&gt;
ALL:ALL EXCEPT 192.168.1.1 
&lt;/pre&gt;

	&lt;p&gt;In /etc/hosts.deny to block all service affected by libwrap, but open to the one source or&lt;/p&gt;


&lt;pre&gt;
ALL:ALL 
&lt;/pre&gt;
In hosts.deny, with explicit service permissions in /etc/hosts.allow.

	&lt;p&gt;&amp;#8216;DenyHosts is a script from sourceforge that you can run from cron to
parse /var/log/secure to review those that have attempted multiple brute force attacks&amp;#8217;
(&amp;#8216;swatch&amp;#8217;-&amp;#8216;pamABL&amp;#8217; are similar scripts, but modify iptables)&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;&lt;span style="color:green;"&gt;IPTables&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;Permits packet filterring at the kernel level. Netfilter is the kernel module that does the dirty work, iptables helps define the rules/chains to permit/deny through the kernels ip stack.&lt;/p&gt;


	&lt;table&gt;
		&lt;tr&gt;
			&lt;td&gt;&lt;strong&gt;&lt;span class="caps"&gt;INPUT&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;
			&lt;td&gt;responsible for inbound destined for the server&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;&lt;strong&gt;&lt;span class="caps"&gt;OUTPUT&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;
			&lt;td&gt;responsible for outbound traffic leaving the server&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;&lt;strong&gt;&lt;span class="caps"&gt;FORWARD&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;
			&lt;td&gt;across the servers interfaces&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt;




&lt;pre&gt;
iptables -L 
&lt;/pre&gt;

	&lt;p&gt;lists or prints the current rules in place&lt;/p&gt;


&lt;pre&gt;
iptables -L -n -v -t nat
&lt;/pre&gt;

	&lt;p&gt;&lt;span style="color:blue;"&gt;iptables-save&lt;/span&gt; writes to /etc/sysconfig/iptables. (keeping rules persistent,they must be apart of this file)&lt;/p&gt;


	&lt;p&gt;Configuration parsed from top to bottom. IPTables will response based on the first match. If there is no specific match, the chain policy will apply.&lt;/p&gt;


	&lt;p&gt;IPtables uses targets to determine what action will be taken if traffic matches an existing rule.&lt;/p&gt;


	&lt;table&gt;
		&lt;tr&gt;
			&lt;td&gt;&lt;strong&gt;&lt;span class="caps"&gt;DROP&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;
			&lt;td&gt;will drop package and send no info to the user&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;&lt;strong&gt;&lt;span class="caps"&gt;REJECT&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;
			&lt;td&gt;will send a connection refused notice back to the sender&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;&lt;strong&gt;&lt;span class="caps"&gt;ACCEPT&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;
			&lt;td&gt;will permit the connection&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;&lt;strong&gt;&lt;span class="caps"&gt;LOG&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;
			&lt;td&gt;will log the connection attempt&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt;




	&lt;p&gt;IPTables syntax rule formulation help:-&lt;/p&gt;


	&lt;p&gt;What chain will the rule apply to?&lt;/p&gt;


&lt;pre&gt;
-A INPUT
&lt;/pre&gt;
What patterns(s) would you like to check for?

&lt;pre&gt;
-s 192.168.2.100
&lt;/pre&gt;

	&lt;p&gt;To make the rule active, you can add the following info to
/etc/sysconfig/iptables&lt;/p&gt;


&lt;pre&gt;
-A INPUT -s 192.168.2.100 -j REJECT
&lt;/pre&gt;

	&lt;p&gt;You can also configure the rule from &lt;span class="caps"&gt;CLI&lt;/span&gt; with&lt;/p&gt;


&lt;pre&gt;
iptables -A INPUT -s 192.168.2.100 -j REJECT
&lt;/pre&gt;

	&lt;p&gt;What should IPTables do when a matching pattern is found?&lt;/p&gt;


&lt;pre&gt;
-j REJECT
&lt;/pre&gt;

	&lt;p&gt;You can also match on the following criteria:&lt;/p&gt;


	&lt;table&gt;
		&lt;tr&gt;
			&lt;td&gt;&lt;strong&gt;-i&lt;/strong&gt;&lt;/td&gt;
			&lt;td&gt;incoming interface&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;&lt;strong&gt;-p&lt;/strong&gt;&lt;/td&gt;
			&lt;td&gt;protocol&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;&lt;strong&gt;-s&lt;/strong&gt;&lt;/td&gt;
			&lt;td&gt;source ip address&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;&lt;strong&gt;-d&lt;/strong&gt;&lt;/td&gt;
			&lt;td&gt;destination ip address&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;&lt;strong&gt;-dport&lt;/strong&gt;&lt;/td&gt;
			&lt;td&gt;destination port&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt;




	&lt;p&gt;Saving the rules &lt;span style="color:blue;"&gt;service iptables-save&lt;/span&gt;&lt;/p&gt;


&lt;pre&gt;
iptables -D INPUT 3 
&lt;/pre&gt;

	&lt;p&gt;This command will delete the third rule in the &lt;span class="caps"&gt;INPUT CHAIN&lt;/span&gt;
A quick means of identifying line number is:&lt;/p&gt;


&lt;pre&gt;
iptables -L --line-numbers
&lt;/pre&gt;

&lt;pre&gt;
iptables -D INPUT &amp;lt;rule&amp;gt; 
&lt;/pre&gt;

	&lt;p&gt;This command will delete the specific rule from
the &lt;span class="caps"&gt;INPUT&lt;/span&gt; chain.&lt;/p&gt;


&lt;pre&gt;
iptables -F 
&lt;/pre&gt;

	&lt;p&gt;This command will flush the IPTables rulesets&lt;/p&gt;


	&lt;p&gt;&lt;span style="color:blue;"&gt;system-config-securitylevel&lt;/span&gt;  utility used to create the following config&lt;/p&gt;


&lt;pre&gt;
[root@station sysconfig]# cat iptables
# Firewall configuration written by system-config-securitylevel
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT                             
---(permit the loopback)
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT                             
---(for ipsec)
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT                             
---(for ipsec)
-A RH-Firewall-1-INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT
---(multicast/Avahi)
-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT            ---(for cups)
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT            ---(for cups)
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j
ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j
ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j
ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 137 -j
ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 138 -j
ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j
ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j
ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j
ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j
ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 110 -j
ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 143 -j
ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 837 -j
ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 993 -j
ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 995 -j
ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT
&lt;/pre&gt;

created the following chain to apply the rules in /etc/sysconfig/iptables:
&lt;pre&gt;
RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
&lt;/pre&gt;
This and the allowed outlined rules above where automagically put in place.

Considered a mostly closed configuration based on the &amp;#8216;ACCEPT&amp;#8217; policy. If you need to use the rulesets generated by &amp;#8216;system&amp;#8217; utlities comment out the last rule to keep from failing the test 
&lt;pre&gt;
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
&lt;/pre&gt;
&lt;span style="color:red;"&gt;service iptables panic&lt;/span&gt; changes to a default drop policy
&lt;pre&gt;
[root@station sysconfig]# service iptables panic
Flushing firewall rules:                                   [  OK  ]
Setting chains to policy DROP: filter                      [  OK  ]
[root@station13 sysconfig]# iptables -L -v
Chain INPUT (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source              
destination

Chain FORWARD (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source              
destination

Chain OUTPUT (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source              
destination
&lt;/pre&gt;

Put these back in place to permit connections
&lt;pre&gt;
[root@station sysconfig]# iptables -P INPUT ACCEPT
[root@station sysconfig]# iptables -P OUTPUT ACCEPT
&lt;/pre&gt;

&lt;pre&gt;
[root@station sysconfig]# iptables -L -v
Chain INPUT (policy ACCEPT 1 packets, 78 bytes)
 pkts bytes target     prot opt in     out     source              
destination

Chain FORWARD (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source              
destination

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source              
destination
&lt;/pre&gt;

	&lt;p&gt;configure your mail server not to accept connections from the
192.168.1.0/24 network, &lt;span class="caps"&gt;EXCEPT&lt;/span&gt; for the 192.168.1.2 host:&lt;/p&gt;


	&lt;p&gt;iptables example&lt;/p&gt;


&lt;pre&gt;
[root@station etc]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
REJECT     all  --  10.0.0.0/8           anywhere            reject-with
icmp-port-unreachable
ACCEPT     tcp  --  192.168.1.2          anywhere            tcp dpt:smtp
REJECT     tcp  --  192.168.1.0/24       anywhere            tcp dpt:smtp
reject-with icmp-port-unreachable

Chain FORWARD (policy DROP)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
&lt;/pre&gt;

&lt;pre&gt;
[root@station etc]# cat /etc/sysconfig/iptables
# Generated by iptables-save v1.3.5 on Thu Aug  9 16:08:07 2007
*filter
:INPUT ACCEPT [134:32679]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [47:4569]
-A INPUT -s 10.0.0.0/255.0.0.0 -j REJECT --reject-with icmp-port-unreachable
-A INPUT -s 192.168.1.2/255.255.255.255 -p tcp -m tcp --dport 25 -j ACCEPT
-A INPUT -s 192.168.1.0/255.255.255.0 -p tcp -m tcp --dport 25 -j REJECT
--reject-with icmp-port-unreachable
&lt;/pre&gt;

	&lt;p&gt;tcp wrapper example ( since this said sendmail, it must be the &lt;span class="caps"&gt;MTA&lt;/span&gt; running, not postfix, as postfix is not compiled against libwrap)&lt;/p&gt;


	&lt;p&gt;alternatives&amp;#8212;config mta&lt;/p&gt;


	&lt;p&gt;then /etc/hosts.deny:&lt;/p&gt;


&lt;pre&gt;
[root@station etc]# cat /etc/hosts.deny
#
# hosts.deny    This file describes the names of the hosts which are
#               *not* allowed to use the local INET services, as decided
#               by the '/usr/sbin/tcpd' server.
#
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow.  In particular
# you should know that NFS uses portmap!
#vsftpd: 10.0.0.0/255.0.0.0
#vsftpd: 10.0.0.0/255.0.0.0 EXCEPT 10.1.1.1
sendmail: 192.168.1.0/24 EXCEPT 192.168.1.2
&lt;/pre&gt;
followed with rules for governing port 110/143:
&lt;del&gt;-&lt;/del&gt;
&lt;pre&gt;[root@station etc]# cat /etc/sysconfig/iptables
# Generated by iptables-save v1.3.5 on Thu Aug  9 16:08:07 2007
*filter
:INPUT ACCEPT [134:32679]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [47:4569]
-A INPUT -s 192.168.1.2/255.255.255.255 -p tcp -m tcp --dport 25 -j ACCEPT
-A INPUT -s 192.168.1.2/255.255.255.255 -p tcp -m tcp --dport 143 -j ACCEPT
-A INPUT -s 192.168.1.2/255.255.255.255 -p tcp -m tcp --dport 993 -j ACCEPT
-A INPUT -s 192.168.1.2/255.255.255.255 -p tcp -m tcp --dport 110 -j ACCEPT
-A INPUT -s 192.168.1.2/255.255.255.255 -p tcp -m tcp --dport 995 -j ACCEPT
-A INPUT -s 192.168.1.0/255.255.255.0 -p tcp -m tcp --dport 25 -j REJECT --reject-with icmp-port-unreachable
-A INPUT -s 192.168.1.0/255.255.255.0 -p tcp -m tcp --dport 143 -j REJECT --reject-with icmp-port-unreachable
-A INPUT -s 192.168.1.0/255.255.255.0 -p tcp -m tcp --dport 993 -j REJECT --reject-with icmp-port-unreachable
-A INPUT -s 192.168.1.0/255.255.255.0 -p tcp -m tcp --dport 110 -j REJECT --reject-with icmp-port-unreachable
-A INPUT -s 192.168.1.0/255.255.255.0 -p tcp -m tcp --dport 995 -j REJECT --reject-with icmp-port-unreachable
&lt;/pre&gt;</description>
      <pubDate>Sat, 03 May 2008 01:02:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:1d7ebdc0-72e4-4f1d-805f-8b28387233a9</guid>
      <author>aalmazan@rackspace.com (alex almazan)</author>
      <link>http://alexalmazan.com/articles/2008/05/03/iptables</link>
      <category>iptables</category>
      <category>libwrap</category>
    </item>
    <item>
      <title>DoveCot SSL</title>
      <description>In order to configure &lt;span class="caps"&gt;SSL&lt;/span&gt; for dovecot, the following is recommended
&lt;pre&gt;
[root@station ]# cd /etc/pki/
[root@station pki]# ls
CA  dovecot  nssdb  rpm-gpg  tls
[root@station pki]# find . -name Makefile
./tls/certs/Makefile
[root@station pki]# cd tls/certs/
[root@station certs]# ls
ca-bundle.crt  localhost.crt  make-dummy-cert  Makefile
[root@station certs]# make
This makefile allows you to create:
  o public/private key pairs
  o SSL certificate signing requests (CSRs)
  o self-signed SSL test certificates

To create a key pair, run "make SOMETHING.key".
To create a CSR, run "make SOMETHING.csr".
To create a test certificate, run "make SOMETHING.crt".
To create a key and a test certificate in one file, run "make SOMETHING.pem".

To create a key for use with Apache, run "make genkey".
To create a CSR for use with Apache, run "make certreq".
To create a test certificate for use with Apache, run "make testcert".

To create a test certificate with serial number other than zero, add
SERIAL=num

Examples:
  make server.key
  make server.csr
  make server.crt
  make stunnel.pem
  make genkey
  make certreq
  make testcert
  make server.crt SERIAL=1
  make stunnel.pem SERIAL=2
  make testcert SERIAL=3
&lt;/pre&gt;

	&lt;p&gt;Dovecot requires a pem, which consists of a key and a cert.
Once generated, place in the location that is outlined in the server
configuration.&lt;/p&gt;


&lt;pre&gt;
[root@station certs]# make dovecot.pem
umask 77 ; \
        PEM1=`/bin/mktemp /tmp/openssl.XXXXXX` ; \
        PEM2=`/bin/mktemp /tmp/openssl.XXXXXX` ; \
        /usr/bin/openssl req -utf8 -newkey rsa:1024 -keyout $PEM1 -nodes
-x509 -days 365 -out $PEM2 -set_serial 0 ; \
        cat $PEM1 &amp;gt;  dovecot.pem ; \
        echo ""    &amp;gt;&amp;gt; dovecot.pem ; \
        cat $PEM2 &amp;gt;&amp;gt; dovecot.pem ; \
        rm -f $PEM1 $PEM2
Generating a 1024 bit RSA private key
.............++++++
..++++++
writing new private key to '/tmp/openssl.B21904'
&lt;/pre&gt;

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter &amp;#8217;.&amp;#8217;, the field will be left blank.
&lt;pre&gt;
Country Name (2 letter code) [GB]:US
State or Province Name (full name) [Berkshire]:Texas
Locality Name (eg, city) [Newbury]:San Antonio
Organization Name (eg, company) [My Company Ltd]: SSL example 
Organizational Unit Name (eg, section) []:3rd shift
Common Name (eg, your name or your server's hostname)
[]:station.rhce.example.com
Email Address []:user@rhce.example.com
[root@station certs]# ls
ca-bundle.crt  dovecot.pem  localhost.crt  make-dummy-cert  Makefile
&lt;/pre&gt;
&lt;span&gt;&lt;strong style="color:red;"&gt;mailtips&lt;/strong&gt;&lt;/span&gt;
for checking email during the test utilize mutt
&lt;pre&gt;
mutt -s imaps://user@@serverhost
&lt;/pre&gt;
&lt;pre&gt;
mutt -f imaps://localhost for checking/displaying:

q:Exit  ?:Help
This certificate belongs to:
   station.rhce.example.com
   Unknown
   SSL example
   3rd shift
   San Antonio

This certificate was issued by:
   station.rhce.example.com
   Unknown
   SSL example
   3rd shift
   San Antonio

This certificate is valid
   from Aug  9 16:52:18 2008 GMT
     to Aug  8 16:52:18 2009 GMT

Fingerprint: B247 62D4 197F 401B 61EA BC83 8733 8D9A
&lt;/pre&gt;
Telnet test to port 110 and &lt;span class="caps"&gt;SSL&lt;/span&gt; mutt foo.
&lt;pre&gt;[root@station etc]# telnet 0 110
Trying 0.0.0.0...
Connected to 0 (0.0.0.0).
Escape character is '^]'.
+OK Dovecot ready.
user mike
+OK
pass redhat
+OK Logged in.
list
+OK 1 messages:
1 472
.
retr 472
-ERR There's no message 472.
retr 1
+OK 472 octets
Return-Path: &amp;lt;root@station.example.com&amp;gt;
X-Original-To: ru@station.example.com
Delivered-To: user@station.example.com
Received: by station.example.com (Postfix, from userid 0)
        id CFB341988BE; Thu,  9 Aug 2007 13:09:10 -0500 (CDT)
To: ru@station.example.com
Subject: maildirdelivery
Message-Id: &amp;lt;20070809180910.CFB341988BE@station13.example.com&amp;gt;
Date: Thu,  9 Aug 2007 13:09:10 -0500 (CDT)
From: root@station.example.com (root)
&lt;/pre&gt;
maildir lab example

	&lt;p&gt;additional notes post lab&lt;/p&gt;


	&lt;p&gt;edits to /etc/dovecot.conf&lt;/p&gt;


	&lt;p&gt;protocols = imap imaps pop3 pop3s&lt;/p&gt;


the pem copied into these locations
&lt;pre&gt;
##
## SSL settings
##

# IP or host address where to listen in for SSL connections. Defaults
# to above if not specified.
#ssl_listen =

# Disable SSL/TLS support.
ssl_disable = no

# PEM encoded X.509 SSL/TLS certificate and private key. They're opened
before
# dropping root privileges, so keep the key file unreadable by anyone but
# root. Included doc/mkcert.sh can be used to easily generate self-signed
# certificate, just make sure to update the domains in dovecot-openssl.cnf
ssl_cert_file = /etc/pki/dovecot/certs/dovecot.pem
ssl_key_file = /etc/pki/dovecot/private/dovecot.pem
&lt;/pre&gt;</description>
      <pubDate>Sat, 03 May 2008 00:42:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:9e906420-901f-434a-99cc-69bfe98bede2</guid>
      <author>aalmazan@rackspace.com (alex almazan)</author>
      <link>http://alexalmazan.com/articles/2008/05/03/dovecot-ssl</link>
      <category>Mail Server Tips &amp; Tricks</category>
      <category>dovecot</category>
      <category>ssl</category>
      <category>IMAP</category>
    </item>
    <item>
      <title>Postfix Maildir</title>
      <description>Rhel5 &lt;span&gt;&lt;strong style="color:blue;"&gt;Postfix&lt;/strong&gt;&lt;/span&gt; installations support the &amp;#8216;mbox&amp;#8217; mailbox typically found in &amp;#8217;/var/spool/mail&amp;#8217; This default behavior can be changed to &amp;#8216;Maildir&amp;#8217; if desired. &lt;p&gt;
(You cannot revert back to &amp;#8216;mbox&amp;#8217; once you have opted to change to Maildir, and you cannot switch back to Sendmail without losing all messages stored and delivered.)
&lt;pre&gt;
postconf -e home_mailbox="Maildir/" 
postconf -e local_recipient_maps="unix:passwd.byname $alias_maps" 
postfix reload
&lt;/pre&gt;

These changes are required as per the following settings outlined in &amp;#8220;&lt;em&gt;/etc/postfix/main.cf&lt;/em&gt;&amp;#8221; 
&lt;pre&gt;
---# REJECTING MAIL FOR UNKNOWN LOCAL USERS
#
# The local_recipient_maps parameter specifies optional lookup tables
# with all names or addresses of users that are local with respect
# to $mydestination, $inet_interfaces or $proxy_interfaces.
#
# If this parameter is defined, then the SMTP server will reject
# mail for unknown local users. This parameter is defined by default.
#
# To turn off local recipient checking in the SMTP server, specify
# local_recipient_maps = (i.e. empty).
#
# The default setting assumes that you use the default Postfix local
# delivery agent for local delivery. You need to update the
# local_recipient_maps setting if:
#
# - You define $mydestination domain recipients in files other than
#   /etc/passwd, /etc/aliases, or the $virtual_alias_maps files.
#   For example, you define $mydestination domain recipients in
#   the $virtual_mailbox_maps files.
&lt;/pre&gt;</description>
      <pubDate>Fri, 02 May 2008 16:59:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:3c058bcb-b0da-4788-8f40-144a22eec087</guid>
      <author>aalmazan@rackspace.com (alex almazan)</author>
      <link>http://alexalmazan.com/articles/2008/05/02/postfix-maildir</link>
      <category>Mail Server Tips &amp; Tricks</category>
      <category>postfix</category>
      <category>maildir</category>
    </item>
    <item>
      <title>Locals Only Postfix</title>
      <description>&lt;p&gt;The default Rhel5 &lt;span&gt;&lt;strong style="color:blue;"&gt;Postfix&lt;/strong&gt;&lt;/span&gt; installation does not have an interface assigned for use. This is similar to the default Rhel5 &lt;span&gt;&lt;strong style="color:green;"&gt;Sendmail&lt;/strong&gt;&lt;/span&gt; defaulting to only serve localhost. &lt;p&gt;&lt;/p&gt;


	&lt;p&gt;To over come this behavior, you can use the &lt;span&gt;&lt;strong style="color:blue;"&gt;Postfix&lt;/strong&gt;&lt;/span&gt; installed &lt;strong&gt;postconf&lt;/strong&gt;  utility as opposed to a direct edit to the file &amp;#8217;/etc/postfix/main.cf&amp;#8217;&lt;/p&gt;


&lt;pre&gt; 
postconf -e "inet_interfaces=all" 
&lt;/pre&gt; 

	&lt;p&gt;Next issue either &amp;#8216;postfix reload&amp;#8217; or  &amp;#8216;&lt;em&gt;service postfix restart| stop | start&lt;/em&gt;&amp;#8217; as  root.&lt;/p&gt;</description>
      <pubDate>Fri, 02 May 2008 16:56:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:84bc0e80-96df-4901-bbe0-d574f7e503f6</guid>
      <author>aalmazan@rackspace.com (alex almazan)</author>
      <link>http://alexalmazan.com/articles/2008/05/02/locals-only-postfix</link>
      <category>Mail Server Tips &amp; Tricks</category>
      <category>postfix</category>
      <category>rhel5</category>
    </item>
    <item>
      <title>Locals Only</title>
      <description>&lt;p&gt;Sendmail default installations are established solely on localhost, please ensure that initial &amp;#8216;&lt;em&gt;.mc&lt;/em&gt;&amp;#8217; edits should include changes to the following line in the file &amp;#8216;&lt;em&gt;/etc/mail/sendmail.mc&lt;/em&gt;&amp;#8217; &lt;p&gt;&lt;/p&gt;


From this: &lt;p&gt;
&lt;pre&gt;
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
&lt;/pre&gt;
To this: &lt;p&gt;
&lt;pre&gt;
DAEMON_OPTIONS(`Port=smtp,Name=MTA')dnl
&lt;/pre&gt;

Considerations for &lt;span class="caps"&gt;SMTP&lt;/span&gt; authentication should also be put forth in the initial edits. Remove each &amp;#8216;&lt;strong&gt;&lt;em&gt;dnl&lt;/em&gt;&lt;/strong&gt;&amp;#8217; from the front of the lines in the file &amp;#8216;&lt;em&gt;/etc/mail/sendmail.mc&lt;/em&gt;&amp;#8217; that impact these listed configuration options:
&lt;pre&gt;
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN'')dnl
define(`confAUTH_MECHANISMS'', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN 
PLAIN'')dnl
&lt;/pre&gt;

	&lt;p&gt;Once your edits are in place, regenerate the configuration&lt;/p&gt;


&lt;pre&gt;
[root@station mail]# service sendmail restart
Shutting down sm-client:                                   [  OK  ]
Shutting down sendmail:                                    [  OK  ]
Starting sendmail:                                         [  OK  ]
Starting sm-client:                                        [  OK  ]
[root@station mail]# telnet 192.168.0.1 25
Trying 192.168.0.1...
Connected to station.example.com (192.168.0.1).
Escape character is '220 station.example.com ESMTP Sendmail 8.13.8/8.13.8; Thu, 9 Aug 2008
10:36:18 -0500
quit
221 2.0.0 station.example.com closing connection

Connection closed by foreign host.
&lt;/pre&gt;</description>
      <pubDate>Fri, 02 May 2008 15:46:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:772449b3-433c-4e08-9739-2d9539667a50</guid>
      <author>aalmazan@rackspace.com (alex almazan)</author>
      <link>http://alexalmazan.com/articles/2008/05/02/locals-only</link>
      <category>Mail Server Tips &amp; Tricks</category>
      <category>sendmail</category>
    </item>
    <item>
      <title>Switching Rhel5 MTA</title>
      <description>&lt;p&gt;&lt;span&gt;&lt;strong style="color:green;"&gt;Rhel alternatives script&lt;/strong&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;


	&lt;p&gt;Rhel5 as with Enterprise 3 and 4 comes with a scripted mechanism for establishing some very important symbolic links in the system. This functionality permits you to transtion your system into using the &lt;span class="caps"&gt;MTA&lt;/span&gt; of your choice. The scripted utility is called &lt;strong&gt;&lt;em&gt;&amp;#8216;alternatives&amp;#8217;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;Notes on the utilities usage:&lt;/p&gt;


&lt;strong&gt;&amp;#8220;&lt;em&gt;alternatives&amp;#8212;display mta&lt;/em&gt;&amp;#8220;&lt;/strong&gt;
&lt;pre&gt;
[root@station13 RHEL5RPMS]# alternatives --display mta
mta - status is auto.
 link currently points to /usr/sbin/sendmail.sendmail
/usr/sbin/sendmail.sendmail - priority 90
 slave mta-pam: /etc/pam.d/smtp.sendmail
 slave mta-mailq: /usr/bin/mailq.sendmail
 slave mta-newaliases: /usr/bin/newaliases.sendmail
 slave mta-rmail: /usr/bin/rmail.sendmail
 slave mta-sendmail: /usr/lib/sendmail.sendmail
 slave mta-mailqman: /usr/share/man/man1/mailq.sendmail.1.gz
 slave mta-newaliasesman: /usr/share/man/man1/newaliases.sendmail.1.gz
 slave mta-aliasesman: /usr/share/man/man5/aliases.sendmail.5.gz
 slave mta-sendmailman: /usr/share/man/man8/sendmail.sendmail.8.gz
/usr/sbin/sendmail.postfix - priority 30
 slave mta-pam: /etc/pam.d/smtp.postfix
 slave mta-mailq: /usr/bin/mailq.postfix
 slave mta-newaliases: /usr/bin/newaliases.postfix
 slave mta-rmail: /usr/bin/rmail.postfix
lave mta-mailqman: /usr/share/man/man1/mailq.postfix.1.gz
 slave mta-newaliasesman: /usr/share/man/man1/newaliases.postfix.1.gz
 slave mta-aliasesman: /usr/share/man/man5/aliases.postfix.5.gz
 slave mta-sendmailman: /usr/share/man/man1/sendmail.postfix.1.gz
Current `best' version is /usr/sbin/sendmail.sendmail.
&lt;/pre&gt;

	&lt;p&gt;The output reveals that this system is set for Sendmail usage. Take note of the listed item &amp;#8216;&lt;em&gt;link currently points to /usr/sbin/sendmail.sendmail&lt;/em&gt;&amp;#8217; Redhat is equipped with two versions of &amp;#8216;&lt;strong&gt;sendmail&lt;/strong&gt;&amp;#8217; for use, the file(s) &lt;span&gt;&lt;em style="color:green;"&gt;/usr/sbin/sendmail.postfix&lt;/em&gt;&lt;/span&gt; and &lt;span&gt;&lt;em style="color:green;"&gt;/usr/sbin/sendmail.sendmail&lt;/em&gt;&lt;/span&gt;. The script &lt;em&gt;alternatives&lt;/em&gt; switches the system links to permit the use of either &lt;span class="caps"&gt;MTA&lt;/span&gt;.&lt;/p&gt;


	&lt;p&gt;Swap system &lt;span class="caps"&gt;MTA&lt;/span&gt; to Postfix via &lt;strong&gt;alternatives&amp;#8212;config mta&lt;/strong&gt;&lt;/p&gt;


&lt;pre&gt;
[root@station13 RHEL5RPMS]# alternatives --config mta
  Selection    Command
-----------------------------------------------
*+ 1           /usr/sbin/sendmail.sendmail
   2           /usr/sbin/sendmail.postfix

&lt;/pre&gt;
Select the number presented to change the &lt;span class="caps"&gt;MTA&lt;/span&gt; in use. Complete all the dialog on the screen and the &lt;em&gt;alternatives&lt;/em&gt; script does all the heavy lifiting.&lt;p&gt;
(Once this is performed, it is important to review the startup scripts to ensure the appropriate &lt;span class="caps"&gt;MTA&lt;/span&gt; starts at server boot time.
&lt;pre&gt;
[root@station13 ]# chkconfig --list |egrep 'sendmail|postfix'
sendmail        0:off   1:off   2:on    3:on    4:on    5:on    6:off
postfix         0:off   1:off   2:on    3:off    4:off    5:off    6:off
&lt;/pre&gt;
 Change this to &amp;#8216;Postfix&amp;#8217; with
&lt;pre&gt;
[root@station13 ]#chkconfig --level 345 sendmail off
[root@station13 ]#chkconfig --level 345 postfix on
&lt;/pre&gt;

Recheck the preferred &lt;span class="caps"&gt;MTA&lt;/span&gt; 
&lt;pre&gt;
[root@station13 ]# chkconfig --list |egrep 'sendmail|postfix'
sendmail       0:off   1:off   2:on    3:off    4:off    5:off    6:off
postfix         0:off   1:off   2:on    3:on    4:on    5:on    6:off
&lt;/pre&gt;

	&lt;p&gt;&lt;span&gt;&lt;strong style="color:red;"&gt;notice&lt;/strong&gt;&lt;/span&gt; the change once sendmail/postfix is changed. It is imperative that these be reviewed if you are transitioning the &lt;span class="caps"&gt;MTA&lt;/span&gt; with &amp;#8216;&lt;em&gt;alternatives&lt;/em&gt;&amp;#8216;&lt;/p&gt;</description>
      <pubDate>Fri, 02 May 2008 15:22:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:ae29fc97-def2-435e-a4bc-0badd86b3c55</guid>
      <author>aalmazan@rackspace.com (alex almazan)</author>
      <link>http://alexalmazan.com/articles/2008/05/02/switching-rhel5-mta</link>
      <category>Mail Server Tips &amp; Tricks</category>
      <category>alternatives</category>
      <category>postfix</category>
      <category>sendmail</category>
    </item>
    <item>
      <title>Rhel5 MTA options</title>
      <description>&lt;p&gt;&lt;strong&gt;&lt;span style="color:green;"&gt;Which &lt;span class="caps"&gt;MTA&lt;/span&gt;?&lt;/span&gt;&lt;/strong&gt; &lt;strong&gt;Differences reviewed&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;A &lt;strong&gt;Mail Transfer Agent&lt;/strong&gt; (MTA) is a program that delivers mail and transports it between machines. Usually, there is only one &lt;span class="caps"&gt;MTA&lt;/span&gt; running on a machine at any particular time.&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;&lt;span class="caps"&gt;MUA&lt;/span&gt;&lt;/strong&gt; vs. &lt;strong&gt;&lt;span class="caps"&gt;MTA&lt;/span&gt;&lt;/strong&gt; &amp;#8211; A &lt;strong&gt;Mail User Agent&lt;/strong&gt; (MUA) is a program that users run to read, reply, to , compose and dispose of emails ( such as outlook, mozilla) You &lt;span style="color:red;"&gt;can&lt;/span&gt; have &lt;strong&gt;many&lt;/strong&gt; different &lt;strong&gt;&lt;span class="caps"&gt;MUA&lt;/span&gt;&lt;/strong&gt;&amp;#8217;s installed and running on one machine.&lt;/p&gt;


	&lt;p&gt;&lt;span&gt;&lt;strong style="color:green;"&gt;Sendmail&lt;/strong&gt;&lt;/span&gt; is an extremely popular mail transfer agent (MTA) used by default on many distributions to handle &lt;span class="caps"&gt;SMTP&lt;/span&gt; messaging.&lt;/p&gt;


	&lt;p&gt;The default  &lt;span&gt;&lt;strong style="color:green;"&gt;Sendmail&lt;/strong&gt;&lt;/span&gt; directory set in Rhel5 is   &amp;#8216;&lt;strong&gt;/etc/mail&lt;/strong&gt;&amp;#8217;. (this does not differ from prior enterprise versions a.k.a &lt;span class="caps"&gt;AS2&lt;/span&gt;.1,rhel3,&amp;#38; rhel4)&lt;/p&gt;


	&lt;p&gt;The file &lt;span&gt;&lt;strong style="color:red;"&gt;/etc/mail/sendmail.mc&lt;/strong&gt;&lt;/span&gt; serves as the configuration &lt;strong&gt;framework&lt;/strong&gt;. (BSD {free,open,net} Sendmail renames this file &lt;em&gt;hostname.mc&lt;/em&gt; post &amp;#8216;make install&amp;#8217; in /etc/mail as root)&lt;/p&gt;


&lt;span&gt;&lt;strong style="color:green;"&gt;Regenerate sendmail.mc&lt;/strong&gt;&lt;/span&gt;&lt;p&gt;
The file &lt;span&gt;&lt;strong style="color:red;"&gt;/etc/mail/sendmail.cf&lt;/strong&gt;&lt;/span&gt; is the cryptic assembly built from the &lt;strong&gt;framework&lt;/strong&gt; &amp;#8216;&lt;em&gt;.mc&lt;/em&gt;&amp;#8217; file with the following syntax as root.
&lt;pre&gt;
# make -C4 /etc/mail  
&lt;/pre&gt;&lt;p&gt;
You can also perform the following for generating the configuration, as well as a &amp;#8216;&lt;em&gt;service sendmail restart&lt;/em&gt;&amp;#8216;
&lt;pre&gt;
m4 &amp;lt; sendmail.mc&amp;gt;sendmail.cf
&lt;/pre&gt;&lt;p&gt;
Once you have made an attempt to regenerate the &lt;span&gt;&lt;strong style="color:green;"&gt;Sendmail&lt;/strong&gt;&lt;/span&gt; configuration, you should check that the corresponding &amp;#8216;&lt;em&gt;.cf&lt;/em&gt;&amp;#8217; file has been updated. To do so quickly, list the contents of  &amp;#8216;&lt;em&gt;/etc/mail&lt;/em&gt;&amp;#8217; with &amp;#8216;&lt;em&gt;ls -lrt&lt;/em&gt;&amp;#8217;, the file should appear at the bottom of the output recieved.

&lt;pre&gt;
[root@station ]# ls -lrt
total 356
-r--r--r-- 1 root root 41286 Nov 28  2006 submit.cf.bak
-rw-r--r-- 1 root root  5521 Nov 28  2006 helpfile
-rw-r--r-- 1 root root     0 Nov 28  2006 virtusertable
-rw-r--r-- 1 root root   127 Nov 28  2006 trusted-users
-rw-r--r-- 1 root root   940 Nov 28  2006 submit.mc
-rw-r--r-- 1 root root  1048 Nov 28  2006 Makefile
-rw-r--r-- 1 root root     0 Nov 28  2006 mailertable
-rw-r--r-- 1 root root    64 Nov 28  2006 local-host-names
-rw-r--r-- 1 root root     0 Nov 28  2006 domaintable
-rw-r--r-- 1 root root   355 Nov 28  2006 access
-rw-r----- 1 root root 12288 Aug  6 15:43 virtusertable.db
-rw-r--r-- 1 root root 58205 Aug  6 15:43 sendmail.cf.bak
-rw-r----- 1 root root 12288 Aug  6 15:43 mailertable.db
-rw-r----- 1 root root 12288 Aug  6 15:43 domaintable.db
-rw-r----- 1 root root 12288 Aug  6 15:43 access.db
-rw-r--r-- 1 root root  7202 Aug  9 10:33 sendmail.mc
-rw-r--r-- 1 root root 40239 Aug  9 10:34 submit.cf
-rw-r--r-- 1 root root 58240 Aug  9 10:34 sendmail.cf
&lt;/pre&gt;

	&lt;p&gt;Regeneration of the Sendmail configuration files should incorporate any and all configuration details put into the default &lt;strong&gt;sendmail.mc&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;Start up and shutdown of the &lt;span&gt;&lt;strong style="color:green;"&gt;Sendmail&lt;/strong&gt;&lt;/span&gt; service can be achieved with the syntax &amp;#8216;&lt;strong&gt;service sendmail &lt;em&gt;stop|start|restart&lt;/em&gt;&lt;/strong&gt;&amp;#8217;. You can also interact with the service, as you do for &lt;span class="caps"&gt;BSD&lt;/span&gt; based &lt;span&gt;&lt;strong style="color:green;"&gt;Sendmail&lt;/strong&gt;&lt;/span&gt; from the directory &amp;#8217;/etc/mail&amp;#8217;. To do so, issue &amp;#8216;&lt;strong&gt;make start&lt;/strong&gt;&amp;#8217; or &amp;#8216;&lt;strong&gt;make install start&lt;/strong&gt;&amp;#8216;&lt;/p&gt;


	&lt;p&gt;Upon service startup, especially after changes to the &lt;strong&gt;framework&lt;/strong&gt; file &lt;span style="color:red;"&gt;/etc/mail/sendmail.mc&lt;/span&gt;, a quick connection test to port 25 should confirm success or failure of the changes put forth into the file  &amp;#8216;&lt;em&gt;/etc/mail/sendmail.cf&lt;/em&gt;&amp;#8217;. Receipt of 200 series response codes are usually enough to confirm successful service operation.&lt;/p&gt;


Here is a telnet test example for a generic system &amp;#8216;user&amp;#8217;
&lt;pre&gt;
[root@station mail]# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 station.example.com ESMTP Sendmail 8.13.8/8.13.8; Thu, 9 Aug 2008
10:40:29 -0500
ehlo localhost
250-station.example.com Hello localhost.localdomain [127.0.0.1], pleased
to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
mail from:root@localhost
250 2.1.0 root@localhost... Sender ok
rcpt to:user@rhce.example.com
250 2.1.5 user@rhce.example.com... Recipient ok
data
354 Enter mail, end with "." on a line by itself
subject:using telnet
from:root
this is a body test good config
.
250 2.0.0 l79FeTOX020441 Message accepted for delivery
quit
221 2.0.0 station.example.com closing connection
Connection closed by foreign host.
&lt;/pre&gt;

Here is the message generated confirming local delivery
&lt;pre&gt;
[root@station mail]# tail -f /var/spool/mail/user
Received: from localhost (localhost.localdomain [127.0.0.1])
        by station.example.com (8.13.8/8.13.8) with ESMTP id l79FeTOX020441
        for user@rhce.example.com; Thu, 9 Aug 2008 10:41:48 -0500
Date: Thu, 9 Aug 2008 10:40:29 -0500
From: root &amp;lt;root@station.example.com&amp;gt;
Message-Id: &amp;lt;200708091541.l79FeTOX020441@station.example.com&amp;gt;
subject: using telnet

this is a body test good config
&lt;/pre&gt;

	&lt;p&gt;&lt;span&gt;&lt;strong style="color:green;"&gt;Virtual Hosting with Sendmail&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;


	&lt;p&gt;The file &lt;span&gt;&lt;strong style="color:red;"&gt;virtusertable&lt;/strong&gt;&lt;/span&gt; serves as a mechanism for building a virtual user environment for &lt;strong&gt;multiple domain hosting&lt;/strong&gt; as well as &lt;strong&gt;message forwarding&lt;/strong&gt;.
The file format employs a dual column setup. The leftmost column defines the  virtual hosted user at domain &amp;#8216;&lt;em&gt;&lt;strong&gt;user@FQDN&lt;/strong&gt;&lt;/em&gt;&amp;#8216;&lt;/p&gt;


	&lt;p&gt;The right hand column can be represented by a system user, or a forwarding email address. The first delivery condition is always utilized.&lt;/p&gt;


&lt;pre&gt;
sales@rhce.example.com        user
sales@demo.example.com        auser@example.com
@demo.example.com             student
script@rhce.example.com        |/path/to/file
&lt;/pre&gt;

	&lt;p&gt;&lt;span&gt;&lt;strong style="color:red;"&gt;Notice&lt;/strong&gt;&lt;/span&gt; &amp;#8211; the last listed examples highlights that you can use the &lt;span&gt;&lt;strong style="color:red;"&gt;virtusertable&lt;/strong&gt;&lt;/span&gt; to forward incoming messages to custom scripts.If file is a txt field, it will append messages. If file is a script then the script will execute with the messages as &lt;em&gt;&lt;strong&gt;stndin&lt;/strong&gt;&lt;/em&gt;.&lt;/p&gt;


Once the &lt;strong&gt;virtusertable&lt;/strong&gt; is created/editted, it has to be regenerated to incorporate the changes much like the &lt;span class="caps"&gt;MTA&lt;/span&gt;&amp;#8217;s main configuration file.  A service restart of &lt;span&gt;&lt;strong style="color:green;"&gt;Sendmail&lt;/strong&gt;&lt;/span&gt; will do it, as will the following syntax as root from the command line shell
&lt;pre&gt;
[root@station ]#makemap hash virtusertable &amp;lt;virtusertable
&lt;/pre&gt;
This action will rebuild the table without a service restart.&lt;p&gt;

	&lt;p&gt;The file &lt;span style="color:red;"&gt;/etc/mail/local-host-names&lt;/span&gt; serves as a list of domains the server will be responsible or accept messaging on behalf of. The acceptable file format is a listing of single domains per-line.&lt;/p&gt;


	&lt;p&gt;&lt;span&gt;&lt;strong style="color:green;"&gt;Sendmail&lt;/strong&gt;&lt;/span&gt; differs from &lt;span&gt;&lt;strong style="color:blue;"&gt;Postfix&lt;/strong&gt;&lt;/span&gt; in that  &amp;#8216;&lt;em&gt;&lt;strong&gt;/etc/aliases&lt;/strong&gt;&lt;/em&gt;&amp;#8217; should be used to send to groups or multiple recipients for &lt;span&gt;&lt;strong style="color:green;"&gt;Sendmail&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;


	&lt;p&gt;&lt;span&gt;&lt;strong style="color:blue;"&gt;Postfix&lt;/strong&gt;&lt;/span&gt; performs  &lt;em&gt;&amp;#8216;group&amp;#8217;&lt;/em&gt; delivery with a listing in a file such as as &lt;strong&gt;&lt;em&gt;/etc/postfix/virtual&lt;/em&gt;&lt;/strong&gt;:&lt;/p&gt;


	&lt;p&gt;The file format of &lt;span style="color:blue;"&gt;/etc/mail/virtusertable&lt;/span&gt; &lt;strong&gt;does &lt;span class="caps"&gt;NOT&lt;/span&gt;&lt;/strong&gt; support comma delimited recpients. This should be handled in the file  &lt;em&gt;&lt;strong&gt;/etc/aliases&lt;/strong&gt;&lt;/em&gt;  as deomonstrated in this example:&lt;/p&gt;


&lt;pre&gt;
# Person who should get root's mail
root:            user
team:           user,student
team2:          chris,jamie
&lt;/pre&gt;

	&lt;p&gt;Additional information or rules on &lt;a href="http://www.sendmail.org/tips/virtualHosting"&gt;Sendmail Virtual Hosting&lt;/a&gt;. can be reviewed at the official site&lt;/p&gt;


	&lt;p&gt;&lt;span&gt;&lt;strong style="color:blue;"&gt;Postfix&lt;/strong&gt;&lt;/span&gt; was designed from the ground up to be a replacement for &lt;span&gt;&lt;strong style="color:green;"&gt;Sendmail&lt;/strong&gt;&lt;/span&gt;.&lt;/p&gt;


	&lt;p&gt;The &lt;span&gt;&lt;strong style="color:blue;"&gt;Postfix&lt;/strong&gt;&lt;/span&gt; development group had the following four goals in mind when developing the service:&lt;/p&gt;


	&lt;table&gt;
		&lt;tr&gt;
			&lt;td&gt;it should be &lt;strong&gt;more efficient&lt;/strong&gt; than Sendmail&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;it should be &lt;strong&gt;more secure&lt;/strong&gt; that Sendmail&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;it should be &lt;strong&gt;easier to administer&lt;/strong&gt; than Sendmail&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;it should be &lt;strong&gt;100% Sendmail compatible&lt;/strong&gt;&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt;




	&lt;p&gt;To accomplish all the development group set out to do,&lt;span&gt;&lt;strong style="color:blue;"&gt;Postfix&lt;/strong&gt;&lt;/span&gt; is composed of many individual programs which each handle a particular aspect of mail transfer.&lt;p&gt;
All spawned processes are managed by a supervisory master daemon. This &lt;em&gt;master&lt;/em&gt; daemon inherits its configuration/operation characteristics through the use of the combined files &amp;#8216;&lt;strong&gt;&lt;em&gt;/etc/postfix/main.cf&lt;/em&gt;&lt;/strong&gt;&amp;#8217; and &amp;#8216;&lt;strong&gt;&lt;em&gt;/etc/postfix/master.cf&lt;/em&gt;&lt;/strong&gt;&amp;#8217;.&lt;p&gt;&lt;/p&gt;


	&lt;p&gt;The file &amp;#8216;&lt;strong&gt;&lt;em&gt;main.cf&lt;/em&gt;&lt;/strong&gt;&amp;#8217; contains configuration statements, where as the file &amp;#8216;&lt;strong&gt;&lt;em&gt;master.cf&lt;/em&gt;&lt;/strong&gt;&amp;#8217; has parameters related to the individual spawned processes connectivity to the system, to include such things as connection time out and service type and overall &amp;#8216;&lt;strong&gt;smtpd&lt;/strong&gt;&amp;#8217; operation of the Postfix service.&lt;/p&gt;


	&lt;p&gt;Provided is a list of the most essential configuration parameters are required for basic operation of &lt;span&gt;&lt;strong style="color:blue;"&gt;Postfix&lt;/strong&gt;&lt;/span&gt;.These items comprise the core elements of the file &amp;#8216;&lt;strong&gt;/etc/postfix/main.cf&lt;/strong&gt;&amp;#8216;&lt;/p&gt;


	&lt;table&gt;
		&lt;tr&gt;
			&lt;th&gt;&lt;em&gt;&lt;strong&gt;&amp;#8216;mydestination&amp;#8217;&lt;/strong&gt;&lt;/em&gt;&lt;/th&gt;
			&lt;td&gt;is equivalent to its Sendmail counterpart &lt;em&gt;&amp;#8217;/etc/mail/local-host-names&amp;#8217;&lt;/em&gt; This should not be used for virtual domains&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;th&gt;&lt;em&gt;&lt;strong&gt;&amp;#8216;mynetworks&amp;#8217;&lt;/strong&gt;&lt;/em&gt;&lt;/th&gt;
			&lt;td&gt;&lt;span class="caps"&gt;NOTE&lt;/span&gt; Postfix will act as a relay to any of the addresses specified with this parameter&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;th&gt;&lt;em&gt;&lt;strong&gt;&amp;#8216;inet_interfaces&amp;#8217;&lt;/strong&gt;&lt;/em&gt;&lt;/th&gt;
			&lt;td&gt;Default setting with Rhel5 is localhost,This configuratoin paramter tells the service which interface to monitor&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt;




&lt;span&gt;&lt;strong style="color:blue;"&gt;Other essential Postfix configuration parameters:&lt;/strong&gt;&lt;/span&gt;&lt;p&gt;
	&lt;table&gt;
		&lt;tr&gt;
			&lt;th&gt;&lt;em&gt;&lt;strong&gt;&amp;#8216;myorigin&amp;#8217;&lt;/strong&gt;&lt;/em&gt;&lt;/th&gt;
			&lt;td&gt;This name is added all locally originating email. The default behavior is to assume &amp;#8216;myhostname&amp;#8217;&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;th&gt;&lt;em&gt;&lt;strong&gt;&amp;#8216;myhostname&amp;#8217;&lt;/strong&gt;&lt;/em&gt;&lt;/th&gt;
			&lt;td&gt;The name of the system to include the domain. It is used to specify the Internet address scheme of the server&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;th&gt;&lt;em&gt;&lt;strong&gt;&amp;#8216;mydomain&amp;#8217;&lt;/strong&gt;&lt;/em&gt;&lt;/th&gt;
			&lt;td&gt;Specifies the current domain the server represents,in accord with configured &lt;span class="caps"&gt;DNS&lt;/span&gt;.This parameter should be used in place of &amp;#8216;&lt;em&gt;myhostname&lt;/em&gt;&amp;#8217; when in use to recieve hosted domain messaging&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;th&gt;&lt;em&gt;&lt;strong&gt;&amp;#8216;local_recipient_maps&amp;#8217;&lt;/strong&gt;&lt;/em&gt;&lt;/th&gt;
			&lt;td&gt;This setting informs the &lt;span class="caps"&gt;MTA&lt;/span&gt; where to find the names of local usersto accept mail for.It confirms user validity for message delivery/relay. (removing altogether will generate errors, blank is OK)&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;th&gt;&lt;em&gt;&lt;strong&gt;&amp;#8216;empty_address_recipient&amp;#8217;&lt;/strong&gt;&lt;/em&gt;&lt;/th&gt;
			&lt;td&gt;Defines the mail address where bounce notifications should be returned to for messages that bounce but have no sender address defined&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;th&gt;&lt;em&gt;&lt;strong&gt;&amp;#8216;smtpd_banner&amp;#8217;&lt;/strong&gt;&lt;/em&gt;&lt;/th&gt;
			&lt;td&gt;Banner provided to connecting &lt;span class="caps"&gt;SMTP&lt;/span&gt; servers.It is recommended that this &lt;span class="caps"&gt;FQDN&lt;/span&gt; value be properly defined in &lt;span class="caps"&gt;DNS&lt;/span&gt;, to include matching reverse mapping entries&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;th&gt;&lt;em&gt;&lt;strong&gt;&amp;#8216;message_size_limit&amp;#8217;&lt;/strong&gt;&lt;/em&gt;&lt;/th&gt;
			&lt;td&gt;Sets the maximum size of a message.Default settings reject all messages larger that 20MB&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;th&gt;&lt;em&gt;&lt;strong&gt;&amp;#8216;mailbox_size_limit&amp;#8217;&lt;/strong&gt;&lt;/em&gt;&lt;/th&gt;
			&lt;td&gt;Sets the maximum size of local mailbox files&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;th&gt;&lt;em&gt;&lt;strong&gt;&amp;#8216;queue_minfree&amp;#8217;&lt;/strong&gt;&lt;/em&gt;&lt;/th&gt;
			&lt;td&gt;This setting adjusts when the &lt;span class="caps"&gt;MTA&lt;/span&gt; will no longer accept messaging due to disk resource limits&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;th&gt;&lt;em&gt;&lt;strong&gt;&amp;#8216;transport_maps&amp;#8217;&lt;/strong&gt;&lt;/em&gt;&lt;/th&gt;
			&lt;td&gt;Specifies which protocol the &lt;span class="caps"&gt;MTA&lt;/span&gt; should use to send mail to particular hosts.This tables lists each remote host and protocol the &lt;span class="caps"&gt;MTA&lt;/span&gt; can use to send messages to that host&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;th&gt;&lt;em&gt;&lt;strong&gt;&amp;#8216;virtual_maps&amp;#8217;&lt;/strong&gt;&lt;/em&gt;&lt;/th&gt;
			&lt;td&gt;Sets the type and location of the &amp;#8216;&lt;em&gt;virtual&lt;/em&gt;&amp;#8217; lookup table.The lookup table lists each address or domain to be redirected on a seperate line. Each then points to a local address that holds messages destined for that domain/address&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;th&gt;&lt;em&gt;&lt;strong&gt;&amp;#8216;smtpd_helo_restrictions&amp;#8217;&lt;/strong&gt;&lt;/em&gt;&lt;/th&gt;
			&lt;td&gt;Can be used to subscribe to RBLs in an effort to combat bulk &lt;span class="caps"&gt;UCE&lt;/span&gt;&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;th&gt;&lt;em&gt;&lt;strong&gt;&amp;#8216;smptd_sender_restrictions&amp;#8217;&lt;/strong&gt;&lt;/em&gt;&lt;/th&gt;
			&lt;td&gt;Used to limit or restrict sending hosts. Used in conjuction with &amp;#8216;&lt;em&gt;helo_restrictions&lt;/em&gt;&amp;#8217; to combat bulk &lt;span class="caps"&gt;UCE&lt;/span&gt;&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;th&gt;&lt;em&gt;&lt;strong&gt;&amp;#8216;smtp_recipient_restrictions&amp;#8217;&lt;/strong&gt;&lt;/em&gt;&lt;/th&gt;
			&lt;td&gt;Prevents the server from being used as an open relay, as well as aids in fighting spam&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;th&gt;&lt;em&gt;&lt;strong&gt;&amp;#8216;content_fliter&amp;#8217;&lt;/strong&gt;&lt;/em&gt;&lt;/th&gt;
			&lt;td&gt;redirect all messaging to a content filter such as &amp;#8216;Amavisd&amp;#8217; or &amp;#8216;AMavisd-new&amp;#8217;&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;th&gt;&lt;em&gt;&lt;strong&gt;&amp;#8216;smtpd_recipient_limit&amp;#8217;&lt;/strong&gt;&lt;/em&gt;&lt;/th&gt;
			&lt;td&gt;limits the number of recipients allows in a single incoming message.Default is 1000&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;th&gt;&lt;em&gt;&lt;strong&gt;&amp;#8216;smtpd_timeout&amp;#8217;&lt;/strong&gt;&lt;/em&gt;&lt;/th&gt;
			&lt;td&gt;Amount of time the &lt;span class="caps"&gt;MTA&lt;/span&gt; waits for an &lt;span class="caps"&gt;STMP&lt;/span&gt; client request after sending a response. This value can be set in minutes, hours, days, or weeks, the default is seconds&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;th&gt;&lt;em&gt;&lt;strong&gt;&amp;#8216;queue_run_delay&amp;#8217;&lt;/strong&gt;&lt;/em&gt;&lt;/th&gt;
			&lt;td&gt;Interval in seconds in which the &lt;span class="caps"&gt;MTA&lt;/span&gt; scans the &lt;em&gt;deferred&lt;/em&gt; message queue for re-delivery. Default value is 1000&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;th&gt;&lt;em&gt;&lt;strong&gt;&amp;#8216;maximal_queue_lifetime&amp;#8217;&lt;/strong&gt;&lt;/em&gt;&lt;/th&gt;
			&lt;td&gt; interval in days that a message remains in the &lt;em&gt;deferred&lt;/em&gt; queue. Default is 5 days&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt;




Here is  all that is required to get messaging started 
&lt;pre&gt;
[root@station ]#postconf -e "myorigin-example.com" 
[root@station ]#postconf -e "mydestination=example.com,mail.example.com" 
[root@station ]#postconf -e "my networks=192.168.0.0/24,127.0.0.1" 
[root@station ]#postconf -e 'inet_interfaces=all
[root@station ]#postfix reload
&lt;/pre&gt;
Once you have put forth configuration changes, you can call up all differences with the &lt;strong&gt;postconf&lt;/strong&gt; utility through the use of switch &amp;#8216;n&amp;#8217;
&lt;pre&gt;
[root@station ]#postconf -n 
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
html_directory = no
inet_interfaces = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = ,localhost.,localhost,hash:/etc/postfix/localhostnames
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
sample_directory = /usr/share/doc/postfix-2.3.3/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
unknown_local_recipient_reject_code = 550
&lt;/pre&gt;

	&lt;p&gt;In order to split the RS configured &amp;#8216;mydomains&amp;#8217; and default &lt;em&gt;virtual&lt;/em&gt; &lt;span&gt;&lt;strong style="color:blue;"&gt;Postfix&lt;/strong&gt;&lt;/span&gt; file the following is needed in the configuration
&lt;em&gt;hash:/etc/postfix/mydomains&lt;/em&gt; at the end of the parameter &amp;#8216;mydestinations&amp;#8217;. The following steps outline how the domains are split off into their own seperate listing&lt;/p&gt;


&lt;pre&gt;
[root@station ]#postconf -e mydestination="$myhostname,localhost.$mydomain,localhost,hash:/etc/postfix/localhostnames" 
&lt;/pre&gt;

	&lt;p&gt;Create the file /etc/postfix/mydomains and add the domains:&lt;/p&gt;


&lt;pre&gt;
[root@station postfix]# cat mydomains
rhce.example.com      OK
demo.example.com      OK
&lt;/pre&gt;
issue 
&lt;pre&gt;
[root@station ]#postmap mydomains
[root@station ]#postfix reload
&lt;/pre&gt;
Next test the changes to &lt;span&gt;&lt;strong style="color:blue;"&gt;Postfix&lt;/strong&gt;&lt;/span&gt;
&lt;pre&gt;
[root@station ]# echo postfix test | mail -s "postfix rocks" 
user@demo.example.com
[root@station ]# tail -f /var/spool/mail/user
Received: by station.example.com (Postfix, from userid 0)
        id D2AFD1988B6; Thu,  9 Aug 2008 11:25:01 -0500 (CDT)
To: user@demo.example.com
Subject: postfix socks
Message-Id: &amp;lt;20070809162501.D2AFD1988B6@station.example.com&amp;gt;
Date: Thu,  9 Aug 2008 11:25:01 -0500 (CDT)
From: root@station.example.com (root)

postfix test
&lt;/pre&gt;
This is also needed to mimic the RS version of postfix
&lt;pre&gt;
virtual_alias_maps=hash:/etc/postfix/virtual
&lt;/pre&gt;

	&lt;p&gt;&lt;span&gt;&lt;strong style="color:blue;"&gt;Postfix&lt;/strong&gt;&lt;/span&gt; has a similar &lt;em&gt;alias&lt;/em&gt; mechanism to &lt;span&gt;&lt;strong style="color:green;"&gt;Sendmail&lt;/strong&gt;&lt;/span&gt;.The file &amp;#8216;&lt;em&gt;/etc/postfix/aliases&lt;/em&gt;&amp;#8217; should be edited to support the handling of mail for non-existent system accounts that may receive messaging such as &amp;#8216;webmaster/postmaster&amp;#8217; and of course handling of the systems &amp;#8216;root&amp;#8217; messaging.&lt;/p&gt;


	&lt;p&gt;When switching to &lt;span&gt;&lt;strong style="color:blue;"&gt;Postfix&lt;/strong&gt;&lt;/span&gt; you should replace the existing system provided &amp;#8216;&lt;em&gt;aliases&lt;/em&gt;&amp;#8217; file in  &amp;#8216;&lt;em&gt;/etc&lt;/em&gt;&amp;#8217; overwriting the existing format, as it is likely in place for &lt;span&gt;&lt;strong style="color:green;"&gt;Sendmail&lt;/strong&gt;&lt;/span&gt; by default. (I would also recommend that you backup all of &amp;#8216;&lt;em&gt;/etc/postfix&lt;/em&gt;&amp;#8217; to &amp;#8216;&lt;em&gt;/etc/postfix-orig&lt;/em&gt;&amp;#8217; .etc prior to implementing changes contrary to the default)&lt;/p&gt;


	&lt;p&gt;A touch or edit to &lt;span style="color:red;"&gt;/etc/aliases&lt;/span&gt; with &lt;span&gt;&lt;strong style="color:blue;"&gt;Postfix&lt;/span&gt;&lt;/strong&gt; requires the issuance of the command &amp;#8216;newaliases&amp;#8217;&lt;/p&gt;


small samples
&lt;pre&gt;
virtual
@domain        catch-all
aliases
catch-all: "/dev/null" 

&lt;/pre&gt;

	&lt;p&gt;Additional information or rules on &lt;a href="http://www.postfix.org/VIRTUAL_README.html"&gt;Postfix Virtual Hosting&lt;/a&gt;. can be reviewed at the official site&lt;/p&gt;</description>
      <pubDate>Tue, 29 Apr 2008 15:31:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:f3d983b0-7c01-48a9-85d4-3ce8ad52d7b1</guid>
      <author>aalmazan@rackspace.com (alex almazan)</author>
      <link>http://alexalmazan.com/articles/2008/04/29/rhel5-mta-options</link>
      <category>Linux Tips &amp; Tricks</category>
      <category>Mail Server Tips &amp; Tricks</category>
      <category>MTA</category>
      <category>sendmail</category>
      <category>postfix</category>
    </item>
  </channel>
</rss>
