add ssh port setting

This commit is contained in:
Kay0u 2021-04-12 18:07:36 +02:00
parent ce64a6380a
commit ee31969be7
No known key found for this signature in database
GPG key ID: AAFEEB16CFA2AE2D
3 changed files with 8 additions and 1 deletions

View file

@ -26,6 +26,8 @@ do_pre_regen() {
# Support different strategy for security configurations
export compatibility="$(yunohost settings get 'security.ssh.compatibility')"
export port="$(yunohost settings get 'security.ssh.port')"
export ssh_keys
export ipv6_enabled
ynh_render_template "sshd_config" "${pending_dir}/etc/ssh/sshd_config"

View file

@ -2,7 +2,7 @@
# by YunoHost
Protocol 2
Port 22
Port {{ port }}
{% if ipv6_enabled == "true" %}ListenAddress ::{% endif %}
ListenAddress 0.0.0.0

View file

@ -71,6 +71,10 @@ DEFAULTS = OrderedDict(
"choices": ["intermediate", "modern"],
},
),
(
"security.ssh.port",
{"type": "int", "default": 22},
),
(
"security.nginx.compatibility",
{
@ -383,6 +387,7 @@ def reconfigure_nginx(setting_name, old_value, new_value):
regen_conf(names=["nginx"])
@post_change_hook("security.ssh.port")
@post_change_hook("security.ssh.compatibility")
def reconfigure_ssh(setting_name, old_value, new_value):
if old_value != new_value: