Represents an author domain signing practices (adsp) record
The Author Domain Signing Policies (\s-1ADSP\s0) record can be published by any domain to help a receiver know what to do when it encounters an unsigned message claiming to originate from that domain.
The record is published as a \s-1DNS\s0 \s-1TXT\s0 record at _adsp._domainkey.DOMAIN where \s-1DOMAIN\s0 is the domain of the message's \*(L"From\*(R" address.
More details about this record can be found by reading the specification itself at <http://tools.ietf.org/html/rfc5617>.
Lookup an \s-1ADSP\s0 record in \s-1DNS\s0.
my $policy = Mail::DKIM::AuthorDomainPolicy->fetch( Protocol => "dns", Author => '[email protected]', );
If the \s-1ADSP\s0 record is found and appears to be valid, an object containing that record's information will be constructed and returned. If the \s-1ADSP\s0 record is blank or simply does not exist, an object representing the default policy will be returned instead. (See also \*(L"is_implied_default_policy()\*(R".) If a \s-1DNS\s0 error occurs (e.g. \s-1SERVFAIL\s0 or time-out), this method will \*(L"die\*(R".
Construct a default policy object.
my $policy = Mail::DKIM::AuthorDomainPolicy->new;
Construct an \s-1ADSP\s0 record from a string.
my $policy = Mail::DKIM::AuthorDomainPolicy->parse( String => "dkim=all", Domain => "aaa.example", );
Apply the policy to the results of a \s-1DKIM\s0 verifier.
my $result = $policy->apply($dkim_verifier);
The caller must provide an instance of Mail::DKIM::Verifier, one which has already been fed the message being verified.
Possible results are:
The message is approved by the sender signing policy.
The message is rejected by the sender signing policy. It can be considered very suspicious.
The message is neither approved nor rejected by the sender signing policy. It can be considered somewhat suspicious.
Note: in the future, these values may become: none - no \s-1ADSP\s0 record is published pass - a passing signature is present fail - \s-1ADSP\s0 record is \*(L"all\*(R" and no passing signature is found discard - \s-1ADSP\s0 record is \*(L"discardable\*(R" and no passing signature is found nxdomain - the \s-1DNS\s0 domain does not exist temperror - transient error occurred permerror - non-transient error occurred
Tells whether this policy implied.
my $is_implied = $policy->is_implied_default_policy;
If you fetch the policy for a particular domain, but that domain does not have a policy published, then the \*(L"default policy\*(R" is in effect. Use this method to detect when that happens.
Tells where the policy was fetched from.
If the policy is domain-wide, this will be domain where the policy was published.
If the policy is user-specific, \s-1TBD\s0.
If nothing is published for the domain, and the default policy was returned instead, the location will be \*(C`undef\*(C'.
Get or set the outbound signing policy (dkim=) tag.
my $sp = $policy->policy;
Outbound signing policy for the entity. Possible values are: The default. The entity may sign some or all email. All mail from the domain is expected to be signed, using a valid Author signature, but the author does not suggest discarding mail without a valid signature. All mail from the domain is expected to be signed, using a valid Author signature, and the author is so confident that non-signed mail claiming to be from this domain can be automatically discarded by the recipient's mail server. The domain is out of scope, i.e., the domain does not exist in the \s-1DNS\s0.
True if policy is \*(L"all\*(R".
True if policy is \*(L"strict\*(R".
Section 4.3 of the specification says to perform a query on the domain itself just to see if it exists. This class is not currently doing that, i.e. it might report \s-1NXDOMAIN\s0 because _adsp._domainkey.example.org is nonexistent, but it should not be treated the same as example.org being nonexistent.
Jason Long, <[email protected]>
Copyright (C) 2006-2009 by Messiah College
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.