diff options
author | Aldo Cortesi <aldo@corte.si> | 2012-12-30 11:27:04 -0800 |
---|---|---|
committer | Aldo Cortesi <aldo@corte.si> | 2012-12-30 11:27:04 -0800 |
commit | cfab27232127437cca8ac3699065db653da97dba (patch) | |
tree | 60a92d02b45daf421a0329e4d404652b8f6b3baa /libmproxy/cmdline.py | |
parent | 3c8dcf880860191ef3bd000f95cf7ea980c6bda9 (diff) | |
parent | 440a9f6bda8d645945e8c056a5e869c712dd2d69 (diff) | |
download | mitmproxy-cfab27232127437cca8ac3699065db653da97dba.tar.gz mitmproxy-cfab27232127437cca8ac3699065db653da97dba.tar.bz2 mitmproxy-cfab27232127437cca8ac3699065db653da97dba.zip |
Merge pull request #83 from rouli/master
Adding some basic proxy authentication code
Diffstat (limited to 'libmproxy/cmdline.py')
-rw-r--r-- | libmproxy/cmdline.py | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/libmproxy/cmdline.py b/libmproxy/cmdline.py index 279c3cb4..db1ebf0d 100644 --- a/libmproxy/cmdline.py +++ b/libmproxy/cmdline.py @@ -15,7 +15,7 @@ import proxy import re, filt - +import argparse class ParseException(Exception): pass class OptionException(Exception): pass @@ -334,4 +334,50 @@ def common_options(parser): help="Header set pattern." ) + + group = parser.add_argument_group( + "Proxy Authentication", + """ + Specification of which users are allowed to access the proxy and the method used for authenticating them. + If authscheme is specified, one must specify a list of authorized users and their passwords. + In case that authscheme is not specified, or set to None, any list of authorized users will be ignored. + """.strip() + ) + + group.add_argument( + "--authscheme", type=str, + action="store", dest="authscheme", default=None, choices=["none", "basic"], + help=""" + Specify the scheme used by the proxy to identify users. + If not none, requires the specification of a list of authorized users. + This option is ignored if the proxy is in transparent or reverse mode. + """.strip() + + ) + + user_specification_group = group.add_mutually_exclusive_group() + + + user_specification_group.add_argument( + "--nonanonymous", + action="store_true", dest="auth_nonanonymous", + help="Allow access to any user as long as a username is specified. Ignores the provided password." + ) + + user_specification_group.add_argument( + "--singleuser", + action="store", dest="auth_singleuser", type=str, + help="Allows access to a single user as specified by the option value. Specify a username and password in the form username:password." + ) + + user_specification_group.add_argument( + "--htpasswd", + action="store", dest="auth_htpasswd", type=argparse.FileType('r'), + help="Allow access to users specified in an Apache htpasswd file." + ) + + + + + proxy.certificate_option_group(parser) |