Skip to content

Make filtermail use normal 127.0.0.1 as the source address#778

Closed
feld wants to merge 1 commit intochatmail:mainfrom
feld:fix-filtermail-srcaddr
Closed

Make filtermail use normal 127.0.0.1 as the source address#778
feld wants to merge 1 commit intochatmail:mainfrom
feld:fix-filtermail-srcaddr

Conversation

@feld
Copy link
Copy Markdown
Collaborator

@feld feld commented Dec 15, 2025

On some OSes in you can use any address in the 127.0.0.0/8 range and it will work fine, but FreeBSD won't allow it.

On some OSes in you can use any address in the 127.0.0.0/8 range
and it will work fine, but FreeBSD won't allow it.
"localhost",
self.config.postfix_reinject_port_incoming,
source_address=("127.0.0.2", 0),
source_address=("127.0.0.1", 0),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above, the reason for using 127.0.0.2 is to make opendkim verify DKIM signature. For messages that come from 127.0.0.1 it signs the message instead.

@hpk42
Copy link
Copy Markdown
Contributor

hpk42 commented Dec 17, 2025

@feld how did you manage to get his freebsd relay running (with working cmping with other hosts, i assume) regarding OpenDKIM ?

@link2xt
Copy link
Copy Markdown
Contributor

link2xt commented Dec 17, 2025

@feld how did you manage to get his freebsd relay running (with working cmping with other hosts, i assume) regarding OpenDKIM ?

Relay probably signs incoming messages instead of verifying the signature if this change is applied.

@feld
Copy link
Copy Markdown
Collaborator Author

feld commented Dec 17, 2025

My incoming messages all show

DKIM Results: Passed=true

However, that may be due to running in a traditional FreeBSD jail without a full network stack (full network stack jails are VNET jails). In this scenario 127.0.0.1 gets remapped automatically to the IP of the jail, which would be something other than 127.0.0.1 when OpenDKIM sees it.

That's likely what's going on, but I need to investigate further.

@link2xt
Copy link
Copy Markdown
Contributor

link2xt commented Dec 17, 2025

DKIM passes because you still sign outgoing mails. But now for incoming mails you also sign them instead of verifying them.

To make this less error-prone, one way would be to set InternalHosts to empty list (need to check if this actually disables signing) and then use MacroList or MTA configuration to make OpenDKIM sign instead of verifying where needed: http://www.opendkim.org/opendkim.conf.5.html

@link2xt
Copy link
Copy Markdown
Contributor

link2xt commented Dec 18, 2025

Let's close this, this change fails the test: #783
I opened #784 using macros instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants