In my environment, I am authenticating users against an LDAP server. The CLI
does not currently allow users to authenticate, though, so provide an example
site_rpc_client_lib that does.
Signed-off-by: Nishanth Aravamudan <[email protected]>
---
Note, an additional change to the cli is necessary to allow a username
to be specified, sent separately. Perhaps update the commit message if
they are both merged to indicate the reference.
diff --git a/contrib/site_rpc_client_lib.py b/contrib/site_rpc_client_lib.py
new file mode 100644
index 0000000..b509cee
--- /dev/null
+++ b/contrib/site_rpc_client_lib.py
@@ -0,0 +1,26 @@
+"""
+This module provides site-local authorization headers for Apache.
+It asks the end-user for a password, rather than assuming no password
+is necessary.
+"""
+
+__author__ = '[email protected] (Nish Aravamudan)'
+
+import getpass, os, base64
+
+
+def authorization_headers(username, server):
+ """
+ Ask the user for their password, rather than assuming they don't
+ need one.
+
+ @returns A dictionary of authorization headers to pass in to get_proxy().
+ """
+ if not username:
+ if 'AUTOTEST_USER' in os.environ:
+ username = os.environ['AUTOTEST_USER']
+ else:
+ username = getpass.getuser()
+ password = getpass.getpass('Enter the password for %s: ' % username)
+ base64string = base64.encodestring('%s:%s' % (username,password))[:-1]
+ return {'AUTHORIZATION' : 'Basic %s' % base64string}
_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel