diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2008-10-06 20:23:04 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2008-10-06 20:23:04 +0000 |
commit | c88f531e8e93c45c6491cf0576f795964e998abd (patch) | |
tree | 935bd4f1ec1e2305733316913e0a4ae11f9844a8 /packages | |
parent | c1903b13c0c9c46b6e19eca43dd27f9e9c569fc0 (diff) | |
download | pfsense-packages-c88f531e8e93c45c6491cf0576f795964e998abd.tar.gz pfsense-packages-c88f531e8e93c45c6491cf0576f795964e998abd.tar.bz2 pfsense-packages-c88f531e8e93c45c6491cf0576f795964e998abd.zip |
Correct path to config.xml data
Diffstat (limited to 'packages')
-rw-r--r-- | packages/autoconfigbackup/autoconfigbackup.php | 10 | ||||
-rw-r--r-- | packages/autoconfigbackup/upload_config_filter.php | 44 |
2 files changed, 30 insertions, 24 deletions
diff --git a/packages/autoconfigbackup/autoconfigbackup.php b/packages/autoconfigbackup/autoconfigbackup.php index 734691a0..acd5568d 100644 --- a/packages/autoconfigbackup/autoconfigbackup.php +++ b/packages/autoconfigbackup/autoconfigbackup.php @@ -42,13 +42,13 @@ $oper_sep = "\|\|"; $get_url = "https://portal.pfsense.org/pfSconfigbackups/restore.php"; // Encryption password -$decrypt_password = $config['installedpackages']['autoconfigbackup']['config']['decrypt_password']; +$decrypt_password = $config['installedpackages']['autoconfigbackup']['config'][0]['decrypt_password']; // Defined username -$username = $config['installedpackages']['autoconfigbackup']['config']['username']; +$username = $config['installedpackages']['autoconfigbackup']['config'][0]['username']; // Defined password -$password = $config['installedpackages']['autoconfigbackup']['config']['password']; +$password = $config['installedpackages']['autoconfigbackup']['config'][0]['password']; if(!$username) { Header("Location: /pkg_edit.php?xml=autoconfigbackup.xml&id=0"); @@ -77,8 +77,8 @@ if($_GET['newver'] != "") { } } else { // Grab username and password from config.xml - $username = $config['installedpackages']['autoconfigbackup']['config']['username']; - $password = $config['installedpackages']['autoconfigbackup']['config']['password']; + $username = $config['installedpackages']['autoconfigbackup']['config'][0]['username']; + $password = $config['installedpackages']['autoconfigbackup']['config'][0]['password']; // Phone home and obtain backups $curl_Session = curl_init($get_url); curl_setopt($curl_Session, CURLOPT_POST, 1); diff --git a/packages/autoconfigbackup/upload_config_filter.php b/packages/autoconfigbackup/upload_config_filter.php index 2073ef07..2216af74 100644 --- a/packages/autoconfigbackup/upload_config_filter.php +++ b/packages/autoconfigbackup/upload_config_filter.php @@ -12,34 +12,40 @@ $last_backup_date = $config['system']['lastpfSbackup']; $last_config_change = $config['revision']['time']; +$hostname = $config['system']['hostname']; +$username = $config['installedpackages']['autoconfigbackup']['config'][0]['username']; +$password = $config['installedpackages']['autoconfigbackup']['config'][0]['password']; +$encryptpw = $config['installedpackages']['autoconfigbackup']['config'][0]['crypto_password']; +$reason = $config['revision']['description']; /* If configuration has changed, upload to pfS */ if($last_backup_date <> $last_config_change) { - $hostname = $config['system']['hostname']; - $username = $config['installedpackages']['pfSautoconfigbackup']['config']['username']; - $password = $config['installedpackages']['pfSautoconfigbackup']['config']['password']; - $encryptpw = $config['installedpackages']['pfSautoconfigbackup']['config']['crypto_password']; - $reason = $config['revision']['description']; + if($username && $password && $encryptpw) { - $upload_url = "https://{$username}:{$password}@portal.pfsense.org/pfSconfigbackups/backup.php"; + log_error("Beginning portal.pfsense.org configuration backup."); - // Encrypt config.xml - $data = file_get_contents("/cf/conf/config.xml"); - $configxml = encrypt_data($data, $encryptpw); - tagfile_reformat($data, $data, "config.xml"); + $upload_url = "https://{$username}:{$password}@portal.pfsense.org/pfSconfigbackups/backup.php"; - // Check configuration into the BSDP repo - $curl_Session = curl_init($upload_url); - curl_setopt($curl_Session, CURLOPT_POST, 1); - curl_setopt($curl_Session, CURLOPT_POSTFIELDS, "reason={$reason}&configxml={$configxml}&hostname={$hostname}"); - curl_setopt($curl_Session, CURLOPT_FOLLOWLOCATION, 1); - $data = curl_exec($curl_Session); - curl_close($curl_Session); + // Encrypt config.xml + $data = file_get_contents("/cf/conf/config.xml"); + $configxml = encrypt_data($data, $encryptpw); + tagfile_reformat($data, $data, "config.xml"); - $config['system']['lastpfSbackup'] = $last_config_change; - write_config("Updating last portal.pfsense.org last backup date/time."); + // Check configuration into the BSDP repo + $curl_Session = curl_init($upload_url); + curl_setopt($curl_Session, CURLOPT_POST, 1); + curl_setopt($curl_Session, CURLOPT_POSTFIELDS, "reason={$reason}&configxml={$configxml}&hostname={$hostname}"); + curl_setopt($curl_Session, CURLOPT_FOLLOWLOCATION, 1); + $data = curl_exec($curl_Session); + curl_close($curl_Session); + $config['system']['lastpfSbackup'] = $last_config_change; + write_config("Updating last portal.pfsense.org last backup date/time."); + + log_error("End of portal.pfsense.org configuration backup."); + + } } ?>
\ No newline at end of file |