Browse Source

implement and document the dovecot module

Helmut Pozimski 7 years ago
parent
commit
1d48d4ee59
4 changed files with 61 additions and 1 deletions
  1. 9 0
      README.md
  2. 45 0
      amulib/dovecot.py
  3. 1 1
      amulib/postfix.py
  4. 6 0
      example/config.json

+ 9 - 0
README.md

@@ -59,6 +59,15 @@ This module accepts the following configuration parameters:
 * tlsa: whether to write tlsa records for the domain
 * tlsa_ports: ports that should receive a TLSA record
 
+### Dovecot
+
+This module accepts the following configuration parameters:
+
+* certificate_path: path of the certificate file (public key and chain)
+* key_path: path of the private key file
+* tlsa: whether to write tlsa records for the domain
+* tlsa_ports: ports that should receive a TLSA record
+
 ## INSTALLATION
 
 Use the setup.py to perform the installation, this requires the setuptools module.

+ 45 - 0
amulib/dovecot.py

@@ -0,0 +1,45 @@
+#   This file is part of acme-updater, written by Helmut Pozimski 2016-2017.
+#
+#   stov is free software: you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation, version 2 of the License.
+#
+#   stov is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License
+#   along with stov.  If not, see <http://www.gnu.org/licenses/>.
+
+
+# -*- coding: utf8 -*-
+
+""" Contains the dovecot module which manages certificates for the dovecot
+mail server.
+"""
+
+import socket
+
+from amulib import service
+
+
+def run(config=None, acme_dir="/var/lib/acme",
+        named_key_path="/run/named/session.key"):
+    """ manages the certificates for dovecot
+
+       :param config: configuration for the service
+       :type config: dict
+       :param acme_dir: path to the acme state dir
+       :type acme_dir: str
+       :param named_key_path: path to the named session.key
+       :type named_key_path: str
+       """
+    if not config:
+        config = {
+            "certificate_path": "/usr/share/ssl/certs/dovecot.pem",
+            "key_path": "/usr/share/ssl/private/dovecot.pem",
+            "tlsa": True,
+            "tlsa_ports": [993]
+        }
+    service.run("dovecot", config, acme_dir, named_key_path)

+ 1 - 1
amulib/postfix.py

@@ -26,7 +26,7 @@ from amulib import service
 
 def run(config=None, acme_dir="/var/lib/acme",
         named_key_path="/run/named/session.key"):
-    """
+    """ manages the certificates for postfix
 
     :param config: configuration for the service
     :type config: dict

+ 6 - 0
example/config.json

@@ -13,5 +13,11 @@
     "key_path": "/etc/postfix/localhost.key",
     "tlsa": true,
     "tlsa_ports": [25, 465, 587]
+  },
+  "dovecot": {
+    "certificate_path": "/usr/share/ssl/certs/dovecot.pem",
+    "key_path": "/usr/share/ssl/private/dovecot.pem",
+    "tlsa": true,
+    "tlsa_ports": [993, 995]
   }
 }