1

I am running opensmtpd and all is well.

Of course I do not run an open relay and I tightly control how mail is sent through the mailserver.

However, my personal mailtool runs on a different virtual machine on the same physical server as the opensmtpd virtual machine. They are the same machine, just different VMs and, of course different IPs.

Can I skip all of the complicated authentication mechanisms and just tell opensmtpd "It is OK to relay mail from THIS IP address" ?

I would really love to just add a single line to my conf, specifying the one IP that is allowed through as if it were the local mailserver, and not have to do complicated configs on both client and server side ...

1 Answer 1

1

I've never used OpenSMTPD, but SMTPD.CONF(5) seems quite helpful. There's even an example on how to configure a server to reject messages unless they are from IP addresses listed as other relays.

Sites that accept non-local messages may be able to cut down on the volume of spam received by rejecting forged messages that claim to be from the local domain. The following example uses a list table other-relays to specify the IP addresses of relays that may legitimately originate mail with the owner's domain as the sender.

table aliases file:/etc/mail/aliases
table other-relays file:/etc/mail/other-relays

listen on lo0
listen on egress

action "local_mail" mbox alias <aliases>
action "outbound" relay

match for local action "local_mail"
match for any action "outbound"
match !from src <other-relays> mail-from "@example.com" for any \
      reject
match from any for domain example.com action "local_mail"

The match for any is quite liberate and requires the match !from src <other-relays> to limit it further, but as you requested a single configuration line, you could take the opposite approach. E.g. if you want to whitelist i.e. allow unrestricted relay from 198.51.100.10, you could:

match from src 198.51.100.10 for any relay

If it doesn't work directly, you might need to specify the simple relay action first:

action "outbound" relay
match from src 198.51.100.10 for any action "outbound"

That's:

  • match options action name

    If at least one mail envelope matches the options of one match action directive, receive the incoming message, put a copy into each matching envelope, and atomically save the envelopes to the mail spool for later processing by the respective dispatcher name.

    • [!] from src address | <address>

      Specify that session may only originate from string or list table address which can be a specific address or a subnet expressed in CIDR-notation.

    • [!] for any Specify that session may address any destination.

  • action name method [options]

    • relay Relay the message to another SMTP server.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .