<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.leaky.org/index.php?action=history&amp;feed=atom&amp;title=Postfix</id>
		<title>Postfix - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.leaky.org/index.php?action=history&amp;feed=atom&amp;title=Postfix"/>
		<link rel="alternate" type="text/html" href="https://wiki.leaky.org/index.php?title=Postfix&amp;action=history"/>
		<updated>2026-04-13T09:51:27Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https://wiki.leaky.org/index.php?title=Postfix&amp;diff=369&amp;oldid=prev</id>
		<title>Leaky: Added postfix notes</title>
		<link rel="alternate" type="text/html" href="https://wiki.leaky.org/index.php?title=Postfix&amp;diff=369&amp;oldid=prev"/>
				<updated>2018-10-16T07:33:38Z</updated>
		
		<summary type="html">&lt;p&gt;Added postfix notes&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== DKIM ==&lt;br /&gt;
&lt;br /&gt;
DKIM notes copied from https://www.linuxtechi.com/configure-domainkeys-with-postfix-on-centos-7/ (in case they disappear).&lt;br /&gt;
&lt;br /&gt;
Enable EPEL repo&lt;br /&gt;
&lt;br /&gt;
 # yum install epel-release&lt;br /&gt;
&lt;br /&gt;
Install OpenDKIM package and generate the default keys&lt;br /&gt;
&lt;br /&gt;
 # yum install -y opendkim&lt;br /&gt;
 # opendkim-default-keygen&lt;br /&gt;
 Generating default DKIM keys:&lt;br /&gt;
 Default DKIM keys for freshdaymall.com created in /etc/opendkim/keys.&lt;br /&gt;
 #&lt;br /&gt;
&lt;br /&gt;
In /etc/opendkim/keys/ are two files - default.private (used for signing the emails) and default.txt (public key to be published in DNS). A selector 'default' is created.&lt;br /&gt;
&lt;br /&gt;
Edit the following config files:&lt;br /&gt;
&lt;br /&gt;
* /etc/opendkim.conf&lt;br /&gt;
&lt;br /&gt;
 Mode sv&lt;br /&gt;
 Socket inet:8891@127.0.0.1&lt;br /&gt;
 Canonicalization relaxed/simple&lt;br /&gt;
 Domain ''yourdomain.com''&lt;br /&gt;
 #KeyFile /etc/opendkim/keys/default.private&lt;br /&gt;
 KeyTable refile:/etc/opendkim/KeyTable&lt;br /&gt;
 SigningTable refile:/etc/opendkim/SigningTable&lt;br /&gt;
 ExternalIgnoreList refile:/etc/opendim/TrustedHosts&lt;br /&gt;
 InternalHosts refile:/etc/opendkim/TrustedHosts&lt;br /&gt;
&lt;br /&gt;
* /etc/opendkim/KeyTable&lt;br /&gt;
&lt;br /&gt;
 default._domainkey.''yourdomain.com'' ''yourdomain.com'':default:/etc/opendkim/keys/default.private&lt;br /&gt;
&lt;br /&gt;
* /etc/opendkim/SigningTable&lt;br /&gt;
&lt;br /&gt;
 *@''yourdomain.com'' default._domainkey.''yourdomain.com''&lt;br /&gt;
&lt;br /&gt;
* /etc/opendkim/TrustedHosts&lt;br /&gt;
&lt;br /&gt;
 127.0.0.1&lt;br /&gt;
 ''host.yourdomain.com''&lt;br /&gt;
 ''yourdomain.com''&lt;br /&gt;
&lt;br /&gt;
Add the following three lines to the end of /etc/postfix/main.cf&lt;br /&gt;
&lt;br /&gt;
 smtpd_milters = inet:127.0.0.1:8891&lt;br /&gt;
 non_smtpd_milters = $smtpd_milters&lt;br /&gt;
 milter_default_action = accept&lt;br /&gt;
&lt;br /&gt;
Restart all the services&lt;br /&gt;
&lt;br /&gt;
 systemctl start opendkim&lt;br /&gt;
 systemctl enable opendkim&lt;br /&gt;
 systemctl restart postfix&lt;br /&gt;
&lt;br /&gt;
Add the contents of /etc/opendkim/keys/default.txt to the DNS for ''yourdomain.com'' and make sure that the zone has been reloaded.&lt;br /&gt;
&lt;br /&gt;
Send a test email:&lt;br /&gt;
&lt;br /&gt;
 # sendmail -fyou@yourdomain.com -t&lt;br /&gt;
 To: you@externaldomain.com&lt;br /&gt;
 From: you@yourdomain.com&lt;br /&gt;
 Subject: DKIM test with Postfix MTA&lt;br /&gt;
 &lt;br /&gt;
 Test&lt;br /&gt;
 .&lt;br /&gt;
&lt;br /&gt;
Check the maillog:&lt;br /&gt;
&lt;br /&gt;
 Oct 15 13:07:11 host opendkim[3530]: 34D25401AE: DKIM-Signature field added (s=default, d=yourdomain.com)&lt;br /&gt;
&lt;br /&gt;
Testing it:&lt;br /&gt;
&lt;br /&gt;
Try the site at http://www.appmaildev.com/en/dkim/&lt;br /&gt;
&lt;br /&gt;
== Configure Postfix to block outgoing email to all but one domain ==&lt;br /&gt;
&lt;br /&gt;
This is useful on demo systems where you don't want to be sending most email but still require the ability to send emails to a particular domain or two.&lt;br /&gt;
&lt;br /&gt;
The correct way is to use Transport Mapping. Check &amp;lt;code&amp;gt;/etc/postfix/main.cf&amp;lt;/code&amp;gt; for a transport_maps option. If there is one already, make a note of the filename in use and substitute that in the rest of these instructions. If there isn't one, add the following to main.cf&lt;br /&gt;
&lt;br /&gt;
 transport_maps = hash:/etc/postfix/transport&lt;br /&gt;
&lt;br /&gt;
CentOS7 Postfix ships with a template transport file - either replace or append:&lt;br /&gt;
&lt;br /&gt;
 yourdomain.com :&lt;br /&gt;
 localhost :&lt;br /&gt;
 * discard:&lt;br /&gt;
&lt;br /&gt;
This will allow emails to localhost or yourdomain.com but nowhere else. You'll see in /var/log/maillog the process postfix/discard instead of postfix/smtp when dropping emails. Add whatever other domains might be required to the file. If you want a bounce, you can use  something like this instead of &amp;lt;code&amp;gt;* discard:&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 * error:Outgoing mail blocked&lt;br /&gt;
&lt;br /&gt;
Rebuild the transport hash using:&lt;br /&gt;
&lt;br /&gt;
 postmap /etc/postfix/transport&lt;br /&gt;
&lt;br /&gt;
After changing the config, restart the postfix service - this is not required if you're just changing the transport map.&lt;br /&gt;
&lt;br /&gt;
 service postfix restart&lt;/div&gt;</summary>
		<author><name>Leaky</name></author>	</entry>

	</feed>