dovecot.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # SPDX-FileCopyrightText: 2016-2023 Helmut Pozimski <helmut@pozimski.eu>
  2. #
  3. # SPDX-License-Identifier: GPL-2.0-only
  4. # -*- coding: utf8 -*-
  5. """ Contains the dovecot module which manages certificates for the dovecot
  6. mail server.
  7. """
  8. from amulib import service
  9. from amulib.cert_path_provider import CertPathProvider
  10. def run(cert_path_provider: CertPathProvider, config=None,
  11. named_key_path="/run/named/session.key", dns_server="localhost"):
  12. """ manages the certificates for dovecot
  13. :param cert_path_provider: provider for certificate paths
  14. :type cert_path_provider: CertPathProvider
  15. :param config: configuration for the service
  16. :type config: dict
  17. :param named_key_path: path to the named session.key
  18. :type named_key_path: str
  19. :param dns_server: dns server to use
  20. :type dns_server: str
  21. """
  22. if not config:
  23. config = {
  24. "certificate_path": "/usr/share/ssl/certs/dovecot.pem",
  25. "key_path": "/usr/share/ssl/private/dovecot.pem",
  26. "tlsa": True,
  27. "tlsa_ports": [993]
  28. }
  29. service.run(cert_path_provider, "dovecot", config, named_key_path, dns_server)