OpenDKIM

  • Re;


    I think I've find a bug in OpenDKIM plugin: https://github.com/i-MSCP/plug…/backend/OpenDKIM.pm#L853


    For me, the statement is wrong there ( should be added in smtpd_milters instead and non_smtpd_milters should reference smtpd_milters.


    I'll check the behavior when installing the plugin together (OpenDKIM, SpamAssassin and fix if needed. I'll do this this week-end because I'm already busy with other plugins ( Monitorix, OwnDDNS ...) which must be updated for the 1.2.x serie.

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • Code
    1. root@panel1:~# cat /etc/opendkim/keys/*****.org/mail.txtmail._domainkey IN TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDAej/tlkqTtJPVd/NhYTxhODZGYJ0pOjs4LLgGvvvbOzAH3IdRvy16XPXbFAf2LHXd2G0AeNAjwLKa3NicwSoIPmXn05xCbMh2JqEcESSlF7zFuXx8jvLXKuhc1SBU63pPCO+4eW2Zt3dKmKq0qsOASPe8H8xyhHIRr5W52+SbQwIDAQAB" ; ----- DKIM key mail for ****.org


    And dig


    Code
    1. root@panel1:~# dig -t txt mail._domainkey.*****.org; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> -t txt mail._domainkey.*****.org;; global options: +cmd;; Got answer:;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 9379;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 5, ADDITIONAL: 0;; QUESTION SECTION:;mail._domainkey.****.org. IN TXT;; ANSWER SECTION:mail._domainkey.****.org. 300 IN TXT "\"v=DKIM1\; k=rsa\; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDAej/tlkqTtJPVd/NhYTxhODZGYJ0pOjs4LLgGvvvbOzAH3IdRvy16XPXbFAf2LHXd2G0AeNAjwLKa3NicwSoIPmXn05xCbMh2JqEcESSlF7zFuXx8jvLXKuhc1SBU63pPCO+4eW2Zt3dKmKq0qsOASPe8H8xyhHIRr5W52+SbQwIDAQAB\""


    Then, now is sending the key, but is sending an invalid key and the test fail


    If you take a look on you key which is inside the file "cat /etc/opendkim/keys/*****.org/mail.txt" you will see this does not match with your dig!
    You insert the key like this

    Code
    1. \"\"v=DKIM1\;..........DAQAB\""


    This is wrong
    You did escape the double quote in a wrong way. That is all. I use the OpenDKIm on other systems and the test with this site: http://www.brandonchecketts.com/emailtest.php will work every time

  • @TheCry


    And what about my previous post? For me, milter configuration is not added correctly (when other milter param are already there). You could maybe fix all your plugins because it's a mess ;)

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • If you take a look on you key which is inside the file "cat /etc/opendkim/keys/*****.org/mail.txt" you will see this does not match with your dig!
    You insert the key like this

    Code
    1. \"\"v=DKIM1\;..........DAQAB\""


    This is wrong
    You did escape the double quote in a wrong way. That is all. I use the OpenDKIm on other systems and the test with this site: http://www.brandonchecketts.com/emailtest.php will work every time


    Yeah, I just check it, the problem is the " in TXT DNS entry.

  • @TheCry


    I'm pretty sure that the statement below which start to line 839 is wrong:



    Here, in case where some milters parameters for another services are already there, you add the OpenDKIM milter service to non_smtp_milters. In my opinion, this is wrong. This should be added to smtpd_milters and non_smtpd_milters should reference smtpd_milters such as non_smtpd_milters = $smtpd_milters

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • Ok Laurent..
    I'd checked the OpenDKIM.
    At first i did install the OpenDKIM as the only plugin with milter connection.
    The main.cf is like this

    Code
    1. # Begin Plugins::i-MSCPmilter_default_action = acceptsmtpd_milters = # Begin Plugin::OpenDKIM inet:localhost:12345 # Ending Plugin::OpenDKIMnon_smtpd_milters = $smtpd_milters# Ending Plugins::i-MSCP


    Then i uninstalled the OpenDKIM and added manually 2 milter to the main.cf

    Code
    1. milter_default_action = acceptsmtpd_milters = unix:/clamav/clamav-milter.ctl unix:/spamass/spamass.socknon_smtpd_milters = $smtpd_milters


    Now i did install the OpenDKIM again. The result is this

    Code
    1. milter_default_action = acceptsmtpd_milters = unix:/clamav/clamav-milter.ctl unix:/spamass/spamass.sock # Begin Plugin::OpenDKIM inet:localhost:12345 # Ending Plugin::OpenDKIMnon_smtpd_milters = $smtpd_milters


    The OpenDKIM milter is on the right place


    With this line

    Code
    1. $fileContent =~ s/^(non_smtpd_milters.*)/$postfixOpendkimConfig$1/gm;


    i remove the existing "non_smtpd_milters", add the lines for OpenDKIM and put the line of the "non_smtpd_milters" at the end. So "non_smtpd_milters = $smtpd_milters" still exist und OpenDKIM is under "smtpd_milters"

  • Ok, I've read the regexp too fast but you're still wrong in one thing:


    By doing:


    Perl
    1. $fileContent =~ s/^(non_smtpd_milters.*)/$postfixOpendkimConfig$1/gm;


    You're making an assumption which presumes that the non_smtpd_milters parameter is placed just after the smtpd_milters parameter. What will be the result if you have something like:


    Code
    1. smtpd_milters = whateveranother_parameter = whatevernon_smtpd_milters = $smtpd_milters


    I bet that here your opendkim milter parameter will be misplaced:


    Code
    1. smtpd_milters = whatever
    2. another_parameter = whatever
    3. # Begin Plugin::OpenDKIM
    4. inet:localhost:12345
    5. # Ending Plugin::OpenDKIM
    6. non_smtpd_milters = $smtpd_milters


    I told you in private already: You must never make any assumption. Some users are crazy and they edit their files in strange way and so on... ;) Postfix doesn't force any parameter declaration order in the main.cf. Thus, you must take this in account ;)


    You could just get the current value of the smtpd_milters configuration parameter and complete it by using postconf ( just an idea ). This should be less error prone ;)

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • Code
    1. smtpd_milters = whatever
    2. another_parameter = whatever
    3. non_smtpd_milters = smtpd_milters


    Ok... You are right.. This situation is bad.. :(


    Quote

    You could just get the current value of the smtpd_milters configuration parameter and complete it by using postconf ( just an idea ).


    I will test this way. I use postconf to read existing milters but not for adding.