mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] better logging during key migration
This commit is contained in:
parent
5086707983
commit
044b2406d3
2 changed files with 10 additions and 5 deletions
|
@ -207,6 +207,10 @@
|
||||||
"mailbox_used_space_dovecot_down": "Dovecot mailbox service need to be up, if you want to get mailbox used space",
|
"mailbox_used_space_dovecot_down": "Dovecot mailbox service need to be up, if you want to get mailbox used space",
|
||||||
"maindomain_change_failed": "Unable to change the main domain",
|
"maindomain_change_failed": "Unable to change the main domain",
|
||||||
"maindomain_changed": "The main domain has been changed",
|
"maindomain_changed": "The main domain has been changed",
|
||||||
|
"migrate_tsig_end": "Migration to hmac-sha512 finished",
|
||||||
|
"migrate_tsig_failed": "Migrating the dyndns domain {domain} to hmac-sha512 failed, rolling back. Error: {error_code} - {error}",
|
||||||
|
"migrate_tsig_start": "Not secure enough key algorithm detected for TSIG signature of domain '{domain}', initiating migration to the more secure one hmac-sha512",
|
||||||
|
"migrate_tsig_wait": "Let's wait 3min for the dyndns server to take the new key into account...",
|
||||||
"migrations_backward": "Migrating backward.",
|
"migrations_backward": "Migrating backward.",
|
||||||
"migrations_bad_value_for_target": "Invalide number for target argument, available migrations numbers are 0 or {}",
|
"migrations_bad_value_for_target": "Invalide number for target argument, available migrations numbers are 0 or {}",
|
||||||
"migrations_cant_reach_migration_file": "Can't access migrations files at path %s",
|
"migrations_cant_reach_migration_file": "Can't access migrations files at path %s",
|
||||||
|
|
|
@ -278,6 +278,7 @@ def dyndns_update(dyn_host="dyndns.yunohost.org", domain=None, key=None,
|
||||||
|
|
||||||
|
|
||||||
def _migrate_from_md5_tsig_to_sha512_tsig(private_key_path, domain, dyn_host):
|
def _migrate_from_md5_tsig_to_sha512_tsig(private_key_path, domain, dyn_host):
|
||||||
|
logger.warning(m18n.n('migrate_tsig_start', domain=domain))
|
||||||
public_key_path = private_key_path.rsplit(".private", 1)[0] + ".key"
|
public_key_path = private_key_path.rsplit(".private", 1)[0] + ".key"
|
||||||
public_key_md5 = open(public_key_path).read().strip().split(' ')[-1]
|
public_key_md5 = open(public_key_path).read().strip().split(' ')[-1]
|
||||||
|
|
||||||
|
@ -299,19 +300,17 @@ def _migrate_from_md5_tsig_to_sha512_tsig(private_key_path, domain, dyn_host):
|
||||||
raise MoulinetteError(errno.ENETUNREACH, m18n.n('no_internet_connection'))
|
raise MoulinetteError(errno.ENETUNREACH, m18n.n('no_internet_connection'))
|
||||||
|
|
||||||
if r.status_code != 201:
|
if r.status_code != 201:
|
||||||
print r.text
|
|
||||||
try:
|
try:
|
||||||
error = json.loads(r.text)['error']
|
error = json.loads(r.text)['error']
|
||||||
print "ERROR:", error
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
print e
|
print e
|
||||||
error = r.text
|
error = r.text
|
||||||
|
|
||||||
# raise MoulinetteError(errno.EPERM,
|
logger.warning(m18n.n('migrate_tsig_failed', domain=domain,
|
||||||
# m18n.n('dyndns_registration_failed', error=error))
|
error_code=str(r.status_code), error=error))
|
||||||
# XXX print warning
|
|
||||||
os.system("mv /etc/yunohost/dyndns/*+165* /tmp")
|
os.system("mv /etc/yunohost/dyndns/*+165* /tmp")
|
||||||
return public_key_path
|
return public_key_path
|
||||||
|
|
||||||
|
@ -319,8 +318,10 @@ def _migrate_from_md5_tsig_to_sha512_tsig(private_key_path, domain, dyn_host):
|
||||||
os.system("mv /etc/yunohost/dyndns/*+157* /tmp")
|
os.system("mv /etc/yunohost/dyndns/*+157* /tmp")
|
||||||
|
|
||||||
# sleep to wait for dyndns cache invalidation
|
# sleep to wait for dyndns cache invalidation
|
||||||
|
logger.warning(m18n.n('migrate_tsig_wait'))
|
||||||
time.sleep(180)
|
time.sleep(180)
|
||||||
|
|
||||||
|
logger.warning(m18n.n('migrate_tsig_end'))
|
||||||
return new_key_path.rsplit(".key", 1)[0] + ".private"
|
return new_key_path.rsplit(".key", 1)[0] + ".private"
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue