aboutsummaryrefslogtreecommitdiffstats
path: root/config/autoconfigbackup/autoconfigbackup.inc
diff options
context:
space:
mode:
authorManuel Silvoso <msilvoso@gmail.com>2014-05-09 18:11:22 +0200
committerManuel Silvoso <msilvoso@gmail.com>2014-07-25 22:25:19 +0200
commit94aa568b4f2fac31e8b8585d0530c5a15b0e5041 (patch)
treea0f619c5c9cec07f8be55ad28d0faa681c625700 /config/autoconfigbackup/autoconfigbackup.inc
parent6cb45d2cadef9867239b8c2e6c40bc27be4f368b (diff)
downloadpfsense-packages-94aa568b4f2fac31e8b8585d0530c5a15b0e5041.tar.gz
pfsense-packages-94aa568b4f2fac31e8b8585d0530c5a15b0e5041.tar.bz2
pfsense-packages-94aa568b4f2fac31e8b8585d0530c5a15b0e5041.zip
added proxy configuration to autoconfigbackup
Diffstat (limited to 'config/autoconfigbackup/autoconfigbackup.inc')
-rw-r--r--config/autoconfigbackup/autoconfigbackup.inc22
1 files changed, 21 insertions, 1 deletions
diff --git a/config/autoconfigbackup/autoconfigbackup.inc b/config/autoconfigbackup/autoconfigbackup.inc
index b49b81fd..06a5c206 100644
--- a/config/autoconfigbackup/autoconfigbackup.inc
+++ b/config/autoconfigbackup/autoconfigbackup.inc
@@ -68,6 +68,20 @@ function custom_php_validation_command($post, &$input_errors) {
unset($_POST['testconnection']);
}
+function configure_proxy($config) {
+ $ret = array();
+ if (!empty($config['system']['proxyurl'])) {
+ $ret[CURLOPT_PROXY] = $config['system']['proxyurl'];
+ if (!empty($config['system']['proxyport']))
+ $ret[CURLOPT_PROXYPORT] = $config['system']['proxyport'];
+ if (!empty($config['system']['proxyuser']) && !empty($config['system']['proxypass'])) {
+ $ret[CURLOPT_PROXYAUTH] = CURLAUTH_ANY | CURLAUTH_ANYSAFE;
+ $ret[CURLOPT_PROXYUSERPWD] = "{$config['system']['proxyuser']}:{$config['system']['proxypass']}";
+ }
+ }
+ return $ret;
+}
+
function test_connection($post) {
global $savemsg, $config, $g;
@@ -102,6 +116,9 @@ function test_connection($post) {
curl_setopt($curl_session, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_session, CURLOPT_CONNECTTIMEOUT, 55);
curl_setopt($curl_session, CURLOPT_TIMEOUT, 30);
+ curl_setopt($curl_session, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/etc/version")));
+ // Proxy
+ curl_setopt_array($curl_session, configure_proxy($config));
curl_setopt($curl_session, CURLOPT_POSTFIELDS, "action=showbackups&hostname={$hostname}");
$data = curl_exec($curl_session);
@@ -209,7 +226,10 @@ function upload_config($reasonm = "") {
curl_setopt($curl_session, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl_session, CURLOPT_CONNECTTIMEOUT, 55);
curl_setopt($curl_session, CURLOPT_TIMEOUT, 30);
-
+ curl_setopt($curl_session, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/etc/version")));
+ // Proxy
+ curl_setopt_array($curl_session, configure_proxy($config));
+
$data = curl_exec($curl_session);
if (curl_errno($curl_session)) {
$fd = fopen("/tmp/backupdebug.txt", "w");