centos9 fixes

This commit is contained in:
Spitap
2022-10-16 15:56:22 +02:00
parent b13cdbf0ba
commit d9ced63e99
6 changed files with 18 additions and 14 deletions

View File

@@ -54,7 +54,7 @@ class PostgreSQL(Database):
"""Install database if required.""" """Install database if required."""
name, version = utils.dist_info() name, version = utils.dist_info()
if "CentOS" in name: if "CentOS" in name:
initdb_cmd = "postgresql-setup initdb" initdb_cmd = "postgresql-setup --initdb"
cfgfile = "/var/lib/pgsql/data/pg_hba.conf" cfgfile = "/var/lib/pgsql/data/pg_hba.conf"
package.backend.install_many(self.packages[package.backend.FORMAT]) package.backend.install_many(self.packages[package.backend.FORMAT])
utils.exec_cmd(initdb_cmd) utils.exec_cmd(initdb_cmd)

View File

@@ -82,17 +82,27 @@ class RPMPackage(Package):
def __init__(self, dist_name): def __init__(self, dist_name):
"""Initialize backend.""" """Initialize backend."""
self.dist_name = dist_name
super(RPMPackage, self).__init__(dist_name) super(RPMPackage, self).__init__(dist_name)
if "centos" in dist_name:
def prepare_system(self):
if "centos" in self.dist_name:
utils.exec_cmd("dnf config-manager --set-enabled crb")
self.install("epel-release") self.install("epel-release")
self.update()
def update(self):
"""Update the database repo."""
utils.exec_cmd("dnf update -y --quiet")
def install(self, name): def install(self, name):
"""Install a package.""" """Install a package."""
utils.exec_cmd("yum install -y --quiet {}".format(name)) """Need to add check for rrdtool, sendmail-milter, libmemcached and --enablerepo=crb"""
utils.exec_cmd("dnf install -y --quiet {}".format(name))
def install_many(self, names): def install_many(self, names):
"""Install many packages.""" """Install many packages."""
return utils.exec_cmd("yum install -y --quiet {}".format(" ".join(names))) return utils.exec_cmd("dnf install -y --quiet {}".format(" ".join(names)))
def get_installed_version(self, name): def get_installed_version(self, name):
"""Get installed package version.""" """Get installed package version."""

View File

@@ -59,7 +59,8 @@ class Dovecot(base.Installer):
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" ssl_protocols = "!SSLv2 !SSLv3"
if package.backend.get_installed_version("openssl").startswith("1.1"): if package.backend.get_installed_version("openssl").startswith("1.1") \
or package.backend.get_installed_version("openssl").startswith("3"):
ssl_protocols = "!SSLv3" 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"

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 = %ssl_protocols ssl_min_protocol = %ssl_protocols
# SSL ciphers to use # SSL ciphers to use

View File

@@ -59,10 +59,6 @@ class Spamassassin(base.Installer):
"""Additional tasks.""" """Additional tasks."""
amavis_user = self.config.get("amavis", "user") amavis_user = self.config.get("amavis", "user")
pw = pwd.getpwnam(amavis_user) pw = pwd.getpwnam(amavis_user)
utils.exec_cmd(
"pyzor --homedir {} discover".format(pw[5]),
sudo_user=amavis_user, login=False
)
install("razor", self.config, self.upgrade) install("razor", self.config, self.upgrade)
if utils.dist_name() in ["debian", "ubuntu"]: if utils.dist_name() in ["debian", "ubuntu"]:
utils.exec_cmd( utils.exec_cmd(

View File

@@ -29,10 +29,7 @@ class Uwsgi(base.Installer):
def get_template_context(self, app): def get_template_context(self, app):
"""Additionnal variables.""" """Additionnal variables."""
context = super(Uwsgi, self).get_template_context() context = super(Uwsgi, self).get_template_context()
if package.backend.FORMAT == "deb": uwsgi_plugin = "python3"
uwsgi_plugin = "python3"
else:
uwsgi_plugin = "python36"
context.update({ context.update({
"app_user": self.config.get(app, "user"), "app_user": self.config.get(app, "user"),
"app_venv_path": self.config.get(app, "venv_path"), "app_venv_path": self.config.get(app, "venv_path"),