Socks5 username/password authentication support
PATCH 1/1 Socks5 username/password authentication support
Hello,
This patch adds support for SOCKS plain text (username/password) authentication as described in RFC 1929. It adds an optional third parameter to the socks-proxy option, which is a file containing the login credentials.
I submitted this patch on the Trac (#62) two days ago, but cron2 asked me to send it here too. It is my first contribution to the OpenVPN project so this patch will probably need to be reworked a bit :) .
I've been using this patch for two weeks now and it does not seem to cause any problem. The only modifications are in the SOCKS handshake handling and the options parser.
----
init.c +1 -0
@@ -417,6 +417,7 @@ init_proxy_dowork (struct context *c) { 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);if (c->c1.socks_proxy)
options.c +6 -2
@@ -120,8 +120,11 @@ static const char usage_message[] = " AGENT user-agent\n"#endif #ifdef ENABLE_SOCKS -"--socks-proxy s [p]: Connect to remote host through a Socks5 proxy at address\n" -" s and port p (default port = 1080).\n" +"--socks-proxy s [p] [up] : Connect to remote host through a Socks5 proxy at\n" +" address s and port p (default port = 1080).\n" +" If proxy authentication is required,\n" +" up is a file containing username/password on 2 lines, or\n" +" 'stdin' to prompt for console.\n" "--socks-proxy-retry : Retry indefinitely on Socks proxy errors.\n"#endif "--resolv-retry n: If hostname resolve fails for --remote, retry\n"
@@ -4471,6 +4474,7 @@ add_option (struct options *options, options->ce.socks_proxy_port =1080 ; } options->ce.socks_proxy_server = p[1 ]; + options->ce.socks_proxy_authfile = p[3 ];/* might be NULL */ }else if (streq (p[0 ],"socks-proxy-retry" )) {
options.h +1 -0
@@ -95,6 +95,7 @@ struct connection_entry#ifdef ENABLE_SOCKS const char *socks_proxy_server;int socks_proxy_port; +const char *socks_proxy_authfile;bool socks_proxy_retry;#endif
socks.c +128 -10
202 lines not on this page · raw message
socks.h +2 -0
@@ -43,12 +43,14 @@ struct socks_proxy_info {char server[128 ];int port; +char authfile[256 ]; };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);
Signature · 3 lines
Pierre "delroth" Bourdon <[email protected]...> Étudiant à l'EPITA / Student at EPITA http://bitbucket.org/delroth/
init.c +1 -0
@@ -417,6 +417,7 @@ init_proxy_dowork (struct context *c) { 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);if (c->c1.socks_proxy)
options.c +6 -2
@@ -120,8 +120,11 @@ static const char usage_message[] = " AGENT user-agent\n"#endif #ifdef ENABLE_SOCKS -"--socks-proxy s [p]: Connect to remote host through a Socks5 proxy at address\n" -" s and port p (default port = 1080).\n" +"--socks-proxy s [p] [up] : Connect to remote host through a Socks5 proxy at\n" +" address s and port p (default port = 1080).\n" +" If proxy authentication is required,\n" +" up is a file containing username/password on 2 lines, or\n" +" 'stdin' to prompt for console.\n" "--socks-proxy-retry : Retry indefinitely on Socks proxy errors.\n"#endif "--resolv-retry n: If hostname resolve fails for --remote, retry\n"
@@ -4471,6 +4474,7 @@ add_option (struct options *options, options->ce.socks_proxy_port =1080 ; } options->ce.socks_proxy_server = p[1 ]; + options->ce.socks_proxy_authfile = p[3 ];/* might be NULL */ }else if (streq (p[0 ],"socks-proxy-retry" )) {
options.h +1 -0
@@ -95,6 +95,7 @@ struct connection_entry#ifdef ENABLE_SOCKS const char *socks_proxy_server;int socks_proxy_port; +const char *socks_proxy_authfile;bool socks_proxy_retry;#endif
socks.c +128 -10
202 lines not on this page · raw message
socks.h +2 -0
@@ -43,12 +43,14 @@ struct socks_proxy_info {char server[128 ];int port; +char authfile[256 ]; };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);
David Sommerseth
Applied-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 11 lines · Pierre Bourdon
Hello,
This patch adds support for SOCKS plain text (username/password) authentication as described in RFC 1929. It adds an optional third parameter to the socks-proxy option, which is a file containing the login credentials.
I submitted this patch on the Trac (#62) two days ago, but cron2 asked me to send it here too. It is my first contribution to the OpenVPN project so this patch will probably need to be reworked a bit :) .
Quoted 5 lines
I've been using this patch for two weeks now and it does not seem to cause any problem. The only modifications are in the SOCKS handshake handling and the options parser.
Signed-off-by Pierre Bourdon <[email protected]...>
Applied to feat_misc, to be merged into allmerged and beta2.2
commit fc1fa9ffc7e3356458ec38d43816e5ddeb0c580a
Author: Pierre Bourdon <delroth@?>
Date: Mon Oct 11 00:56:04 2010 +0200
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAkzdqEcACgkQDC186MBRfrrmRQCcCDgla4fbkxMbvOXFZzJ6dgLE nUgAn24xN/fbpRIQ54TrdLHB1UnaLB9m
=IZqf
-----END PGP SIGNATURE-----