Переглянути джерело

[desktop] Update PAM backend to use a configuration defined service

abec 13 роки тому
батько
коміт
0876925160

+ 2 - 0
desktop/conf.dist/hue.ini

@@ -75,6 +75,8 @@
     # - desktop.auth.backend.AllowFirstUserDjangoBackend
     #     (Default. Relies on Django and user manager, after the first login)
 
+    ## pam_service=login
+
   # Configuration options for connecting to LDAP and Active Directory
   # -------------------------------------------------------------------
   [[ldap]]

+ 2 - 0
desktop/conf/pseudo-distributed.ini.tmpl

@@ -84,6 +84,8 @@
     # - desktop.auth.backend.AllowFirstUserDjangoBackend
     #     (Default. Relies on Django and user manager, after the first login)
 
+    ## pam_service=login
+
   # Configuration options for connecting to LDAP and Active Directory
   # -------------------------------------------------------------------
   [[ldap]]

+ 1 - 1
desktop/core/src/desktop/auth/backend.py

@@ -198,7 +198,7 @@ class PamBackend(DesktopBackendBase):
   login will become the superuser.
   """
   def check_auth(self, username, password):
-    if pam.authenticate(username, password):
+    if pam.authenticate(username, password, desktop.conf.AUTH.PAM_SERVICE.get()):
       is_super = False
       if User.objects.count() == 0:
         is_super = True

+ 4 - 0
desktop/core/src/desktop/conf.py

@@ -268,6 +268,10 @@ AUTH = ConfigSection(
     USER_AUGMENTOR=Config("user_augmentor",
                    default="desktop.auth.backend.DefaultUserAugmentor",
                    help=_("Class which defines extra accessor methods for User objects.")),
+    PAM_SERVICE=Config("pam_service",
+                  default="login",
+                  help=_("The service to use when querying PAM."
+                         "The service usually corresponds to a single filename in /etc/pam.d"))
 ))
 
 LDAP = ConfigSection(