diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/autoconfigbackup/autoconfigbackup.xml | 2 | ||||
-rw-r--r-- | packages/autoconfigbackup/upload_config_filter.php | 25 |
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); } |