1
0
mirror of https://github.com/myvesta/vesta.git synced 2025-03-11 03:52:44 -07:00
myvesta/bin/v-delete-firewall-rule

52 lines
1.3 KiB
Plaintext
Raw Normal View History

2014-09-17 00:32:25 +03:00
#!/bin/bash
# info: delete firewall rule
# options: RULE
#
# The function deletes firewall rule.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
2014-10-05 14:52:15 +03:00
# Importing system variables
source /etc/profile
2015-11-06 17:38:58 +02:00
# Argument definition
2014-09-17 00:32:25 +03:00
rule=$1
# Includes
source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'RULE'
is_format_valid 'rule'
2014-09-17 00:32:25 +03:00
is_system_enabled "$FIREWALL_SYSTEM" 'FIREWALL_SYSTEM'
2014-10-05 14:52:15 +03:00
is_object_valid '../../data/firewall/rules' 'RULE' "$rule"
2014-09-17 00:32:25 +03:00
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Deleting rule
2014-10-05 14:52:15 +03:00
sed -i "/RULE='$rule' /d" $VESTA/data/firewall/rules.conf
2014-09-17 00:32:25 +03:00
# Updating system firewall
2014-10-05 14:52:15 +03:00
$BIN/v-update-firewall
2014-09-17 00:32:25 +03:00
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_event "$OK" "$ARGUMENTS"
2014-09-17 00:32:25 +03:00
exit