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

Add new auditdline probe #1692

Closed
wants to merge 6 commits into from

Conversation

gdidot
Copy link

@gdidot gdidot commented Feb 16, 2021

This PR add the auditdline probe following the proposal OVAL-Community/OVAL#114.

This implementation can query the live auditd rules, not just the one present in audit.rules file.

This implementation is based on the auditctl code use for the -l option, I would like to know if this can cause issue with the licensing?

@openscap-ci
Copy link

Can one of the admins verify this patch?

1 similar comment
@openscap-ci
Copy link

Can one of the admins verify this patch?

@lgtm-com
Copy link

lgtm-com bot commented Feb 16, 2021

This pull request introduces 1 alert when merging 2567888 into 29679eb - view on LGTM.com

new alerts:

  • 1 for Short global name

@evgenyz
Copy link
Contributor

evgenyz commented Feb 16, 2021

Hey, @gdidot.

Thank you for the contribution!

Before we start the discussion about the implementation details I would like to kindly ask you to do two things (so that we won't be messing with future comments):

  • format all newly-written code in accordance with Linux kernel coding style (https://www.kernel.org/doc/html/v4.10/process/coding-style.html), but maintain preexisting formatting in files where you are merely adding some lines. I know that we weren't explicit about the project's code style in the past, but it is the de-facto standard for the project. And I've updated the contribution guidelines just now to make it also a de-jure requirement;
  • squash your PR where appropriate. While it is a good practice to use multiple commits to logically structure the PR, the evolution of the initial implementation is not very valuable for the project history.

@evgenyz
Copy link
Contributor

evgenyz commented Feb 16, 2021

This implementation is based on the auditctl code use for the -l option, I would like to know if this can cause issue with the licensing?

I think it is OK.

@gdidot
Copy link
Author

gdidot commented Feb 16, 2021

This implementation is based on the auditctl code use for the -l option, I would like to know if this can cause issue with the licensing?

I think it is OK.

I forgot to say that auditctl is GPL, and if I understand right OpenSCAP is LGPL, this will not be an issue ?

@evgenyz
Copy link
Contributor

evgenyz commented Feb 16, 2021

This implementation is based on the auditctl code use for the -l option, I would like to know if this can cause issue with the licensing?

I think it is OK.

I forgot to say that auditctl is GPL, and if I understand right OpenSCAP is LGPL, this will not be an issue ?

I believe that the code you borrowed is related to the communication with the API that the audit module provides. Usually there is not much of a room for API invocation. It should be okay. But to be precise, we can analyze the code if you let us know what parts exactly were borrowed.

@gdidot
Copy link
Author

gdidot commented Feb 16, 2021

It's the code from line 79 to 911in the auditdline_probe.c file.

@evgenyz
Copy link
Contributor

evgenyz commented Feb 16, 2021

It's the code from line 79 to 911in the auditdline_probe.c file.

Err, that's actually a lot. I wonder if maybe @stevegrubb could shed some light on this culprit?

@gdidot
Copy link
Author

gdidot commented Feb 16, 2021

@evgenyz I use the clang-format tool to reformat auditdline_probe.c and auditdline_probe.h, is the formating good with you ?

@gdidot
Copy link
Author

gdidot commented Feb 16, 2021

It's the code from line 79 to 911in the auditdline_probe.c file.

Err, that's actually a lot. I wonder if maybe @stevegrubb could shed some light on this culprit?

I know it's a lot but the proposal OVAL-Community/OVAL#114 ask that the auditline entity is to be like the return of the auditctl -k command (I think is more likely the command auditctl -l -k ).

@lgtm-com
Copy link

lgtm-com bot commented Feb 16, 2021

This pull request introduces 1 alert when merging 7aa8f3c into b8c3f2e - view on LGTM.com

new alerts:

  • 1 for Short global name

probe_item_collect(ctx, item);
}

audit_close(audit_fd);

Choose a reason for hiding this comment

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

This audit_close should be moved just above the else because that is the only time the audit_fd descriptor is valid.

@stevegrubb
Copy link

Well, auditctl is GPL. I can probably re-license that file to LGPL. But when you lift code from another project, it's usually good form to attribute the code to the original author. (My copyright still applies.) This way people have a notice that they may want to check periodically to see if it's still in sync with the original to pick up bugfixes and new capabilities. In looking this code over, I already see something that I should probably fix in auditctl. :-)

@evgenyz
Copy link
Contributor

evgenyz commented Feb 23, 2021

@openscap-ci ok to test

@evgenyz
Copy link
Contributor

evgenyz commented Feb 23, 2021

Well, auditctl is GPL. I can probably re-license that file to LGPL. But when you lift code from another project, it's usually good form to attribute the code to the original author. (My copyright still applies.)

@gdidot So, if we choose to take this path (see below), you at least ought to properly attribute the copyright.

This way people have a notice that they may want to check periodically to see if it's still in sync with the original to pick up bugfixes and new capabilities. In looking this code over, I already see something that I should probably fix in auditctl. :-)

This is the initial idea of the OVAL proposal: to take the behavior of the an existing tool and do the same. Its appeal is in apparent simplicity, but this simplicity is treacherous. This path could lead into problems like we have in systemd* probes: #1533.

@gdidot
Copy link
Author

gdidot commented Feb 23, 2021

Thanks for your response @stevegrubb. I updated the code to properly credit you, sorry about that, let me know if it's ok with you. @evgenyz I understand your concern, but the proposal for auditdline is not yet fix. I think we can change it to specify a version of auditctl and avoid the same problem.

@stevegrubb
Copy link

@gdidot looks good to me. I'll change the license in the audit repo.

@evgenyz
Copy link
Contributor

evgenyz commented Feb 9, 2024

That's a very stale proposal and there is no movement on the OVAL side. I'm closing it for now.

@evgenyz evgenyz closed this Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants