Emil CHERICHES

Emil CHERICHES

modern days aliases

February 11, 2014 Emil C
No Comments

Asuming we have on a mail server(that hosts domain1.com) some external aliases, like user1@domain1.com has an alias for user1@domain2.com, which is hosted on a different server, probably on a different mail provider. Typically when a mail is sent to user1@domain1.com, it’s sender’s mail server sends the mail to the MX which hosts domain1.com the mail is accepted, but being an alias the domain1.com MX tries to send it again to user1@domain2.com.

This didn’t used to be a problem few years back when methods like SPF or Sender-ID didn’t existed and the server hosting the domain2.com email would not check if the server identifying as the original sender’s mail server is legit or not.

Sadly, nowadays this wouldn’t work, the domain2.com MX would reject the mail just because the domain1.com MX is not the MX for the original sender.

So, the domain1.com mail server needs to alter this email so that domain2.com’s MX believes the mail comes from user1@domain1.com.

In Postfix this type of configuration is quite simple. The first thing to set the virtual_alias_maps table and put into it user1@domain1.com as an alias to a local account, something like

user1@domain1.com user1

The next step is to modify the local alias map, typically situated in the file /etc/aliases and put something like:

user1:  "|/opt/redirector user1@domain1.com user1@domain2.com"

Then we need to create the /opt/redirector script, which has only two lines:

#!/bin/sh
/usr/sbin/sendmail -bm -f $1 $2

the script needs to be executed

chmod +x /opt/redirector

some database update

postmap /etc/postfix/virtualnewaliases

restart postfix(probably not really necessary) and voila!

 

Image credits.

Tips & Tricks Postfix
Previous Post

RedHat and CentOS

Next Post

Linux still sucks (in 2014)

Leave a Reply Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts
  • Flash Tasmota on the Sonoff Mini – Linux user experience
  • DokuWiki a simple solution to sorting documentation
  • I discovered Wireguard
  • Using Let’s Encrypt with CentOS (for now)
  • Let’s Encrypt is Trusted
Categories
  • from the web
  • just blog
  • linux
    • Mail Server Series
  • News
  • phones
  • Phones & Tablets
  • programing
  • security
  • Smart Home
  • Tips & Tricks
  • Uncategorized
  • Web development
  • Windows
Blogroll
  • cheriches.fr
Subscribe by Email
Recent Posts
  • Flash Tasmota on the Sonoff Mini – Linux user experience
  • DokuWiki a simple solution to sorting documentation
  • I discovered Wireguard
  • Using Let’s Encrypt with CentOS (for now)
  • Let’s Encrypt is Trusted
Categories
  • Android (0)
  • from the web (3)
  • just blog (1)
  • linux (16)
    • Mail Server Series (7)
  • News (1)
  • phones (1)
  • Phones & Tablets (2)
  • programing (1)
  • security (2)
  • Smart Home (1)
  • Tips & Tricks (15)
  • Uncategorized (3)
  • Web development (1)
  • Windows (1)
Blogroll
  • cheriches.fr
Tags cloud
adb ADS aircrack-ng Android Apache apt-get CentOS Chrome ClamAV Cluster CSS Debconf debian DKIM Dovecot EasyRSA EPEL Firefox Firewall GNOME High Availability iptables KVM linux MariaDB Milter MySQL Nginx php Postfix Postfix Admin Proxy_ARP Python release Roundcube Samba SELinux Sonoff SpamAssassin ssh Tasmota ubuntu VRRP windows Youtube
Recent Comments
  • Frank on Dedicated Mail Server Hosting Multiple Domains – Step 3 – Postfix and Dovecot
  • Andrew Schott on Dedicated Mail Server Hosting Multiple Domains – Step 3 – Postfix and Dovecot
  • Emil C on Dedicated Mail Server Hosting Multiple Domains – Step 3 – Postfix and Dovecot
  • Andrew Schott on Dedicated Mail Server Hosting Multiple Domains – Step 3 – Postfix and Dovecot
  • Emil C on Dedicated Mail Server Hosting Multiple Domains – Step 3 – Postfix and Dovecot
Proudly powered by WordPress | Theme: Fmi by Forrss.
Manage Cookie Consent
We use cookies to optimize our website and our service.
Functional cookies Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage vendors Read more about these purposes
View preferences
{title} {title} {title}