Code Monkey home page Code Monkey logo

puppet-opendkim's Introduction

puppet-opendkim

Overview

Puppet module to manage OpenDKIM

Currently only supports Debian/Ubuntu, fork me to support more distributions.

  • opendkim : Main class to install, enable and setup default configuration.
  • opendkim::config : Class to setup OpenDKIM main configuration files.
  • opendkim::socket : Definition to add a new Socket to the /etc/default/opendkim config file.
  • opendkim::domain : Definition to add a new Domain to the /etc/opendkim.conf config file.

Setup your DKIM keys:

openssl genrsa -out example.com.key 1024
openssl rsa -in example.com.key -out example.com.pub -pubout -outform PEM
Move the private key file into your own puppet module

Add your public key to a new TXT record in DNS.

Choose a Selector for your public key, eg. 'mail'
Create a TXT record for your domain:
  mail._domainkey.example.com => v=DKIM1; k=rsa; p=[THE_CONTENT_OF_THE_PUBLIC_KEY_FILE]

Typical usage:

include 'opendkim'

opendkim::socket { 'listen on loopback on port 8891 - Ubuntu default':
  interface => 'localhost';
}
opendkim::domain { 'example.com':
  private_key_source => 'puppet:///modules/mymodule/example.com.key',
}

Configuration options for adding a Socket to OpenDKIM:

  opendkim::socket { 'listen on loopback on port 8891 - Ubuntu default':
    interface => 'localhost';
  }

  opendkim::socket { 'listen on a 192.168.1.1 port 8000':
    type      => 'inet',
    interface => '192.168.1.1',
    port      => '8000';
  }

  opendkim::socket { 'listen on a local file socket':
    type => 'file',
  }

  opendkim::socket { 'listen on a local file socket with a custom name':
    type => 'file',
    file => '/var/run/opendkim/my_custom_name.sock';
  }

Configuration options for adding a Domain to OpenDKIM:

opendkim::domain { 'example.com':
  private_key_source => 'puppet:///modules/mymodule/example.com.key',
}

opendkim::domain { 'example with custom key folder, selector and domain name':
  domain             => 'myexampleduck.com
  private_key_source => 'puppet:///modules/mymodule/myexampleduck.com.key',
  selector           => 'duck',
  key_folder         => '/etc/duck';
}

Dependencies: https://github.com/puppetlabs/puppetlabs-concat

puppet-opendkim's People

Contributors

crispygoth avatar rjpearce avatar szynaka avatar toepi avatar trefzer avatar vzctl avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

puppet-opendkim's Issues

Signing for sub-domains

I want my relay to sign mail for the domain example.com, and also for emails where the domain is a specific host, like [email protected].

That is to say, I'd like /etc/opendkim_signingtable.conf to look like so:

###### MANAGED BY PUPPET
example.com  default._domainkey.example.com
.example.com default._domainkey.example.com

I've tried to do it like so:

opendkim::domain { ['example.com', '.example.com']:
  private_key_content => hiera('dkim_keys/example.com-default.key'),
  selector        => 'default',
}

Unfortunately for the subdomains, this winds up with the signature using a separate entry in the keytable with a leading . on the domain, and the final signature contains d=.example.com, which doesn't work. I don't see a way to use this module without changing it, or perhaps a hackish direct call to concat to extend the signing table as required.

For my particular use case it would be nice to just have a boolean flag on opendkim::domain called something like 'sign_subdomains', which puts the extra entry in /etc/opendkim_signingtable.conf when set to true.

In my case I want to use the same signing key for subdomains that I use for the top level domain. Probably someone else will have a different use case, but that's not my current concern. Beyond the scope of this issue, opendkim allows for a much broader range of configurations, which are not covered by this module. While having a high level defined type like this may suit a lot of uses, I think it should probably sit on top of types which allow for more of what opendkim allows.

provide content instead of source for private key

opendkim::domain expects to be provided with private_key, which is used as a source attribute for the created file.

This means that the private key has to be provided as a download from the puppetmaster or some other source with relatively little security. Any host that can connect to the puppetmaster can download it.

I suggest that the option be added to provide private_key_content instead, which should be passed as a content attribute to the file resource.

module can not be used at a relay

to use this module on a gateway/relay it must also managed InternalHosts.

Default content (worked also without wildcard support) can be

127.0.0.1
localhost
$::network_eth0/$::netmask_eth0

Not sure if it better to use refile:/etc/opendkim_trustedHosts to allow wildcards.

To enable this kind of function a flag should be included (like relaymode) which has false as default.

Config Concat Errors

Hi. If any of the files at https://github.com/rjpearce/puppet-opendkim/blob/master/manifests/config.pp#L33-38 are missing concat will throw a bunch of error messages:

Notice: /Stage[main]/Opendkim::Config/Concat[/etc/opendkim_keytable.conf]/Exec[concat_/etc/opendkim_keytable.conf]/returns: The fragments directory is empty, cowardly refusing to make empty config files
Error: /var/lib/puppet/concat/bin/concatfragments.sh -o /var/lib/puppet/concat/_etc_opendkim_keytable.conf/fragments.concat.out -d /var/lib/puppet/concat/_etc_opendkim_keytable.conf     returned 1 instead of one of [0]
Error: /Stage[main]/Opendkim::Config/Concat[/etc/opendkim_keytable.conf]/Exec[concat_/etc/opendkim_keytable.conf]/returns: change from notrun to 0 failed: /var/lib/puppet/concat/bin/concatfragments.sh -o /var/lib/puppet/concat/_etc_opendkim_keytable.conf/fragments.concat.out -d /var/lib/puppet/concat/_etc_opendkim_keytable.conf     returned 1 instead of one of [0]

On a fresh install opendkim_keytable.conf and opendkim_signingtable.conf don't exist for me. force => true should be set for concat to resolve the issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.