diff options
-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(); } |