Migrating From Sendmail To Postfix, CentOS 6 To CentOS 8

Home » CentOS » Migrating From Sendmail To Postfix, CentOS 6 To CentOS 8
CentOS 3 Comments

I have an email server/aggregator which delivers locally for root, and all other emails in my domain. It sends outbound email to my isp
(networksolutins) masquerading as my domain via SMTP. This is with sendmail.

It does not receive email from the internet via SMTP. I use fetchmail to get incoming mail from multiple email/isp’s. I use procmail for local delivery and serve emails using dovecot/imap. These all work fine.

I am getting new hardware for this machine, and plan to setup CentOS 8, which uses postfix, not sendmail. I’ve been trying to provision a vm with the proper configuration, but cannot get any emails delivered to root.

Is there a pointer to a configuration guide that will help me do what I
want? I have googled about 100 setups, none of which are what I’m trying to achieve. They all suggest using an alias for root to a normal user, but them that user gets all of the cron, fail2ban, etc emails, instead of delivering them to root on the local machine.

Thanks,

-chuck

3 thoughts on - Migrating From Sendmail To Postfix, CentOS 6 To CentOS 8

  • sendmail is also available – postfix is just the default.

    The fact that they are all saying to use an alias must surely be telling you something!

    The issue is that if root is receiving mail, then you must be reading it as root and that is a really bad thing to be doing. If you don’t want the mail to go to a user, then setup another account purely to receive the root mail that doesn’t have elevated privs.

    BTW, other than the fact you shouldn’t login as root, the reason for this is that the mailbox that receives the mail is owned by the user and the delivery process is run as that user – except for root, which is run as a non-privileged user: the last thing you want is for some random email to possibly be processed as root, especially as you say you are using procmail. There is a note in the main.cf file:

    # IF YOU USE THIS TO DELIVER MAIL SYSTEM-WIDE, YOU MUST SET UP AN
    # ALIAS THAT FORWARDS MAIL FOR ROOT TO A REAL USER.

    P.

  • Even for local users that are in /etc/passwd?

    So something in the postfix configuration is telling it to send mail elsewhere. Have you changed the postfix config at all? Because usually it is happy to deliver local mail for local users. The aliases file should have something like

    root: chuck

    where ‘chuck’ is the local user; that will put the message in
    /var/mail/chuck. There’s a postfix config variable called
    ‘local_recipient_maps’ that determines what is a local recipient – but the default uses, amongst other things, the standard unix passwd file.

    P.

  • So even if you do something like

    mail chuck

    at the command line (with whatever user has a local account) it still gets sent to the ISP?

    relay_host is the host that mail is sent to if it can’t be delivered elsewhere.

    relay_domains is a list of domains the host will relay mail to.

    In /etc/postfix/main.cf what is ‘local_recipient_maps’ set to? Also, what about ‘mydestination’

    If you look in /var/log/maillog what does a message log for a local user look like when sent using the mail command?

    P.