aboutsummaryrefslogtreecommitdiffstats
path: root/packages/carp_sync_client.php
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2005-03-14 19:55:02 +0000
committerScott Ullrich <sullrich@pfsense.org>2005-03-14 19:55:02 +0000
commite0bcb1df5f596f9a66f24b296418506597116e62 (patch)
tree3fbd232f23d480a75c2665cc0b0426d2ea72b21d /packages/carp_sync_client.php
parent508fe215e533f231512149ac3572e0691b5c9e72 (diff)
downloadpfsense-packages-e0bcb1df5f596f9a66f24b296418506597116e62.tar.gz
pfsense-packages-e0bcb1df5f596f9a66f24b296418506597116e62.tar.bz2
pfsense-packages-e0bcb1df5f596f9a66f24b296418506597116e62.zip
* Allow aliases, nat, traffic shaping and firewall rules syncing status to be turned on or off
Diffstat (limited to 'packages/carp_sync_client.php')
-rw-r--r--packages/carp_sync_client.php59
1 files changed, 37 insertions, 22 deletions
diff --git a/packages/carp_sync_client.php b/packages/carp_sync_client.php
index cfe59d4b..2d27501b 100644
--- a/packages/carp_sync_client.php
+++ b/packages/carp_sync_client.php
@@ -29,32 +29,47 @@
if($config['installedpackages']['carpsettings']['config'] != "") {
foreach($config['installedpackages']['carpsettings']['config'] as $carp) {
- if($carp['synchronizerules'] <> "" and $carp['synchronizetoip'] <> "" ) {
+ if($carp['synchronizetoip'] <> "" ) {
/* lets sync! */
$synchronizetoip = $carp['synchronizetoip'];
- $current_rules_section = backup_config_section("filter");
- $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);
+ if($carp['synchronizerules'] <> "") {
+ $current_rules_section = backup_config_section("filter");
+ /* generate firewall rules xml */
+ $fout = fopen("{$g['tmp_path']}/rules_section.txt","w");
+ fwrite($fout, $current_rules_section);
+ fclose($fout);
+ mwexec("/usr/bin/scp {$g['tmp_path']}/rules_section.txt root@{$synchronizetoip}:/tmp/");
+ unlink("{$g['tmp_path']}/rules_section.txt");
+ }
+ if($carp['synchronizenat'] <> "") {
+ $current_nat_section = backup_config_section("nat");
+ /* generate nat rules xml */
+ $fout = fopen("{$g['tmp_path']}/nat_section.txt","w");
+ fwrite($fout, $current_nat_section);
+ fclose($fout);
+ mwexec("/usr/bin/scp {$g['tmp_path']}/nat_section.txt root@{$synchronizetoip}:/tmp/");
+ unlink("{$g['tmp_path']}/nat_section.txt");
+ }
+ if($carp['synchronizealiases'] <> "") {
+ $current_aliases_section = backup_config_section("aliases");
+ /* generate aliases xml */
+ $fout = fopen("{$g['tmp_path']}/aliases_section.txt","w");
+ fwrite($fout, $current_aliases_section);
+ fclose($fout);
+ mwexec("/usr/bin/scp {$g['tmp_path']}/aliases_section.txt root@{$synchronizetoip}:/tmp/");
+ unlink("{$g['tmp_path']}/aliases_section.txt");
+ }
+ if($carp['synchronizetrafficshaper'] <> "") {
+ $current_trafficshaper_section = backup_config_section("shaper");
+ /* generate aliases xml */
+ $fout = fopen("{$g['tmp_path']}/trafficshaper_section.txt","w");
+ fwrite($fout, $current_trafficshaper_section);
+ fclose($fout);
+ mwexec("/usr/bin/scp {$g['tmp_path']}/trafficshaper_section.txt root@{$synchronizetoip}:/tmp/");
+ unlink("{$g['tmp_path']}/trafficshaper_section.txt");
+ }
/* 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");
- unlink("{$g['tmp_path']}/rules_section.txt");
- unlink("{$g['tmp_path']}/aliases_section.txt");
- unlink("{$g['tmp_path']}/nat_section.txt");
}
}
}