9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] DKIM with upas
@ 2018-01-29 15:58 Dave MacFarlane
  2018-01-30 22:19 ` Anthony Sorace
  0 siblings, 1 reply; 2+ messages in thread
From: Dave MacFarlane @ 2018-01-29 15:58 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

I started hosting my personal domain's email on 9front and wanted to
sign my outgoing emails with a DKIM, so I wrote something in Go that
reads a message from stdin and writes a DKIM signed version to stdout
(https://github.com/driusan/dkim).

I was planning on using it in /mail/lib/remotemail by having the final
"exec smtp [...]" replaced by " exec dkimsign [...] | upas/smtp [...]"
and that works with marshal (if I ensure that I add all the headers
that I'm signing manually), but not acme.

>From what I can tell, acme always uses a From line of "From:
localname" (overriding any that you manually specified), and expects
upas/smtp to add in the domain, which is causing the signature to fail
after smtp modifies the signed header. (marshal leaves any headers
that you manually specify unmolested, so the signature is valid as
long as you include a fully qualified From: line while writing the
message.)

Is there a better place/way to do the signing? Ideally I could sign it
as the last thing it does before going out over the wire, but at the
very least I need to sign it after expanding the addresses. (The
standard says I also need to do the hashing before smtp dot stuffing,
but I can take care of that with a flag on the Go side..) The best I
can think of is some convoluted mix of "upas/smtp -f .domainname |
dkimsign | [some script that undoes most of what upas/smtp -f did ] |
upas/smtp", but I have a feeling I'm just missing some better place to
do the signing from.

- Dave



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [9fans] DKIM with upas
  2018-01-29 15:58 [9fans] DKIM with upas Dave MacFarlane
@ 2018-01-30 22:19 ` Anthony Sorace
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony Sorace @ 2018-01-30 22:19 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Where you've put it seems like the right place to me.

Acme Mail is doing the wrong thing here. It should respect $upasname for
this purpose, like marshal does. I think this is just a change to mesgsend in
/acme/mail/src/reply.c; unlike marshal, don't overwrite user, but just wrap
"fprint(ofd, "From: %s\n", user);" with a check for $upasname being set.

I'm interested in using your DKIM thing, too, so thanks. :-)


> On Jan 29, 2018, at 10:58 , Dave MacFarlane <driusan@gmail.com> wrote:
>
> I started hosting my personal domain's email on 9front and wanted to
> sign my outgoing emails with a DKIM, so I wrote something in Go that
> reads a message from stdin and writes a DKIM signed version to stdout
> (https://github.com/driusan/dkim).
>
> I was planning on using it in /mail/lib/remotemail by having the final
> "exec smtp [...]" replaced by " exec dkimsign [...] | upas/smtp [...]"
> and that works with marshal (if I ensure that I add all the headers
> that I'm signing manually), but not acme.
>
> From what I can tell, acme always uses a From line of "From:
> localname" (overriding any that you manually specified), and expects
> upas/smtp to add in the domain, which is causing the signature to fail
> after smtp modifies the signed header. (marshal leaves any headers
> that you manually specify unmolested, so the signature is valid as
> long as you include a fully qualified From: line while writing the
> message.)
>
> Is there a better place/way to do the signing? Ideally I could sign it
> as the last thing it does before going out over the wire, but at the
> very least I need to sign it after expanding the addresses. (The
> standard says I also need to do the hashing before smtp dot stuffing,
> but I can take care of that with a flag on the Go side..) The best I
> can think of is some convoluted mix of "upas/smtp -f .domainname |
> dkimsign | [some script that undoes most of what upas/smtp -f did ] |
> upas/smtp", but I have a feeling I'm just missing some better place to
> do the signing from.
>
> - Dave




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-30 22:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-29 15:58 [9fans] DKIM with upas Dave MacFarlane
2018-01-30 22:19 ` Anthony Sorace

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).