Skip to content
Draft
3 changes: 3 additions & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,9 @@
"global_settings_setting_backup_compress_tar_archives": "Compress backups",
"global_settings_setting_backup_compress_tar_archives_help": "When creating new backups, compress the archives (.tar.gz) instead of uncompressed archives (.tar). N.B. : enabling this option means create lighter backup archives, but the initial backup procedure will be significantly longer and heavy on CPU.",
"global_settings_setting_backup_name": "Backup",
"global_settings_setting_certauth.certification_authority": "Identifier of the certification authority",
"global_settings_setting_certauth.certification_authority_fullname": "Full name of the certification authority",
"global_settings_setting_certauth.certification_authority_acme_url": "ACME URL of the certification authority",
"global_settings_setting_dns_custom_resolvers_enabled": "Use custom DNS resolvers",
"global_settings_setting_dns_custom_resolvers_enabled_help": "By default, YunoHost uses a list of trustworthy resolvers located in Europe. Advanced users may want to specify custom resolvers instead.",
"global_settings_setting_dns_custom_resolvers_list": "Custom resolvers' addresses",
Expand Down
14 changes: 14 additions & 0 deletions share/config_global.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,20 @@ i18n = "global_settings_setting"
type = "boolean"
default = false

[security.certauth]
visible = false
[security.certauth.certification_authority]
type = "string"
default = "letsencrypt"

[security.certauth.certification_authority_fullname]
type = "string"
default = "Let's Encrypt"

[security.certauth.certification_authority_acme_url]
type = "url"
default = "https://acme-v02.api.letsencrypt.org"

[email]
[email.pop3]
[email.pop3.pop3_enabled]
Expand Down
5 changes: 3 additions & 2 deletions src/certificate.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from .log import OperationLogger
from .regenconf import regen_conf
from .service import _run_service_command
from .settings import settings_get
from .utils.error import YunohostError, YunohostValidationError
from .utils.file_utils import chmod, chown, read_file
from .utils.network import get_public_ip
Expand Down Expand Up @@ -60,7 +61,7 @@
VALIDITY_LIMIT = 15 # days

# For prod
PRODUCTION_CERTIFICATION_AUTHORITY = "https://acme-v02.api.letsencrypt.org"
PRODUCTION_CERTIFICATION_AUTHORITY = settings_get("security.certauth.certification_authority_acme_url")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This var is only used one time line 540, we probably should call this function only when we really need it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So here it's a global settings and not a domain settings.

I imagine it's the good solution to choose a global settings for that

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The function is now called only once, and the settings put into variables.


#
# Front-end stuff #
Expand Down Expand Up @@ -598,7 +599,7 @@ def _prepare_certificate_signing_request(domain, key_file, output_folder):
# Set the domain
csr.get_subject().CN = domain

sanlist = []
sanlist = [domain]
hook_results = hook_callback("cert_alternate_names", env={"domain": domain})
for hook_name, results in hook_results.items():
#
Expand Down
Loading