Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Parse SSSD group listings #3406

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

psachin
Copy link
Contributor

@psachin psachin commented May 10, 2022

The SSSD group listings breaks the present implementation by parsing the domain
group as the file-size.

Resolves: #3395

Signed-off-by: Sachin Patil psachin@redhat.com

All Pull Requests:

Check all that apply:

  • Have you followed the guidelines in our Contributing document, including the instructions about commit messages?
  • Is this PR to correct an issue?
  • Is this PR an enhancement?

Complete Description of Additions/Changes:

Add your description here

The SSSD group listings breaks the present implementation by parsing the domain
group as the file-size.

Resolves: RedHatInsights#3395

Signed-off-by: Sachin Patil <psachin@redhat.com>
Copy link
Contributor

@xiangce xiangce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this update could not cover the other example mentioned in the issue #3395

# Example 2
-rw-r--r--.  1 root   domain users        40893 Jan 31 16:34 Xorg.1.log
-rw-r--r--.  1 root   domain users        36911 Dec 20 09:49 Xorg.1.log.old

In example-2, there is no "@" in the group name field "domain users".

And I have to agree that without this specific character "@", it is a difficult issue to solve based on the current "ls_parser" resolution. Maybe it's possible to consider another overall reconstruction plan, e.g. the insights.parsers.parse_fixed_table.
It's just my thoughts, you may have a better resolution.

@psachin
Copy link
Contributor Author

psachin commented May 10, 2022

@xiangce

Thanks for pointing that out. I thought I included both the examples (which I did initially) but then I removed it to test each line individually. Finally I forgot to include the second example. My bad!

I researched a bit and found that this strange user-group occurs when the sssd/krb5 DOMAIN/REALM is configured. From what I observed the owner is domain users followed by the @ and DOMAIN name (CR.LOCAL in the example). Hence under the assumption that the group will always start with users in the subsequent commit I am checking if the 4th-index startswith() users. Hopefully this should take care of the user-group issue for both the scenarios.

As to not break the current convention I am storing domain as an owner and rest as the group.

Maybe it's possible to consider another overall reconstruction plan, e.g. the insights.parsers.parse_fixed_table.
It's just my thoughts, you may have a better resolution.

Yeah! I agree that anything new in the ls_parser is not easy to implement especially when we have to parse different elements depending upon the generic and SElinux context. I thought of using parse_fixed_table initially but gave-up eventually because before passing the data to parse_fixed_table it has to be cleaned for table and it still has to parse different numbers of columns based on the generic and SElinux context.

Signed-off-by: Sachin Patil <psachin@redhat.com>
@psachin psachin requested a review from xiangce May 11, 2022 05:04
@xiangce
Copy link
Contributor

xiangce commented May 18, 2022

@psachin

I researched a bit and found that this strange user-group occurs when the sssd/krb5 DOMAIN/REALM is configured. From what I observed the owner is domain users followed by the @ and DOMAIN name (CR.LOCAL in the example). Hence under the assumption that the group will always start with users in the subsequent commit I am checking if the 4th-index startswith() users. Hopefully this should take care of the user-group issue for both the scenarios.

From this official guide document Adjusting how SSSD interprets full user names, it seems that "user" is just an example used in the doc. And I did a bit of research by using the RAT tool and found it's true and different usernames can be used in the group in the SSSD cases. For example:

/var/log:
total 3834048
drwxr-xr-x. 11 root             root                            4096 May 17 03:10 .
drwxr-xr-x. 20 root             root                             281 Nov 15 15:42 ..
-rw-------.  1 root             utmp                           19200 Apr 30 22:45 btmp-20220501
drwxr-xr-x.  2 chrony           chrony                             6 Jan 10  2019 chrony
-rwxrwx---.  1 lfis@cop.rht.com it security@cop.rht.com        56337 May 17 03:15 cron
-rwxrwx---.  1 lfis@cop.rht.com root                          196293 Apr 24 03:40 cron-20220424
-rwxrwx---.  1 lfis@cop.rht.com it security@cop.rht.com       194961 May  1 03:09 cron-20220501
-rwxrwx---.  1 lfis@cop.rht.com it security@cop.rht.com       194926 May  8 03:20 cron-20220508
-rwxrwx---.  1 lfis@cop.rht.com it security@cop.rht.com       195355 May 15 03:13 cron-20220515
-rw-r--r--.  1 root             root                          101107 Apr 23 04:02 dmesg

and

/var/log:
total 571780
-rw-------.  1 root   root                       0 May  8 03:37 spooler-20220515
drwxr-x---.  2 sssd   sssd                    4096 Apr 22 03:17 sssd
-rw-------.  1 root   gls-int-linux team  35607509 May 17 02:05 sudo.log

So, things become more complex ... maybe it's time to think of another resolution.

@xiangce xiangce marked this pull request as draft May 25, 2022 03:45
@xiangce xiangce added the bug label May 25, 2022
@psachin psachin changed the title Parse SSSD group listings Draft: Parse SSSD group listings Jun 9, 2022
@candlepin-bot
Copy link

Can one of the admins verify this patch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LsVarLog parser does not handle group name containing space
3 participants