Small tweaks for the web interface

This commit is contained in:
Alexandre Aubin 2016-11-20 20:36:58 -05:00
parent 11c626881a
commit bba92e4d41
2 changed files with 19 additions and 11 deletions

View file

@ -308,7 +308,7 @@ domain:
### certificate_status()
cert-status:
action_help: List status of current certificates (all by default).
api: GET /certs/status/<domains>
api: GET /domains/cert-status/<domain_list>
configuration:
authenticate: all
authenticator: ldap-anonymous
@ -323,7 +323,7 @@ domain:
### certificate_install()
cert-install:
action_help: Install Let's Encrypt certificates for given domains (all by default).
api: POST /certs/enable/<domains>
api: POST /domains/cert-install/<domain_list>
configuration:
authenticate: all
authenticator: ldap-anonymous
@ -344,7 +344,7 @@ domain:
### certificate_renew()
cert-renew:
action_help: Renew the Let's Encrypt certificates for given domains (all by default).
api: POST /certs/renew/<domains>
api: POST /domains/cert-renew/<domain_list>
configuration:
authenticate: all
authenticator: ldap-anonymous

View file

@ -103,6 +103,7 @@ def certificate_status(auth, domain_list, full=False):
if not full:
del status["subject"]
del status["CA_name"]
del status["ACME_eligible"]
status["CA_type"] = status["CA_type"]["verbose"]
status["summary"] = status["summary"]["verbose"]
@ -249,7 +250,7 @@ def certificate_install_letsencrypt(auth, domain_list, force=False, no_checks=Fa
try:
if not no_checks:
_check_domain_is_correctly_configured(domain)
_check_domain_is_ready_for_ACME(domain)
_configure_for_acme_challenge(auth, domain)
_fetch_and_enable_new_certificate(domain)
@ -318,7 +319,7 @@ def certificate_renew(auth, domain_list, force=False, no_checks=False, email=Fal
try:
if not no_checks:
_check_domain_is_correctly_configured(domain)
_check_domain_is_ready_for_ACME(domain)
_fetch_and_enable_new_certificate(domain)
logger.success(m18n.n("certmanager_cert_renew_success", domain=domain))
@ -608,6 +609,12 @@ def _get_status(domain):
"verbose": "Unknown?",
}
try :
_check_domain_is_ready_for_ACME(domain)
ACME_eligible = True
except :
ACME_eligible = False
return {
"domain": domain,
"subject": cert_subject,
@ -615,6 +622,7 @@ def _get_status(domain):
"CA_type": CA_type,
"validity": days_remaining,
"summary": status_summary,
"ACME_eligible": ACME_eligible
}
###############################################################################
@ -681,7 +689,7 @@ def _backup_current_cert(domain):
shutil.copytree(cert_folder_domain, backup_folder)
def _check_domain_is_correctly_configured(domain):
def _check_domain_is_ready_for_ACME(domain):
public_ip = yunohost.domain.get_public_ip()
# Check if IP from DNS matches public IP