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 a table for more convenient access to docker container environment #7313

Merged
merged 3 commits into from Oct 6, 2021

Conversation

nabilschear
Copy link
Contributor

All the docker container environment variables are joined with a comma and embedded into a single field in the docker_containers table. This makes it hard to construct queries against individual variables. This change introduces a new table called docker_container_envs that splits these environment variables out in separate rows so that they can be used in a similar manner to the process_envs table.

Structured in a similar manner to the docker_container_labels table and re-using the variable parsing code from process_envs

@nabilschear nabilschear requested review from a team as code owners September 16, 2021 00:21
@nabilschear nabilschear changed the title add a table for more convinient access to docker container environment add a table for more convenient access to docker container environment Sep 16, 2021
@mike-myers-tob
Copy link
Member

Hi @nabilschear !

It looks like the integration test is commented out, was this intentional?

@nabilschear
Copy link
Contributor Author

@mike-myers-tob nearly all the docker_* tables have this very simple structure for their tests. They are basically smoketests to make sure that the query can run (but don't check any returned values). See https://github.com/osquery/osquery/blob/master/tests/integration/tables/docker_image_labels.cpp as an example. In my case, I copied from this file: https://github.com/osquery/osquery/blob/master/tests/integration/tables/docker_container_labels.cpp

@nabilschear
Copy link
Contributor Author

any updates on this one?

description("Docker container environment variables.")
schema([
Column("id", TEXT, "Container ID", index=True),
Column("key", TEXT, "Environment variable name", index=True),
Copy link
Member

Choose a reason for hiding this comment

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

This is not indexed.

It might need additional since it's part of the row's primary key.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed indexed from key. It now has a similar structure to the process_envs table, which I think is right (replacing pid for id)

Copy link
Member

@directionless directionless left a comment

Choose a reason for hiding this comment

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

While I'm not totally sure we need it, it seems reasonably in keeping with the rest of the docker tables. Approved, pending CI

@mike-myers-tob
Copy link
Member

I'm going to close and reopen this PR to try to rerun the CI workflows

@directionless
Copy link
Member

I suspect the build failures are because of the LE cert expiration. That should be fixed on HEAD. Can you rebase please?

@Smjert
Copy link
Member

Smjert commented Oct 6, 2021

I suspect the build failures are because of the LE cert expiration. That should be fixed on HEAD. Can you rebase please?

Closing and reopening the PR (as Mike previously did) automatically updates the temporary merge branch that Github uses with the CI behind the curtains, aligning it to master. It should be fine now.

@directionless directionless merged commit a18ffee into osquery:master Oct 6, 2021
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.

None yet

4 participants