1

Topic: iRedMail and php script and dkim

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.5-1
- Linux/BSD distribution name and version: Linux testmail 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19) x86_64 GNU/Linux
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): mysql
- Web server (Apache or Nginx): nginx
- Manage mail accounts with iRedAdmin-Pro? No
- Related log if you're reporting an issue:

Oct 19 22:11:02 testmail postfix/pickup[3498]: 8F5C56064D: uid=0 from=<root>
Oct 19 22:11:02 testmail postfix/cleanup[3624]: 8F5C56064D: message-id=<20161019221102.8F5C56064D@testmail.domain.tld>
Oct 19 22:11:02 testmail postfix/qmgr[3497]: 8F5C56064D: from=<root@domain.tld>, size=345, nrcpt=1 (queue active)
Oct 19 22:11:02 testmail amavis[1184]: (01184-11) (!)connect to /var/run/clamav/clamd.ctl failed, attempt #1: Can't connect to a UNIX socket /var/run/clamav/clamd.ctl: No such file or directory
Oct 19 22:11:03 testmail amavis[1184]: (01184-11) (!)connect to /var/run/clamav/clamd.ctl failed, attempt #1: Can't connect to a UNIX socket /var/run/clamav/clamd.ctl: No such file or directory
Oct 19 22:11:03 testmail amavis[1184]: (01184-11) (!)ClamAV-clamd: All attempts (1) failed connecting to /var/run/clamav/clamd.ctl, retrying (2)
Oct 19 22:11:09 testmail amavis[1184]: (01184-11) (!)connect to /var/run/clamav/clamd.ctl failed, attempt #1: Can't connect to a UNIX socket /var/run/clamav/clamd.ctl: No such file or directory
Oct 19 22:11:09 testmail amavis[1184]: (01184-11) (!)ClamAV-clamd av-scanner FAILED: run_av error: Too many retries to talk to /var/run/clamav/clamd.ctl (All attempts (1) failed connecting to /var/run/clamav/clamd.ctl) at (eval 103) line 613.\n
Oct 19 22:11:09 testmail amavis[1184]: (01184-11) (!)WARN: all primary virus scanners failed, considering backups
Oct 19 22:11:09 testmail amavis[1184]: (01184-11) (!)run_av (ClamAV-clamscan) FAILED - unexpected exit 2, output="WARNING: Ignoring deprecated option --disable-summary\nLibClamAV Error: cli_loaddbdir(): No supported database files found in /var/lib/clamav\nERROR: Can't open file or directory\n\n----------- SCAN SUMMARY -----------\nKnown viruses: 0\nEngine version: 0.99.2\nScanned directories: 0\nScanned files: 0\nInfected files: 0\nData scanned: 0.00 MB\nData read: 0.00 MB (ratio 0.00:1)\nTime: 0.003 sec (0 m 0 s)"
Oct 19 22:11:09 testmail amavis[1184]: (01184-11) (!)ClamAV-clamscan av-scanner FAILED: /usr/bin/clamscan unexpected exit 2, output="WARNING: Ignoring deprecated option --disable-summary\nLibClamAV Error: cli_loaddbdir(): No supported database files found in /var/lib/clamav\nERROR: Can't open file or directory\n\n----------- SCAN SUMMARY -----------\nKnown viruses: 0\nEngine version: 0.99.2\nScanned directories: 0\nScanned files: 0\nInfected files: 0\nData scanned: 0.00 MB\nData read: 0.00 MB (ratio 0.00:1)\nTime: 0.003 sec (0 m 0 s)" at (eval 103) line 905.
Oct 19 22:11:09 testmail amavis[1184]: (01184-11) (!!)AV: ALL VIRUS SCANNERS FAILED
Oct 19 22:11:09 testmail postfix/smtpd[3634]: connect from unknown[127.0.0.1]
Oct 19 22:11:09 testmail postfix/smtpd[3634]: B7E565FF70: client=unknown[127.0.0.1]
Oct 19 22:11:09 testmail postfix/cleanup[3624]: B7E565FF70: message-id=<20161019221102.8F5C56064D@testmail.domain.tld>
Oct 19 22:11:09 testmail postfix/qmgr[3497]: B7E565FF70: from=<root@domain.tld>, size=839, nrcpt=1 (queue active)
Oct 19 22:11:09 testmail postfix/smtpd[3634]: disconnect from unknown[127.0.0.1]
Oct 19 22:11:09 testmail amavis[1184]: (01184-11) Passed UNCHECKED {RelayedInbound}, [127.0.0.1] <root@domain.tld> -> <real_email@yandex.ru>, Message-ID: <20161019221102.8F5C56064D@testmail.domain.tld>, mail_id: MqW-cs84kwUk, Hits: 1.099, size: 345, queued_as: B7E565FF70, 7171 ms, Tests: [DKIM_ADSP_ALL=1.1,NO_RELAYS=-0.001]
Oct 19 22:11:09 testmail postfix/smtp[3631]: 8F5C56064D: to=<real_email@yandex.ru>, relay=127.0.0.1[127.0.0.1]:10024, delay=7.2, delays=0.01/0/0/7.2, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as B7E565FF70)
Oct 19 22:11:09 testmail postfix/qmgr[3497]: 8F5C56064D: removed
Oct 19 22:11:10 testmail postfix/smtp[3639]: Untrusted TLS connection established to mx.yandex.ru[93.158.134.89]:25: TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)
Oct 19 22:11:11 testmail postfix/smtp[3639]: B7E565FF70: to=<real_email@yandex.ru>, relay=mx.yandex.ru[93.158.134.89]:25, delay=1.8, delays=0/0/0.71/1, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued on mxfront13h.mail.yandex.net as 1476915071-OJdI7MeUTR-BAvek2rd)
Oct 19 22:11:11 testmail postfix/qmgr[3497]: B7E565FF70: removed

====

if i send to gmail:

Oct 19 22:15:00 testmail postfix/pickup[3498]: A322D6064D: uid=0 from=<root>
Oct 19 22:15:00 testmail postfix/cleanup[3683]: A322D6064D: message-id=<20161019221500.A322D6064D@testmail.domain.tld>
Oct 19 22:15:00 testmail postfix/qmgr[3497]: A322D6064D: from=<root@domain.tld>, size=345, nrcpt=1 (queue active)
Oct 19 22:15:00 testmail amavis[1185]: (01185-10) (!)connect to /var/run/clamav/clamd.ctl failed, attempt #1: Can't connect to a UNIX socket /var/run/clamav/clamd.ctl: No such file or directory
Oct 19 22:15:01 testmail amavis[1185]: (01185-10) (!)connect to /var/run/clamav/clamd.ctl failed, attempt #1: Can't connect to a UNIX socket /var/run/clamav/clamd.ctl: No such file or directory
Oct 19 22:15:01 testmail amavis[1185]: (01185-10) (!)ClamAV-clamd: All attempts (1) failed connecting to /var/run/clamav/clamd.ctl, retrying (2)
Oct 19 22:15:07 testmail amavis[1185]: (01185-10) (!)connect to /var/run/clamav/clamd.ctl failed, attempt #1: Can't connect to a UNIX socket /var/run/clamav/clamd.ctl: No such file or directory
Oct 19 22:15:07 testmail amavis[1185]: (01185-10) (!)ClamAV-clamd av-scanner FAILED: run_av error: Too many retries to talk to /var/run/clamav/clamd.ctl (All attempts (1) failed connecting to /var/run/clamav/clamd.ctl) at (eval 103) line 613.\n
Oct 19 22:15:07 testmail amavis[1185]: (01185-10) (!)WARN: all primary virus scanners failed, considering backups
Oct 19 22:15:07 testmail amavis[1185]: (01185-10) (!)run_av (ClamAV-clamscan) FAILED - unexpected exit 2, output="WARNING: Ignoring deprecated option --disable-summary\nLibClamAV Error: cli_loaddbdir(): No supported database files found in /var/lib/clamav\nERROR: Can't open file or directory\n\n----------- SCAN SUMMARY -----------\nKnown viruses: 0\nEngine version: 0.99.2\nScanned directories: 0\nScanned files: 0\nInfected files: 0\nData scanned: 0.00 MB\nData read: 0.00 MB (ratio 0.00:1)\nTime: 0.004 sec (0 m 0 s)"
Oct 19 22:15:07 testmail amavis[1185]: (01185-10) (!)ClamAV-clamscan av-scanner FAILED: /usr/bin/clamscan unexpected exit 2, output="WARNING: Ignoring deprecated option --disable-summary\nLibClamAV Error: cli_loaddbdir(): No supported database files found in /var/lib/clamav\nERROR: Can't open file or directory\n\n----------- SCAN SUMMARY -----------\nKnown viruses: 0\nEngine version: 0.99.2\nScanned directories: 0\nScanned files: 0\nInfected files: 0\nData scanned: 0.00 MB\nData read: 0.00 MB (ratio 0.00:1)\nTime: 0.004 sec (0 m 0 s)" at (eval 103) line 905.
Oct 19 22:15:07 testmail amavis[1185]: (01185-10) (!!)AV: ALL VIRUS SCANNERS FAILED
Oct 19 22:15:07 testmail postfix/smtpd[3692]: connect from unknown[127.0.0.1]
Oct 19 22:15:07 testmail postfix/smtpd[3692]: D93545FF70: client=unknown[127.0.0.1]
Oct 19 22:15:07 testmail postfix/cleanup[3683]: D93545FF70: message-id=<20161019221500.A322D6064D@testmail.domain.tld>
Oct 19 22:15:07 testmail postfix/qmgr[3497]: D93545FF70: from=<root@domain.tld>, size=839, nrcpt=1 (queue active)
Oct 19 22:15:07 testmail postfix/smtpd[3692]: disconnect from unknown[127.0.0.1]
Oct 19 22:15:07 testmail amavis[1185]: (01185-10) Passed UNCHECKED {RelayedInbound}, [127.0.0.1] <root@domain.tld> -> <real_email@gmail.com>, Message-ID: <20161019221500.A322D6064D@testmail.domain.tld>, mail_id: fuq4WMMfoSfN, Hits: 1.099, size: 345, queued_as: D93545FF70, 7217 ms, Tests: [DKIM_ADSP_ALL=1.1,NO_RELAYS=-0.001]
Oct 19 22:15:07 testmail postfix/smtp[3689]: A322D6064D: to=<real_email@gmail.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=7.3, delays=0.03/0.01/0/7.2, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as D93545FF70)
Oct 19 22:15:07 testmail postfix/qmgr[3497]: A322D6064D: removed
Oct 19 22:15:08 testmail postfix/smtp[3697]: Untrusted TLS connection established to gmail-smtp-in.l.google.com[74.125.133.26]:25: TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)
Oct 19 22:15:08 testmail postfix/smtp[3697]: D93545FF70: to=<real_email@gmail.com>, relay=gmail-smtp-in.l.google.com[74.125.133.26]:25, delay=0.6, delays=0.01/0.02/0.29/0.28, dsn=2.0.0, status=sent (250 2.0.0 OK 1476915308 eo16si47117293wjb.48 - gsmtp)
Oct 19 22:15:08 testmail postfix/qmgr[3497]: D93545FF70: removed

it is when i send mail from simple script:

<?php

mail("real_email@gmail.com", "Test php message", "Test body", "From: root@domain.tld\r\n");

why from php mails where sent without DKIM? i'm asking, because exim from other server send mails with DKIM

----

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

2

Re: iRedMail and php script and dkim

Please enable smtp auth to send email in your php script.

3

Re: iRedMail and php script and dkim

ZhangHuangbin wrote:

Please enable smtp auth to send email in your php script.

я can do it without smpt auth?
For example dkim-filter?

4

Re: iRedMail and php script and dkim

I need only to the letter sent with the command

(echo "Subject:Hi"; echo "Body contents";) | sendmail -F "root@domain.tld" my_mail@gmail.com

will be DKIM signed

is it possible?

5

Re: iRedMail and php script and dkim

Email picked up by Postfix locally goes through transport "pickup" (defined in /etc/postfix/master.cf). If you want to sign it, modify /etc/postfix/master.cf like this:

*) Find the "pickup" transport, like below:

pickup    unix  n       -       y       60      1       pickup

*) Append one line RIGHT AFTER it:

pickup    unix  n       -       y       60      1       pickup
  -o content_filter=smtp-amavis:[127.0.0.1]:10026

Warning: there must be at least one whitespace before '-o'.
*) Restart Postfix service.

With this change, ALL emails sent with 'sendmail' or 'mail' programs (or PHP mail function, etc) will go through Amavisd (sign DKIM signature, and more).

6

Re: iRedMail and php script and dkim

ZhangHuangbin wrote:

Email picked up by Postfix locally goes through transport "pickup" (defined in /etc/postfix/master.cf). If you want to sign it, modify /etc/postfix/master.cf like this:

*) Find the "pickup" transport, like below:

pickup    unix  n       -       y       60      1       pickup

*) Append one line RIGHT AFTER it:

pickup    unix  n       -       y       60      1       pickup
  -o content_filter=smtp-amavis:[127.0.0.1]:10026

Warning: there must be at least one whitespace before '-o'.
*) Restart Postfix service.

With this change, ALL emails sent with 'sendmail' or 'mail' programs (or PHP mail function, etc) will go through Amavisd (sign DKIM signature, and more).

Thanks! It works! We can close this topic and move to another one)