• Re: dkim clarification

    From tomas@tuxteam.de@21:1/5 to rhkramer@gmail.com on Mon Jul 21 15:30:01 2025
    On Mon, Jul 21, 2025 at 09:10:08AM -0400, rhkramer@gmail.com wrote:
    Is it reasonably accurate (at a simple level) to say that dkim involves applying a digital signature to an email by the domain (as opposed to a digital signature applied by the user / sender of an email)?

    And that the domain uses the private key of a public / private keypair?

    Roughly, yes. It is applied to a (variable, but specified) subset
    of the headers and the mail's body. Which ones are is specified in
    the DKIM-Signature header.

    E.g., if <user>@<domain>.com sends an email, <domain>.com applies a digital signature to it?

    And then, in the DNS system entry for <domain>.com, among other things, the public key is stored?

    Strictly speaking, somewhere *beneath* <domain>.com, specifically at <selector>._domainkey.<domain>.com. The value of <selector> is also stated
    in the DKIM-Signature header.

    Your very mail has (I abbreviated a bit):

    DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
    d=gmail.com; s=20230601; t=1753103411; x=1753708211; darn=lists.debian.org;
    h=message-id:content-transfer-encoding:mime-version:user-agent:date
    :subject:to:from:from:to:cc:subject:date:message-id:reply-to;
    [...]

    ...so the selector would be 20230601, and you can query the public key
    (among other things) with:

    dig 20230601._domainkey.gmail.com TXT

    The "h=..." specifies which bits and bobs from your message go into
    the fingerprint.

    The Wikipedia [1] has, as usually, a very good explanation.

    Cheers

    [1] https://en.wikipedia.org/wiki/DKIM

    --
    tomás

    -----BEGIN PGP SIGNATURE-----

    iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCaH4/ywAKCRAFyCz1etHa Rqi/AJ0W3S8ZqI97jSDgnsjMQT/HT1WCAwCeI71dXBTfKEI12lKJiqkwMPD1zsQ=
    =+ua2
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dan Purgert@21:1/5 to rhkramer@gmail.com on Mon Jul 21 15:30:02 2025
    On Jul 21, 2025, rhkramer@gmail.com wrote:
    Is it reasonably accurate (at a simple level) to say that dkim involves applying a digital signature to an email by the domain (as opposed to a digital signature applied by the user / sender of an email)?

    And that the domain uses the private key of a public / private keypair?

    E.g., if <user>@<domain>.com sends an email, <domain>.com applies a
    digital signature to it?

    And then, in the DNS system entry for <domain>.com, among other
    things, the public key is stored?

    Surface-level, yes this is pretty accurate.


    (Extra points for anybody who can craft a somewhat similar simple
    explanation of DMARC.)

    It's a DNS TXT Record that acts as a request to recipients as to how to
    handle messages that have failed SPF/DKIM checks ( i.e. reject or
    quarantine) and also whether they should report the stats on messages (received/accepted/failed).


    --
    |_|O|_|
    |_|_|O| Github: https://github.com/dpurgert
    |O|O|O| PGP: DDAB 23FB 19FA 7D85 1CC1 E067 6D65 70E5 4CE7 2860

    -----BEGIN PGP SIGNATURE-----

    iQIzBAEBCgAdFiEE3asj+xn6fYUcweBnbWVw5UznKGAFAmh+QC0ACgkQbWVw5Uzn KGDyMBAAhY3WCcnX6Gt4KV6nbFOzaB3EryQWtDejvfHhiDt724S4Sav1cLdP8cfU 5S53SEwI78V02P7Xnvr5rNA7TbUs5eI1rD9O8Zk3Zpvqv3hS1dXxRqmAgsoOZJaX GETUcNdR3rwgmYyjFADvFr/kgjqX8WG/Qf4HvW4ClOLkKUBSPBAjaQif7SeVYDX3 W1ZoXnfLd1mrj/aVfBcVokgpvQV44VFa6pur8wx1jCTfBNRA51tWGm9BM2lqM9V3 AMUFyLB4YkuwwZ6lFV7uFxM1QNvQYfGApb8Fx17LOULq73Luv/to0fstP5E4FGgM RZpbuZCufLrPYk1tE1ML+W8nZqQZ04BQV1VtvsB9c3L4FQYo8PVd2vH21mH4A3dv yOrslM2+s8UU0jz5/vQKjBKWrZh0cIyVeGhmpsqAZqIEl6Ck6dAVmmJ/SjJbGxyl 5VX/SO3qElVLramjxrNq2kj8YUnXSAxj6Ih196qmkekaD6mdmYbe7a9xv5DIB9bF 0K2BB/tcwj04yzNOueUm3mIOT56qtD4A+BLfRUXsd3UbLR1w0gaVskolkb4rTK67 gTxfGAcHCr6jngoP5glzWKZDvyCKIjMkd8qYq5HQjzelswCHftVBwGkR7C4b6cMd etom7LUsVZ6yasFgDkiSddHgVTJKh1pHcJrgmWejXt9PmIY4aw8=
    =7IXb
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Us
  • From Andy Smith@21:1/5 to rhkramer@gmail.com on Mon Jul 21 16:40:01 2025
    Hi,

    On Mon, Jul 21, 2025 at 09:10:08AM -0400, rhkramer@gmail.com wrote:
    (Extra points for anybody who can craft a somewhat similar simple explanation of DMARC.)

    This whole topic is quite convoluted and only really relevant to the
    tiny numbers of us who run our own mail servers. Everyone using an email service providers (ESP) would normally expect their ESP to handle it
    all, maybe after some setup on their side if they use a custom domain.

    DMARC is about communicating what the "responsible" sending domain would
    like recipient servers to do about failures of DKIM and SPF.

    Strictly speaking according to the DMARC RFC, if *either* of SPF or DKIM
    pass then this is considered a DMARC pass. In practice, some mail
    systems have been known to take DMARC-related actions if only one or the
    other fails.

    The DMARC entry in the DNS says if the sender domain would like for
    failed messages to be rejected or quarantined. DMARC is just advisory
    and any system can do what it likes with mail it receives, so accepting
    things that the sender wanted rejected is still compliant if the
    receiving server wants. Of more concern are receiving systems that
    decide to reject even when the sender wanted quarantine. What
    "quarantine" means is also not defined by DMARC and is a local decision
    for the receiving system.

    Note that an email can have multiple DKIM signatures, and this one
    probably does. Any mail server in the path can add a DKIM signature and lists.debian.org does add one. The purpose of this is to make an
    assertion about the contents of the email *at the point that the given
    mail server saw it*.

    For DMARC purposes, it looks for something called "alignment". This just
    means that it wants a DKIM signature from the same domain that is in
    the From: header. i.e, for this email, it wants one from strugglers.net
    and will ignore others such as the one from lists.debian.org. That makes
    sense as you would expect that if an email is alleged to come from an
    address at example.org then it is the DKIM public key in the DNS for example.org that should be consulted, not any other key+signature that
    may be present.

    For SPF there is only ever one DNS entry that is looked for and that is
    inside the DNS zone for the *envelope sender*. The envelope sender of
    this email will be one at lists.debian.org, so it's Debian's SPF record
    that will be checked. The list mail should get an SPF pass because it
    really does come from Debian's infrastructure.

    Some Debian list email will fail DKIM due to overzealous choice of
    headers¹ to sign on the part of the sender — the list software adds a few headers and some people sign [even the non-existence of] these headers.
    But all real Debian list email should pass SPF, and so that pass alone
    should result in a DMARC pass.

    Thanks,
    Andy

    ¹ I'm not sure if it's still true but a couple of years ago the default
    configuration of the default MTA in Debian (exim4) would sign an
    excessive set of headers beyond what is recommended in the DKIM RFC,
    if DKIM signing was enabled.

    --
    https://bitfolk.com/ -- No-nonsense VPS hosting

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From tomas@tuxteam.de@21:1/5 to rhkramer@gmail.com on Wed Jul 23 06:50:01 2025
    On Tue, Jul 22, 2025 at 02:48:56PM -0400, rhkramer@gmail.com wrote:
    (Intentionally top posting): Thanks to all who replied!

    I expect (sooner or later) I will make a WikiLearn page summarizing what I've
    learned, including possibly quoting some of the answers.

    Thanks for spreading knowledge!

    In any case, I would
    include the names of those who responded as contributors unless any of them object.

    No objections from me, but feeling a bit queasy for my half-knowledge :)

    Cheers
    --
    t

    -----BEGIN PGP SIGNATURE-----

    iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCaIBpigAKCRAFyCz1etHa Rmk+AJ97cSLpETiUoWBTXn5OsuLt5SQKlwCfTs5QAZmjO1rlwwvi99xrm9Fl6ds=
    =sGWg
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From tomas@tuxteam.de@21:1/5 to rhkramer@gmail.com on Wed Jul 23 14:40:01 2025
    On Wed, Jul 23, 2025 at 08:24:50AM -0400, rhkramer@gmail.com wrote:
    On Wednesday, July 23, 2025 12:48:16 AM tomas@tuxteam.de wrote:

    [...]

    No objections from me, but feeling a bit queasy for my half-knowledge :)

    In general, for WikiLearn, I'll have a disclaimer to the effect (like many authors and such use) that any mistakes are my fault, not that of contributors.

    No worries: my queasiness comes from the opposite direction ;-)

    I should mention that (my) WikiLearn has been dormant (not many contributions)
    for a long time, but I'm working toward changing that.

    +1

    Cheers
    --
    t

    -----BEGIN PGP SIGNATURE-----

    iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCaIDWVQAKCRAFyCz1etHa Ro0PAJ90giWR8MkytOduj7Rie6VnyDX1rgCbBjVIaezcqpDZ8y5oJgzTsd2lVwI=
    =wt27
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)