postalsys / mailauth

Command line utility and a Node.js library for email authentication
Other
127 stars 10 forks source link

Expose if SPF and DKIM aligned in results #15

Closed titanism closed 2 years ago

titanism commented 2 years ago

Right now there is no way to internally call the tools that mailauth uses such as getAligment and getDmarcRecord to get whether dkim and spf were aligned based off the DMARC policy.

It would be helpful to expose these in DMARC resulting object as properties such as spfAligned: boolean and dkimAligned: boolean, based off the same value exposed here:

https://github.com/postalsys/mailauth/blob/master/lib/dmarc/verify.js#L149-L158

andris9 commented 2 years ago

Added alignment property to dmarc status in v2.3.3, the info includes alignment status and also indicates if strict mode was used or not, see below:

"dmarc": {
  "status": {
    "result": "pass",
    "comment": "p=REJECT arc=pass",
    "header": {
      "from": "github.com",
      "d": "github.com"
    }
  },
  "domain": "github.com",
  "policy": "reject",
  "p": "reject",
  "sp": "reject",
  "pct": 100,
  "rr": "v=DMARC1; p=reject; pct=100; rua=mailto:dmarc@github.com,mailto:d@rua.agari.com",
  "alignment": {
    "spf": {
      "result": false,
      "strict": false
    },
    "dkim": {
      "result": "github.com",
      "strict": false
    }
  },
  "info": "dmarc=pass (p=REJECT arc=pass) header.from=github.com header.d=github.com"
}
titanism commented 2 years ago

Thanks - can you also update the gist https://gist.github.com/andris9/6514b5e7c59154a5b08636f99052ce37 and the examples in the README?