mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-14 18:49:17 -07:00
Firewall with Fail2ban support
This commit is contained in:
parent
f6926670fe
commit
357eb42647
27 changed files with 936 additions and 50 deletions
49
bin/v-suspend-firewall-rule
Executable file
49
bin/v-suspend-firewall-rule
Executable file
|
@ -0,0 +1,49 @@
|
|||
#!/bin/bash
|
||||
# info: suspend firewall rule
|
||||
# options: RULE
|
||||
#
|
||||
# The function suspends a certain firewall rule.
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variable&Function #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Argument defenition
|
||||
rule=$1
|
||||
|
||||
# Inlcudes
|
||||
source $VESTA/func/main.sh
|
||||
source $VESTA/conf/vesta.conf
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
check_args '1' "$#" 'RULE'
|
||||
validate_format 'rule'
|
||||
is_system_enabled "$FIREWALL_SYSTEM" 'FIREWALL_SYSTEM'
|
||||
is_object_valid '../../data/firewall/rules' 'RULE' "$rule"
|
||||
is_object_unsuspended '../../data/firewall/rules' 'RULE' "$rule"
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Suspending rule
|
||||
update_object_value ../../data/firewall/rules RULE $rule '$SUSPENDED' yes
|
||||
|
||||
# Updating system firewall
|
||||
$BIN/v-update-firewall
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Logging
|
||||
log_event "$OK" "$EVENT"
|
||||
|
||||
exit
|
Loading…
Add table
Add a link
Reference in a new issue