| |
@@ -30,7 +30,7 @@
|
| |
import traceback
|
| |
|
| |
from ConfigParser import RawConfigParser
|
| |
- from koji.server import WSGIWrapper, ServerError, ServerRedirect
|
| |
+ from koji.server import WSGIWrapper, ServerError, ServerRedirect, NotAuthorized
|
| |
from koji.util import dslice
|
| |
|
| |
|
| |
@@ -80,6 +80,8 @@
|
| |
['WebCert', 'string', None],
|
| |
['KojiHubCA', 'string', '/etc/kojiweb/kojihubca.crt'],
|
| |
|
| |
+ ['BasicAuthRealm', 'string', None],
|
| |
+
|
| |
['PythonDebug', 'boolean', False],
|
| |
|
| |
['LoginTimeout', 'integer', 72],
|
| |
@@ -403,6 +405,10 @@
|
| |
result, headers = self.error_page(environ, message=msg, err=False)
|
| |
start_response(status, headers)
|
| |
return result
|
| |
+ except NotAuthorized:
|
| |
+ status = "401 Not Authorized"
|
| |
+ start_response(status, [('WWW-Authenticate', 'Basic realm="%s"' % self.options['BasicAuthRealm'])])
|
| |
+ return '401 Not Authorized'
|
| |
except Exception:
|
| |
tb_str = ''.join(traceback.format_exception(*sys.exc_info()))
|
| |
self.logger.error(tb_str)
|
| |
Adds support for PAM authentication for the koji-hub and BasicAuth for the koji-web.
This is useful for our internal use case as it allows us to login without the overhead of setting up either a CA or a kerberos realm for our users.
The configuration is backwards compatible and hopefully similar to the other authentication methods.
To active PAM support on hub you define the option:
PAMService = koji
in hub.conf. The value will be the name of the PAM service. Note the call to the PAM module is done via unprivileged call thus the use of pam_unix
won't be possible.
Note that activating this option will have as result that username/password combinations from the DB will no longer be checked (similarly to when activating kerberos or SSL client auth).
The BasicAuth for koji-web requires 2 changes:
a) To enable WSGIPassAuthorization for /koji/login in httpd configuration. That passes the authorization variable from the apache to the application.
b) Set the "BasicAuthRealm" option to the Basic Authentication Realm that will be presented to the user to login.
Finally python-pam package has been added to the hub's dependencies.