Fixed dovecot config when openssl 1.1

This commit is contained in:
Antoine Nguyen
2017-06-23 10:58:14 +02:00
parent 8052f4aede
commit 0c6647e9a6
3 changed files with 8 additions and 4 deletions

View File

@@ -53,9 +53,9 @@ class DEBPackage(Package):
"""Get installed package version.""" """Get installed package version."""
code, output = utils.exec_cmd( code, output = utils.exec_cmd(
"dpkg -s {} | grep Version".format(name), capture_output=True) "dpkg -s {} | grep Version".format(name), capture_output=True)
match = re.match(r"Version: \d:(.+)-\d", output.decode()) match = re.match(r"Version: (\d:)?(.+)-\d", output.decode())
if match: if match:
return match.group(1) return match.group(2)
return None return None

View File

@@ -55,6 +55,9 @@ class Dovecot(base.Installer):
"""Additional variables.""" """Additional variables."""
context = super(Dovecot, self).get_template_context() context = super(Dovecot, self).get_template_context()
pw = pwd.getpwnam(self.user) pw = pwd.getpwnam(self.user)
ssl_protocols = "!SSLv2 !SSLv3"
if package.backend.get_installed_version("openssl").startswith("1.1"):
ssl_protocols = "!SSLv3"
if "centos" in utils.dist_name(): if "centos" in utils.dist_name():
protocols = "protocols = imap lmtp sieve" protocols = "protocols = imap lmtp sieve"
extra_protocols = self.config.get("dovecot", "extra_protocols") extra_protocols = self.config.get("dovecot", "extra_protocols")
@@ -70,7 +73,8 @@ class Dovecot(base.Installer):
"modoboa_dbname": self.config.get("modoboa", "dbname"), "modoboa_dbname": self.config.get("modoboa", "dbname"),
"modoboa_dbuser": self.config.get("modoboa", "dbuser"), "modoboa_dbuser": self.config.get("modoboa", "dbuser"),
"modoboa_dbpassword": self.config.get("modoboa", "dbpassword"), "modoboa_dbpassword": self.config.get("modoboa", "dbpassword"),
"protocols": protocols "protocols": protocols,
"ssl_protocols": ssl_protocols
}) })
return context return context

View File

@@ -41,7 +41,7 @@ ssl_key = <%tls_key_file
#ssl_parameters_regenerate = 168 #ssl_parameters_regenerate = 168
# SSL protocols to use # SSL protocols to use
ssl_protocols = !SSLv2 !SSLv3 ssl_protocols = %ssl_protocols
# SSL ciphers to use # SSL ciphers to use