diff --git a/data/actionsmap/yunohost.yml b/data/actionsmap/yunohost.yml index 3729e3aa3..18f470a61 100644 --- a/data/actionsmap/yunohost.yml +++ b/data/actionsmap/yunohost.yml @@ -335,7 +335,7 @@ domain: help: Install even if current certificate is not self-signed action: store_true --no-checks: - help: Does not perform any check that your domain seems correcly configured (DNS, reachability) before attempting to install. (Not recommended) + help: Does not perform any check that your domain seems correctly configured (DNS, reachability) before attempting to install. (Not recommended) action: store_true --self-signed: help: Install self-signed certificate instead of Let's Encrypt @@ -353,13 +353,13 @@ domain: help: Domains for which to renew the certificates nargs: "*" --force: - help: Ignore the validity treshold (30 days) + help: Ignore the validity threshold (30 days) action: store_true --email: help: Send an email to root with logs if some renewing fails action: store_true --no-checks: - help: Does not perform any check that your domain seems correcly configured (DNS, reachability) before attempting to renew. (Not recommended) + help: Does not perform any check that your domain seems correctly configured (DNS, reachability) before attempting to renew. (Not recommended) action: store_true ### domain_info() diff --git a/locales/de.json b/locales/de.json index e57315caa..1331c56b4 100644 --- a/locales/de.json +++ b/locales/de.json @@ -57,7 +57,7 @@ "custom_app_url_required": "Es muss eine URL angegeben um deine benutzerdefinierte App {app:s} zu aktualisieren", "custom_appslist_name_required": "Du musst einen Namen für deine benutzerdefinierte Appliste angeben", "dnsmasq_isnt_installed": "dnsmasq scheint nicht installiert zu sein. Bitte führe 'apt-get remove bind9 && apt-get install dnsmasq' aus", - "certmanager_domain_cert_gen_failed": "Zertifikat konnte nicht erzeugt werden", + "domain_cert_gen_failed": "Zertifikat konnte nicht erzeugt werden", "domain_created": "Domain erfolgreich erzeugt", "domain_creation_failed": "Konnte Domain nicht erzeugen", "domain_deleted": "Domain erfolgreich gelöscht", diff --git a/locales/en.json b/locales/en.json index 2dec12706..b3723810e 100644 --- a/locales/en.json +++ b/locales/en.json @@ -237,13 +237,13 @@ "yunohost_configured": "YunoHost has been configured", "yunohost_installing": "Installing YunoHost...", "yunohost_not_installed": "YunoHost is not or not correctly installed. Please execute 'yunohost tools postinstall'.", - "certmanager_domain_cert_gen_failed": "Unable to generate certificate", + "domain_cert_gen_failed": "Unable to generate certificate", "certmanager_attempt_to_replace_valid_cert" : "You are attempting to overwrite a good and valid certificate for domain {domain:s} ! (Use --force to bypass)", "certmanager_domain_unknown": "Unknown domain {domain:s}", - "certmanager_domain_cert_not_selfsigned" : "The certificate of domain {domain:s} is not self-signed. Are you sure you want to replace it ? (Use --force)", + "certmanager_domain_cert_not_selfsigned" : "The certificate for domain {domain:s} is not self-signed. Are you sure you want to replace it ? (Use --force)", "certmanager_certificate_fetching_or_enabling_failed": "Sounds like enabling the new certificate for {domain:s} failed somehow...", - "certmanager_attempt_to_renew_nonLE_cert" : "The certificate of domain {domain:s} is not issued by Let's Encrypt. Cannot renew it automatically !", - "certmanager_attempt_to_renew_valid_cert" : "The certificate of domain {domain:s} is not about to expire ! Use --force to bypass", + "certmanager_attempt_to_renew_nonLE_cert" : "The certificate for domain {domain:s} is not issued by Let's Encrypt. Cannot renew it automatically !", + "certmanager_attempt_to_renew_valid_cert" : "The certificate for domain {domain:s} is not about to expire ! Use --force to bypass", "certmanager_domain_http_not_working": "It seems that the domain {domain:s} cannot be accessed through HTTP. Please check your DNS and nginx configuration is okay.", "certmanager_error_no_A_record" : "No DNS 'A' record found for {domain:s}. You need to make your domain name point to your machine to be able to install a Let's Encrypt certificate ! (If you know what you are doing, use --no-checks to disable those checks.)", "certmanager_domain_dns_ip_differs_from_public_ip" : "The DNS 'A' record for domain {domain:s} is different from this server IP. If you recently modified your A record, please wait for it to propagate (some DNS propagation checkers are available online). (If you know what you are doing, use --no-checks to disable those checks.)", diff --git a/locales/es.json b/locales/es.json index fdd04d10f..549cbe29a 100644 --- a/locales/es.json +++ b/locales/es.json @@ -72,7 +72,7 @@ "diagnostic_monitor_system_error": "No se puede monitorizar el sistema: {error}", "diagnostic_no_apps": "Aplicación no instalada", "dnsmasq_isnt_installed": "Parece que dnsmasq no está instalado, ejecuta 'apt-get remove bind9 && apt-get install dnsmasq'", - "certmanager_domain_cert_gen_failed": "No se pudo crear el certificado", + "domain_cert_gen_failed": "No se pudo crear el certificado", "domain_created": "El dominio ha sido creado", "domain_creation_failed": "No se pudo crear el dominio", "domain_deleted": "El dominio ha sido eliminado", diff --git a/locales/fr.json b/locales/fr.json index 6691b2f28..7898de57f 100644 --- a/locales/fr.json +++ b/locales/fr.json @@ -73,7 +73,7 @@ "diagnostic_monitor_system_error": "Impossible de superviser le système : {error}", "diagnostic_no_apps": "Aucune application installée", "dnsmasq_isnt_installed": "dnsmasq ne semble pas être installé, veuillez lancer « apt-get remove bind9 && apt-get install dnsmasq »", - "certmanager_domain_cert_gen_failed": "Impossible de générer le certificat", + "domain_cert_gen_failed": "Impossible de générer le certificat", "domain_created": "Le domaine a été créé", "domain_creation_failed": "Impossible de créer le domaine", "domain_deleted": "Le domaine a été supprimé", diff --git a/locales/nl.json b/locales/nl.json index 57b05e309..c2bfed31e 100644 --- a/locales/nl.json +++ b/locales/nl.json @@ -37,7 +37,7 @@ "custom_app_url_required": "U moet een URL opgeven om uw aangepaste app {app:s} bij te werken", "custom_appslist_name_required": "U moet een naam opgeven voor uw aangepaste app-lijst", "dnsmasq_isnt_installed": "dnsmasq lijkt niet geïnstalleerd te zijn, voer alstublieft het volgende commando uit: 'apt-get remove bind9 && apt-get install dnsmasq'", - "certmanager_domain_cert_gen_failed": "Kan certificaat niet genereren", + "domain_cert_gen_failed": "Kan certificaat niet genereren", "domain_created": "Domein succesvol aangemaakt", "domain_creation_failed": "Kan domein niet aanmaken", "domain_deleted": "Domein succesvol verwijderd", diff --git a/locales/pt.json b/locales/pt.json index b9c9e4bce..d3796d2e9 100644 --- a/locales/pt.json +++ b/locales/pt.json @@ -36,7 +36,7 @@ "backup_output_directory_not_empty": "A pasta de destino não se encontra vazia", "custom_app_url_required": "Deve proporcionar uma URL para atualizar a sua aplicação personalizada {app:s}", "custom_appslist_name_required": "Deve fornecer um nome para a sua lista de aplicações personalizada", - "certmanager_domain_cert_gen_failed": "Não foi possível gerar o certificado", + "domain_cert_gen_failed": "Não foi possível gerar o certificado", "domain_created": "Domínio criado com êxito", "domain_creation_failed": "Não foi possível criar o domínio", "domain_deleted": "Domínio removido com êxito", diff --git a/src/yunohost/certificate.py b/src/yunohost/certificate.py index 8b3db0283..961cf18fb 100644 --- a/src/yunohost/certificate.py +++ b/src/yunohost/certificate.py @@ -82,6 +82,8 @@ def certificate_status(auth, domain_list, full=False): """ # Check if old letsencrypt_ynh is installed + # TODO / FIXME - Remove this in the future once the letsencrypt app is + # not used anymore _check_old_letsencrypt_app() # If no domains given, consider all yunohost domains @@ -127,16 +129,18 @@ def certificate_install(auth, domain_list, force=False, no_checks=False, self_si """ # Check if old letsencrypt_ynh is installed + # TODO / FIXME - Remove this in the future once the letsencrypt app is + # not used anymore _check_old_letsencrypt_app() if self_signed: - certificate_install_selfsigned(domain_list, force) + _certificate_install_selfsigned(domain_list, force) else: - certificate_install_letsencrypt(auth, domain_list, force, no_checks) + _certificate_install_letsencrypt(auth, domain_list, force, no_checks) -def certificate_install_selfsigned(domain_list, force=False): +def _certificate_install_selfsigned(domain_list, force=False): for domain in domain_list: # Check we ain't trying to overwrite a good cert ! @@ -182,7 +186,7 @@ def certificate_install_selfsigned(domain_list, force=False): out, _ = p.communicate() if p.returncode != 0: logger.warning(out) - raise MoulinetteError(errno.EIO, m18n.n('certmanager_domain_cert_gen_failed')) + raise MoulinetteError(errno.EIO, m18n.n('domain_cert_gen_failed')) else : logger.info(out) @@ -216,7 +220,7 @@ def certificate_install_selfsigned(domain_list, force=False): -def certificate_install_letsencrypt(auth, domain_list, force=False, no_checks=False): +def _certificate_install_letsencrypt(auth, domain_list, force=False, no_checks=False): if not os.path.exists(ACCOUNT_KEY_FILE): _generate_account_key() @@ -276,6 +280,8 @@ def certificate_renew(auth, domain_list, force=False, no_checks=False, email=Fal """ # Check if old letsencrypt_ynh is installed + # TODO / FIXME - Remove this in the future once the letsencrypt app is + # not used anymore _check_old_letsencrypt_app() # If no domains given, consider all yunohost domains with Let's Encrypt @@ -283,12 +289,12 @@ def certificate_renew(auth, domain_list, force=False, no_checks=False, email=Fal if domain_list == []: for domain in yunohost.domain.domain_list(auth)['domains']: - # Does it has a Let's Encrypt cert ? + # Does it have a Let's Encrypt cert ? status = _get_status(domain) if status["CA_type"]["code"] != "lets-encrypt": continue - # Does it expires soon ? + # Does it expire soon ? if force or status["validity"] <= VALIDITY_LIMIT: domain_list.append(domain) @@ -305,11 +311,11 @@ def certificate_renew(auth, domain_list, force=False, no_checks=False, email=Fal status = _get_status(domain) - # Does it expires soon ? + # Does it expire soon ? if not force or status["validity"] <= VALIDITY_LIMIT: raise MoulinetteError(errno.EINVAL, m18n.n('certmanager_attempt_to_renew_valid_cert', domain=domain)) - # Does it has a Let's Encrypt cert ? + # Does it have a Let's Encrypt cert ? if status["CA_type"]["code"] != "lets-encrypt": raise MoulinetteError(errno.EINVAL, m18n.n('certmanager_attempt_to_renew_nonLE_cert', domain=domain)) @@ -383,7 +389,7 @@ def _email_renewing_failed(domain, exception_message, stack): logs = _tail(50, "/var/log/yunohost/yunohost-cli.log") text = """ -At attempt for renewing the certificate for domain %s failed with the following +An attempt for renewing the certificate for domain %s failed with the following error : %s diff --git a/src/yunohost/domain.py b/src/yunohost/domain.py index aadd9086d..7d34aff53 100644 --- a/src/yunohost/domain.py +++ b/src/yunohost/domain.py @@ -114,7 +114,7 @@ def domain_add(auth, domain, dyndns=False): m18n.n('domain_dyndns_root_unknown')) try: - yunohost.certificate.certificate_install_selfsigned([domain], False) + yunohost.certificate._certificate_install_selfsigned([domain], False) try: auth.validate_uniqueness({'virtualdomain': domain})