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

render templates with external functions #1876

Merged
merged 2 commits into from
Mar 5, 2024
Merged

Conversation

tgross
Copy link
Member

@tgross tgross commented Feb 8, 2024

Some consumers of consul-template use it like a library, where the application runs the runner in-process. For projects like Nomad which need to run with a high level of privilege, this is problematic in that its challenging to secure the operations that read and write from disk without running the entirety of CT as an external process (which carries a lot of overhead for Nomad workloads).

Add a RendererFunc and ReaderFunc interface to allow Nomad to inject a sandboxed subprocess when reading from disk and writing to disk.

This implementation is currently being used in Nomad 1.7.4, 1.6.7, and 1.5.14 as a mitigation for hashicorp/nomad#19888. See hashicorp/nomad@df86503 for example usage.

Required for hashicorp/nomad#19919

@tgross tgross added the nomad Related to ingetration in Nomad label Feb 8, 2024
@tgross tgross force-pushed the render-with-external-functions branch from dbe80cb to 1ce54cc Compare February 8, 2024 16:26
@tgross tgross force-pushed the render-with-external-functions branch from 1ce54cc to d6f2db1 Compare February 8, 2024 16:34
@tgross tgross marked this pull request as ready for review February 8, 2024 16:47
@tgross tgross requested a review from a team as a code owner February 8, 2024 16:47
config/config.go Show resolved Hide resolved
manager/runner.go Show resolved Hide resolved
renderer/renderer.go Outdated Show resolved Hide resolved
template/template.go Show resolved Hide resolved
Some consumers of `consul-template` use it like a library, where the application
runs the runner in-process. For projects like Nomad which need to run with a
high level of privilege, this is problematic in that its challenging to secure
the operations that read and write from disk without running the entirety of CT
as an external process (which carries a lot of overhead for Nomad workloads).

Add a `RendererFunc` and `ReaderFunc` interface to allow Nomad to inject a
sandboxed subprocess when reading from disk and writing to disk.

This implementation is currently being used in Nomad 1.7.4, 1.6.7, and
1.5.14 as a mitigation for hashicorp/nomad#19888. See
hashicorp/nomad@df86503
for example usage.
@tgross tgross force-pushed the render-with-external-functions branch from d6f2db1 to d0656c4 Compare March 4, 2024 21:06
@tgross
Copy link
Member Author

tgross commented Mar 4, 2024

@lkysow I've addressed your comments and rebased on main. I can squash merge this if you're happy with the results?

@tgross
Copy link
Member Author

tgross commented Mar 4, 2024

Oh, well there's something wrong with the infra being set up for the Consul ENT test... like Vault isn't accepting writes for some reason during the setup? I see there was a recent set of commits by @kkavish trying to de-flake tests but not sure if this is new or not?

@tgross tgross merged commit 0ca9918 into main Mar 5, 2024
54 checks passed
@tgross tgross deleted the render-with-external-functions branch March 5, 2024 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nomad Related to ingetration in Nomad
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants