aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2005-03-14 17:40:51 +0000
committerScott Ullrich <sullrich@pfsense.org>2005-03-14 17:40:51 +0000
commit739dd7c3898e06875450540447d2afef59f45cd8 (patch)
tree2be14fc7698ff5a31d3d14f696aa5e0afe535a61 /packages
parentea0377aa6465c8dfffc0343f09ac5fe051943a0b (diff)
downloadpfsense-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
Diffstat (limited to 'packages')
-rw-r--r--packages/carp_sync_client.php22
-rw-r--r--packages/carp_sync_server.php4
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();
}