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

Feature Request: Allow for defining path used for TempDir #32

Closed
UranusBytes opened this issue Feb 14, 2023 · 1 comment
Closed

Feature Request: Allow for defining path used for TempDir #32

UranusBytes opened this issue Feb 14, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@UranusBytes
Copy link

The Linux Level-1 CIS benchmarks set the noexec flag on /tmp. This prevents the agent from being able to execute any scripts (fork/exec /tmp/trmm12345: permission denied)

The createTmpFile of utils.go is passing a blank string for the dir path to CreateTemp that is causing the function to use the path as returned by TempDir. https://pkg.go.dev/os#CreateTemp

rmmagent/agent/utils.go

Lines 312 to 315 in 4b1f993

func createTmpFile() (*os.File, error) {
var f *os.File
f, err := os.CreateTemp("", "trmm")
if err != nil {

If the value for this path was a variable (Custom Field) defined at the site or agent level that was an empty string by default, then it would continue to use the default TempDir path, but allow for overrides in circumstances where a different path is needed...

@wh1te909 wh1te909 added the bug Something isn't working label Feb 27, 2023
@wh1te909 wh1te909 self-assigned this Feb 27, 2023
@wh1te909
Copy link
Member

thanks I reworked the function to handle noexec and fallback to the current dir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants