diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2007-10-29 16:40:13 -0400 |
---|---|---|
committer | Michael DeHaan <mdehaan@redhat.com> | 2007-10-29 16:40:13 -0400 |
commit | fcb4cb6bdbb71b3c49215b9da9c4e1c97c7ab20c (patch) | |
tree | a2ce4c810f5fe2f373e54981ddcc938c254e7ab1 /scripts | |
parent | 0d64de62b3a0b011a51d390c8ee1b91820479950 (diff) | |
download | third_party-cobbler-fcb4cb6bdbb71b3c49215b9da9c4e1c97c7ab20c.tar.gz third_party-cobbler-fcb4cb6bdbb71b3c49215b9da9c4e1c97c7ab20c.tar.xz third_party-cobbler-fcb4cb6bdbb71b3c49215b9da9c4e1c97c7ab20c.zip |
Apply AT's patch to switch the WebUI to using Apache digest auth / htaccess / etc
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/webui.cgi | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/scripts/webui.cgi b/scripts/webui.cgi index ed0690f..1a7257d 100755 --- a/scripts/webui.cgi +++ b/scripts/webui.cgi @@ -16,6 +16,7 @@ import cgitb import Cookie import os import sys +import ConfigParser from cobbler.webui.CobblerWeb import CobblerWeb def map_modes(): @@ -44,8 +45,6 @@ def configure(): 'password': None, 'cgitb_enabled': 1 } - #config.username = 'testuser', - #config.password = 'llamas2007' # defaults if config['server'] is None: @@ -54,6 +53,17 @@ def configure(): if config['base_url'] is None: config['base_url'] = base_url() + if ( os.access('/etc/cobbler/auth.conf', os.R_OK) ): + config_parser = ConfigParser.ConfigParser() + auth_conf = open("/etc/cobbler/auth.conf") + config_parser.readfp(auth_conf) + auth_conf.close() + for auth in config_parser.items("xmlrpc_service_users"): + sys.stderr.write( str(auth) ) + if auth[1].lower() != "disabled": + config['username'] = auth[0] + config['password'] = auth[1] + return config def main(): @@ -61,7 +71,6 @@ def main(): cw_conf = configure() path = map_modes() form = cgi.parse() - cookies = Cookie.SimpleCookie(os.environ.get("HTTP_COOKIE","")) # make cgitb enablement configurable if cw_conf['cgitb_enabled'] == 1: @@ -80,12 +89,6 @@ def main(): # instantiate a CobblerWeb object cw = CobblerWeb( **cw_conf ) - # FIXME: allow for direct URL access and pages will redirect appropriately. - - #if not path.startswith('login') and (cw_conf['token'] is None and (cw_conf['username'] is None or cw_conf['password'] is None)): - # func = getattr( cw, 'login' ) - # content = func( message="Authentication Required." ) - # check for a valid path/mode if path in cw.modes(): func = getattr( cw, path ) @@ -96,11 +99,6 @@ def main(): func = getattr( cw, 'error_page' ) content = func( "Invalid Mode: \"%s\"" % path ) - # finally, get any cookies generated by the CobblerWeb object - cookie_header = cw.cookies().output() - if cookie_header: - print cookie_header - # deliver content print "Content-type: text/html" print |