Commit Graph
11 Commits
Author SHA1 Message Date
Mike Jensen fcc97de9f9 Better control on user injected environment values (#36132)
* Better control on user injected environment values

This commit includes two changes:
  * In `environment` we expanded the list of MacOS environment values which should be filtered.  It was demonstrated that these can be used to get code execution in MacOS.
  * In `reexec` we no longer provide the cmdmsg.Environment for the `teleport exec`.  As part of the development of a9055bccd9 it was attempted to fully clear out the environment, but testing showed that to be potentially problematic.  It was believed the safest option was to use the cmd environment, however this introduces a new source of environment variables.  Because this exec happens under `root` this is particularly dangerous (even more so when combined with the missed OSX values mentioned above).  As such we now are only providing the filtered exec environment, which is a closer (but safer) option to the functionality prior to a9055bccd9.

* Update filter to exclude all DYLD_ and LD_ prefixed variables
2023-12-29 19:25:53 +00:00
fheinecke b178b8b732 Updated Teleport codebase to AGPL3 license (#35259)
Signed-off-by: Fred Heinecke <fred.heinecke@goteleport.com>
2023-12-01 17:48:14 +00:00
rosstimothy 747bb34e7d Defer setting up enhanced recording until after PAM has completed (#29279)
The reexec process now has a two way wait mechanism to allow the
child process to complete any setup operations that may be required
before the parent process starts enhanced recording.

The old process was:

1) Parent launches child process
2) Child process opens PAM context and blocks on the continue signal
3) Parent sets up enhanced recording
4) Parent sends the continue signal
5) Child executes command/opens shell

The new process is:

1) Parent launches child process and waits for child continue signal
2) Child process opens PAM context and then signals it has completed setup
3) Parent receives child continue signal and sets up enhanced recording
4) Parent sends the continue signal
5) Child executes command/opens shell

Closes #29030
2023-07-25 14:54:15 +00:00
Jakub Nyckowski 7ccf2f219a Terminate the local shell when a session closes #19817 (#19817)
When a client sends an SSH session before the shell process ends, Teleport sends the SIGKILL signal to the subprocess. This causes the still-leaving shell to be resigned to PID 1 and live forever.
This PR tried to stop the terminal first before killing the subprocess to prevent the terminal from living forever.

Closes #13335
Closes #6245
Closes #4469
2023-02-24 13:56:11 +00:00
Brian Joerger a3bd4650d0 Provide proxy address when beginning a node session (#18579) 2022-12-02 01:56:22 +00:00
Jakub Nyckowski 0ee91f6c37 Enable GCI linter (#17894) 2022-10-28 20:20:28 +00:00
Jakub Nyckowski 716c2bdbf9 Fix BPF (#17269)
* Revert "Refactor bpf/restrictedsession usage in lib/srv (#15824)"

This reverts commit 769951fe4b.

* Remove unused Linux BPF includes

* Fix linter issue
2022-10-12 18:41:26 +00:00
Nic Klaassen d92cd32037 security: only allow one exec request per SSH channel (#16683) 2022-09-28 20:31:02 +00:00
rosstimothy 769951fe4b Refactor bpf/restrictedsession usage in lib/srv (#15824)
Invert the relationship of `lib/srv` and `lib/bpf`,
`lib/restrictedsession` such that `lib/bpf` is only imported in
`lib/srv/regular`. Since not everything is built with the `bpf`
tag it's important to reduce the surface area of `lib/bpf` such
that it isn't inadvertantly imported. For instance it was entirely
possible to import a package in `tsh` that transitively
depends on `lib/bpf` - which breaks the build since `tsh` is not
compiled with the `bpf` tag.

By refactoring the `srv.Server` interface not to use the `bpf.BPF`
and `restrictedsession.Manager` interfaces directly anything that
imports `lib/srv` now won't require that `-tags=bpf` is set in
order to compile.
2022-09-07 14:49:28 +00:00
Russell Jones fdf60ed994 Refactor tests under srv package.
Refactored all tests under "lib/srv" to use testify instead
of gocheck.
2022-07-15 13:04:45 -07:00
Michelle Bergquist ae3a61d72a add ServerHostname to audit event (#13156) 2022-06-10 08:42:59 -06:00