18

Right now my Helo Address = localhost (helo=localhost). Is it better to set this to my server's domain name? If so, how do I change it? I'm running Ubuntu 12.04 and Postfix. Thanks.

petrosmm
  • 107
  • 5
MountainX
  • 5,729
  • 19
  • 65
  • 90

2 Answers2

23

You can change it in postfix configuration file /etc/postfix/main.cf.

The helo line is controlled by the smtpd_banner parameter. It probably references the myhostname option. Put your server name there instead of localhost:

myhostname = server.example.com
smtpd_banner = $myhostname

and restart postfix with sudo postfix reload.

Calimo
  • 1,162
  • 17
  • 23
  • @nvidot thanks for the edit suggestion. You suggested a significant change from my answer. You should post it as a new answer. It sounds like a valid alternative answer to me, so in addition you should be able to get credit for it. – Calimo Aug 10 '20 at 15:32
3

The intended goal of the post owner is to know how to set the Helo Address in Postfix config and to know at what value it is best to set it. I'll make the hypothesis that by best, we should uderstand the value that will give my mail the greatest chance to be accepted on delivery.

The helo line is controlled by the smtp_helo_name parameter. It, by default, references the myhostname parameter.

smtp_helo_name = $myhostname

In order to pass the spf_helo test, you'll need to have a corresponding SPF record in your DNS for the address smtp_helo_name references.

If you already have configured such SPF record for your domain, a straigthforward way to achieve SPF helo check is to use the domain as helo name:

smtp_helo_name = $mydomain

But it is best practice to set it to the fully qualified domain name of the emitting host. This requires to have a SPF for that FQDN hostname in your DNS.

Note: The following holds for a single domain, just replace all occurrences of domainB with domainA. If domainA serves other domains, configure them similar to what is done for domainB.

For example suppose that the DNS for domainB.tld contains the following:

                       600 IN TXT    "v=spf1 mx -all"
                           IN MX     mx.domainA.tld

i.e. domainA hosts the SMTP server of domainB: mx.domainA.tld.

Then domainA DNS zone must contain a SPF record for host mx, along with the corresponding record that resolves to the IP address, for example:

mx                     600 IN TXT    "v=spf1 a -all"
mx                     600 IN A      A.B.C.D

then if myhostname references mx.domainA.tld you can let smtp_helo_name to its default value (i.e. myhostname) or you can configure it as needed.

Then reload postfix configuration (systemctl reload postfix).

nvidot
  • 131
  • 1
  • 1
  • 5
  • 1
    Anecdotal, however, I have recently reviewed Spamhaus a blacklist provider and they stated that helo check should be ideally a [FQDN](https://www.spamhaus.org/faq/section/Hacked...%20Here's%20help#539). I wanted to leave that for others incase they are not sure and postfix manual says similar. – petrosmm Nov 03 '20 at 16:14
  • 1
    Thank you for that information. I initially configured this way because I was trying to achieve SPF helo check but was returned "SPF_helo: none: local=": No applicable sender policy available". Passing the domain as smtp_helo_name did work but indeed was not satisfactory, can't remember why exactly (may be something to do with GMAIL). So I eventually went back to default (i.e. $myhostname) as I realized that what was missing for it to pass helo check was a SPF record for the fqdn_hostname in addition to the SPF record for the domain itself. – nvidot Nov 11 '20 at 12:22
  • And thank you for the follow-up. Now people don't have to spend hours hunting for information like this. – petrosmm Nov 11 '20 at 14:34