diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2005-03-14 17:40:51 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2005-03-14 17:40:51 +0000 |
commit | 739dd7c3898e06875450540447d2afef59f45cd8 (patch) | |
tree | 2be14fc7698ff5a31d3d14f696aa5e0afe535a61 | |
parent | ea0377aa6465c8dfffc0343f09ac5fe051943a0b (diff) | |
download | pfsense-packages-739dd7c3898e06875450540447d2afef59f45cd8.tar.gz pfsense-packages-739dd7c3898e06875450540447d2afef59f45cd8.tar.bz2 pfsense-packages-739dd7c3898e06875450540447d2afef59f45cd8.zip |
* Sync NAT area to other CARP hosts on changes
* Sync ALIASES area to other CARP hosts on changes
-rw-r--r-- | packages/carp_sync_client.php | 22 | ||||
-rw-r--r-- | packages/carp_sync_server.php | 4 |
2 files changed, 21 insertions, 5 deletions
diff --git a/packages/carp_sync_client.php b/packages/carp_sync_client.php index ac8a78ce..11dc630a 100644 --- a/packages/carp_sync_client.php +++ b/packages/carp_sync_client.php @@ -1,5 +1,4 @@ #!/usr/bin/php - /* carp_sync.php part of pfSense (www.pfSense.com) @@ -28,19 +27,32 @@ POSSIBILITY OF SUCH DAMAGE. */ - - -if($config['installedpackages']['carpsettings']['config'] != "") - foreach($config['installedpackages']['carpsettings']['config'] as $carp) +if($config['installedpackages']['carpsettings']['config'] != "") { + foreach($config['installedpackages']['carpsettings']['config'] as $carp) { if($carp['synchronizerules'] <> "") { /* lets sync! */ $synchronizetoip = $carp['synchronizetoip']; $current_rules_section = backup_config_section("rules"); + $current_nat_section = backup_config_section("nat"); + $current_aliases_section = backup_config_section("aliases"); + /* generate firewall rules xml */ $fout = fopen("{$g['tmp_path']}/rules_section.txt","w"); fwrite($fout, $current_rules_section); fclose($fout); + /* generate nat rules xml */ + $fout = fopen("{$g['tmp_path']}/nat_section.txt","w"); + fwrite($fout, $current_nat_section); + fclose($fout); + /* generate aliases xml */ + $fout = fopen("{$g['tmp_path']}/aliases_section.txt","w"); + fwrite($fout, $current_aliases_section); + fclose($fout); /* copy configuration to remote host */ mwexec("/usr/bin/scp {$g['tmp_path']}/rules_section.txt root@{$synchronizetoip}:/tmp/"); + mwexec("/usr/bin/scp {$g['tmp_path']}/aliases_section.txt root@{$synchronizetoip}:/tmp/"); + mwexec("/usr/bin/scp {$g['tmp_path']}/nat_section.txt root@{$synchronizetoip}:/tmp/"); mwexec("/usr/bin/ssh {$synchronizetoip} /usr/local/pkg/carp_sync_server.php"); } + } +} diff --git a/packages/carp_sync_server.php b/packages/carp_sync_server.php index 9dd09577..63d67dfd 100644 --- a/packages/carp_sync_server.php +++ b/packages/carp_sync_server.php @@ -38,7 +38,11 @@ if($config['installedpackages']['carpsettings']['config'] != "") foreach($config['installedpackages']['carpsettings']['config'] as $carp) if($carp['synchronizerules'] <> "") { $rules = return_filename_as_string("{$g['tmp_path']}/rules_section.txt"); + $aliases = return_filename_as_string("{$g['tmp_path']}/aliases_section.txt"); + $nat = return_filename_as_string("{$g['tmp_path']}/nat_section.txt"); restore_config_section("rules", $rules); + restore_config_section("nat", $nat); + restore_config_section("aliases", $aliases); filter_configure(); } |