Module: MailAuth
- Defined in:
- lib/mailauth.rb,
lib/mailauth/arc.rb,
lib/mailauth/spf.rb,
lib/mailauth/dkim.rb,
lib/mailauth/dmarc.rb,
lib/mailauth/domain.rb,
lib/mailauth/result.rb,
lib/mailauth/arc/set.rb,
lib/mailauth/message.rb,
lib/mailauth/version.rb,
lib/mailauth/arc/seal.rb,
lib/mailauth/resolver.rb,
lib/mailauth/arc/chain.rb,
lib/mailauth/spf/macro.rb,
lib/mailauth/spf/budget.rb,
lib/mailauth/spf/record.rb,
lib/mailauth/dkim/signer.rb,
lib/mailauth/dmarc/record.rb,
lib/mailauth/dkim/algorithm.rb,
lib/mailauth/dkim/public_key.rb,
lib/mailauth/dmarc/alignment.rb,
lib/mailauth/arc/message_signature.rb,
lib/mailauth/dkim/canonicalization.rb,
lib/mailauth/authentication_results.rb,
lib/mailauth/dmarc/organizational_domain.rb
Overview
Authenticates a received message against SPF, DKIM, DMARC, and ARC, returning the verdicts and the RFC 8601 Authentication-Results header stating them. Says nothing about whether the message is wanted.
Defined Under Namespace
Modules: Arc, Dkim, Dmarc, Domain, Spf, Status Classes: ArcResult, ArcSeal, ArcSet, ArcSignature, AuthenticationResults, DkimResult, DmarcResult, Message, Resolver, Result, Signature, SpfResult
Constant Summary collapse
- VERSION =
"0.3.1"
Class Method Summary collapse
Class Method Details
.authenticate(raw, ip:, helo: nil, mail_from: nil, mta: nil, resolver: Resolver.new, now: Time.now) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/mailauth.rb', line 15 def self.authenticate(raw, ip:, helo: nil, mail_from: nil, mta: nil, resolver: Resolver.new, now: Time.now) = Message.new(raw) spf = Spf.check(ip: ip, helo: helo, mail_from: mail_from, resolver: resolver) dkim = Dkim.verify(, resolver: resolver, now: now) dmarc = Dmarc.check(header_from: .header_from_domain, spf: spf, dkim: dkim, resolver: resolver) # DMARC is measured against this hop and ARC reports on earlier ones, so the # two are answered apart. Letting a chain speak for DMARC would hand any # sender a pass for the price of sealing their own message. arc = Arc.verify(, resolver: resolver, now: now) Result.new(spf:, dkim:, dmarc:, arc:, authentication_results: AuthenticationResults.new(spf:, dkim:, dmarc:, arc:, mta:, header_from: .header_from_domain).to_s) end |