diff options
-rwxr-xr-x | config/openvpn-client-export/openvpn-client-export.inc | 10 | ||||
-rwxr-xr-x | config/openvpn-client-export/vpn_openvpn_export.php | 27 |
2 files changed, 30 insertions, 7 deletions
diff --git a/config/openvpn-client-export/openvpn-client-export.inc b/config/openvpn-client-export/openvpn-client-export.inc index d79c42c3..02e89eb9 100755 --- a/config/openvpn-client-export/openvpn-client-export.inc +++ b/config/openvpn-client-export/openvpn-client-export.inc @@ -230,7 +230,10 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $quotese $input_errors[] = "This server uses UDP protocol and cannot communicate with HTTP proxy."; return; } - $conf .= "http-proxy {$proxy['ip']} {$proxy['port']} "; + if ($proxy['proxy_type'] == "http") + $conf .= "http-proxy {$proxy['ip']} {$proxy['port']} "; + if ($proxy['proxy_type'] == "socks") + $conf .= "socks-proxy {$proxy['ip']} {$proxy['port']} "; if ($proxy['proxy_authtype'] != "none") { if (!isset($proxy['passwdfile'])) $proxy['passwdfile'] = openvpn_client_export_prefix($srvid, $usrid, $crtid) . "-proxy"; @@ -749,7 +752,10 @@ function openvpn_client_export_sharedkey_config($srvid, $useaddr, $proxy, $zipco $input_errors[] = "This server uses UDP protocol and cannot communicate with HTTP proxy."; return; } - $conf .= "http-proxy {$proxy['ip']} {$proxy['port']} "; + if ($proxy['proxy_type'] == "http") + $conf .= "http-proxy {$proxy['ip']} {$proxy['port']} "; + if ($proxy['proxy_type'] == "socks") + $conf .= "socks-proxy {$proxy['ip']} {$proxy['port']} "; if ($proxy['proxy_authtype'] != "none") { if (!isset($proxy['passwdfile'])) $proxy['passwdfile'] = openvpn_client_export_prefix($srvid) . "-proxy"; diff --git a/config/openvpn-client-export/vpn_openvpn_export.php b/config/openvpn-client-export/vpn_openvpn_export.php index cfec87f7..4f7e1caa 100755 --- a/config/openvpn-client-export/vpn_openvpn_export.php +++ b/config/openvpn-client-export/vpn_openvpn_export.php @@ -159,6 +159,7 @@ if (!empty($act)) { $input_errors[] = "You need to specify a port for the proxy ip."; } else $proxy['port'] = $_GET['proxy_port']; + $proxy['proxy_type'] = $_GET['proxy_type']; $proxy['proxy_authtype'] = $_GET['proxy_authtype']; if ($_GET['proxy_authtype'] != "none") { if (empty($_GET['proxy_user'])) { @@ -345,6 +346,8 @@ function download_begin(act, i, j) { if (document.getElementById("useproxypass").value != 'none') useproxypass = 1; + var proxytype = document.getElementById("useproxytype").value; + var proxyauth = document.getElementById("useproxypass").value; var proxyuser = document.getElementById("proxyuser").value; var proxypass = document.getElementById("proxypass").value; @@ -383,6 +386,7 @@ function download_begin(act, i, j) { if (usepass) dlurl += "&password=" + escape(pass); if (useproxy) { + dlurl += "&proxy_type=" + escape(proxytype); dlurl += "&proxy_addr=" + escape(proxyaddr); dlurl += "&proxy_port=" + escape(proxyport); dlurl += "&proxy_authtype=" + escape(proxyauth); @@ -603,7 +607,7 @@ function useproxy_changed(obj) { </select> <br /> <div style="display:none;" id="HostName"> - <input name="useaddr_hostname" id="useaddr_hostname" /> + <input name="useaddr_hostname" id="useaddr_hostname" size="40" /> <span class="vexpl"> Enter the hostname or IP address the client will use to connect to this server. </span> @@ -682,7 +686,7 @@ function useproxy_changed(obj) { </td> </tr> <tr> - <td width="22%" valign="top" class="vncell">Use HTTP Proxy</td> + <td width="22%" valign="top" class="vncell">Use Proxy</td> <td width="78%" class="vtable"> <table border="0" cellpadding="2" cellspacing="0" summary="http proxy"> <tr> @@ -692,7 +696,7 @@ function useproxy_changed(obj) { </td> <td> <span class="vexpl"> - Use HTTP proxy to communicate with the server. + Use proxy to communicate with the server. </span> </td> </tr> @@ -701,11 +705,24 @@ function useproxy_changed(obj) { <tr> <td align="right" width="25%"> <span class="vexpl"> + Type : + </span> + </td> + <td> + <select name="useproxytype" id="useproxytype" class="formselect"> + <option value="http">HTTP</option> + <option value="socks">Socks</option> + </select> + </td> + </tr> + <tr> + <td align="right" width="25%"> + <span class="vexpl"> IP Address : </span> </td> <td> - <input name="proxyaddr" id="proxyaddr" class="formfld unknown" size="20" value="" /> + <input name="proxyaddr" id="proxyaddr" class="formfld unknown" size="30" value="" /> </td> </tr> <tr> @@ -729,7 +746,7 @@ function useproxy_changed(obj) { <option value="ntlm">ntlm</option> </select> <span class="vexpl"> - Choose HTTP proxy authentication if any. + Choose proxy authentication if any. </span> <br /> <table border="0" cellpadding="2" cellspacing="0" id="useproxypass_opts" style="display:none" summary="name and password"> |