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

Replacing /tmp/gvisor.sock with /run/gvisor.sock #2163

Merged
merged 3 commits into from
Sep 14, 2022

Conversation

vjjmiras
Copy link
Contributor

@vjjmiras vjjmiras commented Aug 11, 2022

According to the FHS 3.0 (https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s15.html), transient UNIX-domain sockets should be placed under the directory /run, so this commit updates the implicit value generated by the application.

Signed-off-by: Vicente J. Jiménez Miras vjjmiras@gmail.com

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind design

/kind documentation

/kind failing-test

/kind feature

If contributing rules or changes to rules, please make sure to also uncomment one of the following line:

/kind rule-update

/kind rule-create

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area build

/area engine

/area rules

/area tests

/area proposals

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

update!: gVisor sock default path changed from `/tmp/gvisor.sock` to `/run/falco/gvisor.sock` 
update!: gRPC server sock default path changed from `/run/falco.sock.sock` to `/run/falco/falco.sock`

@jasondellaluce
Copy link
Contributor

cc @LucaGuerra

@@ -165,7 +165,7 @@ void cmdline_options::define()
("e", "Read the events from <events_file> in .scap format instead of tapping into live.", cxxopts::value(trace_filename), "<events_file>")
#ifdef HAS_GVISOR
("g,gvisor-config", "Parse events from gVisor using the specified configuration file. A falco-compatible configuration file can be generated with --gvisor-generate-config and can be used for both runsc and Falco.", cxxopts::value(gvisor_config), "<gvisor_config>")
("gvisor-generate-config", "Generate a configuration file that can be used for gVisor.", cxxopts::value<std::string>(gvisor_generate_config_with_socket)->implicit_value("/tmp/gvisor.sock"), "<socket_path>")
("gvisor-generate-config", "Generate a configuration file that can be used for gVisor.", cxxopts::value<std::string>(gvisor_generate_config_with_socket)->implicit_value("/run/gvisor.sock"), "<socket_path>")
Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM! Actually @vjjmiras , can we call it something like /run/falco_gvisor.sock so it's clear that it's the socket that gvisor can connect to when interacting with Falco?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also from the FHS 3.0: Programs may have a subdirectory of /run; this is encouraged for programs that use more than one run-time file.

So, in that case, and assuming we might want to follow this method for future integrations, I'd go for /run/falco/gvisor.sock.

The only issue I've seen so far is that Falco doesn't create the subdirectory (falco/ under /run), so it has to either be created manually or the code should take care of the whole path. If the subdirectory has to be created externally, I'd choose systemd-tmpfiles for that job, which can do that just by adding a configuration file.

Copy link
Member

Choose a reason for hiding this comment

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

I believe Falco should create subdirectories. We faced the same issues with the gRPC Unix socket.
Although modifying those default paths would introduce a backward incompatible change, I think it is worth it.
If @falcosecurity/falco-maintainers agree we can fix that.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would accept introducing breaking changes in some default paths to have a more consistent path schema. Which paths will be affected?

Copy link
Member

Choose a reason for hiding this comment

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

AFAIK, only the gRPC unix socket (/run/falco.sock 👉 /run/falco/falco.sock). Btw, we are already using /run/falco/falco.sock in the helm chart.

Copy link
Contributor

Choose a reason for hiding this comment

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

That works for me!

Copy link
Member

Choose a reason for hiding this comment

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

I've rebased this PR and fixed both sock paths (now they are under /run/falco).
PTAL

@leogr
Copy link
Member

leogr commented Aug 18, 2022

/milestone 0.33.0

vjjmiras and others added 3 commits September 12, 2022 16:49
According to the FHS 3.0 (https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s15.html), transient UNIX-domain sockets should be placed under the directory /run, so this commit updates the implicit value generated by the application.

Signed-off-by: Vicente J. Jiménez Miras <vjjmiras@gmail.com>
…or.sock`

Co-authored-by: Vicente J. Jiménez Miras <vjjmiras@gmail.com>
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
@leogr leogr force-pushed the vjjmiras-gvisor-sock-UDS branch from 7bfc411 to cb33970 Compare September 12, 2022 14:55
@poiana poiana added size/S and removed size/XS labels Sep 12, 2022
Copy link
Contributor

@jasondellaluce jasondellaluce left a comment

Choose a reason for hiding this comment

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

/approve

@poiana
Copy link
Contributor

poiana commented Sep 12, 2022

LGTM label has been added.

Git tree hash: 9091928431aabc9960616c44fa9957cbc08491da

Copy link
Member

@Andreagit97 Andreagit97 left a comment

Choose a reason for hiding this comment

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

Thank you for this!
/approve

@poiana
Copy link
Contributor

poiana commented Sep 14, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Andreagit97, jasondellaluce, vjjmiras

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [Andreagit97,jasondellaluce]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@poiana poiana merged commit c732e5d into falcosecurity:master Sep 14, 2022
@vjjmiras vjjmiras deleted the vjjmiras-gvisor-sock-UDS branch January 26, 2023 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants