summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeiko Hund <heiko.hund@sophos.com>2012-02-05 13:47:09 +0100
committerDavid Sommerseth <davids@redhat.com>2012-06-13 10:44:33 +0200
commit8e1975b046dcf821eaf03098677dc5e34cd3a1a5 (patch)
tree3bd5f67b3c97ead27dd26f68164bc4883655f98d
parente656b995b44fab0b8290c6c2a4a73079b3f9813b (diff)
downloadopenvpn-8e1975b046dcf821eaf03098677dc5e34cd3a1a5.tar.gz
openvpn-8e1975b046dcf821eaf03098677dc5e34cd3a1a5.tar.xz
openvpn-8e1975b046dcf821eaf03098677dc5e34cd3a1a5.zip
remove the --auto-proxy option from openvpn
During discussion on FOSDEM 2012 it was decided that proxy auto detection is best done in the GUI as it's highly platform specific and shouldn't be handled in openvpn itself for every supported platform in openvpn itself. This removes --auto-proxy from openvpn. Signed-off-by: Heiko Hund <heiko.hund@sophos.com> Acked-by: David Sommerseth <davids@redhat.com> Message-Id: 1328446029-30523-1-git-send-email-heiko.hund@sophos.com URL: http://article.gmane.org/gmane.network.openvpn.devel/5333 Signed-off-by: David Sommerseth <davids@redhat.com>
-rw-r--r--doc/openvpn.812
-rw-r--r--src/openvpn/init.c10
-rw-r--r--src/openvpn/options.c40
-rw-r--r--src/openvpn/options.h4
-rw-r--r--src/openvpn/proxy.c242
-rw-r--r--src/openvpn/proxy.h27
-rw-r--r--src/openvpn/socks.c15
-rw-r--r--src/openvpn/socks.h3
8 files changed, 11 insertions, 342 deletions
diff --git a/doc/openvpn.8 b/doc/openvpn.8
index f420d58..a821b5e 100644
--- a/doc/openvpn.8
+++ b/doc/openvpn.8
@@ -482,18 +482,6 @@ as the
number of retries of connection attempt (default=infinite).
.\"*********************************************************
.TP
-.B \-\-auto-proxy
-Try to sense HTTP or SOCKS proxy settings automatically.
-If no settings are present, a direct connection will be attempted.
-If both HTTP and SOCKS settings are present, HTTP will be preferred.
-If the HTTP proxy server requires a password, it will be queried from
-stdin or the management interface. If the underlying OS doesn't support an API for
-returning proxy settings, a direct connection will be attempted.
-Currently, only Windows clients support this option via the
-InternetQueryOption API.
-This option exists in OpenVPN 2.1 or higher.
-.\"*********************************************************
-.TP
.B \-\-show-proxy-settings
Show sensed HTTP or SOCKS proxy settings. Currently, only Windows clients
support this option.
diff --git a/src/openvpn/init.c b/src/openvpn/init.c
index 61ced5d..30f5803 100644
--- a/src/openvpn/init.c
+++ b/src/openvpn/init.c
@@ -498,11 +498,10 @@ init_proxy_dowork (struct context *c)
uninit_proxy_dowork (c);
#ifdef ENABLE_HTTP_PROXY
- if (c->options.ce.http_proxy_options || c->options.auto_proxy_info)
+ if (c->options.ce.http_proxy_options)
{
/* Possible HTTP proxy user/pass input */
- c->c1.http_proxy = http_proxy_new (c->options.ce.http_proxy_options,
- c->options.auto_proxy_info);
+ c->c1.http_proxy = http_proxy_new (c->options.ce.http_proxy_options);
if (c->c1.http_proxy)
{
did_http = true;
@@ -512,13 +511,12 @@ init_proxy_dowork (struct context *c)
#endif
#ifdef ENABLE_SOCKS
- if (!did_http && (c->options.ce.socks_proxy_server || c->options.auto_proxy_info))
+ if (!did_http && c->options.ce.socks_proxy_server)
{
c->c1.socks_proxy = socks_proxy_new (c->options.ce.socks_proxy_server,
c->options.ce.socks_proxy_port,
c->options.ce.socks_proxy_authfile,
- c->options.ce.socks_proxy_retry,
- c->options.auto_proxy_info);
+ c->options.ce.socks_proxy_retry);
if (c->c1.socks_proxy)
{
c->c1.socks_proxy_owned = true;
diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index 10636ea..2b96957 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -135,10 +135,6 @@ static const char usage_message[] =
" between connection retries (default=%d).\n"
"--connect-timeout n : For --proto tcp-client, connection timeout (in seconds).\n"
"--connect-retry-max n : Maximum connection attempt retries, default infinite.\n"
-#ifdef GENERAL_PROXY_SUPPORT
- "--auto-proxy : Try to sense proxy settings (or lack thereof) automatically.\n"
- "--show-proxy-settings : Show sensed proxy settings.\n"
-#endif
#ifdef ENABLE_HTTP_PROXY
"--http-proxy s p [up] [auth] : Connect to remote host\n"
" through an HTTP proxy at address s and port p.\n"
@@ -2060,8 +2056,8 @@ options_postprocess_verify_ce (const struct options *options, const struct conne
msg (M_USAGE, "--remote MUST be used in TCP Client mode");
#ifdef ENABLE_HTTP_PROXY
- if ((ce->http_proxy_options || options->auto_proxy_info) && ce->proto != PROTO_TCPv4_CLIENT)
- msg (M_USAGE, "--http-proxy or --auto-proxy MUST be used in TCP Client mode (i.e. --proto tcp-client)");
+ if ((ce->http_proxy_options) && ce->proto != PROTO_TCPv4_CLIENT)
+ msg (M_USAGE, "--http-proxy MUST be used in TCP Client mode (i.e. --proto tcp-client)");
#endif
#if defined(ENABLE_HTTP_PROXY) && defined(ENABLE_SOCKS)
@@ -5000,38 +4996,6 @@ add_option (struct options *options,
options->proto_force = proto_force;
options->force_connection_list = true;
}
-#ifdef GENERAL_PROXY_SUPPORT
- else if (streq (p[0], "auto-proxy"))
- {
- char *error = NULL;
-
- VERIFY_PERMISSION (OPT_P_GENERAL);
- options->auto_proxy_info = get_proxy_settings (&error, &options->gc);
- if (error)
- msg (M_WARN, "PROXY: %s", error);
- }
- else if (streq (p[0], "show-proxy-settings"))
- {
- struct auto_proxy_info *pi;
- char *error = NULL;
-
- VERIFY_PERMISSION (OPT_P_GENERAL);
- pi = get_proxy_settings (&error, &options->gc);
- if (pi)
- {
- msg (M_INFO|M_NOPREFIX, "HTTP Server: %s", np(pi->http.server));
- msg (M_INFO|M_NOPREFIX, "HTTP Port: %d", pi->http.port);
- msg (M_INFO|M_NOPREFIX, "SOCKS Server: %s", np(pi->socks.server));
- msg (M_INFO|M_NOPREFIX, "SOCKS Port: %d", pi->socks.port);
- }
- if (error)
- msg (msglevel, "Proxy error: %s", error);
-#ifdef WIN32
- show_win_proxy_settings (M_INFO|M_NOPREFIX);
-#endif
- openvpn_exit (OPENVPN_EXIT_STATUS_GOOD); /* exit point */
- }
-#endif /* GENERAL_PROXY_SUPPORT */
#ifdef ENABLE_HTTP_PROXY
else if (streq (p[0], "http-proxy") && p[1])
{
diff --git a/src/openvpn/options.h b/src/openvpn/options.h
index cc3e47a..9b6adea 100644
--- a/src/openvpn/options.h
+++ b/src/openvpn/options.h
@@ -232,10 +232,6 @@ struct options
bool force_connection_list;
#endif
-#ifdef GENERAL_PROXY_SUPPORT
- struct auto_proxy_info *auto_proxy_info;
-#endif
-
#if HTTP_PROXY_FALLBACK
bool http_proxy_fallback;
struct http_proxy_options *http_proxy_override;
diff --git a/src/openvpn/proxy.c b/src/openvpn/proxy.c
index 991e165..d33f88f 100644
--- a/src/openvpn/proxy.c
+++ b/src/openvpn/proxy.c
@@ -421,47 +421,11 @@ get_pa_var (const char *key, const char *pa, struct gc_arena *gc)
}
struct http_proxy_info *
-http_proxy_new (const struct http_proxy_options *o,
- struct auto_proxy_info *auto_proxy_info)
+http_proxy_new (const struct http_proxy_options *o)
{
struct http_proxy_info *p;
struct http_proxy_options opt;
- if (auto_proxy_info)
- {
- if (o && o->server)
- {
- /* if --http-proxy explicitly given, disable auto-proxy */
- auto_proxy_info = NULL;
- }
- else
- {
- /* if no --http-proxy explicitly given and no auto settings, fail */
- if (!auto_proxy_info->http.server)
- return NULL;
-
- if (o)
- {
- opt = *o;
- }
- else
- {
- CLEAR (opt);
-
- /* These settings are only used for --auto-proxy */
- opt.timeout = 5;
- opt.http_version = "1.0";
- }
-
- opt.server = auto_proxy_info->http.server;
- opt.port = auto_proxy_info->http.port;
- if (!opt.auth_retry)
- opt.auth_retry = PAR_ALL;
-
- o = &opt;
- }
- }
-
if (!o || !o->server)
msg (M_FATAL, "HTTP_PROXY: server not specified");
@@ -527,7 +491,7 @@ establish_http_proxy_passthru (struct http_proxy_info *p,
bool ret = false;
bool processed = false;
- /* get user/pass if not previously given or if --auto-proxy is being used */
+ /* get user/pass if not previously given */
if (p->auth_method == HTTP_AUTH_BASIC
|| p->auth_method == HTTP_AUTH_DIGEST
|| p->auth_method == HTTP_AUTH_NTLM)
@@ -926,205 +890,3 @@ establish_http_proxy_passthru (struct http_proxy_info *p,
static void dummy(void) {}
#endif /* ENABLE_HTTP_PROXY */
-#ifdef GENERAL_PROXY_SUPPORT
-
-#ifdef WIN32
-
-#if 0
-char *
-get_windows_internet_string (const DWORD dwOption, struct gc_arena *gc)
-{
- DWORD size = 0;
- char *ret = NULL;
-
- /* Initially, get size of return buffer */
- InternetQueryOption (NULL, dwOption, NULL, &size);
- if (size)
- {
- /* Now get actual info */
- ret = (INTERNET_PROXY_INFO *) gc_malloc (size, false, gc);
- if (!InternetQueryOption (NULL, dwOption, (LPVOID) ret, &size))
- ret = NULL;
- }
- return ret;
-}
-#endif
-
-static INTERNET_PROXY_INFO *
-get_windows_proxy_settings (struct gc_arena *gc)
-{
- DWORD size = 0;
- INTERNET_PROXY_INFO *ret = NULL;
-
- /* Initially, get size of return buffer */
- InternetQueryOption (NULL, INTERNET_OPTION_PROXY, NULL, &size);
- if (size)
- {
- /* Now get actual info */
- ret = (INTERNET_PROXY_INFO *) gc_malloc (size, false, gc);
- if (!InternetQueryOption (NULL, INTERNET_OPTION_PROXY, (LPVOID) ret, &size))
- ret = NULL;
- }
- return ret;
-}
-
-static const char *
-parse_windows_proxy_setting (const char *str, struct auto_proxy_info_entry *e, struct gc_arena *gc)
-{
- char buf[128];
- const char *ret = NULL;
- struct buffer in;
-
- CLEAR (*e);
-
- buf_set_read (&in, (const uint8_t *)str, strlen (str));
-
- if (strchr (str, '=') != NULL)
- {
- if (buf_parse (&in, '=', buf, sizeof (buf)))
- ret = string_alloc (buf, gc);
- }
-
- if (buf_parse (&in, ':', buf, sizeof (buf)))
- e->server = string_alloc (buf, gc);
-
- if (e->server && buf_parse (&in, '\0', buf, sizeof (buf)))
- e->port = atoi (buf);
-
- return ret;
-}
-
-static void
-parse_windows_proxy_setting_list (const char *str, const char *type, struct auto_proxy_info_entry *e, struct gc_arena *gc)
-{
- struct gc_arena gc_local = gc_new ();
- struct auto_proxy_info_entry el;
-
- CLEAR (*e);
- if (type)
- {
- char buf[128];
- struct buffer in;
-
- buf_set_read (&in, (const uint8_t *)str, strlen (str));
- if (strchr (str, '=') != NULL)
- {
- while (buf_parse (&in, ' ', buf, sizeof (buf)))
- {
- const char *t = parse_windows_proxy_setting (buf, &el, &gc_local);
- if (t && !strcmp (t, type))
- goto found;
- }
- }
- }
- else
- {
- if (!parse_windows_proxy_setting (str, &el, &gc_local))
- goto found;
- }
- goto done;
-
- found:
- if (el.server && el.port > 0)
- {
- e->server = string_alloc (el.server, gc);
- e->port = el.port;
- }
-
- done:
- gc_free (&gc_local);
-}
-
-static const char *
-win_proxy_access_type (const DWORD dwAccessType)
-{
- switch (dwAccessType)
- {
- case INTERNET_OPEN_TYPE_DIRECT:
- return "INTERNET_OPEN_TYPE_DIRECT";
- case INTERNET_OPEN_TYPE_PROXY:
- return "INTERNET_OPEN_TYPE_PROXY";
- default:
- return "[UNKNOWN]";
- }
-}
-
-void
-show_win_proxy_settings (const int msglevel)
-{
- INTERNET_PROXY_INFO *info;
- struct gc_arena gc = gc_new ();
-
- info = get_windows_proxy_settings (&gc);
- msg (msglevel, "PROXY INFO: %s %s",
- win_proxy_access_type (info->dwAccessType),
- info->lpszProxy ? info->lpszProxy : "[NULL]");
-
- gc_free (&gc);
-}
-
-struct auto_proxy_info *
-get_proxy_settings (char **err, struct gc_arena *gc)
-{
- struct gc_arena gc_local = gc_new ();
- INTERNET_PROXY_INFO *info;
- struct auto_proxy_info *pi;
-
- ALLOC_OBJ_CLEAR_GC (pi, struct auto_proxy_info, gc);
-
- if (err)
- *err = NULL;
-
- info = get_windows_proxy_settings (&gc_local);
-
- if (!info)
- {
- if (err)
- *err = "PROXY: failed to obtain windows proxy info";
- goto done;
- }
-
- switch (info->dwAccessType)
- {
- case INTERNET_OPEN_TYPE_DIRECT:
- break;
- case INTERNET_OPEN_TYPE_PROXY:
- if (!info->lpszProxy)
- break;
- parse_windows_proxy_setting_list (info->lpszProxy, NULL, &pi->http, gc);
- if (!pi->http.server)
- parse_windows_proxy_setting_list (info->lpszProxy, "http", &pi->http, gc);
- parse_windows_proxy_setting_list (info->lpszProxy, "socks", &pi->socks, gc);
- break;
- default:
- if (err)
- *err = "PROXY: unknown proxy type";
- break;
- }
-
- done:
- gc_free (&gc_local);
- return pi;
-}
-
-#else
-
-struct auto_proxy_info *
-get_proxy_settings (char **err, struct gc_arena *gc)
-{
-#if 1
- if (err)
- *err = string_alloc ("PROXY: automatic detection not supported on this OS", gc);
- return NULL;
-#else /* test --auto-proxy feature */
- struct auto_proxy_info *pi;
- ALLOC_OBJ_CLEAR_GC (pi, struct auto_proxy_info, gc);
- pi->http.server = "10.10.0.2";
- pi->http.port = 4000;
- return pi;
-#endif
-}
-
-#endif
-
-#endif /* GENERAL_PROXY_SUPPORT */
diff --git a/src/openvpn/proxy.h b/src/openvpn/proxy.h
index d89aa4a..355a4c3 100644
--- a/src/openvpn/proxy.h
+++ b/src/openvpn/proxy.h
@@ -28,30 +28,6 @@
#include "buffer.h"
#include "misc.h"
-#ifdef GENERAL_PROXY_SUPPORT
-
-/*
- * Return value for get_proxy_settings to automatically
- * determine proxy information.
- */
-struct auto_proxy_info_entry {
- char *server;
- int port;
-};
-
-struct auto_proxy_info {
- struct auto_proxy_info_entry http;
- struct auto_proxy_info_entry socks;
-};
-
-struct auto_proxy_info *get_proxy_settings (char **err, struct gc_arena *gc);
-
-#ifdef WIN32
-void show_win_proxy_settings (const int msglevel);
-#endif /* WIN32 */
-
-#endif /* GENERAL_PROXY_SUPPORT */
-
#ifdef ENABLE_HTTP_PROXY
/* HTTP CONNECT authentication methods */
@@ -94,8 +70,7 @@ struct http_proxy_info {
bool queried_creds;
};
-struct http_proxy_info *http_proxy_new (const struct http_proxy_options *o,
- struct auto_proxy_info *auto_proxy_info);
+struct http_proxy_info *http_proxy_new (const struct http_proxy_options *o);
void http_proxy_close (struct http_proxy_info *hp);
diff --git a/src/openvpn/socks.c b/src/openvpn/socks.c
index 510c110..dd54c8d 100644
--- a/src/openvpn/socks.c
+++ b/src/openvpn/socks.c
@@ -63,23 +63,10 @@ struct socks_proxy_info *
socks_proxy_new (const char *server,
int port,
const char *authfile,
- bool retry,
- struct auto_proxy_info *auto_proxy_info)
+ bool retry)
{
struct socks_proxy_info *p;
- if (auto_proxy_info)
- {
- if (!server)
- {
- if (!auto_proxy_info->socks.server)
- return NULL;
-
- server = auto_proxy_info->socks.server;
- port = auto_proxy_info->socks.port;
- }
- }
-
ALLOC_OBJ_CLEAR (p, struct socks_proxy_info);
ASSERT (server);
diff --git a/src/openvpn/socks.h b/src/openvpn/socks.h
index b748bb3..b55ff6f 100644
--- a/src/openvpn/socks.h
+++ b/src/openvpn/socks.h
@@ -51,8 +51,7 @@ void socks_adjust_frame_parameters (struct frame *frame, int proto);
struct socks_proxy_info *socks_proxy_new (const char *server,
int port,
const char *authfile,
- bool retry,
- struct auto_proxy_info *auto_proxy_info);
+ bool retry);
void socks_proxy_close (struct socks_proxy_info *sp);