mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Fix IPv6 handling in ssh regen conf script
This commit is contained in:
parent
6a812190c5
commit
4db65682eb
2 changed files with 4 additions and 3 deletions
|
@ -11,9 +11,9 @@ do_pre_regen() {
|
||||||
|
|
||||||
# Don't overwrite configuration if from_script
|
# Don't overwrite configuration if from_script
|
||||||
if [[ ! -f /etc/yunohost/from_script ]]; then
|
if [[ ! -f /etc/yunohost/from_script ]]; then
|
||||||
|
|
||||||
# do not listen to IPv6 if unavailable
|
# do not listen to IPv6 if unavailable
|
||||||
[[ -f /proc/net/if_inet6 ]] \
|
[[ -f /proc/net/if_inet6 ]] && ipv6_enabled=true || ipv6_enabled=false
|
||||||
|| sed -i "s/ListenAddress ::/#ListenAddress ::/g" sshd_config
|
|
||||||
|
|
||||||
ssh_keys=$(ls /etc/ssh/ssh_host_{ed25519,rsa,ecdsa}_key 2>/dev/null)
|
ssh_keys=$(ls /etc/ssh/ssh_host_{ed25519,rsa,ecdsa}_key 2>/dev/null)
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ do_pre_regen() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export ssh_keys
|
export ssh_keys
|
||||||
|
export ipv6_enabled
|
||||||
ynh_render_template "sshd_config" "${pending_dir}/etc/ssh/sshd_config"
|
ynh_render_template "sshd_config" "${pending_dir}/etc/ssh/sshd_config"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
Protocol 2
|
Protocol 2
|
||||||
Port 22
|
Port 22
|
||||||
|
|
||||||
ListenAddress ::
|
{% if ipv6_enabled == "true" %}ListenAddress ::{% endif %}
|
||||||
ListenAddress 0.0.0.0
|
ListenAddress 0.0.0.0
|
||||||
|
|
||||||
{% for key in ssh_keys.split() %}
|
{% for key in ssh_keys.split() %}
|
||||||
|
|
Loading…
Add table
Reference in a new issue