Debian 9 DKIM sign outgoing mails sent by host

Discussion in 'Tips/Tricks/Mods' started by ztk.me, Jul 18, 2018.

  1. ztk.me

    ztk.me ISPConfig Developer ISPConfig Developer

    If you have a server called "server.domain.de" it is recommended not to add this to the virtual emaildomain list to avoid some issues.
    However you won't be able to add a dkim-key using the interface then.

    Code:
    cd /var/lib/amavis/dkim
    amavisd-new genrsa /var/lib/dkim/server.domain.de.private 2048
    amavisd-new showkeys server.domain.de
    
    you see the public dns entry along the public key, place it to the .public file accordingly to the contents of the other .public files.
    And chmod 644 both new files, I'm not a fan of it but that's how it's currently on my latest ispconfig.

    add a new file
    /etc/amavis/conf.d/61-dkim
    make sure you use the right selector hostname/filename

    Add the entry to your dns of course - voila your server is capable of signing mails sent by a logged in user, monit/munin mails .....
    don't forget the mx,spf,dmarc,..... entries for your subdomain / hostname aswell of course in case needed.
    If needed, restart your amavisd-new service


    ah yeah to use some mail testing tools you might want to add something to your
    /etc/aliases
    Code:
    root: [email protected]
    
    and run
    $newaliases to receive mail sent to root@hostname
     
    Last edited: Jul 18, 2018
    Jesse Norell likes this.
  2. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    Would that be generic enough to add an option under System Config > {server} > Mail ? The DNS could be updated automatically if the domain is already handled by ISPConfig, and displayed on screen for cut/paste.
     
  3. ztk.me

    ztk.me ISPConfig Developer ISPConfig Developer

    That would be awesome :)
     

Share This Page