Few updates
This commit is contained in:
22
README.rst
22
README.rst
@@ -165,19 +165,17 @@ Certificate
|
|||||||
Self-signed
|
Self-signed
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
It is the default way of the installer, it is however
|
It is the default type of certificate the installer will generate, it
|
||||||
not recommended for production use. We recommend using
|
is however not recommended for production use.
|
||||||
letsencrypt for production. Using Letsencrypt imply that
|
|
||||||
you accept their Tos (see bellow)
|
|
||||||
|
|
||||||
Letsencrypt
|
Letsencrypt
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
Please note that by using this option, you aggree to the `ToS
|
Please note that by using this option, you agree to the `ToS
|
||||||
<https://community.letsencrypt.org/tos>`_ of
|
<https://community.letsencrypt.org/tos>`_ of
|
||||||
letsencrypt and that your IP will be logged (see ToS)
|
letsencrypt and that your IP will be logged (see ToS).
|
||||||
Please also note this option requires the hostname you're using to be
|
Please also note this option requires the hostname you're using to be
|
||||||
valid (ie. it can be resolved with a DNS query) and to match the
|
valid (ie. it can be resolved with a DNS query) and to match the
|
||||||
server you're installing Modoboa on.
|
server you're installing Modoboa on.
|
||||||
@@ -202,11 +200,13 @@ Manual
|
|||||||
------
|
------
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
It is not possible to configure manual certs interactively.
|
|
||||||
To do so, please run ``run.py`` with `--stop-after-configfile-check`,
|
It is not possible to configure manual certs interactively, so
|
||||||
configure your file as desired and apply the configuration as
|
you'll have to do it in 2 steps. Please run ``run.py`` with
|
||||||
written bellow. Then run ``run.py`` without
|
`--stop-after-configfile-check` first, configure your file as
|
||||||
`--stop-after-configfile-check` or `--interactive`.
|
desired and apply the configuration as written bellow. Then run
|
||||||
|
``run.py`` again but without `--stop-after-configfile-check` or
|
||||||
|
`--interactive`.
|
||||||
|
|
||||||
If you want to use already generated certs, simply edit the
|
If you want to use already generated certs, simply edit the
|
||||||
``installer.cfg`` file and modify the following settings::
|
``installer.cfg`` file and modify the following settings::
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ ConfigDictTemplate = [
|
|||||||
"default": "self-signed",
|
"default": "self-signed",
|
||||||
"customizable": True,
|
"customizable": True,
|
||||||
"question": "Please choose your certificate type",
|
"question": "Please choose your certificate type",
|
||||||
"value_return": ["manual"],
|
|
||||||
"values": ["self-signed", "letsencrypt", "manual"],
|
"values": ["self-signed", "letsencrypt", "manual"],
|
||||||
|
"non_interactive_values": ["manual"],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"option": "tls_cert_file_path",
|
"option": "tls_cert_file_path",
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from . import package
|
|||||||
from . import utils
|
from . import utils
|
||||||
|
|
||||||
|
|
||||||
class CertificateBackend(object):
|
class CertificateBackend:
|
||||||
"""Base class."""
|
"""Base class."""
|
||||||
|
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
@@ -29,7 +29,7 @@ class CertificateBackend(object):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ManualCertification(CertificateBackend):
|
class ManualCertificate(CertificateBackend):
|
||||||
"""Use certificate provided."""
|
"""Use certificate provided."""
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@@ -61,7 +61,7 @@ class SelfSignedCertificate(CertificateBackend):
|
|||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
"""Sanity checks."""
|
"""Sanity checks."""
|
||||||
super(SelfSignedCertificate, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
if self.config.has_option("general", "tls_key_file"):
|
if self.config.has_option("general", "tls_key_file"):
|
||||||
# Compatibility
|
# Compatibility
|
||||||
return
|
return
|
||||||
@@ -96,7 +96,7 @@ class LetsEncryptCertificate(CertificateBackend):
|
|||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
"""Update config."""
|
"""Update config."""
|
||||||
super(LetsEncryptCertificate, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.hostname = self.config.get("general", "hostname")
|
self.hostname = self.config.get("general", "hostname")
|
||||||
self.config.set("general", "tls_cert_file", (
|
self.config.set("general", "tls_cert_file", (
|
||||||
"/etc/letsencrypt/live/{}/fullchain.pem".format(self.hostname)))
|
"/etc/letsencrypt/live/{}/fullchain.pem".format(self.hostname)))
|
||||||
@@ -158,5 +158,5 @@ def get_backend(config):
|
|||||||
if cert_type == "letsencrypt":
|
if cert_type == "letsencrypt":
|
||||||
return LetsEncryptCertificate(config)
|
return LetsEncryptCertificate(config)
|
||||||
if cert_type == "manual":
|
if cert_type == "manual":
|
||||||
return ManualCertification(config)
|
return ManualCertificate(config)
|
||||||
return SelfSignedCertificate(config)
|
return SelfSignedCertificate(config)
|
||||||
|
|||||||
@@ -317,16 +317,14 @@ def get_entry_value(entry, interactive):
|
|||||||
if entry.get("values") and user_value != "":
|
if entry.get("values") and user_value != "":
|
||||||
user_value = values[int(user_value)]
|
user_value = values[int(user_value)]
|
||||||
|
|
||||||
condition = (
|
non_interactive_values = entry.get("non_interactive_values", [])
|
||||||
entry.get("value_return") and
|
if user_value in non_interactive_values:
|
||||||
user_value in entry.get("value_return")
|
error(
|
||||||
|
f"{user_value} cannot be set interactively. "
|
||||||
|
"Please configure installer.cfg manually by running "
|
||||||
|
"'python3 run.py --stop-after-configfile-check domain'. "
|
||||||
|
"Check modoboa-installer README for more information."
|
||||||
)
|
)
|
||||||
if condition:
|
|
||||||
error(f"{user_value} cannot be set interactively, "
|
|
||||||
"Please configure installer.cfg manually by running "
|
|
||||||
"'python3 run.py --stop-after-configfile-check domain'. "
|
|
||||||
"Check modoboa-installer Readme for more information."
|
|
||||||
)
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
return user_value if user_value else default_value
|
return user_value if user_value else default_value
|
||||||
|
|||||||
2
run.py
2
run.py
@@ -203,7 +203,7 @@ def main(input_args):
|
|||||||
if not args.skip_checks:
|
if not args.skip_checks:
|
||||||
utils.printcolor("Checking the installer...", utils.BLUE)
|
utils.printcolor("Checking the installer...", utils.BLUE)
|
||||||
checks.handle()
|
checks.handle()
|
||||||
utils.success("Checks complete")
|
utils.success("Checks complete\n")
|
||||||
|
|
||||||
is_config_file_available, outdate_config = utils.check_config_file(
|
is_config_file_available, outdate_config = utils.check_config_file(
|
||||||
args.configfile, args.interactive, args.upgrade, args.backup, is_restoring)
|
args.configfile, args.interactive, args.upgrade, args.backup, is_restoring)
|
||||||
|
|||||||
Reference in New Issue
Block a user