Commit Graph
24 Commits
Author SHA1 Message Date
Andrew LeFevre 9f9f7a639d expose error when PAM fails to write to stream (#67570) 2026-06-09 13:05:54 +00:00
Andrew LeFevreandErik Tate 6dacb41989 check arguments for NULL in converse PAM converse func, trim trailing newlines in user input (#67481)
* check arguments for NULL in converse PAM converse func, trim trailing newlines in user input

* Update session/pam/pam.c

Co-authored-by: Erik Tate <erik.tate@goteleport.com>

---------

Co-authored-by: Erik Tate <erik.tate@goteleport.com>
2026-06-05 21:36:12 +00:00
Andrew LeFevre 2a0d84e69f multiple small fixes around PAM error handling and cleanup (#67278)
* ensure PAM retval is always valid when calling pam_end, prevent deadlock in PAM.free()

* don't call PAM.free in PAM.codeToError, require explicit cleanup to avoid confusion

* unregister handler if Open fails

* always return an error from codeToError
2026-06-05 21:16:29 +00:00
Andrew LeFevre f62ceb241c return an error when an absolute path isn't specified in a moderated upload, or if the path is a dir (#67346)
* return an error when an absolute path isn't specified in a moderated upload, or if the path is a dir

* don't show the filename to moderators

* revert change to comment
2026-06-05 18:54:34 +00:00
Andrew LeFevre ce12c7736f handle failing to load PAM getenvlist symbol correctly (#67477) 2026-06-04 18:24:30 +00:00
Edoardo Spadolini 5c1c9d157d Disable the embedded session helper by default (#67386) 2026-06-03 09:56:48 +00:00
Andrew Burke 5b51177841 Block symlinks and relative paths for moderated file transfers (#65674)
This change updates moderated file transfers to not allow symlink
traversal or relative paths.
2026-05-14 20:40:14 +00:00
rosstimothy 0a7251aa83 Fix sudoers files not being written (#65998)
Teleport validates the contents of sudoers files by using visudo to
check the contents. The binary is invoked from disk using arguments
-c -f - which indicate to validate the content passed via stdin.

Ubuntu 25 and newer uses sudo-rs by default. This causes problems
because the version shipped in Ubuntu 25 does not contain the fix
for https://github.com/trifectatechfoundation/sudo-rs/issues/1358.
This causes visudo to attempt to read a file with the literal name
`-` instead of from stdin. As a result all Teleport sessions which
try to write a sudoers file entry get a file does not exist error
from visudo.

The sanest way to work around this issue without added burden to
end users is to stop using stdin with visudo. All sudoers entries
are first written to a temporary file on disk and that file is
provided to visudo.
2026-05-04 21:04:16 +00:00
Brian Joerger 6e40940512 Capture reexec networking stderr for logging (#65202)
* Capture reexec networking stderr and propagate it to the client.

* Move process closure higher in the callstack when waitReady fails.

* Add test for waitReady.

* Add t.Context() select case.

* Address comments.

* Resolve comments.

* Have callers provide context.

* Address comments.

* Fix merge conflicts.

* Fix typo.

* Fix test.

* Fix merge conflicts.

* Fix edge case with unbounded stderr.

* Fix lint.
2026-04-29 20:04:39 +00:00
Przemko RobakowskiandEdoardo Spadolini a13ff87916 Refactor command reexecution (#65562)
* Refactor command reexecution

* Review comments

* Review comments

* Document context

* Update lib/srv/bpf_test.go

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>

* Update lib/srv/ctx.go

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>

* Update session/reexec/reexec.go

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>

* Encode json before starting goroutine

* Update session/reexec/reexec.go

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>

* Fix ConfigureCommand cleanup

* Use map for extra files

* check nil

* e

---------

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>
2026-04-28 20:38:46 +00:00
Edoardo Spadolini b98921dff8 session-helper: Build changes (#66003)
* Build and test changes for sessionhelper

* Always print text in check-session-helper

* Fix TwoClustersTunnel
2026-04-24 10:07:18 +00:00
Andrew LeFevre 0a0f33b303 unset XAUTHORITY env var for the networking command (#65713)
* unset XAUTHORITY env var for the networking command

When Teleport passes almost all the environment variables to the child
processes that are born of a reexec. This is an issue when XAUTHORITY is
set as it will be passed to the networking process, causing `xauth` to
use a different file than the one that the SSH session process will use.
This is because the SSH session process only inherits a small subset of
the environment variables from the parent process, and XAUTHORITY is not
one of them. This causes X11 forwarding to fail.

* add Remove method to SafeEnv
2026-04-22 18:49:35 +00:00
rosstimothy 5870768c88 Stop using text/template and html/template to enable DCE (#65401)
All existing template usage was converted to make use of
github.com/DataDog/datadog-agent/pkg/template. The DataDog package
is a fork of the stdlib template packages with method calling
removed so that reflect.MethodByName does not prevent DCE.

There were a handful of method calls in our templates that were trivially
changed to use custom functions defined via FuncMaps or specifying the
calculated value to the template instead of calling a function in the template.

A future change will add linter rules to prevent new text/template or
html/imports from landing. They have not been included here so as
to not to break enterprise code while it is migrated.
2026-04-22 15:54:43 +00:00
Edoardo Spadolini 3da0f44c80 session-helper: embeddable binary and embedding logic (#65784)
* Clean up unneeded forwarder for reexec.IsReexec

* Disallow reexec through common.Run

* Remove the checkhomedir SSH subsystem

* Add true reexec subcommand

* Assume /proc/self/exe is always usable

* Add sessionhelper embed logic
2026-04-17 14:16:53 +00:00
Edoardo Spadolini bcffdcbfd6 session-helper: move the sftp subcommand to reexec.RunAndExit (#65392)
* Split the approver map away from FileTransferRequest

* Move or copy files in session/reexec/sftputils and session/reexec/reexecsftp

* Split up copied files and clean up the new session packages

* Use custom types for SFTP audit log events

* Clean up imports and run sftp in RunAndExit

* Finish renaming types and functions

* Streamline reexec in main and tests

* Add test with the legacy SFTP event implementation
2026-04-15 13:28:27 +00:00
Andrew LeFevre cee8aba4cb update SSH SELinux module to work with cilium/ebpf (#65049)
Also ensure the specified Teleport binary has the proper context
restored when using the SELinux module install script.
2026-04-14 20:44:49 +00:00
Edoardo Spadolini a60b33de5e Convert the template in session/auditd to string formatting (#65393) 2026-04-08 10:16:09 +00:00
Edoardo Spadolini 825b23049e session-helper: move srv.RunAndExit to session/reexec (#65263)
* Move the reexec parts of lib/srv to session/reexec

* Update references to the moved bits of lib/srv

* Avoid testutils in session/reexec

* Shuffle some constants around to avoid imports in session/reexec

* Vendor in the relevant parts of logutils in session/reexec

* Remove unnecessary symlink checks when opening files

* Inline the last two things from lib/utils in session/reexec

* Inline moved constants

* Deprecate group name consts and fix missed inlines

* Add missing session/reexec.TestMain with reexec check

* Reuse existing constants from the log constants package in session

* Fix broken godoc link
2026-04-08 09:40:52 +00:00
Edoardo Spadolini 644f415a27 session-helper: submodule preparation and dependencies of lib/srv/reexec.go (#65145)
* Depguard rules for the session submodule

* Move lib/auditd to session/auditd

* Move lib/loginuid to session/loginuid

* Reduce dependencies of lib/utils/envutils

* Move lib/utils/envutils to session/envutils

* Split the SSH utilities of sshutils/x11 into sshutils/x11forward

* Move lib/sshutils/x11 to session/networking/x11

* Move lib/sshutils/networking to session/networking

* Move lib/shell to session/shell

* Move lib/utils/uds to session/uds

* Move lib/utils/host to session/host

* Move lib/pam to session/pam

* Avoid lib/utils/log in session/pam

* Move lib/service/servicecfg.PAMConfig to session/pam/pamcfg.PAMConfig

* Move lib/srv/uacc to session/uacc

* Avoid importing lib/utils in session/uacc

* Move lib/selinux to session/selinux

* Avoid lib/utils and lib/utils/log in session/selinux

* make go-mod-tidy-all

* Update oss-fuzz path for session/networking/x11
2026-04-01 12:34:10 +00:00
Alex Lyulkov 9afc9a38a1 Fixed imports 2015-10-05 17:33:25 +03:00
Alex Lyulkov 888c340f97 Moved from backend to services 2015-08-25 20:54:16 +03:00
klizhentas 9b094782ae using session model to connect everywhere 2015-07-03 13:08:26 -07:00
klizhentas 0fadb4a44f not too embarrasing 2015-07-02 17:16:44 -07:00
klizhentas e1fafe7c93 WIP: adding backend sessions support 2015-06-30 16:12:18 -07:00