zone-eu / zone-mta-template

Template application for ZoneMTA
39 stars 25 forks source link

Configuration #12

Open Fred2VOX opened 4 years ago

Fred2VOX commented 4 years ago

Hi, In first, thanks for this great work.

I followed the deployment instructions and get a running server. But, I encounter some issues during invocation thru swaks. So, my main question is:

Another question:

Thanks in advance for the answers

Fred

andris9 commented 4 years ago
  1. When using this repo then edit config files in this folder. These values are merged with the default config, so if some key is missing then default is used.
  2. AWS DynamoDb is not tested so it may or may not work.
Fred2VOX commented 4 years ago

@andris9 Thanks for the answer.

Could you clarify the configuration of DKIM feature, please? I don't find a way in the TOML file to specify the domain, the selector, or the place where to read the corresponding private certificate.

Thanks in advance

Fred

andris9 commented 4 years ago

ZoneMTA is more like a framework than a final MTA application. So the DKIM plugin is just an example and does not do much. You are supposed to write your own dkim plugin and load keys from whatever storage you use, either from file system or database or wherever.

Minimal DKIM plugin would look like this:

'use strict';

module.exports.title = 'DKIM signer';
module.exports.init = function (app, done) {
  // this hook is triggered when a connection is established to MX
  app.addHook('sender:connection', (delivery, options, next) => {

    // 1. resolve domain name to be used for signing
    let from = delivery.envelope.from || '';
    let fromDomain = from.substr(from.lastIndexOf('@') + 1).toLowerCase();

    // 2. load the key data from somewhere for `fromDomain`

    // 3. add key to DKIM handler assuming that `fromDomain` is "example.com" and dkim selector is "test"
    delivery.dkim.keys.push({
      domainName: 'example.com',
      keySelector: 'test',
      privateKey: '---- BEGIN RSA PRIVATE KEY...',
    });

     next();
  });
  done();
};
andris9 commented 4 years ago

If you want to use header From: address domain for signing then use delivery.parsedEnvelope.from instead of delivery.envelope.from