LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-13-2013, 10:55 AM   #1
tts00
LQ Newbie
 
Registered: Aug 2013
Posts: 6

Rep: Reputation: Disabled
Firewall HA sync


Hello,

I have 2 firewalls in HA using keepalived and i need to keep both with the same configuration like rules, routes. We use the script bellow on the firewall 02, but we have some fails with this approach. If the firewall 01 failed, ok, the firewall 02 is up to date, but when firewall 01 back again, the changes on firewall 02 won´t be replicated to it.

How do you do with the replication? Any good ideas?

Replication script on firewall 02

#!/bin/bash
MD5=`which md5sum`
SSHPASS=`which sshpass`
fileconf[1]="/etc/init.d/firewall";command[1]="/etc/init.d/firewall restart"
fileconf[2]="/etc/squid/squid.conf";command[2]="squid -k reconfigure"
fileconf[3]="/etc/pptpd.conf";command[3]="/etc/init.d/pptpd restart"
fileconf[4]="/etc/ppp/options";command[4]="/etc/init.d/pptpd restart"
fileconf[5]="/etc/ppp/pptpd-options";command[5]="/etc/init.d/pptpd restart"

count=${#fileconf[@]}
for i in `seq 1 $count`
do
if [ -f "${fileconf[$i]}" ]; then

md5sum1=`$SSHPASS -p "password" ssh 10.0.0.1 -l user $MD5 ${fileconf[$i]} | awk -F " " '{print $1}'`
md5sum2=`$MD5 ${fileconf[$i]} | awk -F " " '{print $1}'`

if [ "$( echo $md5sum1 | grep -v ' ' )" -a "$md5sum1" != "$md5sum2" ];then
$SSHPASS -p "password" ssh 10.0.0.1 -l user cat ${fileconf[$i]} > ${fileconf[$i]}
${command[$i]}
fi
fi
done
 
Old 08-13-2013, 08:25 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3603Reputation: 3603Reputation: 3603Reputation: 3603Reputation: 3603Reputation: 3603Reputation: 3603Reputation: 3603Reputation: 3603Reputation: 3603Reputation: 3603
If you need to store iptables rules you best run 'iptables-save' to an output file (incron job on some action?) because '/etc/init.d/firewall restart' will only save rules if so configured. As for syncing settings why not rsync between servers over SSH or use a third machine as central repo and commit to / fetch changes from there?
 
Old 08-16-2013, 11:44 AM   #3
tts00
LQ Newbie
 
Registered: Aug 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by unSpawn View Post
If you need to store iptables rules you best run 'iptables-save' to an output file (incron job on some action?) because '/etc/init.d/firewall restart' will only save rules if so configured. As for syncing settings why not rsync between servers over SSH or use a third machine as central repo and commit to / fetch changes from there?
Yes, i think rsyncd as central repo is the better solution, thank you.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Managing A Single Firewall Policy For Multiple Servers Using Firewall Builder LXer Syndicated Linux News 0 12-06-2010 11:20 AM
pppoe-setup masquerade firewall vs custom firewall matters Slackware 12 03-06-2009 05:50 AM
router billion 5102 has firewall and software firewall tests aus9 Linux - Security 6 12-31-2006 11:09 PM
Sync for Samsung Sync master Naphoon Linux - Hardware 1 10-16-2004 07:20 PM
Firewall Builder sample firewall policy file ? (.xml) nuwanguy Linux - Networking 0 09-13-2003 01:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration