Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
2e69f922
Commit
2e69f922
authored
Mar 13, 2020
by
nixonrodrigues
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1866 :- Documentation for PAM type authentication and better logging for PAM auth
parent
72910c4f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
3 deletions
+53
-3
Authentication.md
docs/src/documents/Security/Authentication.md
+24
-0
AtlasAbstractAuthenticationProvider.java
...las/web/security/AtlasAbstractAuthenticationProvider.java
+2
-1
AtlasPamAuthenticationProvider.java
...he/atlas/web/security/AtlasPamAuthenticationProvider.java
+18
-1
PamLoginModule.java
...in/java/org/apache/atlas/web/security/PamLoginModule.java
+9
-1
No files found.
docs/src/documents/Security/Authentication.md
View file @
2e69f922
...
@@ -20,6 +20,7 @@ Atlas supports following authentication methods
...
@@ -20,6 +20,7 @@ Atlas supports following authentication methods
*
**Kerberos**
*
**Kerberos**
*
**LDAP**
*
**LDAP**
*
**Keycloak (OpenID Connect / OAUTH2)**
*
**Keycloak (OpenID Connect / OAUTH2)**
*
**PAM**
Following properties should be set true to enable the authentication of that type in
`atlas-application.properties`
file.
Following properties should be set true to enable the authentication of that type in
`atlas-application.properties`
file.
...
@@ -153,3 +154,26 @@ Setup you keycloak.json per instructions from Keycloak. Make sure to include `"p
...
@@ -153,3 +154,26 @@ Setup you keycloak.json per instructions from Keycloak. Make sure to include `"p
"autodetect-bearer-only": true
"autodetect-bearer-only": true
}`
}
}`
}
</SyntaxHighlighter>
</SyntaxHighlighter>
### PAM.
The prerequisite for enabling PAM authentication, is to have login service file in
*/etc/pam.d/*
To enable the PAM authentication mode in Atlas.
*
Set the atlas property
`atlas.authentication.method.pam`
to true in
`atlas-application.properties`
.
<SyntaxHighlighter
wrapLines=
{true}
language=
"shell"
style=
{theme.dark}
>
{
`atlas.authentication.method.pam=true`
}
</SyntaxHighlighter>
*
Set the property
`atlas.authentication.method.pam.service=<login service>`
to use desired PAM login service.
For example, set below property to use
`/etc/pam.d/login`
.
<SyntaxHighlighter
wrapLines=
{true}
language=
"shell"
style=
{theme.dark}
>
{
`atlas.authentication.method.pam.service=login`
}
</SyntaxHighlighter>
webapp/src/main/java/org/apache/atlas/web/security/AtlasAbstractAuthenticationProvider.java
View file @
2e69f922
...
@@ -37,6 +37,7 @@ import java.util.ArrayList;
...
@@ -37,6 +37,7 @@ import java.util.ArrayList;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.Arrays
;
import
org.apache.atlas.utils.AuthenticationUtil
;
import
org.apache.atlas.utils.AuthenticationUtil
;
...
@@ -106,7 +107,7 @@ public abstract class AtlasAbstractAuthenticationProvider implements Authenticat
...
@@ -106,7 +107,7 @@ public abstract class AtlasAbstractAuthenticationProvider implements Authenticat
String
[]
groups
=
ugi
.
getGroupNames
();
String
[]
groups
=
ugi
.
getGroupNames
();
if
(
LOG
.
isDebugEnabled
())
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"UserGroupInformation userGroups="
+
groups
);
LOG
.
debug
(
"UserGroupInformation userGroups="
+
Arrays
.
toString
(
groups
)
);
}
}
if
(
groups
!=
null
)
{
if
(
groups
!=
null
)
{
...
...
webapp/src/main/java/org/apache/atlas/web/security/AtlasPamAuthenticationProvider.java
View file @
2e69f922
...
@@ -110,7 +110,7 @@ public class AtlasPamAuthenticationProvider extends AtlasAbstractAuthenticationP
...
@@ -110,7 +110,7 @@ public class AtlasPamAuthenticationProvider extends AtlasAbstractAuthenticationP
LOG
.
debug
(
"Pam Authentication Failed:"
,
e
);
LOG
.
debug
(
"Pam Authentication Failed:"
,
e
);
}
}
if
(
isDebugEnabled
)
{
if
(
isDebugEnabled
)
{
LOG
.
debug
(
"<== AtlasPamAuthenticationProvider getPamAuthentication
"
);
LOG
.
debug
(
"<== AtlasPamAuthenticationProvider getPamAuthentication
: "
+
jaasAuthenticationProvider
);
}
}
return
authentication
;
return
authentication
;
}
}
...
@@ -127,6 +127,13 @@ public class AtlasPamAuthenticationProvider extends AtlasAbstractAuthenticationP
...
@@ -127,6 +127,13 @@ public class AtlasPamAuthenticationProvider extends AtlasAbstractAuthenticationP
if
(!
options
.
containsKey
(
"service"
))
{
if
(!
options
.
containsKey
(
"service"
))
{
options
.
put
(
"service"
,
"atlas-login"
);
options
.
put
(
"service"
,
"atlas-login"
);
}
}
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"AtlasPAMAuthenticationProvider{groupsFromUGI= "
+
groupsFromUGI
+
'\''
+
", options="
+
options
+
'}'
);
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
LOG
.
error
(
"Exception while setLdapProperties"
,
e
);
LOG
.
error
(
"Exception while setLdapProperties"
,
e
);
}
}
...
@@ -148,6 +155,16 @@ public class AtlasPamAuthenticationProvider extends AtlasAbstractAuthenticationP
...
@@ -148,6 +155,16 @@ public class AtlasPamAuthenticationProvider extends AtlasAbstractAuthenticationP
UserAuthorityGranter
[]
authorityGranters
=
new
UserAuthorityGranter
[]{
authorityGranter
};
UserAuthorityGranter
[]
authorityGranters
=
new
UserAuthorityGranter
[]{
authorityGranter
};
jaasAuthenticationProvider
.
setAuthorityGranters
(
authorityGranters
);
jaasAuthenticationProvider
.
setAuthorityGranters
(
authorityGranters
);
jaasAuthenticationProvider
.
afterPropertiesSet
();
jaasAuthenticationProvider
.
afterPropertiesSet
();
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"AtlasPAMAuthenticationProvider{"
+
"jaasAuthenticationProvider='"
+
jaasAuthenticationProvider
+
'\''
+
", loginModuleName='"
+
loginModuleName
+
'\''
+
", controlFlag='"
+
controlFlag
+
'\''
+
", options='"
+
options
+
'}'
);
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
LOG
.
error
(
"Failed to init PAM Authentication"
,
e
);
LOG
.
error
(
"Failed to init PAM Authentication"
,
e
);
}
}
...
...
webapp/src/main/java/org/apache/atlas/web/security/PamLoginModule.java
View file @
2e69f922
...
@@ -22,7 +22,8 @@ package org.apache.atlas.web.security;
...
@@ -22,7 +22,8 @@ package org.apache.atlas.web.security;
import
org.jvnet.libpam.PAM
;
import
org.jvnet.libpam.PAM
;
import
org.jvnet.libpam.PAMException
;
import
org.jvnet.libpam.PAMException
;
import
org.jvnet.libpam.UnixUser
;
import
org.jvnet.libpam.UnixUser
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.Logger
;
import
javax.security.auth.Subject
;
import
javax.security.auth.Subject
;
import
javax.security.auth.callback.*
;
import
javax.security.auth.callback.*
;
import
javax.security.auth.login.FailedLoginException
;
import
javax.security.auth.login.FailedLoginException
;
...
@@ -35,6 +36,8 @@ import java.util.Map;
...
@@ -35,6 +36,8 @@ import java.util.Map;
import
java.util.Set
;
import
java.util.Set
;
public
class
PamLoginModule
extends
Object
implements
LoginModule
{
public
class
PamLoginModule
extends
Object
implements
LoginModule
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
PamLoginModule
.
class
);
public
static
final
String
SERVICE_KEY
=
"service"
;
public
static
final
String
SERVICE_KEY
=
"service"
;
private
PAM
pam
;
private
PAM
pam
;
...
@@ -110,6 +113,9 @@ public class PamLoginModule extends Object implements LoginModule {
...
@@ -110,6 +113,9 @@ public class PamLoginModule extends Object implements LoginModule {
initUserName
(
nameCallback
);
initUserName
(
nameCallback
);
initPassword
(
passwordCallback
);
initPassword
(
passwordCallback
);
if
(
LOG
.
isDebugEnabled
())
LOG
.
debug
(
"Searching for user "
+
nameCallback
.
getName
());
}
}
catch
(
IOException
|
UnsupportedCallbackException
ex
)
catch
(
IOException
|
UnsupportedCallbackException
ex
)
{
{
...
@@ -150,6 +156,8 @@ public class PamLoginModule extends Object implements LoginModule {
...
@@ -150,6 +156,8 @@ public class PamLoginModule extends Object implements LoginModule {
principal
=
new
PamPrincipal
(
user
);
principal
=
new
PamPrincipal
(
user
);
authSucceeded
=
true
;
authSucceeded
=
true
;
if
(
LOG
.
isDebugEnabled
())
LOG
.
debug
(
"user "
+
username
);
return
true
;
return
true
;
}
}
catch
(
PAMException
ex
)
catch
(
PAMException
ex
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment