mirror of
https://github.com/myvesta/vesta.git
synced 2024-11-03 04:00:20 -08:00
52 lines
1.3 KiB
Bash
Executable File
52 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# info: delete firewall rule
|
|
# options: RULE
|
|
#
|
|
# The function deletes firewall rule.
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Variable&Function #
|
|
#----------------------------------------------------------#
|
|
|
|
# Importing system variables
|
|
source /etc/profile
|
|
|
|
# Argument definition
|
|
rule=$1
|
|
|
|
# Includes
|
|
source $VESTA/func/main.sh
|
|
source $VESTA/conf/vesta.conf
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Verifications #
|
|
#----------------------------------------------------------#
|
|
|
|
check_args '1' "$#" 'RULE'
|
|
is_format_valid 'rule'
|
|
is_system_enabled "$FIREWALL_SYSTEM" 'FIREWALL_SYSTEM'
|
|
is_object_valid '../../data/firewall/rules' 'RULE' "$rule"
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Action #
|
|
#----------------------------------------------------------#
|
|
|
|
# Deleting rule
|
|
sed -i "/RULE='$rule' /d" $VESTA/data/firewall/rules.conf
|
|
|
|
# Updating system firewall
|
|
$BIN/v-update-firewall
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Vesta #
|
|
#----------------------------------------------------------#
|
|
|
|
# Logging
|
|
log_event "$OK" "$ARGUMENTS"
|
|
|
|
exit
|