DEV-5029: Remove iptable and firewall reference from script. #4

Merged
jfunk merged 3 commits from DEV-5029-remove-iptables-and-firewall-check-from-migrate-script into master 2023-07-24 08:33:13 -03:00

33
migrate
View File

@ -186,25 +186,10 @@ function check_source() {
# Make sure the target host can access this one
#
if which bondingadmin-nftables >/dev/null ; then
nft_file=/etc/bondingadmin/nftables/filter-input-bondingadmin-migrate.nft
if [ ! -f $nft_file ] ; then
echo "ip saddr $(get_var target_ip) accept" > $nft_file
bondingadmin-nftables start
fi
else
manthan marked this conversation as resolved Outdated
Outdated
Review

Also the if which bondingadmin-nftables >/dev/null ; then and always do the stuff inside that clause since that's always the case now.

Also the `if which bondingadmin-nftables >/dev/null ; then` and always do the stuff inside that clause since that's always the case now.
known_ips=/etc/firewall.d/known_ips
target_ip_present=false
target_ip=$(get_var target_ip)
if [ -f $known_ips ] ; then
if grep -q $target_ip $known_ips ; then
target_ip_present=true
fi
fi
if [ $target_ip_present = "false" ] ; then
echo "iptables -A \$CHAIN -s $target_ip -j ACCEPT" >> $known_ips
systemctl restart firewall
fi
nft_file=/etc/bondingadmin/nftables/filter-input-bondingadmin-migrate.nft
if [ ! -f $nft_file ] ; then
echo "ip saddr $(get_var target_ip) accept" > $nft_file
bondingadmin-nftables start
fi
# Check TTL of hostname
@ -568,13 +553,9 @@ function action_target_post() {
echo -e "Running remotebackup"
ba remotebackup
if -f /usr/sbin/bondingadmin-nftables ; then
echo -e "Restarting nftables service"
systemctl restart bondingadmin-nftables
else
manthan marked this conversation as resolved Outdated
Outdated
Review

Same here.

Same here.
echo -e "Restarting firewall service"
systemctl restart firewall
fi
echo -e "Restarting nftables service"
systemctl restart bondingadmin-nftables
# Migrate influxDB
echo -ne "Migrating influxDB "