<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Linux System Administration and Security &#187; Postfix</title>
	<atom:link href="http://www.jasonbrown.us/category/software/postfix/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jasonbrown.us</link>
	<description></description>
	<lastBuildDate>Tue, 31 Jan 2012 02:58:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Postfix and SSL</title>
		<link>http://www.jasonbrown.us/2009/11/postfix-and-ssl/</link>
		<comments>http://www.jasonbrown.us/2009/11/postfix-and-ssl/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 17:55:45 +0000</pubDate>
		<dc:creator>jason</dc:creator>
				<category><![CDATA[Postfix]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[OpenSSL]]></category>

		<guid isPermaLink="false">http://www.jasonbrown.us/?p=19</guid>
		<description><![CDATA[First we need to create our certificates. To create a certificate authority download the openssl-perl package through Yum: &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; yum install openssl-perl &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; Then issue the following command to create the CA certificate. &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; ./CA.pl -newca &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; After this process is done we need to create the certificate request and key. Once the certificate request ]]></description>
			<content:encoded><![CDATA[<p>First we need to create our certificates. To create a certificate authority download the openssl-perl package through Yum:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<em><strong><code>yum install openssl-perl</code></strong></em><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Then issue the following command to create the CA certificate.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>./CA.pl -newca</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>After this process is done we need to create the certificate request and key. Once the certificate request has been generated you then need to have the pem file signed by the CA.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>openssl req -new -days 365 -newkey rsa:2048 -keyout newkey.key -out newreq.pem<br />
openssl ca -out post_signed_cert.pem -infiles newreq.pem</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Create a directory on the Postfix server under the /etc/pki directory called postfix, place these files there, and change the permissions on the files.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>chmod 0400 *</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Add the following lines at the bottom of the main.cf file for Postfix<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>#SASL<br />
smtpd_sasl_auth_enable = yes<br />
broken_sasl_auth_clients = yes<br />
smtpd_sasl_type = dovecot<br />
smtpd_sasl_path = private/auth<br />
smtpd_sasl_security_options = noanonymous<br />
smtpd_recipient_restrictions =<br />
permit_mynetworks,<br />
permit_sasl_authenticated,<br />
reject_unauth_destination</code></em></strong></p>
<p>#TLS<br />
smtpd_tls_key_file = /etc/pki/postfix/private/postkey.key<br />
smtpd_tls_cert_file = /etc/pki/postfix/certs/post_signed_cert.pem<br />
smtpd_tls_loglevel = 1<br />
smtpd_tls_session_cache_timeout = 3600s<br />
smtpd_tls_session_cache_database = btree:/var/spool/postfix/smtpd_tls_cache<br />
tls_random_source = dev:/dev/urandom<br />
smtpd_tls_auth_only = yes<br />
smtpd_tls_security_level = may</p>
<p>#HELO Restrictions<br />
smtpd_delay_reject = yes<br />
smtpd_helo_required = yes<br />
smtpd_helo_restrictions =<br />
permit_mynetworks,<br />
reject_non_fqdn_helo_hostname,<br />
reject_invalid_helo_hostname,<br />
permit<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Next uncomment the submission line in the master.cf file.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>smtp inet n - n - - smtpd<br />
submission inet n - n - - smtpd</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>We now need to tie it into Dovecot. Go to the auth default section of the configuration file and add/edit the following lines.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>auth default {<br />
mechanisms = plain login<br />
passdb pam {<br />
}<br />
userdb passwd {<br />
}<br />
user = root<br />
socket listen {<br />
client {<br />
path = /var/spool/postfix/private/auth<br />
mode = 0660<br />
user = postfix<br />
group = postfix<br />
}<br />
}<br />
}</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Restart the Postfix and Dovecot services.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>service postfix restart<br />
service dovecot restart</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>In order to test to make sure SSL/TLS is working we will need to telnet to the port and run a few commands.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>$ telnet localhost 25<br />
Connected to localhost.localdomain (127.0.0.1).<br />
Escape character is '^]'.<br />
220 smtp.example.com ESMTP Postfix<br />
ehlo smtp.example.com<br />
250-smtp.example.com<br />
250-PIPELINING<br />
250-SIZE 10240000<br />
250-VRFY<br />
250-ETRN<br />
250-STARTTLS<br />
250-ENHANCEDSTATUSCODES<br />
250-8BITMIME<br />
250 DSN</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>What you are looking for is STARTTLS, this will tell you that SSL/TLS is activated. To make sure that the certificates are working correctly type: STARTTLS which should say 220 2.0.0 Ready to start TLS. If it says anything else then there is something wrong and you will need to go back and fix it.</p>
<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Postfix+and+SSL+http%3A%2F%2Fjasonbrown.us%2F%3Fp%3D19" title="Post to Twitter"><img class="nothumb" src="http://www.jasonbrown.us/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-big2.png" alt="Post to Twitter" /></a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.jasonbrown.us/2009/11/postfix-and-ssl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Postfix and ClamAV with RHEL/CentOS</title>
		<link>http://www.jasonbrown.us/2009/11/postfix-and-clamav-with-rhelcentos/</link>
		<comments>http://www.jasonbrown.us/2009/11/postfix-and-clamav-with-rhelcentos/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 13:58:12 +0000</pubDate>
		<dc:creator>jason</dc:creator>
				<category><![CDATA[Postfix]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[ClamAV]]></category>
		<category><![CDATA[RHEL]]></category>

		<guid isPermaLink="false">http://www.jasonbrown.us/?p=23</guid>
		<description><![CDATA[Postfix Install To create a functional SMTP server, first you need to install Postfix by running &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; yum install postfix &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; Check to make sure that your hostname also has your fully qualified domain name. &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; echo $HOSTNAME &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; If it does not have your domain, then you must add it to the configuration file. ]]></description>
			<content:encoded><![CDATA[<p><strong>Postfix Install</strong><br />
To create a functional SMTP server, first you need to install Postfix by running<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>yum install postfix</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Check to make sure that your hostname also has your fully qualified domain name.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<em><strong><code>echo $HOSTNAME</code></strong></em><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
If it does not have your domain, then you must add it to the configuration file.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>myhostname = smtp.example.com</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>You must also make your SMTP server listen on an interface besides the localhost. Uncomment:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<em><code><strong>inter_interfaces = localhost</strong><br />
-----------------------------------------------------------</code></em></p>
<p>To:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><code><em>inet_interfaces = all</em></code></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Now edit the configuration to allow trusted networks to relay emails. In most situations uncommenting:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>mynetworks_style = subnet</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
should be sufficient, however if you are allowing a larger network or deal with multiple networks then manually add the networks that will be trusted.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>mynetworks = 127.0.0.0/8, 192.168.1.0/24</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p><strong>ClamAV</strong><br />
Download and install clamav, clamav-db, clamd, clamav-milter from http://packages.sw.be/clamav/</p>
<p>Edit the init scripts to allow Postfix to read the clamav-milter socket. Add the following lines in the start, stop, and restart case statements.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>chmod 0775 /var/clamav/clmilter.socket<br />
chown clamav.postfix /var/clamav/clmilter.socket</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>If these settings are not set, Postfix will not be able to correctly communicate with the ClamAV milter and will receive a<br />
warning: connect to Milter service unix:/var/clama/clmilter.socket: Permission denied<br />
in the mail log</p>
<p>Now add:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong><em><code>smtpd_milters = unix:/var/clamav/clmilter.socket<br />
non_smtpd_milters = unix:/var/clamav/clmilter.socket</code></em></strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
to the bottom of main.cf and restart the Postfix service.</p>
<p>Now add freshclam to the cron to get automatic updates and everything should be all set.</p>
<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Postfix+and+ClamAV+with+RHEL%2FCentOS+http%3A%2F%2Fjasonbrown.us%2F%3Fp%3D23" title="Post to Twitter"><img class="nothumb" src="http://www.jasonbrown.us/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-big2.png" alt="Post to Twitter" /></a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.jasonbrown.us/2009/11/postfix-and-clamav-with-rhelcentos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

