diff options
author | jim-p <jimp@pfsense.org> | 2012-07-01 15:40:52 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2012-07-01 15:40:52 -0400 |
commit | e27491c9f1609c76e4189806386ef45071efef1d (patch) | |
tree | e25b7c94235470ab6e836b33ce491683dcbc8f9b /config/openvpn-client-export/vpn_openvpn_export.php | |
parent | e27c484b01b55b6d1198f46aefb84ac6fc23afb0 (diff) | |
download | pfsense-packages-e27491c9f1609c76e4189806386ef45071efef1d.tar.gz pfsense-packages-e27491c9f1609c76e4189806386ef45071efef1d.tar.bz2 pfsense-packages-e27491c9f1609c76e4189806386ef45071efef1d.zip |
Add inline config format that the openvpn client for android likes (ca, cert, key, tls-auth inside single config file) to the export package.
Diffstat (limited to 'config/openvpn-client-export/vpn_openvpn_export.php')
-rwxr-xr-x | config/openvpn-client-export/vpn_openvpn_export.php | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/config/openvpn-client-export/vpn_openvpn_export.php b/config/openvpn-client-export/vpn_openvpn_export.php index dceaf20f..dd56ee0e 100755 --- a/config/openvpn-client-export/vpn_openvpn_export.php +++ b/config/openvpn-client-export/vpn_openvpn_export.php @@ -138,6 +138,8 @@ if (!empty($act)) { $advancedoptions = $_GET['advancedoptions']; $usetoken = $_GET['usetoken']; + if ($usetoken && ($act == "confinline")) + $input_errors[] = "You cannot use Microsoft Certificate Storage with an Inline configuration."; $password = ""; if ($_GET['password']) $password = $_GET['password']; @@ -168,13 +170,19 @@ if (!empty($act)) { $exp_name = openvpn_client_export_prefix($srvid); - if($act == "conf" || $act == "confzip") { - if ($act == "confzip") { - $exp_name = urlencode($exp_name."-config.zip"); - $expformat = "zip"; - } else { - $exp_name = urlencode($exp_name."-config.ovpn"); - $expformat = "baseconf"; + if(substr($act, 0, 4) == "conf") { + switch ($act) { + case "confzip": + $exp_name = urlencode($exp_name."-config.zip"); + $expformat = "zip"; + break; + case "confinline": + $exp_name = urlencode($exp_name."-config.ovpn"); + $expformat = "inline"; + break; + default: + $exp_name = urlencode($exp_name."-config.ovpn"); + $expformat = "baseconf"; } $exp_path = openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $usetoken, $nokeys, $proxy, $expformat, $password, false, false, $advancedoptions); } @@ -194,7 +202,7 @@ if (!empty($act)) { } if (empty($input_errors)) { - if ($act == "conf") { + if (($act == "conf") || ($act == "confinline")) { $exp_size = strlen($exp_path); } else { $exp_size = filesize($exp_path); @@ -204,7 +212,7 @@ if (!empty($act)) { header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename={$exp_name}"); header("Content-Length: $exp_size"); - if ($act == "conf") { + if (($act == "conf") || ($act == "confinline")) { echo $exp_path; } else { readfile($exp_path); @@ -374,6 +382,8 @@ function server_changed() { cell2.className = "listr"; cell2.innerHTML = "<a href='javascript:download_begin(\"conf\"," + i + ", -1)'>Configuration</a>"; cell2.innerHTML += "<br/>"; + cell2.innerHTML += "<a href='javascript:download_begin(\"confinline\"," + i + ", -1)'>Inline Configuration</a>"; + cell2.innerHTML += "<br/>"; cell2.innerHTML += "<a href='javascript:download_begin(\"confzip\"," + i + ", -1)'>Configuration archive</a>"; cell2.innerHTML += "<br/>"; cell2.innerHTML += "<a href='javascript:download_begin(\"inst\"," + i + ", -1)'>Windows Installer</a>"; @@ -396,6 +406,8 @@ function server_changed() { cell2.className = "listr"; cell2.innerHTML = "<a href='javascript:download_begin(\"conf\", -1," + j + ")'>Configuration</a>"; cell2.innerHTML += "<br/>"; + cell2.innerHTML += "<a href='javascript:download_begin(\"confinline\", -1," + j + ")'>Inline Configuration</a>"; + cell2.innerHTML += "<br/>"; cell2.innerHTML += "<a href='javascript:download_begin(\"confzip\", -1," + j + ")'>Configuration archive</a>"; cell2.innerHTML += "<br/>"; cell2.innerHTML += "<a href='javascript:download_begin(\"inst\", -1," + j + ")'>Windows Installer</a>"; @@ -414,6 +426,8 @@ function server_changed() { cell2.className = "listr"; cell2.innerHTML = "<a href='javascript:download_begin(\"conf\"," + i + ")'>Configuration</a>"; cell2.innerHTML += "<br/>"; + cell2.innerHTML += "<a href='javascript:download_begin(\"confinline\"," + i + ")'>Inline Configuration</a>"; + cell2.innerHTML += "<br/>"; cell2.innerHTML += "<a href='javascript:download_begin(\"confzip\"," + i + ")'>Configuration archive</a>"; cell2.innerHTML += "<br/>"; cell2.innerHTML += "<a href='javascript:download_begin(\"inst\"," + i + ")'>Windows Installer</a>"; |