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

Custom macro expansion issues in falco_rules.local.yaml #504

Closed
JPLachance opened this issue Jan 28, 2019 · 9 comments
Closed

Custom macro expansion issues in falco_rules.local.yaml #504

JPLachance opened this issue Jan 28, 2019 · 9 comments

Comments

@JPLachance
Copy link
Contributor

Greetings,

I an trying to define some custom conditions in the user_read_sensitive_file_conditions macro. That macro is defined in falco_rules.yaml and I'm overriding it in falco_rules.local.yaml.

To make my YAML file cleaner, I'm defining the following macro:

- macro: puppet_access_sudoers
  condition: proc.name=puppet and proc.cmdline="puppet /usr/bin/puppet agent" and fd.name startswith "/etc/sudoers"

Then, I'm using the puppet_access_sudoers in the override of user_read_sensitive_file_conditions:

- macro: user_read_sensitive_file_conditions
  condition: puppet_access_sudoers

The result is the following error:

Fri Jan 25 22:02:20 2019: Runtime error: Error loading rules: /usr/share/falco/lua/compiler.lua:78: Undefined macro 'puppet_access_sudoers' used in filter.. Exiting.

The puppet_access_sudoers is defined above the override user_read_sensitive_file_conditions, but the Lua compiler fails to find it.

A workaround is the following:

- macro: user_read_sensitive_file_conditions
  condition: proc.name=puppet and proc.cmdline="puppet /usr/bin/puppet agent" and fd.name startswith "/etc/sudoers"

It works, but it will be more complicated to maintain. :)

Thanks for your help!

@mfdii
Copy link
Member

mfdii commented Mar 5, 2019

@mstemm any thoughts on why the Lua compiler isn't working for this macro?

@mstemm
Copy link
Contributor

mstemm commented Mar 5, 2019

When I debugged it with him, I think it had to due to the fact that the user macro was in a separate file.

@stale
Copy link

stale bot commented May 4, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label May 4, 2019
@JPLachance
Copy link
Contributor Author

Hello! I think we need this one because it will allow users to make their rules cleaner 🙂

@stale stale bot removed the wontfix label May 6, 2019
@mstemm
Copy link
Contributor

mstemm commented May 8, 2019

Ok, reopening.

@stale
Copy link

stale bot commented Jul 7, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jul 7, 2019
@leodido
Copy link
Member

leodido commented Jul 7, 2019

Related to #706

@stale stale bot removed the wontfix label Jul 7, 2019
@fntlnz
Copy link
Contributor

fntlnz commented Jul 8, 2019

I think we can close this since it had been detailed a lot more in #706 - wdyt @JPLachance ?

@JPLachance
Copy link
Contributor Author

Have fun! :)

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

No branches or pull requests

5 participants