Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 123 additions & 0 deletions installer.cfg
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should not be there

Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
[general]
hostname = mail.%(domain)s

[certificate]
generate = true
type = self-signed

[letsencrypt]
email = [email protected]

[database]
engine = mysql
host = 127.0.0.1
install = true

[postgres]
user = postgres
password =

[mysql]
user = root
password =
charset = utf8
collation = utf8_general_ci

[fail2ban]
enabled = true
config_dir = /etc/fail2ban
max_retry = 20
ban_time = 3600
find_time = 30

[modoboa]
user = modoboa
home_dir = /srv/modoboa
venv_path = %(home_dir)s/env
instance_path = %(home_dir)s/instance
timezone = Europe/Paris
dbname = modoboa
dbuser = modoboa
dbpassword = w7l9tRsrpxZW8fd8
extensions = modoboa-amavis modoboa-postfix-autoreply modoboa-sievefilters modoboa-webmail modoboa-contacts modoboa-radicale
devmode = false

[automx]
enabled = true
user = automx
config_dir = /etc
home_dir = /srv/automx
venv_path = %(home_dir)s/env
instance_path = %(home_dir)s/instance

[amavis]
enabled = true
user = amavis
max_servers = 2
dbname = amavis
dbuser = amavis
dbpassword = rluH50ZePN5JfnCq

[clamav]
enabled = true
user = clamav

[dovecot]
enabled = true
config_dir = /etc/dovecot
user = dovecot
home_dir = /srv/vmail
mailboxes_owner = vmail
extra_protocols =
postmaster_address = postmaster@%(domain)s
radicale_auth_socket_path = /var/run/dovecot/auth-radicale

[nginx]
enabled = true
config_dir = /etc/nginx

[razor]
enabled = true
config_dir = /etc/razor

[postfix]
enabled = true
config_dir = /etc/postfix
message_size_limit = 11534336
dhe_group = 4096

[postwhite]
enabled = true
config_dir = /etc

[spamassassin]
enabled = true
config_dir = /etc/mail/spamassassin
dbname = spamassassin
dbuser = spamassassin
dbpassword = WyCxTR0EJp1GrMf1

[uwsgi]
enabled = true
config_dir = /etc/uwsgi
nb_processes = 2

[radicale]
enabled = true
user = radicale
config_dir = /etc/radicale
home_dir = /srv/radicale
venv_path = %(home_dir)s/env

[opendkim]
enabled = true
user = opendkim
config_dir = /etc
port = 12345
keys_storage_dir = /var/lib/dkim
dbuser = opendkim
dbpassword = p54KctDPaSy2ENgl

[backup]
default_path = ./modoboa_backup/

6 changes: 3 additions & 3 deletions modoboa_installer/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class RPMPackage(Package):
def __init__(self, dist_name):
"""Initialize backend."""
super(RPMPackage, self).__init__(dist_name)
if "centos" in dist_name:
if dist_name in ["centos", "oracle linux server"]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be careful here, you're changing the check logic for centos. This was not a strict comparison

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a better comparison could be to use the availability of the package manager. Anyways, it still didn't affect CentOS functionality at all. Do you suggest something different?

self.install("epel-release")

def install(self, name):
Expand All @@ -99,7 +99,7 @@ def install(self, name):

def install_many(self, names):
"""Install many packages."""
return utils.exec_cmd("yum install -y --quiet {}".format(" ".join(names)))
return utils.exec_cmd("yum install -y {}".format(" ".join(names))) # Before it was quiet
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you remove the quiet option?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To see if somehow one of the packages may fail. Also, during this step installation took so long, so it didn't actually seems to be doing anything, or, better said, it didn't give the sensation of progress.


def get_installed_version(self, name):
"""Get installed package version."""
Expand All @@ -117,7 +117,7 @@ def get_backend():
backend = None
if distname in ["debian", "debian gnu/linux", "ubuntu", "linuxmint"]:
backend = DEBPackage
elif "centos" in distname:
elif distname in ["centos", "oracle linux server"]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be careful here, you're changing the check logic for centos. This was not a strict comparison

backend = RPMPackage
else:
raise NotImplementedError(
Expand Down
3 changes: 2 additions & 1 deletion modoboa_installer/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,13 @@ def setup_virtualenv(path, sudo_user=None):
"""Install a virtualenv if needed."""
if os.path.exists(path):
return
if utils.dist_name().startswith("centos"):
if utils.dist_name().startswith("centos") or utils.dist_name().startswith("oracle linux server")::
python_binary = "python3"
packages = ["python3"]
else:
python_binary = "python3"
packages = ["python3-venv"]

package.backend.install_many(packages)
with utils.settings(sudo_user=sudo_user):
utils.exec_cmd("{} -m venv {}".format(python_binary, path))
Expand Down
2 changes: 1 addition & 1 deletion modoboa_installer/scripts/dovecot.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def get_template_context(self):
ssl_protocols = "!SSLv3"
if ssl_protocol_parameter == "ssl_min_protocol":
ssl_protocols = "TLSv1"
if "centos" in utils.dist_name():
if utils.dist_name() in ["centos", "oracle linux server"]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be careful here, you're changing the check logic for centos. This was not a strict comparison

protocols = "protocols = imap lmtp sieve"
extra_protocols = self.config.get("dovecot", "extra_protocols")
if extra_protocols:
Expand Down
18 changes: 12 additions & 6 deletions modoboa_installer/scripts/modoboa.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,16 @@ def get_config_files(self):

# Add worker for dkim if needed
if self.modoboa_2_2_or_greater:
config_files.append(
"supervisor-rq-dkim=/etc/supervisor/conf.d/modoboa-dkim-worker.conf")
config_files.append(
"supervisor-rq-base=/etc/supervisor/conf.d/modoboa-base-worker.conf")
if package.backend.FORMAT == "deb":
config_files.append(
"supervisor-rq-dkim=/etc/supervisor/conf.d/modoboa-dkim-worker.conf")
config_files.append(
"supervisor-rq-base=/etc/supervisor/conf.d/modoboa-base-worker.conf")
else:
config_files.append(
"supervisor-rq-dkim=/etc/supervisord.d/modoboa-dkim-worker.conf")
config_files.append(
"supervisor-rq-base=/etc/supervisord.d/modoboa-base-worker.conf")
return config_files

def get_template_context(self):
Expand Down Expand Up @@ -313,15 +319,15 @@ def apply_settings(self):

def post_run(self):
"""Additional tasks."""
if 'centos' in utils.dist_name():
if utils.dist_name() in ["centos", "oracle linux server"]:
system.enable_and_start_service("redis")
else:
system.enable_and_start_service("redis-server")
self._deploy_instance()
if not self.upgrade:
self.apply_settings()

if 'centos' in utils.dist_name():
if utils.dist_name() in ["centos", "oracle linux server"]:
supervisor = "supervisord"
else:
supervisor = "supervisor"
Expand Down
2 changes: 1 addition & 1 deletion modoboa_installer/scripts/opendkim.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def post_run(self):
with open(params_file, "a") as f:
f.write('\n'.join([
"",
'SOCKET="inet:12345@localhost"',
'Socket inet:12345@localhost',
]))

# Make sure opendkim is started after postgresql and mysql,
Expand Down
6 changes: 3 additions & 3 deletions modoboa_installer/scripts/uwsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Uwsgi(base.Installer):
appname = "uwsgi"
packages = {
"deb": ["uwsgi", "uwsgi-plugin-python3"],
"rpm": ["uwsgi", "uwsgi-plugin-python36"],
"rpm": ["uwsgi", "uwsgi-plugin-python3"], #Previousli was 36
}

def get_socket_path(self, app):
Expand All @@ -29,7 +29,7 @@ def get_socket_path(self, app):
def get_template_context(self, app):
"""Additionnal variables."""
context = super(Uwsgi, self).get_template_context()
if package.backend.FORMAT == "deb":
if package.backend.FORMAT == "deb" or True:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you doing this ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On oracle linux the default usage of python was also python3. Then, I suggest this to be the default scenario, as I don't know in which distros "python36" is being used. (Reversing the logic might be a better solution: in those distro's special cases, use python36 instead of python3)

uwsgi_plugin = "python3"
else:
uwsgi_plugin = "python36"
Expand Down Expand Up @@ -105,7 +105,7 @@ def post_run(self):
def restart_daemon(self):
"""Restart daemon process."""
# Temp. fix for CentOS
if utils.dist_name().startswith("centos"):
if utils.dist_name().startswith("centos") or utils.dist_name().startswith("oracle linux server"):
pw = pwd.getpwnam("uwsgi")
utils.mkdir(
"/run/uwsgi",
Expand Down
2 changes: 1 addition & 1 deletion run.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def main(input_args):
ssl_backend.generate_cert()
for appname in PRIMARY_APPS:
scripts.install(appname, config, args.upgrade, args.restore)
system.restart_service("cron")
system.restart_service("crond")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this work in all cases?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could give it a try using Rocky, as CentOS is now unavailable. I haven't installed it on debian based distros.

package.backend.restore_system()
if not args.restore:
utils.success(
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20b6ede21173441284efe533627e95ba91bfeb53
f38c9eb0bd3558d8c6b162ec5ae8209389b1687c