Skip to content

Commit

Permalink
$ cat /proc/*/environ -> $ cat /proc/self/environ
Browse files Browse the repository at this point in the history
Signed-off-by: Kapil Sharma <[email protected]>
  • Loading branch information
h4l0gen authored Apr 9, 2024
1 parent 08c5f80 commit 651fb14
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions events/syscall/read_environment_variable_from_proc_files.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,26 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package syscall

import (
"os/exec"
"github.com/falcosecurity/event-generator/events"
"os/exec"

"github.com/falcosecurity/event-generator/events"
)

var _ = events.Register(
ReadEnvironmentVariableFromProcFiles,
events.WithDisabled(), // this rules is not included in falco_rules.yaml (stable rules), so disable the action
ReadEnvironmentVariableFromProcFiles,
events.WithDisabled(), // this rule is not included in falco_rules.yaml (stable rules), so disable the action
)

func ReadEnvironmentVariableFromProcFiles(h events.Helper) error {
if h.InContainer() {
cmd := exec.Command("cat", "/proc/*/environ")
err := cmd.Run()
if err != nil {
return err
}

h.Log().Infof("Environment variables were retrieved from /proc files")
}

return nil
if h.InContainer() {
cmd := exec.Command("cat", "/proc/self/environ")
err := cmd.Run()
if err != nil {
return err
}
}
return nil
}

0 comments on commit 651fb14

Please sign in to comment.