diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2006-02-01 01:48:49 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2006-02-01 01:48:49 +0000 |
commit | 96b2e054b1beaeb2c3fa77a697aef2955f63bbe0 (patch) | |
tree | 2bc5c687f65409a84dc6379af75fdbcef07c74ac /packages | |
parent | 09a8e110276b004522b38d48e55be6b9796d038b (diff) | |
download | pfsense-packages-96b2e054b1beaeb2c3fa77a697aef2955f63bbe0.tar.gz pfsense-packages-96b2e054b1beaeb2c3fa77a697aef2955f63bbe0.tar.bz2 pfsense-packages-96b2e054b1beaeb2c3fa77a697aef2955f63bbe0.zip |
Add xmlrpc sync code that will be used to sync spamd's config to backup firewalls
Diffstat (limited to 'packages')
-rw-r--r-- | packages/spamd.inc | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/packages/spamd.inc b/packages/spamd.inc index 4868072c..2edcb129 100644 --- a/packages/spamd.inc +++ b/packages/spamd.inc @@ -127,6 +127,45 @@ function sync_package_spamd() { mwexec("/usr/local/etc/rc.d/spamd.sh start"); } +function sync_spamd_config_to_backup() { + global $g, $config; + if(is_array($config['installedpackages']['carpsettings']['config'])) { + foreach($config['installedpackages']['carpsettings']['config'] as $carp) { + if($carp['synchronizetoip'] != "" ) { + $synctoip = $carp['synchronizetoip']; + $password = $carp['password']; + $username = "admin"; + } + } + } + if($synctoip and $password) { + if($config['system']['webgui']['protocol'] != "") { + $synchronizetoip = $config['system']['webgui']['protocol']; + $synchronizetoip .= "://"; + } + $port = $config['system']['webgui']['port']; + /* if port is empty lets rely on the protocol selection */ + if($port == "") { + if($config['system']['webgui']['protocol'] == "http") { + $port = "80"; + } else { + $port = "443"; + } + } + $params = array(XML_RPC_encode($password),XML_RPC_encode($xml)); + /* create files to sync array */ + $filetosync = array("/var/db/spamd", "/var/db/whitelist.txt"); + /* loop through files to sync list and sync them up */ + foreach($filetosync as $f2s) { + $f2c_contents = file_get_contents($f2s); + xmlrpc_sync_file($url, $password, $f2s, $f2c_contents, $port); + } + /* signal remote process config reload */ + xmlrpc_exec_shell($url, $password, "/usr/bin/killall -HUP spamlogd", $port); + xmlrpc_exec_shell($url, $password, "/usr/bin/killall -HUP spamd", $port); + } +} + function custom_php_install_command() { global $config, $g; system("touch /var/db/whitelist.txt"); |