<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to configure Phantom to use LDAP/Active Directory for authentication? in Security</title>
    <link>https://community.splunk.com/t5/Security/How-to-configure-Phantom-to-use-LDAP-Active-Directory-for/m-p/471160#M10925</link>
    <description>&lt;P&gt;Yes, I believe so but I don't have a non-AD directory with which to test.  Feel free to reach out on Phantom-Community slack to @sam_phantom and I'd be happy to work with you.&lt;/P&gt;</description>
    <pubDate>Fri, 22 Nov 2019 15:51:23 GMT</pubDate>
    <dc:creator>sam_splunk</dc:creator>
    <dc:date>2019-11-22T15:51:23Z</dc:date>
    <item>
      <title>How to configure Phantom to use LDAP/Active Directory for authentication?</title>
      <link>https://community.splunk.com/t5/Security/How-to-configure-Phantom-to-use-LDAP-Active-Directory-for/m-p/471156#M10921</link>
      <description>&lt;P&gt;I want to configure Phantom to use Active Directory for authentication instead of the built-in authentication mechanism. How can I get this working?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 03:04:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/How-to-configure-Phantom-to-use-LDAP-Active-Directory-for/m-p/471156#M10921</guid>
      <dc:creator>sam_splunk</dc:creator>
      <dc:date>2019-09-04T03:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure Phantom to use LDAP/Active Directory for authentication?</title>
      <link>https://community.splunk.com/t5/Security/How-to-configure-Phantom-to-use-LDAP-Active-Directory-for/m-p/471157#M10922</link>
      <description>&lt;H2&gt;Opening notes&lt;/H2&gt;

&lt;P&gt;While there is excellent documentation provided for phantom here: &lt;A href="https://my.phantom.us/4.5/docs/admin/user#Authentication"&gt;https://my.phantom.us/4.5/docs/admin/user#Authentication&lt;/A&gt;, sometimes a screen-by-screen walkthrough can sometimes be helpful. Consequently, this answer is intended as such an example walkthrough for Active Directory as the authentication source for Phantom.&lt;/P&gt;

&lt;P&gt;When connecting to an LDAP server you may be able to bind (ldap terminology for 'authenticate') with various levels of security. There can be a great deal of nuance to this and if what I've covered here (in my experience, &amp;gt; 95% of configurations), I'd recommending working with your LDAP administrator.&lt;/P&gt;

&lt;P&gt;I will also be using Active Directory which is generally a reasonable and compliant LDAP implementation (see their conformance document here for more information: &lt;A href="https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-adts/5b4872af-d421-42ff-9e47-2ce17159a965"&gt;https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-adts/5b4872af-d421-42ff-9e47-2ce17159a965&lt;/A&gt;). However, configuration for LDAP &lt;EM&gt;in general&lt;/EM&gt; can be wildly different between vendors so except for Active Directory, this should be considered general guidance, at best.&lt;/P&gt;

&lt;H3&gt;Preparing Active Directory (Basic requirements)&lt;/H3&gt;

&lt;P&gt;First thing we want to do is decide where our Phantom users live in our Directory. For my case, I've created a new OU called &lt;STRONG&gt;Phantom Users&lt;/STRONG&gt; which holds accounts for &lt;STRONG&gt;Sam&lt;/STRONG&gt; and &lt;STRONG&gt;Robert&lt;/STRONG&gt;. The path is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ou=Phantom Users,dc=splunk,dc=lab
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and looks something like this:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://i.imgur.com/Oje3E4z.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;Next I'm going to create a service account with which Phantom can bind to the directory to perform authentication for the user. For this, I've created a new OU called &lt;STRONG&gt;Service Accounts&lt;/STRONG&gt; and within it, a new user called &lt;STRONG&gt;svc-phantom&lt;/STRONG&gt; (with no special group memberships or permission adjustments). This configuration looks like the following screenshot.&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://i.imgur.com/S2fVlYo.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;Finally, we're going to map user roles from a group in the directory to a role in Phantom, so we need to create a few groups. In my example here, In an OU called &lt;STRONG&gt;Groups&lt;/STRONG&gt;, I've created two groups called &lt;STRONG&gt;phantom-admins&lt;/STRONG&gt; and &lt;STRONG&gt;phantom-readonly&lt;/STRONG&gt;. These will be mapped to &lt;STRONG&gt;Administrator&lt;/STRONG&gt; and &lt;STRONG&gt;Observer&lt;/STRONG&gt; within Phantom, respectively. &lt;STRONG&gt;Robert&lt;/STRONG&gt; is a member of &lt;STRONG&gt;phantom-readonly&lt;/STRONG&gt; and &lt;STRONG&gt;Sam&lt;/STRONG&gt; is a member of &lt;STRONG&gt;phantom-admins&lt;/STRONG&gt;. My groups look like the following screenshot:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://i.imgur.com/Q9sfZxo.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;H3&gt;Configuring Phantom&lt;/H3&gt;

&lt;P&gt;We're going to do the basic implementation on Phantom now. Note that I won't enable SSL until this basic work is done. If this approach does not work for you, please feel free to merge the sections together as you continue.&lt;/P&gt;

&lt;P&gt;Let's log into Phantom and browse to &lt;STRONG&gt;Administration&lt;/STRONG&gt;, then &lt;STRONG&gt;User Management&lt;/STRONG&gt;, then &lt;STRONG&gt;Authentication&lt;/STRONG&gt;. Here we'll see an LDAP tab and an on/off button. Turn LDAP on. Note that if LDAP is enabled, local authentication still works.&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://i.imgur.com/Rv7UqNI.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;Plug in the relevant information for your environment. My settings can be seen in the screenshot below and will be described presently.&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Active&lt;/STRONG&gt;: YES (because I'm working on it)&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Server&lt;/STRONG&gt;: My local domain controller&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Domain&lt;/STRONG&gt;: My domain name&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Bind Username&lt;/STRONG&gt;: The user Phantom will bind with (i.e. a service account)&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Bind Password&lt;/STRONG&gt;: The (hopefully very strong) password of the bind account&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Test User&lt;/STRONG&gt;: The user Phantom will use to verify the settings. Since I have 'sam' who is a member of the 'phantom-admins' group, this is a good test.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Test Group&lt;/STRONG&gt;: The AD group the Test User is a member of. This is only necessary if you're doing Group mapping (which we are in this example).&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;&lt;IMG src="https://i.imgur.com/n14vgSP.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;Now we'll click &lt;STRONG&gt;Test Authentication&lt;/STRONG&gt; and you hopefully will get a screen that looks something like the following screenshot.&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://i.imgur.com/wLUEqjv.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;NOTE: if you do not get a success status here, head down to the Troubleshooting section at the bottom of this answer.&lt;/P&gt;

&lt;P&gt;Let's drop down the &lt;STRONG&gt;Advanced&lt;/STRONG&gt; section and map our groups. My configuration looks like this:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://i.imgur.com/mXg4YdO.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;The key pieces I've adjusted are&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;User Base DN&lt;/STRONG&gt;: This is used on how you want to scope searching. I am searching my entire domain but I could just as easily have scoped it to ou=Phantom Users,dc=splunk,dc=lab and because of my configuration described here, everything would work perfectly.&lt;BR /&gt;
&lt;STRONG&gt;The Group Base DN&lt;/STRONG&gt;: Exactly the same as above, except we're talking about group objects.&lt;BR /&gt;
&lt;STRONG&gt;Group&lt;/STRONG&gt;: Phantom-admins → Administrator&lt;BR /&gt;
&lt;STRONG&gt;Group&lt;/STRONG&gt;: phantom-readonly → Observer&lt;BR /&gt;
Those last two are where I am mapping group membership to Phantom role. In addition to Role mapping, I can map attributes from my directory to Phantom to more fully populate the user. For example:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://i.imgur.com/mwn8qPz.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;So long as those attributes are populated in the directory, as soon as I log into Phantom they will be written on that account under &lt;STRONG&gt;Users&lt;/STRONG&gt;:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://i.imgur.com/EAdUBWj.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;H2&gt;Lockdown - Securing things&lt;/H2&gt;

&lt;P&gt;To quote Andy Dufresne, "If you've come this far, maybe you're willing to come a little further". We've got LDAP working, let's go ahead and secure it.... That is, presuming your LDAP has a certificate available and is appropriately configured for SSL or TLS.&lt;/P&gt;

&lt;P&gt;In my case, I do have a certificate set up and my server is listening on port 636 for secure LDAP, but when I try to bind, I get the following error:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://i.imgur.com/M7Nc8I5.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;Why? Well as the documentation I linked at the top mentions, we need to load up our cert to Phantom's keystore. A process described in our docs here: &lt;A href="https://my.phantom.us/kb/16/"&gt;https://my.phantom.us/kb/16/&lt;/A&gt;. Nevertheless, I will walk through this as well.&lt;/P&gt;

&lt;P&gt;Lucky for you - if you're on Phantom 3.0+ you simply need to copy the root certificate and possibly intermediate certs to Phantom and install them with the install script. The command from the docs looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;phenv python2.7 /opt/phantom/bin/import_cert.py -i /tmp/ca.crt
service uwsgi restart
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;...and a screenshot from the installation in my lab is just below.&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://i.imgur.com/Cov6zg1.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;At this point, clicking &lt;STRONG&gt;Test Authentication&lt;/STRONG&gt; should work as expected and if it does, you can begin logging in with the appropriate directory users.&lt;/P&gt;

&lt;H2&gt;Troubleshooting&lt;/H2&gt;

&lt;P&gt;If you get an error like the following (top right), this can be caused by any of the settings outlined in red.&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://i.imgur.com/YLEOBv6.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;So, what can you do? Well, you can investigate the log file /var/log/phantom/wsgi.log on the Phantom server. I've outlined some of the errors you might see depending on which field is wrong (highlighting mine).&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Bad Server Name:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;gt; generated 184 bytes in 38 msecs (HTTP/1.1 200) 4 headers in 123 bytes (1 switches on core 0)
[04/Sep/2019 02:50:15] WARNING: Caught LDAPError while trying to bind using svc-phantom@splunk.lab: SERVER_DOWN({u'info': 'No such file or directory', 'errno': 2, 'desc': u"Can't contact LDAP server"},)
[04/Sep/2019 02:50:15] ERROR: Traceback (most recent call last):
  File "../../www/phantom_ui/ui/rest.py", line 82, in rest_api
  File "../../www/phantom_ui/ui/rest.py", line 201, in _rest_api
  File "../../www/phantom_ui/ui/rest.py", line 219, in delegate
  File "../../www/phantom_ui/ui/rest.py", line 252, in standard_request
  File "/builds/phantom/phantom/www/phantom_ui/ui/models/system.py", line 2278, in rest_create
  File "/builds/phantom/phantom/www/phantom_ui/ui/models/system.py", line 2123, in test_ldap
  File "/builds/phantom/phantom/www/phantom_ui/auth_backends/ph_ldap.py", line 329, in test_connection
  File "/opt/phantom/usr/lib/python2.7/site-packages/django_auth_ldap/backend.py", line 458, in connection
    self._bind()
  File "/opt/phantom/usr/lib/python2.7/site-packages/django_auth_ldap/backend.py", line 786, in _bind
    sticky=True)
  File "/opt/phantom/usr/lib/python2.7/site-packages/django_auth_ldap/backend.py", line 798, in _bind_as
    force_text(bind_password))
  File "/opt/phantom/usr/lib64/python2.7/site-packages/ldap/ldapobject.py", line 443, in simple_bind_s
    msgid = self.simple_bind(who,cred,serverctrls,clientctrls)
  File "/opt/phantom/usr/lib64/python2.7/site-packages/ldap/ldapobject.py", line 437, in simple_bind
    return self._ldap_call(self._l.simple_bind,who,cred,RequestControlTuples(serverctrls),RequestControlTuples(clientctrls))
  File "/opt/phantom/usr/lib64/python2.7/site-packages/ldap/ldapobject.py", line 329, in _ldap_call
    reraise(exc_type, exc_value, exc_traceback)
  File "/opt/phantom/usr/lib64/python2.7/site-packages/ldap/ldapobject.py", line 313, in _ldap_call
    result = func(*args,**kwargs)
SERVER_DOWN: {u'info': 'No such file or directory', 'errno': 2, 'desc': u"Can't contact LDAP server"}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Bad Bind Name:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[04/Sep/2019 02:52:01] WARNING: Caught LDAPError while trying to bind using svc-phantom1@splunk.lab: INVALID_CREDENTIALS({'info': u'80090308: LdapErr: DSID-0C09042F, comment: AcceptSecurityContext error, data 52e, v2580', 'desc': u'Invalid credentials'},)
[pid: 24507|app: 0|req: 30/42] 192.168.54.22 () {60 vars in 1171 bytes} [Wed Sep  4 02:52:01 2019] POST /rest/system_settings/ =&amp;gt; generated 137 bytes in 34 msecs (HTTP/1.1 200) 4 headers in 123 bytes (1 switches on core 0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Bad User:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[04/Sep/2019 02:52:51] WARNING: Unable to locate user using search_s('dc=splunk,dc=lab', 2, '(&amp;amp;(sAMAccountName=sam1)(objectClass=user))') 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Bad Group:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[04/Sep/2019 02:53:17] WARNING: No group named phantom-admins1 returned using search_s('dc=splunk,dc=lab', 2, '(&amp;amp;(member=cn=sam,ou=phantom users,dc=splunk,dc=lab)(objectClass=group))') 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Finally, if you see an error like the following, it likely means your LDAP is not configured to securely bind, and troubleshooting should happen on that system.&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://i.imgur.com/7iBVt0f.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;This will likely have a corresponding event on the Domain Controller like the following. This will be definitive evidence that AD is not configured for secure binds.&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://i.imgur.com/JLuycFN.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;H2&gt;Summary&lt;/H2&gt;

&lt;P&gt;Well, I hope this helps if you've configuring your LDAP/AD to allow Phantom authentication or simply troubleshooting. Feel free to leave comments for follow-up questions.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 03:09:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/How-to-configure-Phantom-to-use-LDAP-Active-Directory-for/m-p/471157#M10922</guid>
      <dc:creator>sam_splunk</dc:creator>
      <dc:date>2019-09-04T03:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure Phantom to use LDAP/Active Directory for authentication?</title>
      <link>https://community.splunk.com/t5/Security/How-to-configure-Phantom-to-use-LDAP-Active-Directory-for/m-p/471158#M10923</link>
      <description>&lt;P&gt;This is great work!&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 10:41:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/How-to-configure-Phantom-to-use-LDAP-Active-Directory-for/m-p/471158#M10923</guid>
      <dc:creator>rgresham_splunk</dc:creator>
      <dc:date>2019-09-04T10:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure Phantom to use LDAP/Active Directory for authentication?</title>
      <link>https://community.splunk.com/t5/Security/How-to-configure-Phantom-to-use-LDAP-Active-Directory-for/m-p/471159#M10924</link>
      <description>&lt;P&gt;Thanks for the above! Really nice guide. Does anyone know if it is possible to do  get phantom to use LDAP but not through Active Directory? &lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 12:40:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/How-to-configure-Phantom-to-use-LDAP-Active-Directory-for/m-p/471159#M10924</guid>
      <dc:creator>ucz350</dc:creator>
      <dc:date>2019-11-22T12:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure Phantom to use LDAP/Active Directory for authentication?</title>
      <link>https://community.splunk.com/t5/Security/How-to-configure-Phantom-to-use-LDAP-Active-Directory-for/m-p/471160#M10925</link>
      <description>&lt;P&gt;Yes, I believe so but I don't have a non-AD directory with which to test.  Feel free to reach out on Phantom-Community slack to @sam_phantom and I'd be happy to work with you.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 15:51:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/How-to-configure-Phantom-to-use-LDAP-Active-Directory-for/m-p/471160#M10925</guid>
      <dc:creator>sam_splunk</dc:creator>
      <dc:date>2019-11-22T15:51:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure Phantom to use LDAP/Active Directory for authentication?</title>
      <link>https://community.splunk.com/t5/Security/How-to-configure-Phantom-to-use-LDAP-Active-Directory-for/m-p/559392#M12413</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/196088"&gt;@sam_splunk&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;&lt;P&gt;Cheers for the guide!&lt;/P&gt;&lt;P&gt;I think these types of guides should be included in every admin guide that even has the troubleshooting part; love it!&amp;nbsp;&lt;/P&gt;&lt;P&gt;Noticed that the logs now reside in &lt;STRONG&gt;/opt/phantom/var/log/phantom/wsgi.log&lt;/STRONG&gt; (using OVA:&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;Phantom 4.10.4.56260)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jul 2021 10:23:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/How-to-configure-Phantom-to-use-LDAP-Active-Directory-for/m-p/559392#M12413</guid>
      <dc:creator>aropaltioali</dc:creator>
      <dc:date>2021-07-14T10:23:41Z</dc:date>
    </item>
  </channel>
</rss>

