diff options
-rw-r--r-- | packages/carp_settings.xml | 70 | ||||
-rw-r--r-- | packages/carp_sync_client.php | 23 |
2 files changed, 20 insertions, 73 deletions
diff --git a/packages/carp_settings.xml b/packages/carp_settings.xml index 6417aac2..4aa0f590 100644 --- a/packages/carp_settings.xml +++ b/packages/carp_settings.xml @@ -107,72 +107,14 @@ <field> <fielddescr>Synchronize to IP</fielddescr> <fieldname>synchronizetoip</fieldname> - <description>Enter the IP address of the firewall you would like to synchornize your rules to.</description> + <description>Enter the IP address of the firewall you would like to synchronize your rules to.</description> <type>input</type> </field> <field> - <fielddescr>Known Hosts</fielddescr> - <fieldname>knownhosts</fieldname> - <description>Paste in the /etc/ssh/ssh_host_dsa_key.pub file generated from the destination server.</description> - <rows>4</rows> - <cols>50</cols> - <type>textarea</type> - </field> - <field> - <fielddescr>Authorized Keys</fielddescr> - <fieldname>authorizedkeys</fieldname> - <description>Paste in your Authorized Keys file generated from OpenSSH.</description> - <rows>4</rows> - <cols>50</cols> - <type>textarea</type> - </field> - <field> - <fielddescr>Install keys</fielddescr> - <fieldname>installkeys</fieldname> - <description>Check this option and enter a password below of the remote box if you would like to automatically install the keys on the remote machine.</description> - <type>checkbox</type> - </field> - <field> - <fielddescr>Install keys password</fielddescr> - <fieldname>installkeyspassword</fieldname> - <description>Enter the password of the remote machine that you would like to copy the keys to.</description> - <type>password</type> - </field> - + <fielddescr>Remote System Password</fielddescr> + <fieldname>password</fieldname> + <description>Enter the webGUI password of the system that you would like to synchronize with.</description> + <type>input</type> + </field> </fields> - <custom_php_command_before_form> - </custom_php_command_before_form> - <custom_php_resync_config_command> - system("/etc/rc.packages >/dev/null 2>&1 &"); - </custom_php_resync_config_command> - <custom_delete_php_command> - </custom_delete_php_command> - <custom_php_install_command> - system("/bin/mkdir -p /root/.ssh"); - if($_POST['knownhosts'] != "") { - $fout = fopen("/root/.ssh/known_hosts","w"); - fwrite($fout, $_POST['knownhosts']); - fclose($fout); - } - if($_POST['authorizedkeys'] != "") { - $fout = fopen("/root/.ssh/authorized_keys","w"); - fwrite($fout, $_POST['authorizedkeys']); - fclose($fout); - } - if($_POST['installkeys'] != "") { - $httpport = "80"; - $cmd = "/bin/mkdir /root/.ssh"; - /* make sure /root/.ssh exists */ - $vararrays = array("cmd" => "mkdir -p /root/.ssh"); - http_post($synchronizetoip, $httpport, "/exec_raw.php", $vararrays); - /* populate /root/.ssh/known_hosts */ - $vararrays = array("cmd" => "echo \"{$_POST['knownhosts']}\" > /root/.ssh/known_hosts"); - http_post($synchronizetoip, $httpport, "/exec_raw.php", $vararrays); - /* populate /root/.ssh/authorized_keys */ - $vararrays = array("cmd" => "echo \"{$_POST['authorizedkeys']}\" > /root/.ssh/authorized_keys"); - http_post($synchronizetoip, $httpport, "/exec_raw.php", $vararrays); - } - </custom_php_install_command> - <custom_php_deinstall_command> - </custom_php_deinstall_command> </packagegui> diff --git a/packages/carp_sync_client.php b/packages/carp_sync_client.php index e5bd1cdf..b2da24ba 100644 --- a/packages/carp_sync_client.php +++ b/packages/carp_sync_client.php @@ -2,7 +2,7 @@ /* carp_sync.php part of pfSense (www.pfSense.com) - Copyright (C) 2004 Scott Ullrich (sullrich@gmail.com) + Copyright (C) 2005 Scott Ullrich (sullrich@gmail.com) and Colin Smith (ethethlay@gmail.com) All rights reserved. Redistribution and use in source and binary forms, with or without @@ -25,25 +25,30 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + TODO: + * SSL support! + */ +require_once("xmlrpc_client.inc"); // Include client classes from our XMLRPC implementation. +require_once("xmlparse_pkg.inc"); // Include pfSense helper functions. +require_once("config.inc"); +require_once("functions.inc"); + +function carp_sync_xml($url, $password, $section, $section_xml) { + $params = array(new XML_R + if($already_processed != 1) if($config['installedpackages']['carpsettings']['config'] <> "" and is_array($config['installedpackages']['carpsettings']['config'])) { $already_processed = 1; foreach($config['installedpackages']['carpsettings']['config'] as $carp) { if($carp['synchronizetoip'] <> "" ) { - /* lets sync! */ $synchronizetoip = $carp['synchronizetoip']; - $files_to_copy = ""; if($carp['synchronizerules'] <> "" and is_array($config['filter'])) { $current_rules_section = backup_config_section("filter"); - $current_rules_section = str_replace("<?xml version=\"1.0\"?>", "", $current_rules_section); - /* generate firewall rules xml */ - $fout = fopen("{$g['tmp_path']}/filter_section.txt","w"); - fwrite($fout, $current_rules_section); - fclose($fout); - $files_to_copy .= "{$g['tmp_path']}/filter_section.txt"; + //$current_rules_section = str_replace("<?xml version=\"1.0\"?>", "", $current_rules_section); } if($carp['synchronizenat'] <> "" and is_array($config['nat'])) { $current_nat_section = backup_config_section("nat"); |