mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Also propagate ssh port on fail2ban config
This commit is contained in:
parent
fc818cc6a7
commit
37c0825eed
3 changed files with 12 additions and 2 deletions
|
@ -2,6 +2,8 @@
|
|||
|
||||
set -e
|
||||
|
||||
. /usr/share/yunohost/helpers
|
||||
|
||||
do_pre_regen() {
|
||||
pending_dir=$1
|
||||
|
||||
|
@ -13,7 +15,9 @@ do_pre_regen() {
|
|||
|
||||
cp yunohost.conf "${fail2ban_dir}/filter.d/yunohost.conf"
|
||||
cp jail.conf "${fail2ban_dir}/jail.conf"
|
||||
cp yunohost-jails.conf "${fail2ban_dir}/jail.d/"
|
||||
|
||||
export ssh_port="$(yunohost settings get 'security.ssh.port')"
|
||||
ynh_render_template "yunohost-jails.conf" "${fail2ban_dir}/jail.d/yunohost-jails.conf"
|
||||
}
|
||||
|
||||
do_post_regen() {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
[sshd]
|
||||
port = {{ssh_port}}
|
||||
enabled = true
|
||||
|
||||
[nginx-http-auth]
|
||||
|
|
|
@ -387,13 +387,18 @@ 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:
|
||||
regen_conf(names=["ssh"])
|
||||
|
||||
|
||||
@post_change_hook("security.ssh.port")
|
||||
def reconfigure_ssh_and_fail2ban(setting_name, old_value, new_value):
|
||||
if old_value != new_value:
|
||||
regen_conf(names=["ssh", "fail2ban"])
|
||||
|
||||
|
||||
@post_change_hook("smtp.allow_ipv6")
|
||||
@post_change_hook("smtp.relay.host")
|
||||
@post_change_hook("smtp.relay.port")
|
||||
|
|
Loading…
Add table
Reference in a new issue