Commit Graph
9 Commits
Author SHA1 Message Date
Jakub Nyckowski 7fab8fadc6 Currently, our BPF modules send all events from the kernel to the userspace, where we filter them and log only the ones related to our process. Sending the events between the user and kernel space is expensive, and most of the events are discarded after. (#19354)
This PR moves the filtering from the userspace to the kernel, where we can filter them earlier and not pay for sending all events to our userspace process. Because the filtering happens in the kernel, the BPF test had to be rewritten to execute events in a sub-cgroup instead of the global one.
2023-02-07 19:20:55 +00:00
Jakub Nyckowski 0ee91f6c37 Enable GCI linter (#17894) 2022-10-28 20:20:28 +00:00
Russell Jones c411ebf21b Refactor tests under cgroup package (#14357)
Refactor tests under cgroup package.

Refactored all tests under "lib/cgroup" to use testify instead
of gocheck.
2022-07-22 10:28:47 -04:00
James PerryandZac Bergquist 536671b541 set err to scanner.Err (#11100)
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
2022-03-23 22:31:38 +00:00
Zac Bergquist 77fbed70ce Clean up cgroups.go
Prefer package filepath over package path when working with the
filesystem.

Stop using the deprecated ioutil package.
2022-03-16 15:05:42 -06:00
JoelandZac Bergquist 62173e096b use google/uuid instead of pborman/uuid (#9793)
* replace imports

* use google/uuid

* fix test

* reverse changelog changes

* update gomod

* zac steps

* tidy

Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com>
2022-01-19 23:44:48 +00:00
Zac Bergquist 0bae0d255f Cleanup lint targets
- Don't assume an explicit $GOPATH is set
- Remove golint from linters - it's been deprecated for over a year
  and golangci-lint prints a warning instead of running it.
2021-10-19 09:21:55 -06:00
Russell Jones 80f88c315f Directly call NameToHandleAt for cgroup ID.
Instead of using the "name_to_handle_at" in glibc, call
unix.NameToHandleAt (which issues that syscall directly). This allows
for cgroup resolution on systems with older version of glibc (like the
one that ships with CentOS 6).

See the following links for more details:

http://man7.org/linux/man-pages/man2/open_by_handle_at.2.html
https://godoc.org/golang.org/x/sys/unix#NameToHandleAt
2020-01-20 14:04:36 -08:00
Russell Jones 77e8b63470 Enhanced Session Recording.
Added package cgroup to orchestrate cgroups. Only support for cgroup2
was added to utilize because cgroup2 cgroups have unique IDs that can be
used correlated with BPF events.

Added bpf package that contains three BPF programs: execsnoop,
opensnoop, and tcpconnect. The bpf package starts and stops these
programs as well  correlating their output with Teleport sessions
and emitting them to the audit log.

Added support for Teleport to re-exec itself before launching a shell.
This allows Teleport to start a child process, capture it's PID, place
the PID in a cgroup, and then continue to process. Once the process is
continued it can be tracked by it's cgroup ID.

Reduced the total number of connections to a host so Teleport does not
quickly exhaust all file descriptors. Exhausting all file descriptors
happens very quickly when disk events are emitted to the audit log which
are emitted at a very high rate.

Added tarballs for exec sessions. Updated session.start and session.end
events with additional metadata. Updated the format of session tarballs
to include enhanced events.

Added file configuration for enhanced session recording. Added code to
startup enhanced session recording and pass package to SSH nodes.
2019-12-02 15:10:39 -08:00