1

Topic: Your message is not signed with DKIM

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.8.7
- Deployed with iRedMail Easy or the downloadable installer?
- Linux/BSD distribution name and version: ubuntu 14.04
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):  PGSQL
- Web server (Apache or Nginx): apache2
- Manage mail accounts with iRedAdmin-Pro? no
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.

"Your message is not signed with DKIM"
====

/etc/amavis/conf.d/50-user

chomp($mydomain = "iredmail02.abc.com");
@local_domains_maps = 1;
@mynetworks = qw( 127.0.0.0/8 [::1] [FE80::]/10 [FEC0::]/10
                  10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 );

$inet_socket_port = [10024, 9998,];

$virus_admin = "root\@$mydomain"; # due to D_DISCARD default
$mailfrom_notify_admin = "root\@$mydomain";
$mailfrom_notify_recip = "root\@$mydomain";
$mailfrom_notify_spamadmin = "root\@$mydomain";

$mailfrom_notify_admin     = "root\@$mydomain";  # notifications sender
$mailfrom_notify_recip     = "root\@$mydomain";  # notifications sender
$mailfrom_notify_spamadmin = "root\@$mydomain"; # notifications sender
$mailfrom_to_quarantine = ''; # null return path; uses original sender if undef

$defang_banned = 0;  # MIME-wrap passed mail containing banned name

$policy_bank{'MYNETS'} = {   # mail originating from @mynetworks
  originating => 1,  # is true in MYNETS by default, but let's make it explicit
  os_fingerprint_method => undef,  # don't query p0f for internal clients
  allow_disclaimers => 1,  # enables disclaimer insertion if available
};

$policy_bank{'ORIGINATING'} = {  # mail supposedly originating from our users
  originating => 1,  # declare that mail was submitted by our smtp client
  allow_disclaimers => 1,  # enables disclaimer insertion if available
  # notify administrator of locally originating malware
  virus_admin_maps => ["root\@$mydomain"],
  spam_admin_maps  => ["root\@$mydomain"],
  warnbadhsender   => 0,
  warnbannedsender   => 0,
  warnvirussender  => 1,
  warnspamsender   => 1,
  # forward to a smtpd service providing DKIM signing service
  #forward_method => 'smtp:[amavis]:10027',
  # force MTA conversion to 7-bit (e.g. before DKIM signing)
  smtpd_discard_ehlo_keywords => ['8BITMIME'],
  #bypass_banned_checks_maps => [1],  # allow sending any file names and types
  terminate_dsn_on_notify_success => 0,  # don't remove NOTIFY=SUCCESS option
};

$log_level = 0;              # verbosity 0..5, -d
$sa_debug = 0;

$myhostname = "iredmail02.abc.com";

$notify_method  = 'smtp:[127.0.0.1]:10025';
$forward_method = 'smtp:[127.0.0.1]:10025';

$final_virus_destiny      = D_DISCARD;
$final_banned_destiny     = D_PASS;
$final_spam_destiny       = D_PASS;
$final_bad_header_destiny = D_PASS;

@av_scanners = (

    #### http://www.clamav.net/
    ['ClamAV-clamd',
    \&ask_daemon, ["CONTSCAN {}\n", "/tmp/clamd.socket"],
    qr/\bOK$/, qr/\bFOUND$/,
    qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],
);

@av_scanners_backup = (

    ### http://www.clamav.net/   - backs up clamd or Mail::ClamAV
    ['ClamAV-clamscan', 'clamscan',
    "--stdout --disable-summary -r --tempdir=$TEMPBASE {}", [0], [1],
    qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],
);



$policy_bank{'MYUSERS'} = {
    # declare that mail was submitted by our smtp client
    originating => 1,

    # enables disclaimer insertion if available
    allow_disclaimers => 1,

    # notify administrator of locally originating malware
    virus_admin_maps => ["root\@$mydomain"],
    spam_admin_maps  => ["root\@$mydomain"],

    # forward to a smtpd service providing DKIM signing service
    #forward_method => 'smtp:[127.0.0.1]:10027',

    # force MTA conversion to 7-bit (e.g. before DKIM signing)
    smtpd_discard_ehlo_keywords => ['8BITMIME'],
    # don't remove NOTIFY=SUCCESS option
    terminate_dsn_on_notify_success => 0,

    # don't perform spam/virus/header check.
    #bypass_spam_checks_maps => [1],
    #bypass_virus_checks_maps => [1],
    #bypass_header_checks_maps => [1],

    # allow sending any file names and types
    #bypass_banned_checks_maps => [1],

    # Quarantine clean messages
    #clean_quarantine_method => 'sql:',
    #final_destiny_by_ccat => {CC_CLEAN, D_DISCARD},
};


$interface_policy{'9998'} = 'AM.PDP-INET';
$policy_bank{'AM.PDP-INET'} = {
    protocol => 'AM.PDP',       # select Amavis policy delegation protocol
    inet_acl => [qw( 127.0.0.1 [::1] )],    # restrict access to these IP addresses
    auth_required_release => 1,    # 0 - don't require secret_id for amavisd-release
    #log_level => 4,
    #always_bcc_by_ccat => {CC_CLEAN, 'admin@example.com'},
};

$bad_header_quarantine_method = undef;

$spam_quarantine_method = undef;

$banned_files_quarantine_method = undef;
$sa_spam_modifies_subj = 1;

$warnbannedsender = 0;


$warnbadhsender = 0;

$warnvirusrecip = 0;
$warnbannedrecip = 0;

$warn_offsite = 0;
$sql_allow_8bit_address = 1;
$timestamp_fmt_mysql = 1;

$undecipherable_subject_tag = undef;

$smtp_connection_cache_enable = 0;

$signed_header_fields{'received'} = 0;
$signed_header_fields{'to'} = 1;

$originating = 1;

dkim_key("abc.com", "dkim", "/var/lib/dkim/abc.com.pem");



@dkim_signature_options_bysender_maps = ( {
    # ------------------------------------
    # For domain: abc.com.
    # ------------------------------------
    # 'd' defaults to a domain of an author/sender address,
    # 's' defaults to whatever selector is offered by a matching key

    #'postmaster@abc.com'    => { d => "abc.com", a => 'rsa-sha256', ttl =>  7*24*3600 },
    #"spam-reporter@abc.com"    => { d => "abc.com", a => 'rsa-sha256', ttl =>  7*24*3600 },

    # explicit 'd' forces a third-party signature on foreign (hosted) domains
    "abc.com"  => { d => "abc.com", a => 'rsa-sha256', ttl => 10*24*3600 },
    #"host1.abc.com"  => { d => "host1.abc.com", a => 'rsa-sha256', ttl => 10*24*3600 },
    #"host2.abc.com"  => { d => "host2.abc.com", a => 'rsa-sha256', ttl => 10*24*3600 },
    # ---- End domain: abc.com ----

    # catchall defaults
    '.' => { a => 'rsa-sha256', c => 'relaxed/simple', ttl => 30*24*3600 },
} );
$enable_dkim_verification = 1;  # enable DKIM signatures verification
$enable_dkim_signing = 1;    # load DKIM signing code, keys defined by dkim_key

$altermime = '/usr/bin/altermime';

@altermime_args_disclaimer = qw(--disclaimer=/etc/postfix/disclaimer/_OPTION_.txt --disclaimer-html=/etc/postfix/disclaimer/_OPTION_.txt --force-for-bad-html);
@disclaimer_options_bysender_maps = ({
    # Per-domain disclaimer setting: /etc/postfix/disclaimer/host1.iredmail.org.txt
    #'host1.iredmail.org' => 'host1.iredmail.org',

    # Sub-domain disclaimer setting: /etc/postfix/disclaimer/iredmail.org.txt
    #'.iredmail.org'      => 'iredmail.org',

    # Per-user disclaimer setting: /etc/postfix/disclaimer/boss.iredmail.org.txt
    #'boss@iredmail.org'  => 'boss.iredmail.org',

    # Catch-all disclaimer setting: /etc/postfix/disclaimer/default.txt
    '.' => 'default',
},);
@storage_sql_dsn = (
    ['DBI:Pg:database=amavisd;host=127.0.0.1;port=5432', 'amavisd', 'fo70bDCQtFydlcZn31DnIOtq33MDBc'],
);
delete $admin_maps_by_ccat{&CC_UNCHECKED};

$max_servers = 10;

1;  # insure a defined return

I can pass the testkeys

minion@mail:/etc/amavis/conf.d$ sudo amavisd-new testkey
TESTING#1: dkim._domainkey.abc.com   => pass
minion@mail:/etc/amavis/conf.d$

and DKIM/SPF DNS record also passed

dig DKIM

minion@mail:/etc/amavis/conf.d$ dig -t txt dkim._domainkey.abc.com

; <<>> DiG 9.9.5-3-Ubuntu <<>> -t txt dkim._domainkey.abc.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62431
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;dkim._domainkey.abc.com. IN    TXT

;; ANSWER SECTION:
dkim._domainkey.abc.com. 639 IN    TXT    "v=DKIM1\; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCkE2MzUIncitiaK46eLYxvYaHKkgjROWy78K52zk0VTDoVSI1an70RQUTNdYBV+WQzc10lzv8YLweTvg+gBOda6OkvZtaDYbKgN6NYZA07DsT4eNY80nASaiwtggxha4MdNqEVaWHpeAcVE4L2YchTTjM+P02V17K4BDHSTPDzUwIDAQAB"

;; Query time: 8 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Thu Feb 21 09:58:29 CST 2019
;; MSG SIZE  rcvd: 300

minion@mail:/etc/amavis/conf.d$

dig spf

minion@mail:/etc/amavis/conf.d$ dig abc.com txt

; <<>> DiG 9.9.5-3-Ubuntu <<>> abc.com txt
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1855
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;abc.com.        IN    TXT

;; ANSWER SECTION:
abc.com.    3599    IN    TXT    "google-site-verification=vHPSgHLB0gJIGY0wg"
abc.com.    3599    IN    TXT    "v=spf1 mx a ptr ip4:2.2.2.2/32 ~all"

;; Query time: 283 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Thu Feb 21 09:59:13 CST 2019
;; MSG SIZE  rcvd: 180

minion@mail:/etc/amavis/conf.d$

but outgoing mails still not sign by DKIM  according to mail-tester.com or port25.com

is there anything I should look for ?? what configuration I missed ?

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Your message is not signed with DKIM

Questions:

- Did you send email with SMTP authentication?
- Try to update Amavisd parameter, add "d => "abc.com"" for the catch-all domain like below, restart amavisd service and try again.

@dkim_signature_options_bysender_maps = ( {
    ...
    "abc.com"  => { d => "abc.com", a => 'rsa-sha256', ttl => 10*24*3600 },
    ...
    '.' => { d => "abc.com", a => 'rsa-sha256', c => 'relaxed/simple', ttl => 30*24*3600 },
} );