Commit Graph
803 Commits
Author SHA1 Message Date
Michael 399ddddaa2 Pick edition logo at build time instead of runtime config (#66815) 2026-05-26 17:23:06 +00:00
Cam Hutchison 54273f91fe fips: Switch to Go-native FIPS140 builds from boring crypto (#66690)
* fips: Switch to Go-native FIPS140 builds from boring crypto

Switch to using Go-native FIPS140 builds, using the GOFIPS140 build
environment variable, from the old boringcrypto FIPS140 build. The
latter is no longer supported now that Go supports FIPS140 builds
natively.

FIPS140 is enabled across the build when FIPS=1 is passed to `make` when
building. The main package of the binaries import the `lib/fipscheck`
package to ensure that a binary is not switched into or out of FIPS140
mode at launch time using the GODEBUG environment variable.

FIPS140 builds of OSS Teleport are not a supported configuration,
however the base of the Enterprise edition is the OSS repository, so
most of the changes are in this repository. Building OSS Teleport in
FIPS140 mode may not be complete.

* fips: Stop using fips buildbox

Stop using the fips buildbox for fips release builds, and just use the
normal centos7 buildbox. The fips buildbox sets
`GOEXPERIMENT=boringcrypto` which should no longer be set when building
with Go-native FIPS140. The fips buildbox is otherwise identical to the
non-fips buildbox.
2026-05-20 00:42:41 +00:00
Tiago Silva fb98c980ec Add enum value rendering to CLI docs and remove duplicate descriptions (#66466)
This commit enhances the CLI reference documentation by automatically
displaying valid enum values in the "Default" column of flag tables,
eliminating the need to manually list these values in flag descriptions.
It also adds a CI step to verify that CLI reference docs stay in sync
with source code changes.

The core implementation uses reflection to extract enum values from
kingpin flags and formats them as "(valid: `value1`, `value2`, ...)".
All CLI source files have been updated to remove duplicate enum value
lists from flag help text, as these are now automatically rendered.

A new 'cli-docs-up-to-date' Makefile target and corresponding GitHub
Actions workflow job ensure that any changes to CLI flags are reflected
in the generated documentation.

Example output:
Before: |`--format`|`yaml`|Output format, 'yaml', 'json', or 'text'|
After:  |`--format`|`yaml` (valid: `yaml`, `json`, `text`)|Output format.|

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
2026-05-08 13:53:15 +00:00
Cam Hutchison 937e6fcaa6 fips: Build fips binaries via OSS Makefile (#66385)
Update the targets in `build.assets/Makefile` to build fips binaries by
calling `release-ent` in the OSS Makefile instead of calling `release`
in the Enterprise Makefile. This allows the top-level Makefile to set up
things properly for building fips (GOEXPERIMENT, and soon GOFIPS140)
rather than having to duplicate it in the Enterprise Makefile or fips
buildbox.

This also means we no longer need to pass through VERSION and GITTAG to
the Enterprise make as this is set by the OSS Makefile.

Remove the guard on the `release-ent` target. That should fail if there
is no Enterprise repo checked out. Other places where it is guarded are
when it performs an OSS + maybe enterprise operation, which should not
fail. But an explicit call for `release-ent` should fail if the repo is
not checked out.
2026-05-08 01:24:10 +00:00
Alan Parra 13134bc98a Ignore "*.tftest.hcl" files on addlicense (#66481)
* Ignore "*.tftest.hcl" files on addlicense

* Ignore 'web/packages/teleterm/build/**'
2026-05-06 17:27:38 +00:00
Andrew LeFevreandAndrew LeFevre 7e0e6c9794 Fix unreadable Enhanced Session Recording events (#64581)
* refactor command and disk eBPF programs to fix some events not getting emitted

* fixed handling of flags in disk events

* remove unused constants to appease linter

* handle failing to read filename in enter_execve correctly

* added more tests

* prevent potential panic if args_len exceed args buffer size

* handle empty args in command events correctly

* minor changes from feedback

* update comments in eBPF files

---------

Co-authored-by: Andrew LeFevre <andrewlefevre@goteleport.com>
2026-05-04 12:25:25 +00:00
Gus Rivera 415a6810a0 Adding export back to makefile (#66375) 2026-05-02 10:42:43 +00:00
Hugo Shaka 8ea6a9b687 Consolidate all the Helm Makefiles (#65455)
* Extract Helm logic into lib

* Add helm-janitor

* Fix lint values

* Use helmjanitor for tests, lint, and version-update

* Convert example/chart Makefile to helm-janitor + add library support

* Fix release pipeline

* lint

* Disable CGO

* lint
2026-04-29 21:26:31 +00:00
Brian Joerger a09174cd0b Add piv tag for lint-api make target; Fix lint errors in piv package. (#65669) 2026-04-29 17:50:49 +00:00
Zac Bergquist 9da22d53a3 Minor Makefile improvmements (#65180)
- Remove unused targets
- Use $(MAKE) for better flag propagation
- Fix error in sloccount target
2026-04-26 03:31:01 +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
rosstimothy ed41e6c9d5 Enable DCE for most binaries (#66033)
The linker is now able to perform DCE for all binaries except tsh
and teleport. A change to enable DCE for teleport will come in the
future. DCE for tsh will be harder to achieve until kubectl dependencies
are capable of DCE.

This udpates e to include https://github.com/gravitational/teleport.e/pull/8447
which removes the last template usages in enterprise code. Now that
templates are no longer imported a depguard rule has been added to
prevent it from being imported in the future.

The last step to eliminate DCE was to add the grpcnotrace build tag
to all binaries.
2026-04-23 00:15:07 +00:00
rosstimothy 30a56a5c91 Update Access List and Access List Member equality operations (#64715)
Adds an additional accesslist.EqualAccessListsOption,
accesslist.WithIgnoreOktaUserManagedFields to support equality checking
which ignoring Spec.Owners, Spec.MembershipRequires, spec.OwnershipRequires,
and Spec.Audit. This will be used to replace the current go-cmp usage
to determine whether modification of Okta Access Lists are allowed.

(AccessListMember) IsEqual has been restored with a goderived implementation
which checks full equality. This was removed in https://github.com/gravitational/teleport/pull/64542
to prevent accidental use with a services.Reconciler. As of
https://github.com/gravitational/teleport/pull/65151, the Reconcilers
require an explicit comparison function instead of implicitly using
an IsEqual implementation the concerns which led to removing the IsEqual
are slightly mitigated.
2026-04-20 18:04:21 +00:00
Ryan ClarkandRafał Cieślak 09156cb157 Run E2E tests in CI (#64557)
* Run E2E tests in CI

* Rename results JSON so upload-artifacts finds it

* Skip failing auth connector test

* Remove e2e's pnpm workspace, add it to root

* Use cache v5

* Change paths-filter checkout to only on merge group

* Add timeout to e2e tests job

* Only run build/test if there are changes

* Cache the pnpm store instead of node_modules

* Add rust-toolchain.toml to changed files detection

* Add rust-toolchain.toml and Makefile to Rust cache hash

* Add build.assets/Makefile to Rust cache too

* Expand the path filters to capture more changes

* Improve the build error reporting, upload failure logs as artifacts

* Add `contents:read` permission for checkout in merge_group/push triggers

* Cancel previous jobs on new push in a PR

* Move type checking to earlier to fail faster

* Use the correct glob syntax

* Remove redundant env var

* Validate playwright version before trying to get the container

* Use fetch-depth: 1 for faster checkouts

* Use bash for pipefail

* Add versions.mk to changes detection and Rust cache key

* Use bash for version checking

* Ensure build is successful before running tests

* Exit with code 1 if any build failed

* Remove redundant corepack enable

* Use exit $failed for consistency

* Exit as early as possible if e2e type-checking errors

* Remove pnpm store cache as pnpm install is fast enough

* Change playwright back to ^, remove validation, get version from installed

* Run playwright version getter in e2e dir

* Add nested Cargo.toml to paths filter

* Add --init to playwright container

* Add --ipc=host to playwright docker container

* stateRestoration.spec.ts: Limit number of `login` calls

This is to avoid running into auth rate limits when running the full
Connect test suite.

* Cleanup temp dir if `fs.cp` fails

* Remove typescript/node types from e2e package.json

* Move GitHub report to a separate step

* Add more pnpm stuff to paths filter

* Skip for dependabot PRs

* Add persist-credentials: false to checkout

* Move e2e binary building to a bash script

* Define the test results JSON path only once

* Move PR comment management to gh CLI calls instead of runner

* Add build-e2e-binaries.sh to paths filter

* Handle the possibility of a missing PR comment file

* Move PR comment posting to a separate job

* Always run the update-pr-comment job

* Print logs instead of uploading them

* Add the repo name to the concurrency group

* Up test timeout limit to 20s

* Add a SHA flag to the e2e report command

* Fix the GitHub comment not deleting on success

---------

Co-authored-by: Rafał Cieślak <maja.cieslak@goteleport.com>
2026-03-31 15:39:37 +00:00
Zac Bergquist 989cdc3732 Remove OpenSSL FIPS configuration from the FIPS build image (#64591)
PR #34950 put OpenSSL into FIPS mode in the _build container_,
which causes any build tooling that relies on OpenSSL to use FIPS
crypto.

A result of that change is that we can no longer update our Rust
toolchain. The `cargo` utility shipped with Rust versions newer
than 1.86 depends on a newer version of OpenSSL, and when this
version runs in FIPS mode cargo itself is not able to fetch dependencies
from the public registry due to incompatible cipher suites.

Note: our build artifacts are still compiled against FIPS-validated
modules (Go's GOEXPERIMENT=boring, and Cloudflare's boring crate for
Rust).
2026-03-20 20:21:26 +00:00
rosstimothy 813a507d95 Stop comparing AccessListMembers with go-cmp (#64542)
Replaces `(AccessListMember) IsEqual` with a local goderived
implementation in local/services. All reconcilers
have been previously updated to specify their own comparison
function to prevent this change from breaking enterprise in
https://github.com/gravitational/teleport.e/pull/8233.

IsEqual was not updated to use the goderived implementation because
different use cases have different ideas about equality. A single
API to support them all is untenable and confusing. As a result the
callers are now responsible for adhering to their own equality
definitions. If in the future another use case arises that requires
full equality IsEqual may be reconsidered.
2026-03-16 18:50:02 +00:00
Matt Smith 4424d04dc0 Release 19.0.0-prealpha.2 (#64631) 2026-03-13 17:56:57 +00:00
Matt Smith 53aeefd389 Release 19.0.0-prealpha.1 (#64603)
* Release 19.0.0-prealpha.1

* Update changelog
2026-03-13 13:34:56 +00:00
Ryan ClarkandNick Marais 45a1d737b1 Add a runner utility for E2E tests (#64214)
* Add a runner utility for E2E tests

* credentials -> usercredentials

* Use NotifyContext instead

* Add a comment about the port allocation

* Use `getByTestId`

* Update e2e/tests/auth.setup.ts

Co-authored-by: Nick Marais <nicholas.marais@goteleport.com>

---------

Co-authored-by: Nick Marais <nicholas.marais@goteleport.com>
2026-03-10 17:15:54 +00:00
ravicious 80d2c2760d make update-tag: Add GOWORK=off to go run ./cmd/check (#64463) 2026-03-10 14:27:19 +00:00
Luke Okraszewski 97aa043722 make test-logs mkdir idempotent (#64415)
There is a chance that for parallel targets that check the order
only deps the dir is not found for both leading to one mkdir failing.
2026-03-09 14:46:29 +00:00
Luke Okraszewski c223947413 [ci] add differential benchmark workflows (#63100)
This commit does the following:
- Move existing smoke benchmark workflows to seperate workflow.
- Add differential benchmark workflows
- Split benchmarks into heavy and micro categories
- Add make target arguments for benchmark time and count
- Move smoketests to run only on PRs
- Differential benchmarks run on merge queue

Benchmarks above 1ms/op are considered heavy and should make
use of iteration based benchtime to prevent the CI job from taking
too much time. Benchmarks are skipped based on env vars, this is an
alternative to splitting benchmark targets into seperate files with
build tags.

The smoke tests should be much faster and as such are set to run
on PRs to ensure the targets are not broken in the change.

The current parameters for differential benchmarks attempt to balance
CI runner time and confidence for benchstat.

Differential benchmarks determine the base commit to run the tests against,
this happens within the same job to remove the runner to runner variance.
2026-02-20 15:31:03 +00:00
Luke Okraszewski eea85f5f49 [ci] add upload of test results to s3 (#63629)
The upload steps are non-blocking, should they
fail the workflow status will not be affected.

This commit also changes the way the test logs are created,
now each Makefile accepts `TEST_LOG_DIR` as an optional parameter,
defaulting to `./test-logs`. This allows the top level Makefile
to propagate the location for the sub modules to write their
junit output, such that the CI jobs do not need to track
which top level make target corresponds to which directory.
Instead a simple glob is used to grab all the xml JUNIT files.

This approach also allows more targets to be added or removed in the future
without modifying the CI job definitons. Another benefit is allowing
the caller to modify the output destination should we want to bundle
the files as job artifacts in the future.

Makes `TEST_LOG_DIR` an order only dep for all targets.
2026-02-20 14:23:25 +00:00
Andrew LeFevre 7ec6d03b52 use the audit login session ID to track sessions when using Enhanced Sesssion Recording (#63050) 2026-02-19 18:20:18 +00:00
Luke Okraszewski e9356dbd90 [tools] add benchstat tool (#63694)
* [tools] add benchstat tool

Adds `golang.org/x/perf/cmd/benchstat` to tools.
Required for differential benchmarking.

Example:
```
make test-go-bench BENCH_OUTPUT=a.txt
make test-go-bench BENCH_OUTPUT=b.txt
make benchstat "BENCH_FILES=a.txt b.txt"
```

While the tool can be invoked directly, the Make target
provides a convient command for CI workflows.

* missing newline

* bump benchstat deps
2026-02-17 15:46:54 +00:00
Luke Okraszewski 8f4131ff15 [tools] move go tools to isolated dir (#63724)
Each go tool will now reside in a isolated dir under
`build.assets/tools`, this allows us to isolate the
deps of each tool from both main module without
merging them for tools. This should make reviewing
tools and dep changes easier at a glance and remove
noise from main module dep manifest.

Each tool is a Makefile var to allow easy overrides
over a macro which cannot be temporarily unset/overriden.

The tools have been added to common.mk for easy reuse
across OSS and e.
2026-02-16 12:30:30 +00:00
Bartosz Leper 891d155d2b Change Go test deps to fix a flaky filesessions test (#63448) 2026-02-11 15:58:55 +00:00
Gavin Frazar a0b1ddb107 Generate reference docs for Terraform modules (#63314)
* Generate reference docs for Terraform modules

* Check Terraform module reference docs are updated
2026-02-02 14:59:04 +00:00
Paul Gottschling e58e510ef2 Generate a tctl reference page (#62729)
* Generate a tctl reference page

Add a `cli-docs-tctl` Make target and generate the page.

To allow the page to render, make the `tctl edit` help text more
consistent with that of other commands by using a single line for the
resource type/name argument.

This change adds 47 `tctl` commands not present in the current
reference.

Also change the default value of the `tctl recordings download`
`output-dir` flag to the system-independent "." value. Otherwise,
generating this page prints a system-specific file path.

Also make minor modifications to flag, argument, and command
descriptions to be consistent with messaging conventions in the docs.

* CLI ref generator: add arg/flag default overrides

In the CLI reference doc generator, make it possible to override default
argument and flag values. This is necessary when these values are
dynamic and system dependent, e.g., a user's home directory.

Add the `flag_default_overrides` and `arg_default_overrides` fields to
the generator config file. Use these fields to create template functions
that replace default values in a `*kingpin.FlagModel` or
`*kingpin.ArgModel`.

* Add flag default overrides for tctl reference

Configure flags with dynamic values to have hardcoded values in the
reference docs page so there is no need to edit the dynamic argument
logic in the tctl source.
2026-01-30 15:46:28 +00:00
Luke Okraszewski 3677d382d5 [tooling] add benchfind (#62981)
This commit adds benchfind, a cli utility which can be used
to discover Benchmark test targets in a golang tree. The reason
this is useful in a large codebase is that to run `go test -bench ./...`
would require the linking of every test target binary. This can
take 1h+. Previously a `grep` expression was used to find targets:

```sh
grep --exclude-dir api --include "*_test.go" -lr testing.B .  | xargs dirname | xargs go list | sort -u
```

The issue with this is that it can break when the tree contains
other go modules and requires handling of pipefail. Instead a single
utility is provided.

This can now be replaced with:
```sh
benchfind ./...
```

Note that the tool will respect module boundaries, instead of
having to explicitly exclude them, call the CLI multiple times with `-d`
flag.
2026-01-28 10:54:06 +00:00
Luke Okraszewski 9f2498e7cd Exclude gen dirs when finding benchmarks (#62969)
This is a workaround to fix the failing benchmark targets both
locally and ci. Note that trying to run Benchmarks across go modules
will fail which is the underlying failure here. This commit will
unblock ci.
2026-01-22 10:57:55 +00:00
Paul Gottschling c82c0c1ae1 Generate a teleport CLI reference page (#62733)
Add a `cli-docs-teleport` Make target and generate the `teleport` CLI
reference page.

Edit the `teleport` app description to work with both in-app help text
and the generated docs.
2026-01-20 14:36:46 +00:00
Zac Bergquist 07aa756126 Add Rust RDP decoder library (#61858)
This library makes the IronRDP fast path decoder available to Go code
via CGo. There are three build options:

1. A standalone library (for use by tsh), enabled with the rust_rdp_decoder
   build tag.
2. All functionality included in the existing RDP client library,
   enabled with the desktop_access_rdp build tag.
3. A no-op implementation which avoids any Rust dependencies.

The decoder also respects the RDPCLIENT_SKIP_BUILD=1 flag from the makefile,
under the assumption that if you don't have Rust tooling and don't want
to build the RDP client that you also don't want the decoder.
2026-01-18 18:40:04 +00:00
Paul Gottschling 76c8ab4649 Generate a tbot reference page (#62732)
Add a `cli-docs-tbot` Make target and generate the page.

This change adds 19 `tbot` commands not present in the current
reference.

Also make minor changes to the app description so it can apply to both
in-app help text and generated docs.
2026-01-16 18:31:43 +00:00
Edoardo Spadolini 2c221c7905 Disable -buildmode=pie (#62776)
* Disable -buildmode=pie

* Update e
2026-01-12 18:50:00 +00:00
Zac Bergquist 57ea14be8b Fix make build-binaries (#62626)
* Fix make build-binaries

The dockerized build (make -C build.assets build-binaries) fails
with GLIBC errors because it is a multi-stage build that runs
across several different containers.

First, we build the webassets in buildbox-node. Then we build the
Teleport binaries in buildbox-centos7, reusing the webassets built
previously.

The issue arises because buildbox-node runs a newer version of GLIBC
than buildbox-centos7, and we weren't properly cleaning some build
artifacts when switching from one builder to another. As a result,
the centos7 builder would see intermediate artifacts with a dependency
on a GLIBC version that is too new.

Fix the issue by ensuring we run a clean-build after hopping into
the centos7 container.

Closes #62594

* Fix build-enterprise-binaries too
2026-01-07 02:38:18 +00:00
Noah Stride ecb5d66c07 SPIFFE Daemon Set Helm Chart (#61424)
* Skeleton/README

* Update Makefile with new targets

* More makefile changes

* Add Chart.yaml

* Add _helpers.yaml

* Add supporting RBAC

* Add values file and tweak config

* Add ClusterRole/ClusterRoleBinding

* Fix docs on values

* Hack on daemonset definition

* templatize security contexts

* Fix up daemonset labels/matchers

* Add workload api listener to tbot config

* Fix bad service account name

* Support debug mode logs

* Add value for workloadIdentitySelector

* Update documentation

* Add snapshot testsAdd snapshot testsAdd snapshot testsAdd snapshot
testsAdd snapshot testsAdd snapshot testsAdd snapshot testsAdd snapshot
tests

* Add to the chart index

* Fix missing "?" in helm value

* Generate reference doucmentation

* Appease newline linting

* Add note regarding high level of privileges

* Update chart ref
2026-01-02 15:47:40 +00:00
Paul Gottschling c4e5b6c60d Add a resource reference generator (#60395)
* Add a resource reference generator

Closes #16948
Closes #9949

Implements RFD 130.

See the included README for information about how the generator works.

This implementation breaks from, and updates, RFD 130:

- The reference includes separate pages for dynamic resources in order
  to make it easier to read. Edit the RFD to be less specific about the
  output template so this isn't wedded to implementation details.
- The generator uses a YAML configuration file. This is because the
  config ended up including more fields than specified in the RFD, so
  separating the config from the source made sense to give users less
  noise to deal with.
- The generator requires that a user specify the resources to include in
  the reference docs. This makes it easier to start with a smaller, more
  manageable set of resource reference docs.
- Support RFD 153 in the reference generator: RFD 153 resource types
  include unexported fields and include a `Metadata` field from a
  different package than legacy resources types. They also include the
  `Metadata` field with a pointer. Adjust the generator to ignore
  unexported fields in struct declarations, and to treat pointer field
  types the same way as value field types.
- Remove the description of example YAML delimiters. These are no longer
  viable, as we maintain several documentation generators that extract
  comments from the source. Instead, if we can't generate example YAML,
  show a comment in the YAML example advising the reader to read the
  description of a field.

Other changes:

 - Add a Make target for generating dynamic resource reference
   documentation, plus a target for checking that the resource reference
   docs are up to date. Run the checker in the `Lint (Proto)` job.
 - Generate reference docs for Bot, RoleV6, OIDCConnectorV3, and
   SAMLConnectorV2.

* Clean up the resource reference generator

- Remove an unneeded import.
- Use slices.SortFunc instead of sort.Sort for sorting reference entry
  fields.
- Change `errors.Is(err, NotAGenDeclError{})` calls to use `errors.As`.
  While `NotAGenDeclError{}` structs are always empty, using `errors.As`
  ensures the calls still do the same thing if we add fields to the
  type.
2025-11-25 15:27:14 +00:00
Paul Gottschling 626fdf048e Generate an Access Monitoring event reference (#61632)
* Generate an Access Monitoring event reference

Closes #60074

Use the getters we declared to access protobuf-generated event structs
in order to create Athena views for Access Monitoring events, populating
a template with the event structs and including examples of `tctl audit
query exec` queries.

Add Make targets to generate the page and check that it was generated.
Add a step to the `Lint (Proto)` job to check that this was generated.

* Clean up the event schema reference generator

- Remove unnecessary line breaks.
- Move `teleport` requirement into the main `require` block.
- Embed the template.
- Accommodate characters that exceed one byte in `prepareDescription`.
- Use a no-allocation alternative to strings.Join in `colNameList`.
2025-11-24 17:25:28 +00:00
Hugo Shaka 3c4b355560 Strip VCS build information from go builds (#61502)
Scanners such as trivy are misinterpreting the go pseudoversions
describing which commit was used to build the project.
See: https://github.com/aquasecurity/trivy/discussions/9446

This causes false positives and considerable toil for our support team
as every user/customer is seeing trivy reporting that Teleport is
affected by CVE-2022-36633 (it is not).

Trivy doesn't seem to want to fix their tool so we must strip VCS
information from the go binary to stop the false positives.

This actually makes the binaries _less traceable_, but this is the only
workaround to reduce the noise caused by those tools.
2025-11-19 17:28:46 +00:00
Andrew LeFevre 8e41e5da36 add bpf integration tests (#61408) 2025-11-17 20:24:28 +00:00
rosstimothy a986f9fd48 Generate test artifacts (#61296)
Updates test targets to output json and junit files. These files
will be forwarded to a durable storage location in the future to
be consumed for analytical purposes.
2025-11-14 23:19:36 +00:00
Andrew LeFevre d46bec8af0 fixed bpf-bytecode make target exiting with error when not called (#61240) 2025-11-11 20:39:40 +00:00
7a7f08cb39 Replace aquasecurity/libbpfgo with cilium/ebpf (#60541)
* start the refactor away from aquasecurity/libbpfgo to use cilium/ebpf

Remove debug statements and unused code in BPF library

This commit eliminates unnecessary debug log statements from bpf_test.go and removes unused code in disk.go and network.go files within BPF library. The aim is to make codebase cleaner, enhancing readability and maintainability without losing track of functional aspects. It's part of an ongoing effort to maintain optimal code quality across the project.

Revise Dockerfile and Makefile instructions

Adjusted Dockerfile and Makefile commands to optimize build process. The changes ensure better readability and maintainability of code, especially with respect to BPF bytecode and test preparations. A clause was also added to check for the presence of clang before building BPF bytecode.

Refactor BPF code and tests

Refactored BPF source code and its corresponding tests for better readability and efficiency. This includes updating data structures like rawExecEvent, rawOpenEvent, rawConn4Event and rawConn6Event to their more meritorious versions like commandDataT, diskDataT, networkIpv4DataT and networkIpv6DataT respectively. Also, generated concise and clear bindigs for eBPF programs to replace the previous multi-arch setup. Furthermore, correspondingly adapted all related test cases arising in bpf_test.go, command.go and other files.

Remove counter_test from BPF and related test code

This commit removes the file counter_test.bpf.c from the enhanced recording in BPF. Following this file deletion, corresponding test functions in bpf_test.go, that were originally testing the functionality provided by counter_test.bpf.c, have been removed as well.

Refactor BPF test and improve error handling

The commit refactors the BPF test suite to run each test as a sub-test by using t.Run, easing debugging and error tracing. It also simplifies the 'executeCommand' function by removing redundant function calls related to finding executable files, and improves error handling. In 'cgroup.go', the code has been adjusted to retry on EBUSY errors when removing a cgroup, instead of ignoring them.

Update cgroup deletion process and error handling

The changes made introduce a retry mechanism when deleting a cgroup in case the cgroup is busy. This prevents a failed attempt from immediately returning an error. Additionally, error handling has been improved in the 'writePids' function to better handle 'no such process' errors.

Enhance cgroup monitoring in disk.bpf.c

The code has been updated to check if current cgroup is being monitored in the "enter_open" method of "disk.bpf.c". If the cgroup is not marked for monitoring, it will be ignored, enhancing overall cgroup management.

Improve resource handling

This commit introduces a deferred close to the sendEvents function to ensure proper resource handling of the eventBuf object.

Add rlimit package to remove resource limits

Introduced the "github.com/cilium/ebpf/rlimit" package and added a function to remove resource limits for kernels less than 5.11. This operation is necessary for kernels with a lower version because they may face issues when running applications with allocated memory limitations.

Fix a test after rebase

Refactor BPF testing setup and implement session closing

This commit updates the BPF testing structure to remove the context dependency in event generation functions, simplifying the test setup. Additionally, it adds a 'closed' field to the 'open', 'conn', and 'exec' structs alongside mutex protection. This implementation allows checking if a session is closed before any operations, correctly handling already closed sessions. Furthermore, it corrects tracepoints for handling 'openat' and 'openat2' system calls for different platforms. This refactoring effort aims to improve the robustness and readability of the BPF testing suite.

Update conditions for BPF bytecode building

This update modifies the Makefile to add a conditional check for the presence of /usr/include/bpf/bpf_helpers.h. This new requirement must be met along with the existence of /usr/include/linux/bpf.h and the installation of Clang, in order to facilitate the correct build of BPF bytecode. Consequently, this change enhances the reliability of the build process.

Add conditional for bpf_helpers.h in Makefile

This commit adds an additional check in the Makefile for the existence of /usr/include/bpf/bpf_helpers.h. This ensures that BPF bytecode only gets built when both bpf.h and bpf_helpers.h exist, and Clang is installed, improving the build process reliability.

Refactor and improve BPF bytecode generation

This commit refactors and improves the BPF bytecode generation process. It introduces distinct bytecode structures for different architectures, ensuring better compatibility and execution. The BPF test is adjusted due to its tendency to fail unpredictably, hence it's commented out to avoid unnecessary build failures. This commit also eliminates certain redundancies in `common.mk`, improving the clarity of the build process.

Comment out test code in bpf_test.go

The test code in the file bpf_test.go has been commented out. These changes are circumstantial and do not imply that the test code is obsolete or unnecessary. The use of such tests may be needed in future commits or for local development testing and debugging.

Remove libbpf dependency from Vagrantfile and update README

The Vagrantfile and README have been updated to remove the no longer needed libbpf dependency. This change simplifies the project set up by eliminating unused build steps in the Vagrantfile and correcting related instructions in the README. This results in a more streamlined, intuitive build process and reduced potential for code complexity and dependency conflicts.

Remove obsolete dependencies and related code blocks

The 'aquasecurity/libbpfgo' library referencing and the related code blocks have been removed from the test files and core modules. The corresponding setup instructions in the dockerfiles and build scripts have also been eliminated. This update simplifies the build process and overall project structure while reducing unnecessary dependency risks.

Remove aquasecurity/libbpfgo dependency

Remove restricted.bpf.c

Migrate disk events to cilium

Migrate network events to cilium

Remove restricted session

Use cilium/ebpf for BPF

* fix build issues caused by stale branch

Also updated bpf bytecode, updated github.com/cilium/ebpf to 0.19.0,
and updated bpf/README to reflect changes

* fix tests and a bit of cleanup

Also added a subtest and fixed receiving IPv6 network events and
fixed attempting to create tracepoints for syscalls that are not
present on arm64.

* repurpose buffer size configs to set event channel buffer size

* add new GHA job to check that generated eBPF files are up to date

* fix lost event promethus counters and address feedback

* address feedback

* use only unsafe instead of CGO to convert C strings

* rename common_data_t comm -> command

* convert strings in bpf programs from char arrays to u8 or uint8 arrays so we can convert them to Go strings without the use of the unsafe package

---------

Co-authored-by: Jakub Nyckowski <jakub.nyckowski@goteleport.com>
Co-authored-by: Tim Ross <tim.ross@goteleport.com>
2025-11-11 15:33:32 +00:00
rhammonds-teleport 6377a5b119 Upgrade IronRDP Dependency (#59661)
* * Update to latest commit of IronRDP.
* resolve conflicting 'getrandom' dependencies.
* Add necessary RUSTFLAG env var to ironrdp-wasm compilation. Needed by 'getrandom' dependency to enable its wasm_js feature.
* Configure client to use remotefx codec.
* Bump rust toolchain version to 1.86.0.
* Unset existing rustup overrides before building rdpclient or ironrdp wasm module.
* Fix lint warnings after Rust toolchain upgrade.

* Simplify BitmapFrame rendering and fix some rendering glitches that were revealed after updating IronRDP

* fix typo

* Try to determine the active Rust toolchain and print a helpful warning if it does not match the version defined in our toolchain file.
2025-11-05 15:40:02 +00:00
Paul GottschlingandRafał Cieślak 11f1d646eb Add an audit event reference generator (#60290)
* Add an audit event reference generator

Closes #5044
Closes #10350

This change adds a generator for audit event reference documentation
based on Web UI audit event formatters and, if available, test fixtures.

Previous attempts to generate an audit event reference drew from the
Teleport source using `AuditEvent` declarations (#13615) and naming
conventions (#38344), but inconsistencies within the source meant that
the resulting generator was inadequate. The Web UI source files
represent the most complete set of source data we have on audit event
schemas.

Implementation details:

- If an event includes a fixture, use that as an example of its schema.
  For any event formatter with no test fixture, include the event, type,
  code, and description in the reference guide using data from the
  formatter, but don't include an example.
- If one event type includes multiple possible codes, document each code
  in an H3 section.
- Ignore instances of the same code beyond the first occurrence.

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>

* Get rid of `any` in types

The events map did not define what types it stores, so TypeScript
defaulted it to Map<any, any>. After adjusting this type, it turned out
that there were many functions with worked on Event but were actually
given ReferencePageEventData, so I changed their signatures too.

Types usually start with upper case, hence ReferencePageEventData and
not referencePageEventData.

The `as` in `Object.keys(formatters) as Array<keyof Formatters>` was
not necessary, as TypeScript correctly infers the type here.

* Add more context to the README

* Add shorthand command to build and gen reference

* Check audit event reference docs in CI

Add Make targets for running and checking the audit event reference
docs. Add a step to the GitHub Actions job that runs Web UI linters to
check the audit event reference docs.

---------

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>
2025-10-29 14:37:41 +00:00
Edoardo Spadolini 19cb4f5515 Add chart for the Relay service (#59454)
* Chart yaml, values and helpers

* address comments

* autogenerated reference docs

* add missing extra labels and annotations for the service

* admonition formatting

* version and image helpers

* join secret name helper

* resources

* update reference

* add linting

* Add helm unittests

* Allow custom key for the trusted CA bundle secret

* Remove check for negative replicaCount value

* Clean up .lint/full.yaml and fill it in a bit more

* Fix selector labels indentation in PDB

* Redo tests avoiding snapshots

* Update exercise-configmap to render the whole chart for linting
2025-10-02 16:17:46 +00:00
rhammonds-teleport f09d381132 Add Rust Toolchain File (#59335)
* Add rust toolchain file

* Determine rust version by checking the top level toolchain file. Remove overrides.

* Remove explicit overrides and target installation from workflows.

* Remove from macOS build docs any language about installing specific rust toolchains or setting overrides. We're relying on the toolchain file and rustup to quietly install and use the toolchain(s) specified by the toolchain file.

* Always re-install wasm-bindgen if the currently installed version is out-of-date

* e submodule invokes the 'rustup-set-version' target, but it is not needed now that we have the toolchain file. Leave this target in for now so that we don't break the build. We can clean it up later.

* Remove target that install wasm toolchain. It is no longer necessary.

* Fix awk expression that extracts rust version from the toolchain file.

* Fix comment and remove explicit rust toolchain install from lint workflow

* We still need to ensure that rustfmt and clippy are installed on machine that runs rust lint.
2025-09-26 16:36:48 +00:00
Zac Bergquist 80bbf6fa8f Pin tool versions using Go tool deps (#59540)
* Pin tool versions using Go tool deps

Use versioned tools rather than installing @latest on every run.
This ensures consistency across developer machines and can also
help protect against supply chain attacks.

Updates usages of gci, goda, and gotestsum.

* make go-generate
2025-09-24 19:18:56 +00:00
Noah Stride 0b000b6d28 Remove DevBox (#59455) 2025-09-23 07:49:19 +00:00