https://github.com/jirutka/opensmtpd-filter-rewrite-from
OpenSMTPD 6.6+ filter for rewriting From address
https://github.com/jirutka/opensmtpd-filter-rewrite-from
awk filter opensmtpd opensmtpd-filter
Last synced: 3 months ago
JSON representation
OpenSMTPD 6.6+ filter for rewriting From address
- Host: GitHub
- URL: https://github.com/jirutka/opensmtpd-filter-rewrite-from
- Owner: jirutka
- License: isc
- Created: 2019-08-18T16:27:22.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-01-20T12:00:03.000Z (over 4 years ago)
- Last Synced: 2025-10-06T20:32:13.119Z (8 months ago)
- Topics: awk, filter, opensmtpd, opensmtpd-filter
- Language: Awk
- Size: 4.88 KB
- Stars: 22
- Watchers: 3
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE
Awesome Lists containing this project
README
= OpenSMTPD filter-rewrite-from
:script-name: filter-rewrite-from
This is a _very_ simple OpenSMTPD filter for rewriting email address in both `MAIL FROM` command and `From` header in all footnote:[This implementation doesn’t support any conditions or different rewrite addresses based on the source. It’s really trivial, just for my current needs.] messages with the specified email address.
It’s useful when you want to ensure that all the relayed messages will be “send from” some _no-reply_ email address.
This filter is implemented in ~60 lines (LoC) of `awk`.
== Requirements
* http://pubs.opengroup.org/onlinepubs/009695399/utilities/awk.html[POSIX awk] (e.g. from Busybox, GNU, BSD, …)
* https://www.opensmtpd.org/[OpenSMTPD] 6.6.0 or higher
== Installation
Just copy link:{script-name}[{script-name}] to some directory, e.g. `/usr/local/share/opensmtpd`.
If you have `awk` installed in a different directory than `/usr/bin`, adjust the shebang.
== Configuration
The filter itself requires no configuration, only the desired From email address as the first argument.
It must be declared in smtpd.conf and attached to a listener:
[source, subs="+attributes"]
----
filter "rewrite-from" proc-exec "/usr/local/share/opensmtpd/{script-name} no-reply@example.org"
listen on socket filter "rewrite-from"
----
== See Also
* https://poolp.org/posts/2018-11-03/opensmtpd-released-and-upcoming-filters-preview/[OpenSMTPD released and upcoming filters preview] by https://github.com/poolpOrg[Gilles Chehade]
* https://poolp.org/posts/2019-07-27/july-2019-report-tons-of-smtpd-work-mostly/[July 2019 report: tons of smtpd work mostly] by https://github.com/poolpOrg[Gilles Chehade]
== License
This project is licensed under http://opensource.org/licenses/ISC/[ISC License].
For the full text of the license, see the link:LICENSE[LICENSE] file.