mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 10:37:42 -07:00
Firewall support enable/disable
This commit is contained in:
parent
b15b5e5cbd
commit
6626ba34bf
2 changed files with 105 additions and 0 deletions
57
bin/v-add-sys-firewall
Executable file
57
bin/v-add-sys-firewall
Executable file
|
@ -0,0 +1,57 @@
|
|||
#!/bin/bash
|
||||
# info: add system firewall
|
||||
# opions: NONE
|
||||
#
|
||||
# The script enables firewall
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variable&Function #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Includes
|
||||
source $VESTA/func/main.sh
|
||||
source $VESTA/conf/vesta.conf
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
if [ "$FIREWALL_SYSTEM" = 'iptables' ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Adding firewall directory
|
||||
mkdir -p $VESTA/data/firewall/
|
||||
|
||||
# Adding default ruleset
|
||||
if [ ! -e "$VESTA/data/firewall/rules.conf" ]; then
|
||||
cp $VESTA/install/rhel/7/* $VESTA/data/firewall/
|
||||
fi
|
||||
|
||||
# Updating FIREWAL_SYSTEM value
|
||||
if [ -z "$(grep FIREWALL_SYSTEM $VESTA/conf/vesta.conf)" ]; then
|
||||
echo "FIREWALL_SYSTEM='iptables'" >> $VESTA/conf/vesta.conf
|
||||
else
|
||||
sed -i "s/FIREWALL_SYSTEM.*/FIREWALL_SYSTEM='iptables'/g" \
|
||||
$VESTA/conf/vesta.conf
|
||||
fi
|
||||
|
||||
# Updating firewall rules
|
||||
$BIN/v-update-firewall
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Logging
|
||||
log_event "$OK" "$EVENT"
|
||||
|
||||
exit
|
Loading…
Add table
Add a link
Reference in a new issue