Security

select lookuptable based on role of the current user

FritzWittwer_ol
Contributor

We have an app which is deployed for different user groups which are distinguished by different roles which gives them access to their indexes. The searches use an asterisk in the index specification so each user gets the data from the index to which he gets access based on his role.

We need the same functionality for lookups, e.g.

  • lookuptable_a (belongs role a)
  • lookuptable_b (belongs role b)

spl: index=* | lookup lookuptable_* ...

Depending on the users role either lookuptable_a or lookuptable_b should be used, but wild-carding of lookup-table-name is not supported

0 Karma

somesoni2
Revered Legend

Give this a try

1) Create a macro (read by everyone or by both role_a and role_b)
Name: getlookupname
content:

[| rest /services/authentication/current-context splunk_server=local | table roles | eval search=case(isnotnull(mvfind(roles,"role_a")),"lookuptable_a",isnotnull(mvfind(roles,"role_b")),"lookuptable_b") | table search ]

2) Change sharing permissions on the lookup tables so that lookuptable_a is only accessible by role_a. same for lookuptable_b.

Now your users can use that macro in place of lookup table like this

index=* | lookup `getgetlookupname` ...
0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...