12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- # 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 postfix module which manages certificates for the postfix
- 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 postfix
- :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
- """
- hostname = socket.gethostname()
- if not config:
- config = {
- "certificate_path": "/etc/postfix/%s.crt" % hostname,
- "key_path": "/etc/postfix/%s.key" % hostname,
- "tlsa": True,
- "tlsa_ports": [25, 465, 587]
- }
- service.run("postfix", config, acme_dir, named_key_path)
|