aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2008-10-06 03:22:50 +0000
committerScott Ullrich <sullrich@pfsense.org>2008-10-06 03:22:50 +0000
commitcf871581de8399edc6f73aa38544786e452739d5 (patch)
tree7c78db5fa06fed02533a5b549517f492a071ceed /packages
parente06b65ef00232340d995d3031458bc6607114ebb (diff)
downloadpfsense-packages-cf871581de8399edc6f73aa38544786e452739d5.tar.gz
pfsense-packages-cf871581de8399edc6f73aa38544786e452739d5.tar.bz2
pfsense-packages-cf871581de8399edc6f73aa38544786e452739d5.zip
Encrypt config.xml and send to backup repo
Diffstat (limited to 'packages')
-rw-r--r--packages/autoconfigbackup/autoconfigbackup.xml2
-rw-r--r--packages/autoconfigbackup/upload_config_filter.php25
2 files changed, 17 insertions, 10 deletions
diff --git a/packages/autoconfigbackup/autoconfigbackup.xml b/packages/autoconfigbackup/autoconfigbackup.xml
index a272c6b2..57d24f5d 100644
--- a/packages/autoconfigbackup/autoconfigbackup.xml
+++ b/packages/autoconfigbackup/autoconfigbackup.xml
@@ -88,7 +88,7 @@
</field>
<field>
<fielddescr>Encryption password</fielddescr>
- <fieldname>decrypt_password</fieldname>
+ <fieldname>crypto_password</fieldname>
<type>password</type>
</field>
</fields>
diff --git a/packages/autoconfigbackup/upload_config_filter.php b/packages/autoconfigbackup/upload_config_filter.php
index a6e58c4c..876bc51f 100644
--- a/packages/autoconfigbackup/upload_config_filter.php
+++ b/packages/autoconfigbackup/upload_config_filter.php
@@ -17,19 +17,26 @@ $last_config_change = $config['revision']['time'];
/* 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'];
- $reason = $config['revision']['description'];
+ $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'];
$upload_url = "https://{$username}:{$password}@portal.pfsense.org/pfSconfigbackups/backup.php";
+ // Encrypt config.xml
+ $data = file_get_contents("/cf/conf/config.xml");
+ $configxml = encrypt_data($data, $encryptpw);
+ tagfile_reformat($data, $data, "config.xml");
+
+ // 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);
- curl_exec ($curl_Session);
- curl_close ($curl_Session);
+ 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);
}