Postfix Generic

While it is certainly possible to masquerade messages from your Postfix server using the "myorigin" parameter, it may have some undesirable side effects like you needing to also set up Postfix to receive email for the masqueraded domain using the "mydestination" parameter. In addition, using this approach is an all or nothing choice (except for the root user who remains exposed from the real origin).

Instead, if you want to be able to just masquerade a few user accounts, so that it appears that emails from these accounts are masqueraded and not all, then the Postfix "generic" option may be for you.

When I send email from the command line in Linux (Fedora 14) from my keith account (to an address not on my machine), I want it to appear that the email originated from my wright.keith@gmail account. Otherwise, most likely my email will get bounced because it will appear to have come from keith@nv53a.fedora.test.

Here's what I did to achieve this:

1. I added these two lines to the /etc/postfix/generic file:
keith@localhost wright.keith@gmail.com
keith@nv53a.fedora.test wright.keith@gmail.com

2. I added this line to /etc/postfix/main.cf:
smtp_generic_maps = hash:/etc/postfix/generic

3. I executed this command as root to hash the generic file into generic.db:
postmap /etc/postfix/generic

4. I restarted postfix to make the changes effective:
service postfix restart

Thanks to this wonderful tip from nixcraft.com (not sure why the url is cyberciti.biz):

No comments:

About Me - WrightRocket

My photo

I've worked with computers for over 30 years, programming, administering, using and building them from scratch.

I'm an instructor for technical computer courses, an editor and developer of training manuals, and an Android developer.