aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfig/openvpn-client-export/openvpn-client-export.inc24
-rwxr-xr-xconfig/openvpn-client-export/vpn_openvpn_export.php27
-rw-r--r--config/openvpn-client-export/vpn_openvpn_export_shared.php45
3 files changed, 69 insertions, 27 deletions
diff --git a/config/openvpn-client-export/openvpn-client-export.inc b/config/openvpn-client-export/openvpn-client-export.inc
index d79c42c3..06a0928c 100755
--- a/config/openvpn-client-export/openvpn-client-export.inc
+++ b/config/openvpn-client-export/openvpn-client-export.inc
@@ -226,11 +226,15 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $quotese
}
if (!empty($proxy)) {
- if ($proto == "udp") {
- $input_errors[] = "This server uses UDP protocol and cannot communicate with HTTP proxy.";
- return;
+ if ($proxy['proxy_type'] == "http") {
+ if ($proto == "udp") {
+ $input_errors[] = "This server uses UDP protocol and cannot communicate with HTTP proxy.";
+ return;
+ }
+ $conf .= "http-proxy {$proxy['ip']} {$proxy['port']} ";
}
- $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";
@@ -745,11 +749,15 @@ function openvpn_client_export_sharedkey_config($srvid, $useaddr, $proxy, $zipco
$conf .= "ping-timer-rem\n";
if (!empty($proxy)) {
- if ($proto == "udp") {
- $input_errors[] = "This server uses UDP protocol and cannot communicate with HTTP proxy.";
- return;
+ if ($proxy['proxy_type'] == "http") {
+ if ($proto == "udp") {
+ $input_errors[] = "This server uses UDP protocol and cannot communicate with HTTP proxy.";
+ return;
+ }
+ $conf .= "http-proxy {$proxy['ip']} {$proxy['port']} ";
}
- $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">
+ &nbsp; Type :&nbsp;
+ </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">
&nbsp; IP Address :&nbsp;
</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">
diff --git a/config/openvpn-client-export/vpn_openvpn_export_shared.php b/config/openvpn-client-export/vpn_openvpn_export_shared.php
index e20a8383..da77870a 100644
--- a/config/openvpn-client-export/vpn_openvpn_export_shared.php
+++ b/config/openvpn-client-export/vpn_openvpn_export_shared.php
@@ -3,7 +3,7 @@
vpn_openvpn_export.php
Copyright (C) 2008 Shrew Soft Inc.
- Copyright (C) 2010 Ermal Luçi
+ Copyright (C) 2010 Ermal Luçi
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -98,6 +98,7 @@ if(($act == "skconf") || ($act == "skzipconf")) {
$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'])) {
@@ -193,6 +194,8 @@ function download_begin(act) {
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;
@@ -215,15 +218,16 @@ function download_begin(act) {
var dlurl;
dlurl = "/vpn_openvpn_export_shared.php?act=" + act;
- dlurl += "&amp;srvid=" + servers[index][0];
- dlurl += "&amp;useaddr=" + useaddr;
+ dlurl += "&srvid=" + servers[index][0];
+ dlurl += "&useaddr=" + useaddr;
if (useproxy) {
- dlurl += "&amp;proxy_addr=" + proxyaddr;
- dlurl += "&amp;proxy_port=" + proxyport;
- dlurl += "&amp;proxy_authtype=" + proxyauth;
+ dlurl += "&proxy_type=" + escape(proxytype);
+ dlurl += "&proxy_addr=" + proxyaddr;
+ dlurl += "&proxy_port=" + proxyport;
+ dlurl += "&proxy_authtype=" + proxyauth;
if (useproxypass) {
- dlurl += "&amp;proxy_user=" + proxyuser;
- dlurl += "&amp;proxy_password=" + proxypass;
+ dlurl += "&proxy_user=" + proxyuser;
+ dlurl += "&proxy_password=" + proxypass;
}
}
@@ -263,7 +267,7 @@ function useaddr_changed(obj) {
function useproxy_changed(obj) {
if ((obj.id == "useproxy" && obj.checked) ||
- $(obj.id + 'pass').value != 'none') {
+ (obj.id == "useproxypass" && (obj.value != 'none'))) {
$(obj.id + '_opts').show();
} else {
$(obj.id + '_opts').hide();
@@ -324,7 +328,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>
@@ -335,7 +339,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>
@@ -345,7 +349,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>
@@ -354,11 +358,24 @@ function useproxy_changed(obj) {
<tr>
<td align="right" width="25%">
<span class="vexpl">
+ &nbsp; Type :&nbsp;
+ </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">
&nbsp; IP Address :&nbsp;
</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>
@@ -382,7 +399,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">