More explicit name for setting

This commit is contained in:
Alexandre Aubin 2018-11-27 23:55:15 +01:00
parent e596758184
commit 325678f541
4 changed files with 10 additions and 10 deletions

View file

@ -13,8 +13,8 @@ do_pre_regen() {
[[ -f /proc/net/if_inet6 ]] \ [[ -f /proc/net/if_inet6 ]] \
|| sed -i "s/ListenAddress ::/#ListenAddress ::/g" sshd_config || sed -i "s/ListenAddress ::/#ListenAddress ::/g" sshd_config
# Add DSA HostKey to let user remove it with migration 7 # Support legacy setting (this setting might be disabled by a user during a migration)
if [[ "$(yunohost settings get 'service.ssh._deprecated_dsa_hostkey')" == "True" ]]; then if [[ "$(yunohost settings get 'service.ssh.allow_deprecated_dsa_hostkey')" == "True" ]]; then
sed -i '/HostKey \/etc\/ssh\/ssh_host_rsa_key/a HostKey /etc/ssh/ssh_host_dsa_key' sshd_config sed -i '/HostKey \/etc\/ssh\/ssh_host_rsa_key/a HostKey /etc/ssh/ssh_host_dsa_key' sshd_config
fi fi

View file

@ -44,7 +44,7 @@ class MyMigration(Migration):
dsa = True dsa = True
break break
if dsa: if dsa:
settings_set("service.ssh._deprecated_dsa_hostkey", True) settings_set("service.ssh.allow_deprecated_dsa_hostkey", True)
# Create sshd_config.d dir # Create sshd_config.d dir
if not os.path.exists(SSHD_CONF + '.d'): if not os.path.exists(SSHD_CONF + '.d'):

View file

@ -28,7 +28,7 @@ class MyMigration(Migration):
""" """
def migrate(self): def migrate(self):
settings_set("service.ssh._deprecated_dsa_hostkey", False) settings_set("service.ssh.allow_deprecated_dsa_hostkey", False)
service_regen_conf(names=['ssh'], force=True) service_regen_conf(names=['ssh'], force=True)
def backward(self): def backward(self):
@ -44,7 +44,7 @@ class MyMigration(Migration):
# (basically nothing shall change) # (basically nothing shall change)
ynh_hash = _get_conf_hashes('ssh').get(SSHD_CONF, None) ynh_hash = _get_conf_hashes('ssh').get(SSHD_CONF, None)
current_hash = _calculate_hash(SSHD_CONF) current_hash = _calculate_hash(SSHD_CONF)
dsa = settings_get("service.ssh._deprecated_dsa_hostkey") dsa = settings_get("service.ssh.allow_deprecated_dsa_hostkey")
if ynh_hash == current_hash and not dsa: if ynh_hash == current_hash and not dsa:
return "auto" return "auto"

View file

@ -39,7 +39,7 @@ DEFAULTS = OrderedDict([
# -1 disabled, 0 alert if listed, 1 8-letter, 2 normal, 3 strong, 4 strongest # -1 disabled, 0 alert if listed, 1 8-letter, 2 normal, 3 strong, 4 strongest
("security.password.admin.strength", {"type": "int", "default": 1}), ("security.password.admin.strength", {"type": "int", "default": 1}),
("security.password.user.strength", {"type": "int", "default": 1}), ("security.password.user.strength", {"type": "int", "default": 1}),
("service.ssh._deprecated_dsa_hostkey", {"type": "bool", "default": False}), ("service.ssh.allow_deprecated_dsa_hostkey", {"type": "bool", "default": False}),
]) ])