amidaware / rmmagent

Tactical RMM Agent
https://github.com/amidaware/tacticalrmm
Other
129 stars 75 forks source link

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

Closed UranusBytes closed 1 year ago

UranusBytes commented 1 year ago

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 https://github.com/amidaware/rmmagent/blob/4b1f993a7633c3f69d49cd6ee4ae509c3896d19b/agent/utils.go#L312-L315

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 commented 1 year ago

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