2017-09-17 22:20:16 +00:00
# Make targets:
#
# all : builds all binaries in development mode, without web assets (default)
# full : builds all binaries for PRODUCTION use
# release: prepares a release tarball
# clean : removes all buld artifacts
# test : runs tests
# To update the Teleport version, update VERSION variable:
2016-06-15 17:50:45 +00:00
# Naming convention:
2020-10-13 17:30:07 +00:00
# Stable releases: "1.0.0"
# Pre-releases: "1.0.0-alpha.1", "1.0.0-beta.2", "1.0.0-rc.3"
# Master/dev branch: "1.0.0-dev"
2022-06-15 23:28:08 +00:00
VERSION = 11.0.0-dev
2016-06-14 23:52:32 +00:00
2022-07-26 16:14:08 +00:00
2022-06-09 09:16:52 +00:00
DOCKER_IMAGE_OPERATOR_CI ?= quay.io/gravitational/teleport-operator-ci
2022-07-26 16:14:08 +00:00
DOCKER_IMAGE_QUAY ?= quay.io/gravitational/teleport
DOCKER_IMAGE_ECR ?= public.ecr.aws/gravitational/teleport
DOCKER_IMAGE_STAGING ?= 146628656107.dkr.ecr.us-west-2.amazonaws.com/gravitational/teleport
2019-10-08 14:09:56 +00:00
2021-10-13 22:01:30 +00:00
GOPATH ?= $( shell go env GOPATH)
2016-04-18 03:55:46 +00:00
# These are standard autotools variables, don't change them please
2021-06-03 00:26:59 +00:00
i f n e q ( "$(wildcard /bin/bash)" , "" )
2021-08-23 17:53:51 +00:00
SHELL := /bin/bash -o pipefail
2021-06-03 00:26:59 +00:00
e n d i f
2016-03-23 01:22:48 +00:00
BUILDDIR ?= build
2021-03-27 00:37:52 +00:00
ASSETS_BUILDDIR ?= lib/web/build
2016-03-24 19:32:59 +00:00
BINDIR ?= /usr/local/bin
DATADIR ?= /usr/local/share/teleport
2016-03-22 19:15:17 +00:00
ADDFLAGS ?=
2017-01-13 06:56:53 +00:00
PWD ?= ` pwd `
2016-05-11 05:05:01 +00:00
TELEPORT_DEBUG ?= no
2017-01-19 00:53:19 +00:00
GITTAG = v$( VERSION)
2017-08-03 19:51:06 +00:00
BUILDFLAGS ?= $( ADDFLAGS) -ldflags '-w -s'
2018-10-30 23:52:18 +00:00
CGOFLAG ?= CGO_ENABLED = 1
2022-02-15 16:02:10 +00:00
CGOFLAG_TSH ?= CGO_ENABLED = 1
2021-02-04 21:30:32 +00:00
# Windows requires extra parameters to cross-compile with CGO.
i f e q ( "$(OS)" , "windows" )
2022-04-04 15:04:00 +00:00
ARCH ?= amd64
i f n e q ( "$(ARCH)" , "amd64" )
$( error "Building for windows requires ARCH =amd 64")
e n d i f
2021-02-04 21:30:32 +00:00
BUILDFLAGS = $( ADDFLAGS) -ldflags '-w -s' -buildmode= exe
CGOFLAG = CGO_ENABLED = 1 CC = x86_64-w64-mingw32-gcc CXX = x86_64-w64-mingw32-g++
2022-02-15 16:02:10 +00:00
CGOFLAG_TSH = $( CGOFLAG)
2021-02-04 21:30:32 +00:00
e n d i f
2021-02-11 15:14:27 +00:00
i f e q ( "$(OS)" , "linux" )
2022-07-02 02:11:37 +00:00
# Link static version of libgcc to reduce system dependencies.
CGOFLAG ?= CGO_ENABLED = 1 CGO_LDFLAGS = "-Wl,--as-needed"
CGOFLAG_TSH ?= CGO_ENABLED = 1 CGO_LDFLAGS = "-Wl,--as-needed"
2021-02-11 15:14:27 +00:00
# ARM builds need to specify the correct C compiler
i f e q ( "$(ARCH)" , "arm" )
CGOFLAG = CGO_ENABLED = 1 CC = arm-linux-gnueabihf-gcc
2022-02-15 16:02:10 +00:00
CGOFLAG_TSH = $( CGOFLAG)
2021-02-11 15:14:27 +00:00
e n d i f
# ARM64 builds need to specify the correct C compiler
i f e q ( "$(ARCH)" , "arm64" )
CGOFLAG = CGO_ENABLED = 1 CC = aarch64-linux-gnu-gcc
2022-02-15 16:02:10 +00:00
CGOFLAG_TSH = $( CGOFLAG)
2021-02-11 15:14:27 +00:00
e n d i f
e n d i f
2021-04-01 17:12:53 +00:00
OS ?= $( shell go env GOOS)
ARCH ?= $( shell go env GOARCH)
2019-03-12 22:30:44 +00:00
FIPS ?=
2021-02-11 15:14:27 +00:00
RELEASE = teleport-$( GITTAG) -$( OS) -$( ARCH) -bin
2018-07-31 20:41:33 +00:00
2019-03-12 22:30:44 +00:00
# FIPS support must be requested at build time.
FIPS_MESSAGE := "without FIPS support"
i f n e q ( "$(FIPS)" , "" )
FIPS_TAG := fips
FIPS_MESSAGE := "with FIPS support"
2021-02-11 15:14:27 +00:00
RELEASE = teleport-$( GITTAG) -$( OS) -$( ARCH) -fips-bin
2019-03-12 22:30:44 +00:00
e n d i f
2018-09-27 01:21:45 +00:00
# PAM support will only be built into Teleport if headers exist at build time.
PAM_MESSAGE := "without PAM support"
i f n e q ( "$(wildcard /usr/include/security/pam_appl.h)" , "" )
2019-03-12 22:30:44 +00:00
PAM_TAG := pam
2018-09-27 01:21:45 +00:00
PAM_MESSAGE := "with PAM support"
2020-07-24 20:46:20 +00:00
e l s e
# PAM headers for Darwin live under /usr/local/include/security instead, as SIP
# prevents us from modifying/creating /usr/include/security on newer versions of MacOS
i f n e q ( "$(wildcard /usr/local/include/security/pam_appl.h)" , "" )
PAM_TAG := pam
PAM_MESSAGE := "with PAM support"
e n d i f
2018-09-27 01:21:45 +00:00
e n d i f
2019-11-16 00:39:40 +00:00
# BPF support will only be built into Teleport if headers exist at build time.
BPF_MESSAGE := "without BPF support"
2021-02-11 15:14:27 +00:00
2021-06-01 16:42:46 +00:00
# We don't compile BPF for anything except regular non-FIPS linux/amd64 for now, as other builds
# have compilation issues that require fixing.
2021-04-09 23:20:56 +00:00
with_bpf := no
2021-06-01 16:42:46 +00:00
i f e q ( "$(OS)" , "linux" )
i f e q ( "$(ARCH)" , "amd64" )
2021-04-09 23:20:56 +00:00
i f n e q ( "$(wildcard /usr/include/bpf/libbpf.h)" , "" )
with_bpf := yes
2019-11-16 00:39:40 +00:00
BPF_TAG := bpf
BPF_MESSAGE := "with BPF support"
2021-04-09 23:20:56 +00:00
CLANG ?= $( shell which clang || which clang-10)
CLANG_FORMAT ?= $( shell which clang-format || which clang-format-10)
LLVM_STRIP ?= $( shell which llvm-strip || which llvm-strip-10)
KERNEL_ARCH := $( shell uname -m | sed 's/x86_64/x86/' )
INCLUDES :=
2021-07-14 20:27:53 +00:00
ER_BPF_BUILDDIR := lib/bpf/bytecode
RS_BPF_BUILDDIR := lib/restrictedsession/bytecode
2021-04-09 23:20:56 +00:00
# Get Clang's default includes on this system. We'll explicitly add these dirs
# to the includes list when compiling with `-target bpf` because otherwise some
# architecture-specific dirs will be "missing" on some architectures/distros -
# headers such as asm/types.h, asm/byteorder.h, asm/socket.h, asm/sockios.h,
# sys/cdefs.h etc. might be missing.
#
# Use '-idirafter': Don't interfere with include mechanics except where the
# build would have failed anyways.
CLANG_BPF_SYS_INCLUDES = $( shell $( CLANG) -v -E - </dev/null 2>& 1 \
| sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }' )
2022-07-02 02:11:37 +00:00
CGOFLAG = CGO_ENABLED = 1 CGO_LDFLAGS = "-Wl,-Bstatic -lbpf -lelf -lz -Wl,-Bdynamic -Wl,--as-needed"
CGOFLAG_TSH = CGO_ENABLED = 1
2019-11-16 00:39:40 +00:00
e n d i f
2021-02-11 15:14:27 +00:00
e n d i f
2021-06-01 16:42:46 +00:00
e n d i f
2019-11-16 00:39:40 +00:00
2021-08-25 18:39:59 +00:00
# Check if rust and cargo are installed before compiling
CHECK_CARGO := $( shell cargo --version 2>/dev/null)
CHECK_RUST := $( shell rustc --version 2>/dev/null)
2021-10-26 15:22:13 +00:00
with_rdpclient := no
RDPCLIENT_MESSAGE := "without Windows RDP client"
CARGO_TARGET_darwin_amd64 := x86_64-apple-darwin
CARGO_TARGET_darwin_arm64 := aarch64-apple-darwin
CARGO_TARGET_linux_arm := arm-unknown-linux-gnueabihf
CARGO_TARGET_linux_arm64 := aarch64-unknown-linux-gnu
CARGO_TARGET_linux_386 := i686-unknown-linux-gnu
CARGO_TARGET_linux_amd64 := x86_64-unknown-linux-gnu
CARGO_TARGET := --target= ${ CARGO_TARGET_ ${ OS } _ ${ ARCH } }
2021-08-25 18:39:59 +00:00
i f n e q ( $( CHECK_RUST ) , )
i f n e q ( $( CHECK_CARGO ) , )
2021-10-26 15:22:13 +00:00
2022-01-06 19:35:46 +00:00
i f n e q ( "$(ARCH)" , "arm" )
2022-06-25 04:01:21 +00:00
# Do not build RDP client on ARM.
2021-10-26 15:22:13 +00:00
with_rdpclient := yes
RDPCLIENT_MESSAGE := "with Windows RDP client"
RDPCLIENT_TAG := desktop_access_rdp
2021-08-25 18:39:59 +00:00
e n d i f
e n d i f
2022-01-06 19:35:46 +00:00
e n d i f
2021-08-23 19:50:14 +00:00
2022-04-28 16:32:02 +00:00
# Enable libfido2 for testing?
# Eargerly enable if we detect the package, we want to test as much as possible.
i f e q ( "$(shell pkg-config libfido2 2>/dev/null; echo $$?)" , "0" )
LIBFIDO2_TEST_TAG := libfido2
Run tests and lint libfido2 code on buildbox (#11547)
- Lint libfido2 (and other) Go build tags
- `make test-go` exercises the libfido2 build tag, as long as `libfido2` is present in the system
- Install `libfido2` (and dependencies) in the teleport-buildbox image
Libraries are installed from source, instead of apt or ppas, so we can guarantee deterministic (and current!) versions.
(Binary releases are not available.)
At the present moment, `librdp_client` and `libfido2` can't be used together. This is because `librdp_client` embeds
openssl/`libcrypto`, which is also a dependency for `libfido2`, causing duplicate symbol errors. In practice both
libraries never coexist in the same binary, so it's easy to sidestep the issue (`librdp_client` links to `teleport`,
while FIDO2 code is only used by `tsh`). I may be able to make them coexist, but not without changes to how go-libfido2
builds.
This change is only for linting/testing libfido2 code, I'll address `tsh` releases in a future PR.
#9160
* Install libfido2 in buildbox
libfido2 and libcbor are installed from source to make sure we get
deterministic versions (apt is outdated and ppas are likely to move
forward with time).
* Run libfido2 tests on test-go
* Lint libfido2 Go build tag
* Lint other Go build tags
* Comment build tags that break the linter
* Tidy modules
* Re-enable roletester linter
* Pass tags conditionally to golangci-lint
* Clarify and improve libfido2 wildcard
* Drop `:$LD_LIBRARY_PATH` from variable
* Replace LD_LIBRARY_PATH with `ldconfig`
* Test for ARM homebrew location too
2022-03-30 17:52:29 +00:00
e n d i f
2022-04-28 16:32:02 +00:00
# Build tsh against libfido2?
2022-07-20 14:28:29 +00:00
# FIDO2=yes and FIDO2=static enable static libfido2 builds.
# FIDO2=dynamic enables dynamic libfido2 builds.
2022-04-18 14:07:10 +00:00
LIBFIDO2_MESSAGE := without libfido2
2022-07-20 14:28:29 +00:00
i f n e q ( , $( filter $ ( FIDO 2) , yes static ) )
2022-04-28 16:32:02 +00:00
LIBFIDO2_MESSAGE := with libfido2
LIBFIDO2_BUILD_TAG := libfido2 libfido2static
2022-07-20 14:28:29 +00:00
e l s e i f e q ( "$(FIDO2)" , "dynamic" )
LIBFIDO2_MESSAGE := with libfido2
LIBFIDO2_BUILD_TAG := libfido2
2022-04-28 16:32:02 +00:00
e n d i f
Run tests and lint libfido2 code on buildbox (#11547)
- Lint libfido2 (and other) Go build tags
- `make test-go` exercises the libfido2 build tag, as long as `libfido2` is present in the system
- Install `libfido2` (and dependencies) in the teleport-buildbox image
Libraries are installed from source, instead of apt or ppas, so we can guarantee deterministic (and current!) versions.
(Binary releases are not available.)
At the present moment, `librdp_client` and `libfido2` can't be used together. This is because `librdp_client` embeds
openssl/`libcrypto`, which is also a dependency for `libfido2`, causing duplicate symbol errors. In practice both
libraries never coexist in the same binary, so it's easy to sidestep the issue (`librdp_client` links to `teleport`,
while FIDO2 code is only used by `tsh`). I may be able to make them coexist, but not without changes to how go-libfido2
builds.
This change is only for linting/testing libfido2 code, I'll address `tsh` releases in a future PR.
#9160
* Install libfido2 in buildbox
libfido2 and libcbor are installed from source to make sure we get
deterministic versions (apt is outdated and ppas are likely to move
forward with time).
* Run libfido2 tests on test-go
* Lint libfido2 Go build tag
* Lint other Go build tags
* Comment build tags that break the linter
* Tidy modules
* Re-enable roletester linter
* Pass tags conditionally to golangci-lint
* Clarify and improve libfido2 wildcard
* Drop `:$LD_LIBRARY_PATH` from variable
* Replace LD_LIBRARY_PATH with `ldconfig`
* Test for ARM homebrew location too
2022-03-30 17:52:29 +00:00
2022-05-25 16:52:37 +00:00
# Enable Touch ID builds?
# Only build if TOUCHID=yes to avoid issues when cross-compiling to 'darwin'
# from other systems.
TOUCHID_MESSAGE := without Touch ID
i f e q ( "$(TOUCHID)" , "yes" )
TOUCHID_MESSAGE := with Touch ID
TOUCHID_TAG := touchid
e n d i f
2021-10-26 15:22:13 +00:00
# Reproducible builds are only available on select targets, and only when OS=linux.
2021-08-23 19:50:14 +00:00
REPRODUCIBLE ?=
i f n e q ( "$(OS)" , "linux" )
REPRODUCIBLE = no
e n d i f
2018-07-31 20:41:33 +00:00
# On Windows only build tsh. On all other platforms build teleport, tctl,
# and tsh.
Certificate renewal bot (#10099)
* Add certificate renewal bot
This adds a new `tbot` tool to continuously renew a set of
certificates after registering with a Teleport cluster using a
similar process to standard node joining.
This makes some modifications to user certificate generation to allow
for certificates that can be renewed beyond their original TTL, and
exposes new gRPC endpoints:
* `CreateBotJoinToken` creates a join token for a bot user
* `GenerateInitialRenewableUserCerts` exchanges a token for a set of
certificates with a new `renewable` flag set
A new `tctl` command, `tctl bots add`, creates a bot user and calls
`CreateBotJoinToken` to issue a token. A bot instance can then be
started using a provided command.
* Cert bot refactoring pass
* Use role requests to split renewable certs from end-user certs
* Add bot configuration file
* Use `teleport.dev/bot` label
* Remove `impersonator` flag on initial bot certs
* Remove unnecessary `renew` package
* Misc other cleanup
* Do not pass through `renewable` flag when role requests are set
This adds additional restrictions on when a certificate's `renewable`
flag is carried over to a new certificate. In particular, it now also
denies the flag when either role requests are present, or the
`disallowReissue` flag has been previously set.
In practice `disallow-reissue` would have prevented any undesired
behavior but this improves consistency and resolves a TODO.
* Various tbot UX improvements; render SSH config
* Fully flesh out config template rendering
* Fix rendering for SSH configuration templates
* Added `String()` impls for destination types
* Improve certificate renewal logging; show more detail
* Properly fall back to default (all) roles
* Add mode hints for files
* Add/update copyright headers
* Add stubs for tbot init and watch commands
* Add gRPC endpoints for managing bots
* Add `CreateBot`, `DeleteBot`, and `GetBotUsers` gRPC endpoints
* Replace `tctl bot (add|rm|ls)` implementations with gRPC calls
* Define a few new constants, `DefaultBotJoinTTL`, `BotLabel`,
`BotGenerationLabel`
* Fix outdated destination flag in example tbot command
* Bugfix pass for demo
* Fixed a few nil pointer derefs when using config from CLI args
* Properly create destination if `--destination-dir` flag is used
* Remove improper default on CLI flag
* `DestinationConfig` is now a list of pointers
* Address first wave of review feedback
Fixes the majority of smaller issues caught by reviewers, thanks all!
* Add doc comments for bot.go functions
* Return the token TTL from CreateBot
* Split initial user cert issuance from `generateUserCerts()`
Issuing initial renewable certificate ended up requiring a lot of
hacks to skip checks that prevented anonymous bots from getting
certs even though we'd verified their identity elsewhere (via token).
This reverts all those hacks and splits initial bot cert logic into a
dedicated `generateInitialRenewableUserCerts()` function which should
make the whole process much easier to follow.
* Set bot traits to silence log messages
* tbot log message consistency pass
* Resolve lints
* Add config tests
* Remove CreateBotJoinToken endpoint
Users should instead use the CreateBot/DeleteBot endpoints.
* Create a fresh private key for every impersonated identity renewal
* Hide `config` subcommand
* Rename bot label prefix to `teleport.internal/`
* Use types.NewRole() to create bot roles
* Clean up error handling in custom YAML unmarshallers
Also, add notes about the supported YAML shapes.
* Fetch proxy host via gRPC Ping() instead of GetProxies()
* Update lib/auth/bot.go
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
* Fix some review comments
* Add renewable certificate generation checks (#10098)
* Add renewable certificate generation checks
This adds a new validation check for renewable certificates that
maintains a renewal counter as both a certificate extension and a
user label. This counter is used to ensure only a single certificate
lineage can exist: for example, if a renewable certificate is stolen,
only one copy of the certificate can be renewed as the generation
counter will not match
When renewing a certificate, first the generation counter presented
by the user (via their TLS identity) is compared to a value stored
with the associated user (in a new `teleport.dev/bot-generation`
label field). If they aren't equal, the renewal attempt fails.
Otherwise, the generation counter is incremented by 1, stored to the
database using a `CompareAndSwap()` to ensure atomicity, and set on
the generated certificate for use in future renewals.
* Add unit tests for the generation counter
This adds new unit tests to exercise the generation counter checks.
Additionally, it fixes two other renewable cert tests that were
failing.
* Remove certRequestGeneration() function
* Emit audit event when cert generations don't match
* Fully implement `tctl bots lock`
* Show bot name in `tctl bots ls`
* Lock bots when a cert generation mismatch is found
* Make CompareFailed respones from validateGenerationLabel() more actionable
* Update lib/services/local/users.go
Co-authored-by: Nic Klaassen <nic@goteleport.com>
* Backend changes for tbot IoT and AWS joining (#10360)
* backend changes
* add token permission check
* pass ctx from caller
Co-authored-by: Roman Tkachenko <roman@goteleport.com>
* fix comment typo
Co-authored-by: Roman Tkachenko <roman@goteleport.com>
* use UserMetadata instead of Identity in RenewableCertificateGenerationMismatch event
* Client changes for tbot IoT joining (#10397)
* client changes
* delete replaced APIs
* delete unused tbot/auth.go
* add license header
* don't unecessarily fetch host CA
* log fixes
* s/tunnelling/tunneling/
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
* auth server addresses may be proxies
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
* comment typo fix
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
* move *Server methods out of auth_with_roles.go (#10416)
Co-authored-by: Tim Buckley <tim@goteleport.com>
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
Co-authored-by: Tim Buckley <tim@goteleport.com>
Co-authored-by: Roman Tkachenko <roman@goteleport.com>
Co-authored-by: Tim Buckley <tim@goteleport.com>
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
Co-authored-by: Nic Klaassen <nic@goteleport.com>
Co-authored-by: Roman Tkachenko <roman@goteleport.com>
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
* Address another batch of review feedback
* Addres another batch of review feedback
Add `Role.SetMetadata()`, simplify more `trace.WrapWithMessage()`
calls, clear some TODOs and lints, and address other misc feedback
items.
* Fix lint
* Add missing doc comments to SaveIdentity / LoadIdentity
* Remove pam tag from tbot build
* Update note about bot lock deletion
* Another pass of review feedback
Ensure all requestable roles exist when creating a bot, adjust the
default renewable cert TTL down to 1 hour, and check types during
`CompareAndSwapUser()`
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
Co-authored-by: Nic Klaassen <nic@goteleport.com>
Co-authored-by: Roman Tkachenko <roman@goteleport.com>
2022-02-19 02:41:45 +00:00
BINARIES = $( BUILDDIR) /teleport $( BUILDDIR) /tctl $( BUILDDIR) /tsh $( BUILDDIR) /tbot
2022-06-25 04:01:21 +00:00
RELEASE_MESSAGE := " Building with GOOS= $( OS) GOARCH= $( ARCH) REPRODUCIBLE= $( REPRODUCIBLE) and $( PAM_MESSAGE) and $( FIPS_MESSAGE) and $( BPF_MESSAGE) and $( RDPCLIENT_MESSAGE) and $( LIBFIDO2_MESSAGE) and $( TOUCHID_MESSAGE) . "
2018-07-31 20:41:33 +00:00
i f e q ( "$(OS)" , "windows" )
BINARIES = $( BUILDDIR) /tsh
e n d i f
2017-01-16 00:27:19 +00:00
2021-08-23 19:50:14 +00:00
# On platforms that support reproducible builds, ensure the archive is created in a reproducible manner.
2021-08-12 01:43:32 +00:00
TAR_FLAGS ?=
2021-08-23 19:50:14 +00:00
i f e q ( "$(REPRODUCIBLE)" , "yes" )
2021-08-12 01:43:32 +00:00
TAR_FLAGS = --sort= name --owner= root:0 --group= root:0 --mtime= 'UTC 2015-03-02' --format= gnu
e n d i f
2021-06-18 18:52:55 +00:00
VERSRC = version.go gitref.go api/version.go
2017-01-16 00:27:19 +00:00
2018-06-15 22:05:15 +00:00
KUBECONFIG ?=
TEST_KUBE ?=
export
2022-02-15 01:19:33 +00:00
TEST_LOG_DIR = ${ abspath ./test-logs }
2022-06-06 13:06:57 +00:00
CLANG_FORMAT_STYLE = '{ColumnLimit: 100, IndentWidth: 4, Language: Proto}'
2016-01-17 18:28:34 +00:00
#
2018-07-31 20:41:33 +00:00
# 'make all' builds all 3 executables and places them in the current directory.
2018-02-24 01:23:09 +00:00
#
2017-09-17 22:20:16 +00:00
# IMPORTANT: the binaries will not contain the web UI assets and `teleport`
# won't start without setting the environment variable DEBUG=1
# This is the default build target for convenience of working on
# a web UI.
2016-02-14 01:09:05 +00:00
.PHONY : all
2021-06-18 18:52:55 +00:00
all : version
2018-09-27 01:21:45 +00:00
@echo "---> Building OSS binaries."
2018-03-27 17:43:27 +00:00
$( MAKE) $( BINARIES)
2018-05-19 23:58:14 +00:00
# By making these 3 targets below (tsh, tctl and teleport) PHONY we are solving
# several problems:
# * Build will rely on go build internal caching https://golang.org/doc/go1.10 at all times
# * Manual change detection was broken on a large dependency tree
# If you are considering changing this behavior, please consult with dev team first
.PHONY : $( BUILDDIR ) /tctl
2022-06-25 04:01:21 +00:00
$(BUILDDIR)/tctl :
GOOS = $( OS) GOARCH = $( ARCH) $( CGOFLAG) go build -tags " $( PAM_TAG) $( FIPS_TAG) " -o $( BUILDDIR) /tctl $( BUILDFLAGS) ./tool/tctl
2018-03-27 17:43:27 +00:00
2018-05-19 23:58:14 +00:00
.PHONY : $( BUILDDIR ) /teleport
2021-10-01 22:01:17 +00:00
$(BUILDDIR)/teleport : ensure -webassets bpf -bytecode rdpclient
2021-10-26 15:22:13 +00:00
GOOS = $( OS) GOARCH = $( ARCH) $( CGOFLAG) go build -tags " $( PAM_TAG) $( FIPS_TAG) $( BPF_TAG) $( WEBASSETS_TAG) $( RDPCLIENT_TAG) " -o $( BUILDDIR) /teleport $( BUILDFLAGS) ./tool/teleport
2018-03-27 17:43:27 +00:00
2018-05-19 23:58:14 +00:00
.PHONY : $( BUILDDIR ) /tsh
$(BUILDDIR)/tsh :
2022-05-25 16:52:37 +00:00
GOOS = $( OS) GOARCH = $( ARCH) $( CGOFLAG_TSH) go build -tags " $( FIPS_TAG) $( LIBFIDO2_BUILD_TAG) $( TOUCHID_TAG) " -o $( BUILDDIR) /tsh $( BUILDFLAGS) ./tool/tsh
2016-03-22 19:15:17 +00:00
Certificate renewal bot (#10099)
* Add certificate renewal bot
This adds a new `tbot` tool to continuously renew a set of
certificates after registering with a Teleport cluster using a
similar process to standard node joining.
This makes some modifications to user certificate generation to allow
for certificates that can be renewed beyond their original TTL, and
exposes new gRPC endpoints:
* `CreateBotJoinToken` creates a join token for a bot user
* `GenerateInitialRenewableUserCerts` exchanges a token for a set of
certificates with a new `renewable` flag set
A new `tctl` command, `tctl bots add`, creates a bot user and calls
`CreateBotJoinToken` to issue a token. A bot instance can then be
started using a provided command.
* Cert bot refactoring pass
* Use role requests to split renewable certs from end-user certs
* Add bot configuration file
* Use `teleport.dev/bot` label
* Remove `impersonator` flag on initial bot certs
* Remove unnecessary `renew` package
* Misc other cleanup
* Do not pass through `renewable` flag when role requests are set
This adds additional restrictions on when a certificate's `renewable`
flag is carried over to a new certificate. In particular, it now also
denies the flag when either role requests are present, or the
`disallowReissue` flag has been previously set.
In practice `disallow-reissue` would have prevented any undesired
behavior but this improves consistency and resolves a TODO.
* Various tbot UX improvements; render SSH config
* Fully flesh out config template rendering
* Fix rendering for SSH configuration templates
* Added `String()` impls for destination types
* Improve certificate renewal logging; show more detail
* Properly fall back to default (all) roles
* Add mode hints for files
* Add/update copyright headers
* Add stubs for tbot init and watch commands
* Add gRPC endpoints for managing bots
* Add `CreateBot`, `DeleteBot`, and `GetBotUsers` gRPC endpoints
* Replace `tctl bot (add|rm|ls)` implementations with gRPC calls
* Define a few new constants, `DefaultBotJoinTTL`, `BotLabel`,
`BotGenerationLabel`
* Fix outdated destination flag in example tbot command
* Bugfix pass for demo
* Fixed a few nil pointer derefs when using config from CLI args
* Properly create destination if `--destination-dir` flag is used
* Remove improper default on CLI flag
* `DestinationConfig` is now a list of pointers
* Address first wave of review feedback
Fixes the majority of smaller issues caught by reviewers, thanks all!
* Add doc comments for bot.go functions
* Return the token TTL from CreateBot
* Split initial user cert issuance from `generateUserCerts()`
Issuing initial renewable certificate ended up requiring a lot of
hacks to skip checks that prevented anonymous bots from getting
certs even though we'd verified their identity elsewhere (via token).
This reverts all those hacks and splits initial bot cert logic into a
dedicated `generateInitialRenewableUserCerts()` function which should
make the whole process much easier to follow.
* Set bot traits to silence log messages
* tbot log message consistency pass
* Resolve lints
* Add config tests
* Remove CreateBotJoinToken endpoint
Users should instead use the CreateBot/DeleteBot endpoints.
* Create a fresh private key for every impersonated identity renewal
* Hide `config` subcommand
* Rename bot label prefix to `teleport.internal/`
* Use types.NewRole() to create bot roles
* Clean up error handling in custom YAML unmarshallers
Also, add notes about the supported YAML shapes.
* Fetch proxy host via gRPC Ping() instead of GetProxies()
* Update lib/auth/bot.go
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
* Fix some review comments
* Add renewable certificate generation checks (#10098)
* Add renewable certificate generation checks
This adds a new validation check for renewable certificates that
maintains a renewal counter as both a certificate extension and a
user label. This counter is used to ensure only a single certificate
lineage can exist: for example, if a renewable certificate is stolen,
only one copy of the certificate can be renewed as the generation
counter will not match
When renewing a certificate, first the generation counter presented
by the user (via their TLS identity) is compared to a value stored
with the associated user (in a new `teleport.dev/bot-generation`
label field). If they aren't equal, the renewal attempt fails.
Otherwise, the generation counter is incremented by 1, stored to the
database using a `CompareAndSwap()` to ensure atomicity, and set on
the generated certificate for use in future renewals.
* Add unit tests for the generation counter
This adds new unit tests to exercise the generation counter checks.
Additionally, it fixes two other renewable cert tests that were
failing.
* Remove certRequestGeneration() function
* Emit audit event when cert generations don't match
* Fully implement `tctl bots lock`
* Show bot name in `tctl bots ls`
* Lock bots when a cert generation mismatch is found
* Make CompareFailed respones from validateGenerationLabel() more actionable
* Update lib/services/local/users.go
Co-authored-by: Nic Klaassen <nic@goteleport.com>
* Backend changes for tbot IoT and AWS joining (#10360)
* backend changes
* add token permission check
* pass ctx from caller
Co-authored-by: Roman Tkachenko <roman@goteleport.com>
* fix comment typo
Co-authored-by: Roman Tkachenko <roman@goteleport.com>
* use UserMetadata instead of Identity in RenewableCertificateGenerationMismatch event
* Client changes for tbot IoT joining (#10397)
* client changes
* delete replaced APIs
* delete unused tbot/auth.go
* add license header
* don't unecessarily fetch host CA
* log fixes
* s/tunnelling/tunneling/
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
* auth server addresses may be proxies
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
* comment typo fix
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
* move *Server methods out of auth_with_roles.go (#10416)
Co-authored-by: Tim Buckley <tim@goteleport.com>
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
Co-authored-by: Tim Buckley <tim@goteleport.com>
Co-authored-by: Roman Tkachenko <roman@goteleport.com>
Co-authored-by: Tim Buckley <tim@goteleport.com>
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
Co-authored-by: Nic Klaassen <nic@goteleport.com>
Co-authored-by: Roman Tkachenko <roman@goteleport.com>
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
* Address another batch of review feedback
* Addres another batch of review feedback
Add `Role.SetMetadata()`, simplify more `trace.WrapWithMessage()`
calls, clear some TODOs and lints, and address other misc feedback
items.
* Fix lint
* Add missing doc comments to SaveIdentity / LoadIdentity
* Remove pam tag from tbot build
* Update note about bot lock deletion
* Another pass of review feedback
Ensure all requestable roles exist when creating a bot, adjust the
default renewable cert TTL down to 1 hour, and check types during
`CompareAndSwapUser()`
Co-authored-by: Zac Bergquist <zmb3@users.noreply.github.com>
Co-authored-by: Nic Klaassen <nic@goteleport.com>
Co-authored-by: Roman Tkachenko <roman@goteleport.com>
2022-02-19 02:41:45 +00:00
.PHONY : $( BUILDDIR ) /tbot
$(BUILDDIR)/tbot :
GOOS = $( OS) GOARCH = $( ARCH) $( CGOFLAG) go build -tags " $( FIPS_TAG) " -o $( BUILDDIR) /tbot $( BUILDFLAGS) ./tool/tbot
2021-04-09 23:20:56 +00:00
#
# BPF support (IF ENABLED)
# Requires a recent version of clang and libbpf installed.
#
i f e q ( "$(with_bpf)" , "yes" )
2021-07-14 20:27:53 +00:00
$(ER_BPF_BUILDDIR) :
mkdir -p $( ER_BPF_BUILDDIR)
$(RS_BPF_BUILDDIR) :
mkdir -p $( RS_BPF_BUILDDIR)
2021-04-09 23:20:56 +00:00
# Build BPF code
2021-07-14 20:27:53 +00:00
$(ER_BPF_BUILDDIR)/%.bpf.o : bpf /enhancedrecording /%.bpf .c $( wildcard bpf /*.h ) | $( ER_BPF_BUILDDIR )
2021-04-09 23:20:56 +00:00
$( CLANG) -g -O2 -target bpf -D__TARGET_ARCH_$( KERNEL_ARCH) $( INCLUDES) $( CLANG_BPF_SYS_INCLUDES) -c $( filter %.c,$^) -o $@
$( LLVM_STRIP) -g $@ # strip useless DWARF info
2021-07-14 20:27:53 +00:00
# Build BPF code
$(RS_BPF_BUILDDIR)/%.bpf.o : bpf /restrictedsession /%.bpf .c $( wildcard bpf /*.h ) | $( RS_BPF_BUILDDIR )
$( CLANG) -g -O2 -target bpf -D__TARGET_ARCH_$( KERNEL_ARCH) $( INCLUDES) $( CLANG_BPF_SYS_INCLUDES) -c $( filter %.c,$^) -o $@
$( LLVM_STRIP) -g $@ # strip useless DWARF info
.PHONY : bpf -rs -bytecode
bpf-rs-bytecode : $( RS_BPF_BUILDDIR ) /restricted .bpf .o
.PHONY : bpf -er -bytecode
bpf-er-bytecode : $( ER_BPF_BUILDDIR ) /command .bpf .o $( ER_BPF_BUILDDIR ) /disk .bpf .o $( ER_BPF_BUILDDIR ) /network .bpf .o $( ER_BPF_BUILDDIR ) /counter_test .bpf .o
2021-04-09 23:20:56 +00:00
.PHONY : bpf -bytecode
2021-07-14 20:27:53 +00:00
bpf-bytecode : bpf -er -bytecode bpf -rs -bytecode
2021-04-09 23:20:56 +00:00
# Generate vmlinux.h based on the installed kernel
.PHONY : update -vmlinux -h
update-vmlinux-h :
bpftool btf dump file /sys/kernel/btf/vmlinux format c >bpf/vmlinux.h
e l s e
.PHONY : bpf -bytecode
bpf-bytecode :
e n d i f
2021-10-26 15:22:13 +00:00
i f e q ( "$(with_rdpclient)" , "yes" )
2021-10-01 22:01:17 +00:00
.PHONY : rdpclient
rdpclient :
2022-01-26 21:07:42 +00:00
cargo build -p rdp-client --release $( CARGO_TARGET)
2021-10-01 22:01:17 +00:00
e l s e
.PHONY : rdpclient
rdpclient :
e n d i f
2016-06-14 23:52:32 +00:00
#
2018-07-31 20:41:33 +00:00
# make full - Builds Teleport binaries with the built-in web assets and
# places them into $(BUILDDIR). On Windows, this target is skipped because
# only tsh is built.
2017-09-17 23:24:11 +00:00
#
.PHONY : full
2021-06-28 19:06:47 +00:00
full : $( ASSETS_BUILDDIR ) /webassets
2018-07-31 20:41:33 +00:00
i f n e q ( "$(OS)" , "windows" )
2021-03-27 00:37:52 +00:00
$( MAKE) all WEBASSETS_TAG = "webassets_embed"
2018-07-31 20:41:33 +00:00
e n d i f
2016-03-18 21:54:20 +00:00
2020-07-15 00:15:01 +00:00
#
# make full-ent - Builds Teleport enterprise binaries
#
.PHONY : full -ent
full-ent :
i f n e q ( "$(OS)" , "windows" )
2021-05-04 18:13:47 +00:00
@if [ -f e/Makefile ] ; then \
2021-06-28 19:06:47 +00:00
rm $( ASSETS_BUILDDIR) /webassets; \
2021-05-04 18:13:47 +00:00
$( MAKE) -C e full; fi
2020-07-15 00:15:01 +00:00
e n d i f
2018-07-31 20:41:33 +00:00
#
2021-10-13 22:01:30 +00:00
# make clean - Removes all build artifacts.
2018-07-31 20:41:33 +00:00
#
2016-03-19 20:43:23 +00:00
.PHONY : clean
2016-01-17 22:50:00 +00:00
clean :
2018-09-27 01:21:45 +00:00
@echo "---> Cleaning up OSS build artifacts."
2016-03-19 20:43:23 +00:00
rm -rf $( BUILDDIR)
2022-07-18 17:06:58 +00:00
# Check if the variable is set to prevent calling remove on the root directory.
i f n e q ( $( ER_BPF_BUILDDIR ) , )
rm -f $( ER_BPF_BUILDDIR) /*.o
e n d i f
i f n e q ( $( RS_BPF_BUILDDIR ) , )
rm -f $( RS_BPF_BUILDDIR) /*.o
e n d i f
2022-01-28 02:34:45 +00:00
-cargo clean
2021-04-01 17:12:53 +00:00
-go clean -cache
2022-07-18 17:06:58 +00:00
rm -f *.gz
rm -f *.zip
2017-09-19 19:17:23 +00:00
rm -f gitref.go
Attempts to make CI integration test logs more useful (#9626)
Actually tracking down the cause of a failure in the integration tests can
be hard:
* It's hard to get an overall summary of what failed
* The tests sometimes emit no output before timing out, meaning any
diagnostic info is lost
* The emitted logs are too voluminous for a human to parse
* The emitted logs can present information out of order
* It's often hard to tell where the output from one test ends
and the next one begins
This patch attempts to address these concerns without attempting to rewrite
any of the underlying teleport logging.
* It improves the render-tests script to (optionally) report progress per-
test, rather than on a per-package basis. My working hypothesis on the
tests that time out with no output is that go test ./integration is
waiting for the entire set of integration tests tests to be complete
before reporting success or failure. Reporting on a per-test cycle gives
faster feedback and means that any timed-out builds should give at least
some idea of where they are stuck.
* Adds the render-tests filter to the integration and integration-root make
targets. This will show an overall summary of test results, as well as
- Discarding log output from passing tests to increase signal-to-noise
ratio, and
- Strongly delimiting the output from each failed test, making failures
easier to find.
* Removes the notion of a failure-only logger in favour of post-processing
the log events with render-tests. The failure-only logger catches log
output from the tests and only forwards it to the console if the test
fails. Unfortunately, not all log output is guaranteed to pass through
this logger (some teleport packages do not honour the configured logger,
and reports from the go race detector certainly don't), meaning some
output is presented at the time it happens, and other output is batched
and displayed at the end of the test. This makes working out what
happened where harder than it need be.
In addition, this patch also promotes the render-tests script into a fully-
fledged program, with appropriate makefile targets, make clean support, etc.
It is now also more robust in the face on non-JSON output from go test
(which happens if a package fails to compile).
2022-01-04 23:42:07 +00:00
rm -rf build.assets/tooling/bin
2016-01-17 22:50:00 +00:00
2017-09-17 23:24:11 +00:00
#
2018-07-31 20:41:33 +00:00
# make release - Produces a binary release tarball.
2018-02-24 01:23:09 +00:00
#
.PHONY :
2017-09-17 23:24:11 +00:00
export
2018-07-31 20:41:33 +00:00
release :
2018-09-27 01:21:45 +00:00
@echo " ---> $( RELEASE_MESSAGE) "
2018-07-31 20:41:33 +00:00
i f e q ( "$(OS)" , "windows" )
$( MAKE) --no-print-directory release-windows
e l s e
$( MAKE) --no-print-directory release-unix
e n d i f
2021-03-23 01:32:45 +00:00
# These are aliases used to make build commands uniform.
.PHONY : release -amd 64
release-amd64 :
$( MAKE) release ARCH = amd64
.PHONY : release -386
release-386 :
$( MAKE) release ARCH = 386
.PHONY : release -arm
release-arm :
$( MAKE) release ARCH = arm
.PHONY : release -arm 64
release-arm64 :
$( MAKE) release ARCH = arm64
2018-07-31 20:41:33 +00:00
#
# make release-unix - Produces a binary release tarball containing teleport,
# tctl, and tsh.
#
.PHONY :
release-unix : clean full
2018-09-27 01:21:45 +00:00
@echo "---> Creating OSS release archive."
2017-09-17 23:24:11 +00:00
mkdir teleport
2017-09-19 19:54:02 +00:00
cp -rf $( BUILDDIR) /* \
2017-09-17 23:24:11 +00:00
examples \
build.assets/install\
README.md \
CHANGELOG.md \
teleport/
echo $( GITTAG) > teleport/VERSION
2021-08-12 01:43:32 +00:00
tar $( TAR_FLAGS) -c teleport | gzip -n > $( RELEASE) .tar.gz
2017-09-17 23:24:11 +00:00
rm -rf teleport
2018-09-27 01:21:45 +00:00
@echo " ---> Created $( RELEASE) .tar.gz. "
2021-03-27 00:37:52 +00:00
@if [ -f e/Makefile ] ; then \
2021-06-28 19:06:47 +00:00
rm -fr $( ASSETS_BUILDDIR) /webassets; \
2021-03-27 00:37:52 +00:00
$( MAKE) -C e release; \
fi
2018-07-31 20:41:33 +00:00
#
2021-09-02 22:34:57 +00:00
# make release-windows-unsigned - Produces a binary release archive containing only tsh.
2018-07-31 20:41:33 +00:00
#
2021-09-02 22:34:57 +00:00
.PHONY : release -windows -unsigned
release-windows-unsigned : clean all
2018-09-27 01:21:45 +00:00
@echo "---> Creating OSS release archive."
2018-07-31 20:41:33 +00:00
mkdir teleport
cp -rf $( BUILDDIR) /* \
README.md \
CHANGELOG.md \
teleport/
2021-09-02 22:34:57 +00:00
mv teleport/tsh teleport/tsh-unsigned.exe
2018-07-31 20:41:33 +00:00
echo $( GITTAG) > teleport/VERSION
2021-09-02 22:34:57 +00:00
zip -9 -y -r -q $( RELEASE) -unsigned.zip teleport/
rm -rf teleport/
@echo " ---> Created $( RELEASE) -unsigned.zip. "
#
# make release-windows - Produces an archive containing a signed release of
# tsh.exe
#
.PHONY : release -windows
release-windows : release -windows -unsigned
@if [ ! -f "windows-signing-cert.pfx" ] ; then \
echo "windows-signing-cert.pfx is missing or invalid, cannot create signed archive." ; \
exit 1; \
fi
rm -rf teleport
@echo " ---> Extracting $( RELEASE) -unsigned.zip "
unzip $( RELEASE) -unsigned.zip
2021-10-01 22:01:17 +00:00
2021-09-02 22:34:57 +00:00
@echo "---> Signing Windows binary."
@osslsigncode sign \
-pkcs12 "windows-signing-cert.pfx" \
-n "Teleport" \
-i https://goteleport.com \
-t http://timestamp.digicert.com \
-h sha2 \
-in teleport/tsh-unsigned.exe \
-out teleport/tsh.exe; \
success = $$ ?; \
rm -f teleport/tsh-unsigned.exe; \
if [ " $$ {success} " -ne 0 ] ; then \
echo "Failed to sign tsh.exe, aborting." ; \
exit 1; \
fi
2018-07-31 20:41:33 +00:00
zip -9 -y -r -q $( RELEASE) .zip teleport/
rm -rf teleport/
2018-09-27 01:21:45 +00:00
@echo " ---> Created $( RELEASE) .zip. "
2017-01-28 02:26:27 +00:00
2020-06-18 00:09:41 +00:00
#
# Remove trailing whitespace in all markdown files under docs/.
#
# Note: this runs in a busybox container to avoid incompatibilities between
# linux and macos CLI tools.
#
.PHONY : docs -fix -whitespace
docs-fix-whitespace :
docker run --rm -v $( PWD) :/teleport busybox \
find /teleport/docs/ -type f -name '*.md' -exec sed -E -i 's/\s+$$//g' '{}' \;
#
# Test docs for trailing whitespace and broken links
#
.PHONY : docs -test
2021-03-10 18:01:48 +00:00
docs-test : docs -test -whitespace
2020-06-18 00:09:41 +00:00
#
# Check for trailing whitespace in all markdown files under docs/
#
.PHONY : docs -test -whitespace
docs-test-whitespace :
if find docs/ -type f -name '*.md' | xargs grep -E '\s+$$' ; then \
echo "trailing whitespace found in docs/ (see above)" ; \
echo "run 'make docs-fix-whitespace' to fix it" ; \
exit 1; \
fi
Attempts to make CI integration test logs more useful (#9626)
Actually tracking down the cause of a failure in the integration tests can
be hard:
* It's hard to get an overall summary of what failed
* The tests sometimes emit no output before timing out, meaning any
diagnostic info is lost
* The emitted logs are too voluminous for a human to parse
* The emitted logs can present information out of order
* It's often hard to tell where the output from one test ends
and the next one begins
This patch attempts to address these concerns without attempting to rewrite
any of the underlying teleport logging.
* It improves the render-tests script to (optionally) report progress per-
test, rather than on a per-package basis. My working hypothesis on the
tests that time out with no output is that go test ./integration is
waiting for the entire set of integration tests tests to be complete
before reporting success or failure. Reporting on a per-test cycle gives
faster feedback and means that any timed-out builds should give at least
some idea of where they are stuck.
* Adds the render-tests filter to the integration and integration-root make
targets. This will show an overall summary of test results, as well as
- Discarding log output from passing tests to increase signal-to-noise
ratio, and
- Strongly delimiting the output from each failed test, making failures
easier to find.
* Removes the notion of a failure-only logger in favour of post-processing
the log events with render-tests. The failure-only logger catches log
output from the tests and only forwards it to the console if the test
fails. Unfortunately, not all log output is guaranteed to pass through
this logger (some teleport packages do not honour the configured logger,
and reports from the go race detector certainly don't), meaning some
output is presented at the time it happens, and other output is batched
and displayed at the end of the test. This makes working out what
happened where harder than it need be.
In addition, this patch also promotes the render-tests script into a fully-
fledged program, with appropriate makefile targets, make clean support, etc.
It is now also more robust in the face on non-JSON output from go test
(which happens if a package fails to compile).
2022-01-04 23:42:07 +00:00
#
# Builds some tooling for filtering and displaying test progress/output/etc
#
2022-02-10 20:49:28 +00:00
TOOLINGDIR := ${ abspath ./build.assets/tooling }
RENDER_TESTS := $( TOOLINGDIR) /bin/render-tests
$(RENDER_TESTS) : $( wildcard $ ( TOOLINGDIR ) /cmd /render -tests /*.go )
cd $( TOOLINGDIR) && go build -o " $@ " ./cmd/render-tests
2016-02-16 21:18:58 +00:00
#
2021-03-16 16:58:58 +00:00
# Runs all Go/shell tests, called by CI/CD.
2020-10-02 01:02:02 +00:00
#
2021-03-16 16:58:58 +00:00
.PHONY : test
2022-06-09 09:16:52 +00:00
test : test -helm test -sh test -ci test -api test -go test -rust test -operator
2021-03-16 16:58:58 +00:00
2022-02-07 17:03:10 +00:00
# Runs bot Go tests.
#
.PHONY : test -bot
test-bot :
2022-04-15 22:35:34 +00:00
test-bot : FLAGS ?= -race -shuffle on
2022-02-07 17:03:10 +00:00
test-bot :
cd .github/workflows/robot && go test $( FLAGS) ./...
2022-02-15 01:19:33 +00:00
$(TEST_LOG_DIR) :
mkdir $( TEST_LOG_DIR)
2022-03-20 19:01:58 +00:00
# Google Cloud Build uses a weird homedir and Helm can't pick up plugins by default there,
# so override the plugin location via environment variable when running in CI.
.PHONY : test -helm
test-helm :
@if [ -d /builder/home ] ; then export HELM_PLUGINS = /root/.local/share/helm/plugins; fi ; \
helm unittest examples/chart/teleport-cluster && \
helm unittest examples/chart/teleport-kube-agent
.PHONY : test -helm -update -snapshots
test-helm-update-snapshots :
helm unittest -u examples/chart/teleport-cluster
helm unittest -u examples/chart/teleport-kube-agent
2021-03-16 16:58:58 +00:00
#
# Runs all Go tests except integration, called by CI/CD.
2020-10-02 01:02:02 +00:00
# Chaos tests have high concurrency, run without race detector and have TestChaos prefix.
2016-02-16 21:18:58 +00:00
#
2021-03-16 16:58:58 +00:00
.PHONY : test -go
2022-06-25 04:01:21 +00:00
test-go : ensure -webassets bpf -bytecode rdpclient $( TEST_LOG_DIR ) $( RENDER_TESTS )
2022-04-15 22:35:34 +00:00
test-go : FLAGS ?= -race -shuffle on
2022-06-09 09:16:52 +00:00
test-go : PACKAGES = $( shell go list ./... | grep -v -e integration -e tool /tsh -e operator )
2022-01-13 16:00:33 +00:00
test-go : CHAOS_FOLDERS = $( shell find . -type f -name '*chaos *.go ' | xargs dirname | uniq )
2022-02-15 01:19:33 +00:00
test-go : $( VERSRC ) $( TEST_LOG_DIR )
2022-06-25 04:01:21 +00:00
$( CGOFLAG) go test -cover -json -tags " $( PAM_TAG) $( FIPS_TAG) $( BPF_TAG) $( RDPCLIENT_TAG) $( TOUCHID_TAG) " $( PACKAGES) $( FLAGS) $( ADDFLAGS) \
2022-02-15 01:19:33 +00:00
| tee $( TEST_LOG_DIR) /unit.json \
Attempts to make CI integration test logs more useful (#9626)
Actually tracking down the cause of a failure in the integration tests can
be hard:
* It's hard to get an overall summary of what failed
* The tests sometimes emit no output before timing out, meaning any
diagnostic info is lost
* The emitted logs are too voluminous for a human to parse
* The emitted logs can present information out of order
* It's often hard to tell where the output from one test ends
and the next one begins
This patch attempts to address these concerns without attempting to rewrite
any of the underlying teleport logging.
* It improves the render-tests script to (optionally) report progress per-
test, rather than on a per-package basis. My working hypothesis on the
tests that time out with no output is that go test ./integration is
waiting for the entire set of integration tests tests to be complete
before reporting success or failure. Reporting on a per-test cycle gives
faster feedback and means that any timed-out builds should give at least
some idea of where they are stuck.
* Adds the render-tests filter to the integration and integration-root make
targets. This will show an overall summary of test results, as well as
- Discarding log output from passing tests to increase signal-to-noise
ratio, and
- Strongly delimiting the output from each failed test, making failures
easier to find.
* Removes the notion of a failure-only logger in favour of post-processing
the log events with render-tests. The failure-only logger catches log
output from the tests and only forwards it to the console if the test
fails. Unfortunately, not all log output is guaranteed to pass through
this logger (some teleport packages do not honour the configured logger,
and reports from the go race detector certainly don't), meaning some
output is presented at the time it happens, and other output is batched
and displayed at the end of the test. This makes working out what
happened where harder than it need be.
In addition, this patch also promotes the render-tests script into a fully-
fledged program, with appropriate makefile targets, make clean support, etc.
It is now also more robust in the face on non-JSON output from go test
(which happens if a package fails to compile).
2022-01-04 23:42:07 +00:00
| ${ RENDER_TESTS }
Run tests and lint libfido2 code on buildbox (#11547)
- Lint libfido2 (and other) Go build tags
- `make test-go` exercises the libfido2 build tag, as long as `libfido2` is present in the system
- Install `libfido2` (and dependencies) in the teleport-buildbox image
Libraries are installed from source, instead of apt or ppas, so we can guarantee deterministic (and current!) versions.
(Binary releases are not available.)
At the present moment, `librdp_client` and `libfido2` can't be used together. This is because `librdp_client` embeds
openssl/`libcrypto`, which is also a dependency for `libfido2`, causing duplicate symbol errors. In practice both
libraries never coexist in the same binary, so it's easy to sidestep the issue (`librdp_client` links to `teleport`,
while FIDO2 code is only used by `tsh`). I may be able to make them coexist, but not without changes to how go-libfido2
builds.
This change is only for linting/testing libfido2 code, I'll address `tsh` releases in a future PR.
#9160
* Install libfido2 in buildbox
libfido2 and libcbor are installed from source to make sure we get
deterministic versions (apt is outdated and ppas are likely to move
forward with time).
* Run libfido2 tests on test-go
* Lint libfido2 Go build tag
* Lint other Go build tags
* Comment build tags that break the linter
* Tidy modules
* Re-enable roletester linter
* Pass tags conditionally to golangci-lint
* Clarify and improve libfido2 wildcard
* Drop `:$LD_LIBRARY_PATH` from variable
* Replace LD_LIBRARY_PATH with `ldconfig`
* Test for ARM homebrew location too
2022-03-30 17:52:29 +00:00
# rdpclient and libfido2 don't play well together, so we run libfido2 tests
# separately.
# TODO(codingllama): Run libfido2 tests along with others once RDP doesn't
# embed openssl/libcrypto.
2022-04-28 16:32:02 +00:00
i f n e q ( "$(LIBFIDO2_TEST_TAG)" , "" )
$( CGOFLAG) go test -cover -json -tags " $( LIBFIDO2_TEST_TAG) " ./lib/auth/webauthncli/... $( FLAGS) $( ADDFLAGS) \
Run tests and lint libfido2 code on buildbox (#11547)
- Lint libfido2 (and other) Go build tags
- `make test-go` exercises the libfido2 build tag, as long as `libfido2` is present in the system
- Install `libfido2` (and dependencies) in the teleport-buildbox image
Libraries are installed from source, instead of apt or ppas, so we can guarantee deterministic (and current!) versions.
(Binary releases are not available.)
At the present moment, `librdp_client` and `libfido2` can't be used together. This is because `librdp_client` embeds
openssl/`libcrypto`, which is also a dependency for `libfido2`, causing duplicate symbol errors. In practice both
libraries never coexist in the same binary, so it's easy to sidestep the issue (`librdp_client` links to `teleport`,
while FIDO2 code is only used by `tsh`). I may be able to make them coexist, but not without changes to how go-libfido2
builds.
This change is only for linting/testing libfido2 code, I'll address `tsh` releases in a future PR.
#9160
* Install libfido2 in buildbox
libfido2 and libcbor are installed from source to make sure we get
deterministic versions (apt is outdated and ppas are likely to move
forward with time).
* Run libfido2 tests on test-go
* Lint libfido2 Go build tag
* Lint other Go build tags
* Comment build tags that break the linter
* Tidy modules
* Re-enable roletester linter
* Pass tags conditionally to golangci-lint
* Clarify and improve libfido2 wildcard
* Drop `:$LD_LIBRARY_PATH` from variable
* Replace LD_LIBRARY_PATH with `ldconfig`
* Test for ARM homebrew location too
2022-03-30 17:52:29 +00:00
| tee $( TEST_LOG_DIR) /unit.json \
| ${ RENDER_TESTS }
e n d i f
2022-05-25 16:52:37 +00:00
# Make sure untagged touchid code build/tests.
i f n e q ( "$(TOUCHID_TAG)" , "" )
$( CGOFLAG) go test -cover -json ./lib/auth/touchid/... $( FLAGS) $( ADDFLAGS) \
| tee $( TEST_LOG_DIR) /unit.json \
| ${ RENDER_TESTS }
e n d i f
$( CGOFLAG_TSH) go test -cover -json -tags " $( PAM_TAG) $( FIPS_TAG) $( LIBFIDO2_TEST_TAG) $( TOUCHID_TAG) " github.com/gravitational/teleport/tool/tsh $( FLAGS) $( ADDFLAGS) \
2022-02-15 16:02:10 +00:00
| tee $( TEST_LOG_DIR) /unit.json \
| ${ RENDER_TESTS }
2022-06-25 04:01:21 +00:00
$( CGOFLAG) go test -cover -json -tags " $( PAM_TAG) $( FIPS_TAG) $( BPF_TAG) $( RDPCLIENT_TAG) " -test.run= TestChaos $( CHAOS_FOLDERS) \
2022-02-15 01:19:33 +00:00
| tee $( TEST_LOG_DIR) /chaos.json \
Attempts to make CI integration test logs more useful (#9626)
Actually tracking down the cause of a failure in the integration tests can
be hard:
* It's hard to get an overall summary of what failed
* The tests sometimes emit no output before timing out, meaning any
diagnostic info is lost
* The emitted logs are too voluminous for a human to parse
* The emitted logs can present information out of order
* It's often hard to tell where the output from one test ends
and the next one begins
This patch attempts to address these concerns without attempting to rewrite
any of the underlying teleport logging.
* It improves the render-tests script to (optionally) report progress per-
test, rather than on a per-package basis. My working hypothesis on the
tests that time out with no output is that go test ./integration is
waiting for the entire set of integration tests tests to be complete
before reporting success or failure. Reporting on a per-test cycle gives
faster feedback and means that any timed-out builds should give at least
some idea of where they are stuck.
* Adds the render-tests filter to the integration and integration-root make
targets. This will show an overall summary of test results, as well as
- Discarding log output from passing tests to increase signal-to-noise
ratio, and
- Strongly delimiting the output from each failed test, making failures
easier to find.
* Removes the notion of a failure-only logger in favour of post-processing
the log events with render-tests. The failure-only logger catches log
output from the tests and only forwards it to the console if the test
fails. Unfortunately, not all log output is guaranteed to pass through
this logger (some teleport packages do not honour the configured logger,
and reports from the go race detector certainly don't), meaning some
output is presented at the time it happens, and other output is batched
and displayed at the end of the test. This makes working out what
happened where harder than it need be.
In addition, this patch also promotes the render-tests script into a fully-
fledged program, with appropriate makefile targets, make clean support, etc.
It is now also more robust in the face on non-JSON output from go test
(which happens if a package fails to compile).
2022-01-04 23:42:07 +00:00
| ${ RENDER_TESTS }
2021-04-09 23:20:56 +00:00
2022-02-15 01:19:33 +00:00
.PHONY : test -ci
test-ci : $( TEST_LOG_DIR ) $( RENDER_TESTS )
( cd .cloudbuild/scripts && \
go test -cover -json ./... \
| tee $( TEST_LOG_DIR) /ci.json \
| ${ RENDER_TESTS } )
2021-04-09 23:20:56 +00:00
#
# Runs all Go tests except integration and chaos, called by CI/CD.
#
UNIT_ROOT_REGEX := ^TestRoot
.PHONY : test -go -root
2022-06-25 04:01:21 +00:00
test-go-root : ensure -webassets bpf -bytecode rdpclient $( TEST_LOG_DIR ) $( RENDER_TESTS )
2022-04-15 22:35:34 +00:00
test-go-root : FLAGS ?= -race -shuffle on
2022-06-09 09:16:52 +00:00
test-go-root : PACKAGES = $( shell go list $ ( ADDFLAGS ) ./... | grep -v -e integration -e operator )
2021-04-09 23:20:56 +00:00
test-go-root : $( VERSRC )
2022-06-25 04:01:21 +00:00
$( CGOFLAG) go test -json -run " $( UNIT_ROOT_REGEX) " -tags " $( PAM_TAG) $( FIPS_TAG) $( BPF_TAG) $( RDPCLIENT_TAG) " $( PACKAGES) $( FLAGS) $( ADDFLAGS)
2022-02-15 01:19:33 +00:00
| tee $( TEST_LOG_DIR) /unit-root.json \
| ${ RENDER_TESTS }
2016-02-24 07:35:25 +00:00
2022-02-07 18:57:46 +00:00
#
# Runs Go tests on the api module. These have to be run separately as the package name is different.
2021-03-31 00:02:04 +00:00
#
.PHONY : test -api
test-api :
2022-04-15 22:35:34 +00:00
test-api : FLAGS ?= -race -shuffle on
2022-01-13 16:00:33 +00:00
test-api : PACKAGES = $( shell cd api && go list ./...)
2022-02-15 01:19:33 +00:00
test-api : $( VERSRC ) $( TEST_LOG_DIR ) $( RENDER_TESTS )
2022-06-25 04:01:21 +00:00
$( CGOFLAG) go test -json -tags " $( PAM_TAG) $( FIPS_TAG) $( BPF_TAG) " $( PACKAGES) $( FLAGS) $( ADDFLAGS) \
2022-02-15 01:19:33 +00:00
| tee $( TEST_LOG_DIR) /api.json \
| ${ RENDER_TESTS }
2021-03-31 00:02:04 +00:00
2022-06-09 09:16:52 +00:00
#
# Runs Teleport Operator tests.
# We have to run them using the makefile to ensure the installation of the k8s test tools (envtest)
#
.PHONY : test -operator
test-operator :
make -C operator test
2022-02-07 18:57:46 +00:00
#
# Runs cargo test on our Rust modules.
# (a no-op if cargo and rustc are not installed)
#
i f n e q ( $( CHECK_RUST ) , )
i f n e q ( $( CHECK_CARGO ) , )
.PHONY : test -rust
test-rust :
cargo test
e l s e
.PHONY : test -rust
test-rust :
e n d i f
e n d i f
2021-03-16 16:58:58 +00:00
# Find and run all shell script unit tests (using https://github.com/bats-core/bats-core)
.PHONY : test -sh
test-sh :
2021-04-08 15:02:29 +00:00
@if ! type bats 2>& 1 >/dev/null; then \
echo "Not running 'test-sh' target as 'bats' is not installed." ; \
if [ " $$ {DRONE} " = "true" ] ; then echo "This is a failure when running in CI." && exit 1; fi ; \
exit 0; \
fi ; \
find . -iname "*.bats" -exec dirname { } \; | uniq | xargs -t -L1 bats $( BATSFLAGS)
2021-03-16 16:58:58 +00:00
2021-11-30 01:12:16 +00:00
.PHONY : run -etcd
run-etcd :
examples/etcd/start-etcd.sh
2016-04-14 21:42:10 +00:00
#
2020-04-17 15:57:10 +00:00
# Integration tests. Need a TTY to work.
2021-02-15 19:43:39 +00:00
# Any tests which need to run as root must be skipped during regular integration testing.
2016-04-14 21:42:10 +00:00
#
.PHONY : integration
2020-04-17 15:57:10 +00:00
integration : FLAGS ?= -v -race
2022-01-13 16:00:33 +00:00
integration : PACKAGES = $( shell go list ./... | grep integration )
2022-02-15 01:19:33 +00:00
integration : $( TEST_LOG_DIR ) $( RENDER_TESTS )
2018-06-15 22:05:15 +00:00
@echo KUBECONFIG is: $( KUBECONFIG) , TEST_KUBE: $( TEST_KUBE)
2022-06-25 04:01:21 +00:00
$( CGOFLAG) go test -timeout 30m -json -tags " $( PAM_TAG) $( FIPS_TAG) $( BPF_TAG) $( RDPCLIENT_TAG) " $( PACKAGES) $( FLAGS) \
2022-02-15 01:19:33 +00:00
| tee $( TEST_LOG_DIR) /integration.json \
Attempts to make CI integration test logs more useful (#9626)
Actually tracking down the cause of a failure in the integration tests can
be hard:
* It's hard to get an overall summary of what failed
* The tests sometimes emit no output before timing out, meaning any
diagnostic info is lost
* The emitted logs are too voluminous for a human to parse
* The emitted logs can present information out of order
* It's often hard to tell where the output from one test ends
and the next one begins
This patch attempts to address these concerns without attempting to rewrite
any of the underlying teleport logging.
* It improves the render-tests script to (optionally) report progress per-
test, rather than on a per-package basis. My working hypothesis on the
tests that time out with no output is that go test ./integration is
waiting for the entire set of integration tests tests to be complete
before reporting success or failure. Reporting on a per-test cycle gives
faster feedback and means that any timed-out builds should give at least
some idea of where they are stuck.
* Adds the render-tests filter to the integration and integration-root make
targets. This will show an overall summary of test results, as well as
- Discarding log output from passing tests to increase signal-to-noise
ratio, and
- Strongly delimiting the output from each failed test, making failures
easier to find.
* Removes the notion of a failure-only logger in favour of post-processing
the log events with render-tests. The failure-only logger catches log
output from the tests and only forwards it to the console if the test
fails. Unfortunately, not all log output is guaranteed to pass through
this logger (some teleport packages do not honour the configured logger,
and reports from the go race detector certainly don't), meaning some
output is presented at the time it happens, and other output is batched
and displayed at the end of the test. This makes working out what
happened where harder than it need be.
In addition, this patch also promotes the render-tests script into a fully-
fledged program, with appropriate makefile targets, make clean support, etc.
It is now also more robust in the face on non-JSON output from go test
(which happens if a package fails to compile).
2022-01-04 23:42:07 +00:00
| $( RENDER_TESTS) -report-by test
2016-03-23 00:03:58 +00:00
2021-02-15 19:43:39 +00:00
#
# Integration tests which need to be run as root in order to complete successfully
# are run separately to all other integration tests. Need a TTY to work.
#
INTEGRATION_ROOT_REGEX := ^TestRoot
.PHONY : integration -root
integration-root : FLAGS ?= -v -race
2022-01-13 16:00:33 +00:00
integration-root : PACKAGES = $( shell go list ./... | grep integration )
2022-02-15 01:19:33 +00:00
integration-root : $( TEST_LOG_DIR ) $( RENDER_TESTS )
Attempts to make CI integration test logs more useful (#9626)
Actually tracking down the cause of a failure in the integration tests can
be hard:
* It's hard to get an overall summary of what failed
* The tests sometimes emit no output before timing out, meaning any
diagnostic info is lost
* The emitted logs are too voluminous for a human to parse
* The emitted logs can present information out of order
* It's often hard to tell where the output from one test ends
and the next one begins
This patch attempts to address these concerns without attempting to rewrite
any of the underlying teleport logging.
* It improves the render-tests script to (optionally) report progress per-
test, rather than on a per-package basis. My working hypothesis on the
tests that time out with no output is that go test ./integration is
waiting for the entire set of integration tests tests to be complete
before reporting success or failure. Reporting on a per-test cycle gives
faster feedback and means that any timed-out builds should give at least
some idea of where they are stuck.
* Adds the render-tests filter to the integration and integration-root make
targets. This will show an overall summary of test results, as well as
- Discarding log output from passing tests to increase signal-to-noise
ratio, and
- Strongly delimiting the output from each failed test, making failures
easier to find.
* Removes the notion of a failure-only logger in favour of post-processing
the log events with render-tests. The failure-only logger catches log
output from the tests and only forwards it to the console if the test
fails. Unfortunately, not all log output is guaranteed to pass through
this logger (some teleport packages do not honour the configured logger,
and reports from the go race detector certainly don't), meaning some
output is presented at the time it happens, and other output is batched
and displayed at the end of the test. This makes working out what
happened where harder than it need be.
In addition, this patch also promotes the render-tests script into a fully-
fledged program, with appropriate makefile targets, make clean support, etc.
It is now also more robust in the face on non-JSON output from go test
(which happens if a package fails to compile).
2022-01-04 23:42:07 +00:00
$( CGOFLAG) go test -json -run " $( INTEGRATION_ROOT_REGEX) " $( PACKAGES) $( FLAGS) \
2022-02-15 01:19:33 +00:00
| tee $( TEST_LOG_DIR) /integration-root.json \
Attempts to make CI integration test logs more useful (#9626)
Actually tracking down the cause of a failure in the integration tests can
be hard:
* It's hard to get an overall summary of what failed
* The tests sometimes emit no output before timing out, meaning any
diagnostic info is lost
* The emitted logs are too voluminous for a human to parse
* The emitted logs can present information out of order
* It's often hard to tell where the output from one test ends
and the next one begins
This patch attempts to address these concerns without attempting to rewrite
any of the underlying teleport logging.
* It improves the render-tests script to (optionally) report progress per-
test, rather than on a per-package basis. My working hypothesis on the
tests that time out with no output is that go test ./integration is
waiting for the entire set of integration tests tests to be complete
before reporting success or failure. Reporting on a per-test cycle gives
faster feedback and means that any timed-out builds should give at least
some idea of where they are stuck.
* Adds the render-tests filter to the integration and integration-root make
targets. This will show an overall summary of test results, as well as
- Discarding log output from passing tests to increase signal-to-noise
ratio, and
- Strongly delimiting the output from each failed test, making failures
easier to find.
* Removes the notion of a failure-only logger in favour of post-processing
the log events with render-tests. The failure-only logger catches log
output from the tests and only forwards it to the console if the test
fails. Unfortunately, not all log output is guaranteed to pass through
this logger (some teleport packages do not honour the configured logger,
and reports from the go race detector certainly don't), meaning some
output is presented at the time it happens, and other output is batched
and displayed at the end of the test. This makes working out what
happened where harder than it need be.
In addition, this patch also promotes the render-tests script into a fully-
fledged program, with appropriate makefile targets, make clean support, etc.
It is now also more robust in the face on non-JSON output from go test
(which happens if a package fails to compile).
2022-01-04 23:42:07 +00:00
| $( RENDER_TESTS) -report-by test
2021-02-15 19:43:39 +00:00
2020-04-10 18:37:09 +00:00
#
2021-11-05 19:35:20 +00:00
# Lint the source code.
2021-03-19 16:26:56 +00:00
# By default lint scans the entire repo. Pass GO_LINT_FLAGS='--new' to only scan local
2020-04-10 18:37:09 +00:00
# changes (or last commit).
#
.PHONY : lint
2022-02-07 18:57:46 +00:00
lint : lint -sh lint -helm lint -api lint -go lint -license lint -rust lint -tools
2022-02-07 17:03:10 +00:00
.PHONY : lint -tools
2022-02-10 20:49:28 +00:00
lint-tools : lint -build -tooling lint -bot lint -ci -scripts lint -backport
2021-11-05 19:35:20 +00:00
2022-02-07 18:57:46 +00:00
#
# Runs the clippy linter on our rust modules
# (a no-op if cargo and rustc are not installed)
#
i f n e q ( $( CHECK_RUST ) , )
i f n e q ( $( CHECK_CARGO ) , )
.PHONY : lint -rust
lint-rust :
cargo clippy --locked --all-targets -- -D warnings \
2021-11-05 19:35:20 +00:00
&& cargo fmt -- --check
2022-02-07 18:57:46 +00:00
e l s e
.PHONY : lint -rust
lint-rust :
e n d i f
e n d i f
2020-09-28 23:04:42 +00:00
.PHONY : lint -go
lint-go : GO_LINT_FLAGS ?=
lint-go :
2022-05-25 16:52:37 +00:00
golangci-lint run -c .golangci.yml --build-tags= '$(LIBFIDO2_TEST_TAG) $(TOUCHID_TAG)' $( GO_LINT_FLAGS)
2020-09-28 23:04:42 +00:00
2022-02-10 20:49:28 +00:00
.PHONY : lint -build -tooling
lint-build-tooling : GO_LINT_FLAGS ?=
lint-build-tooling :
cd build.assets/tooling && golangci-lint run -c ../../.golangci.yml $( GO_LINT_FLAGS)
2022-02-07 17:03:10 +00:00
.PHONY : lint -backport
lint-backport : GO_LINT_FLAGS ?=
lint-backport :
cd assets/backport && golangci-lint run -c ../../.golangci.yml $( GO_LINT_FLAGS)
.PHONY : lint -bot
lint-bot : GO_LINT_FLAGS ?=
lint-bot :
cd .github/workflows/robot && golangci-lint run -c ../../../.golangci.yml $( GO_LINT_FLAGS)
.PHONY : lint -ci -scripts
lint-ci-scripts : GO_LINT_FLAGS ?=
lint-ci-scripts :
cd .cloudbuild/scripts/ && golangci-lint run -c ../../.golangci.yml $( GO_LINT_FLAGS)
2021-03-31 00:02:04 +00:00
# api is no longer part of the teleport package, so golangci-lint skips it by default
.PHONY : lint -api
lint-api : GO_LINT_API_FLAGS ?=
lint-api :
2021-05-20 05:14:12 +00:00
cd api && golangci-lint run -c ../.golangci.yml $( GO_LINT_API_FLAGS)
2021-03-31 00:02:04 +00:00
2020-09-28 23:04:42 +00:00
# TODO(awly): remove the `--exclude` flag after cleaning up existing scripts
.PHONY : lint -sh
lint-sh : SH_LINT_FLAGS ?=
lint-sh :
2022-01-04 22:51:57 +00:00
find . -type f -name '*.sh' | xargs \
2020-09-28 23:04:42 +00:00
shellcheck \
2020-10-07 17:00:02 +00:00
--exclude= SC2086 \
2020-09-28 23:04:42 +00:00
$( SH_LINT_FLAGS)
2020-04-10 18:37:09 +00:00
2020-11-17 14:49:56 +00:00
# lint AWS AMI scripts
# SC1091 prints errors when "source" directives are not followed
find assets/aws/files/bin -type f | xargs \
shellcheck \
--exclude= SC2086 \
--exclude= SC1091 \
2021-02-24 00:45:28 +00:00
--exclude= SC2129 \
2020-11-17 14:49:56 +00:00
$( SH_LINT_FLAGS)
2021-02-08 21:08:05 +00:00
# Lints all the Helm charts found in directories under examples/chart and exits on failure
# If there is a .lint directory inside, the chart gets linted once for each .yaml file in that directory
2021-05-17 14:35:11 +00:00
# We inherit yamllint's 'relaxed' configuration as it's more compatible with Helm output and will only error on
2021-04-08 15:02:29 +00:00
# show-stopping issues. Kubernetes' YAML parser is not particularly fussy.
2021-05-17 14:35:11 +00:00
# If errors are found, the file is printed with line numbers to aid in debugging.
2021-02-08 21:08:05 +00:00
.PHONY : lint -helm
lint-helm :
2021-04-08 15:02:29 +00:00
@if ! type yamllint 2>& 1 >/dev/null; then \
echo "Not running 'lint-helm' target as 'yamllint' is not installed." ; \
if [ " $$ {DRONE} " = "true" ] ; then echo "This is a failure when running in CI." && exit 1; fi ; \
exit 0; \
fi ; \
2021-02-08 21:08:05 +00:00
for CHART in $$ ( find examples/chart -mindepth 1 -maxdepth 1 -type d) ; do \
2021-05-17 14:35:11 +00:00
if [ -d $$ { CHART} /.lint ] ; then \
for VALUES in $$ { CHART} /.lint/*.yaml; do \
export HELM_TEMP = $$ ( mktemp) ; \
echo -n " Using values from ' $$ {VALUES}': " ; \
2021-05-17 19:01:16 +00:00
yamllint -c examples/chart/.lint-config.yaml $$ { VALUES} || { cat -en $$ { VALUES} ; exit 1; } ; \
2021-05-17 14:35:11 +00:00
helm lint --strict $$ { CHART} -f $$ { VALUES} || exit 1; \
helm template test $$ { CHART} -f $$ { VALUES} 1>$$ { HELM_TEMP} || exit 1; \
2021-05-17 19:01:16 +00:00
yamllint -c examples/chart/.lint-config.yaml $$ { HELM_TEMP} || { cat -en $$ { HELM_TEMP} ; exit 1; } ; \
2021-02-08 21:08:05 +00:00
done \
else \
2021-05-17 14:35:11 +00:00
export HELM_TEMP = $$ ( mktemp) ; \
helm lint --strict $$ { CHART} || exit 1; \
helm template test $$ { CHART} 1>$$ { HELM_TEMP} || exit 1; \
2021-05-17 19:01:16 +00:00
yamllint -c examples/chart/.lint-config.yaml $$ { HELM_TEMP} || { cat -en $$ { HELM_TEMP} ; exit 1; } ; \
2021-05-17 14:35:11 +00:00
fi ; \
2021-02-08 21:08:05 +00:00
done
2021-08-30 16:44:09 +00:00
ADDLICENSE := $( GOPATH) /bin/addlicense
ADDLICENSE_ARGS := -c 'Gravitational, Inc' -l apache \
-ignore '**/*.c' \
-ignore '**/*.h' \
-ignore '**/*.html' \
-ignore '**/*.js' \
-ignore '**/*.py' \
-ignore '**/*.sh' \
-ignore '**/*.tf' \
-ignore '**/*.yaml' \
-ignore '**/*.yml' \
-ignore '**/Dockerfile' \
-ignore 'api/version.go' \
-ignore 'e/**' \
-ignore 'gitref.go' \
-ignore 'lib/web/build/**' \
2022-02-15 20:44:28 +00:00
-ignore 'lib/teleterm/api/protogen/**' \
2021-08-30 16:44:09 +00:00
-ignore 'version.go' \
-ignore 'webassets/**' \
2021-11-08 21:54:07 +00:00
-ignore 'ignoreme' \
2022-07-07 23:50:31 +00:00
-ignore 'lib/srv/desktop/rdp/rdpclient/target/**' \
-ignore 'docs/pages/includes/**/*.go'
2021-08-30 16:44:09 +00:00
.PHONY : lint -license
lint-license : $( ADDLICENSE )
$( ADDLICENSE) $( ADDLICENSE_ARGS) -check * 2>/dev/null
.PHONY : fix -license
fix-license : $( ADDLICENSE )
$( ADDLICENSE) $( ADDLICENSE_ARGS) * 2>/dev/null
$(ADDLICENSE) :
cd && go install github.com/google/addlicense@v1.0.0
2021-06-18 18:52:55 +00:00
# This rule triggers re-generation of version files if Makefile changes.
.PHONY : version
version : $( VERSRC )
# This rule triggers re-generation of version files specified if Makefile changes.
2017-01-25 03:36:30 +00:00
$(VERSRC) : Makefile
2016-12-31 08:13:41 +00:00
VERSION = $( VERSION) $( MAKE) -f version.mk setver
2021-10-28 17:15:47 +00:00
# Update api module path, but don't fail on error.
2022-01-24 19:16:05 +00:00
$( MAKE) update-api-import-path || true
2021-10-28 17:15:47 +00:00
# This rule updates the api module path to be in sync with the current api release version.
# e.g. github.com/gravitational/teleport/api/vX -> github.com/gravitational/teleport/api/vY
#
# It will immediately fail if:
# 1. A suffix is present in the version - e.g. "v7.0.0-alpha"
# 2. The major version suffix in the api module path hasn't changed. e.g:
# - v7.0.0 -> v7.1.0 - both use version suffix "/v7" - github.com/gravitational/teleport/api/v7
# - v0.0.0 -> v1.0.0 - both have no version suffix - github.com/gravitational/teleport/api
#
# Note: any build flags needed to compile go files (such as build tags) should be provided below.
2022-01-24 19:16:05 +00:00
.PHONY : update -api -import -path
update-api-import-path :
2022-06-25 04:01:21 +00:00
go run build.assets/gomod/update-api-import-path/main.go -tags "bpf fips pam desktop_access_rdp linux"
2022-01-24 19:16:05 +00:00
$( MAKE) grpc
2016-06-13 18:27:19 +00:00
2016-06-15 17:50:45 +00:00
# make tag - prints a tag to use with git for the current version
# To put a new release on Github:
# - bump VERSION variable
# - run make setver
# - commit changes to git
# - build binaries with 'make release'
# - run `make tag` and use its output to 'git tag' and 'git push --tags'
2021-07-23 02:31:53 +00:00
.PHONY : update -tag
update-tag :
@test $( VERSION)
git tag $( GITTAG)
git tag api/$( GITTAG)
git push origin $( GITTAG) && git push origin api/$( GITTAG)
2016-03-23 00:03:58 +00:00
2021-06-28 19:06:47 +00:00
# build/webassets directory contains the web assets (UI) which get
# embedded in the teleport binary
$(ASSETS_BUILDDIR)/webassets : ensure -webassets $( ASSETS_BUILDDIR )
2018-07-31 20:41:33 +00:00
i f n e q ( "$(OS)" , "windows" )
2021-06-28 19:06:47 +00:00
@echo "---> Copying OSS web assets." ; \
rm -rf $( ASSETS_BUILDDIR) /webassets; \
mkdir $( ASSETS_BUILDDIR) /webassets; \
cd webassets/teleport/ ; cp -r . ../../$@
2018-07-31 20:41:33 +00:00
e n d i f
2015-03-02 20:11:23 +00:00
2021-03-27 00:37:52 +00:00
$(ASSETS_BUILDDIR) :
mkdir -p $@
2021-05-04 18:13:47 +00:00
2016-03-23 18:12:24 +00:00
.PHONY : test -package
test-package : remove -temp -files
2021-04-01 17:12:53 +00:00
go test -v ./$( p)
2015-03-02 20:11:23 +00:00
2016-03-23 18:12:24 +00:00
.PHONY : test -grep -package
test-grep-package : remove -temp -files
2021-04-01 17:12:53 +00:00
go test -v ./$( p) -check.f= $( e)
2015-03-02 20:11:23 +00:00
2016-03-23 18:12:24 +00:00
.PHONY : cover -package
2015-05-04 15:28:32 +00:00
cover-package : remove -temp -files
2021-04-01 17:12:53 +00:00
go test -v ./$( p) -coverprofile= /tmp/coverage.out
go tool cover -html= /tmp/coverage.out
2015-03-02 20:11:23 +00:00
2016-03-23 18:12:24 +00:00
.PHONY : profile
2015-03-02 20:11:23 +00:00
profile :
2021-04-01 17:12:53 +00:00
go tool pprof http://localhost:6060/debug/pprof/profile
2015-03-02 20:11:23 +00:00
2016-03-23 18:12:24 +00:00
.PHONY : sloccount
2015-03-02 20:11:23 +00:00
sloccount :
2022-01-04 22:51:57 +00:00
find . -o -name "*.go" -print0 | xargs -0 wc -l
2015-05-14 01:40:39 +00:00
2016-03-23 18:12:24 +00:00
.PHONY : remove -temp -files
remove-temp-files :
find . -name flymake_* -delete
2016-10-09 23:00:20 +00:00
2020-04-25 00:54:49 +00:00
# Dockerized build: useful for making Linux releases on OSX
2016-10-09 23:00:20 +00:00
.PHONY : docker
docker :
2020-04-25 00:54:49 +00:00
make -C build.assets build
2021-12-07 15:46:08 +00:00
# Dockerized build: useful for making Linux binaries on macOS
2020-04-25 00:54:49 +00:00
.PHONY : docker -binaries
2020-07-20 20:18:00 +00:00
docker-binaries : clean
2020-04-25 00:54:49 +00:00
make -C build.assets build-binaries
2016-12-21 00:39:11 +00:00
# Interactively enters a Docker container (which you can build and run Teleport inside of)
.PHONY : enter
enter :
make -C build.assets enter
2017-05-27 01:03:19 +00:00
2022-04-22 10:50:24 +00:00
# Interactively enters a Docker container, as root (which you can build and run Teleport inside of)
.PHONY : enter -root
enter-root :
make -C build.assets enter-root
2022-04-18 14:07:10 +00:00
# Interactively enters a Docker container (which you can build and run Teleport inside of).
# Similar to `enter`, but uses the centos7 container.
.PHONY : enter /centos 7
enter/centos7 :
make -C build.assets enter/centos7
2021-12-07 15:46:08 +00:00
# grpc generates GRPC stubs from service definitions.
2022-01-20 01:05:25 +00:00
# This target runs in the buildbox container.
2017-05-27 01:03:19 +00:00
.PHONY : grpc
2021-03-10 19:16:08 +00:00
grpc :
2021-10-28 17:15:47 +00:00
$( MAKE) -C build.assets grpc
2017-05-27 01:03:19 +00:00
2022-02-22 19:39:35 +00:00
print/env :
env
2022-01-26 21:07:42 +00:00
2022-01-20 01:05:25 +00:00
# buildbox-grpc generates GRPC stubs
.PHONY : buildbox -grpc
2022-02-22 19:39:35 +00:00
buildbox-grpc : API_IMPORT_PATH := $( shell head -1 api /go .mod | awk '{print $ $ 2}')
# Proto file dependencies within the api module must be passed with the 'M'
# flag. This way protoc generated files will use the correct api module import
# path in the case where the import path has a version suffix, e.g.
# "github.com/gravitational/teleport/api/v8".
buildbox-grpc : GOGOPROTO_IMPORTMAP := $\
Mgithub.com/gravitational/teleport/api/types/events/events.proto= $( API_IMPORT_PATH) /types/events,$\
Mgithub.com/gravitational/teleport/api/types/types.proto= $( API_IMPORT_PATH) /types,$\
Mgithub.com/gravitational/teleport/api/types/webauthn/webauthn.proto= $( API_IMPORT_PATH) /types/webauthn,$\
Mgithub.com/gravitational/teleport/api/types/wrappers/wrappers.proto= $( API_IMPORT_PATH) /types/wrappers,$\
Mignoreme = ignoreme
2022-01-20 01:05:25 +00:00
buildbox-grpc :
2022-02-22 19:39:35 +00:00
@echo " PROTO_INCLUDE = $$ PROTO_INCLUDE "
2022-06-06 13:06:57 +00:00
$( CLANG_FORMAT) -i -style= $( CLANG_FORMAT_STYLE) \
2021-12-16 22:20:53 +00:00
api/client/proto/authservice.proto \
2022-06-02 17:08:24 +00:00
api/client/proto/certs.proto \
2022-02-10 00:41:34 +00:00
api/client/proto/joinservice.proto \
2022-06-02 17:08:24 +00:00
api/client/proto/proxyservice.proto \
2021-12-16 22:20:53 +00:00
api/types/events/events.proto \
api/types/types.proto \
api/types/webauthn/webauthn.proto \
api/types/wrappers/wrappers.proto \
lib/multiplexer/test/ping.proto \
lib/web/envelope.proto
2022-01-24 19:16:05 +00:00
cd api/client/proto && protoc -I= .:$$ PROTO_INCLUDE \
--gogofast_out= plugins = grpc,$( GOGOPROTO_IMPORTMAP) :. \
2022-06-02 17:08:24 +00:00
authservice.proto certs.proto joinservice.proto proxyservice.proto
2020-04-15 19:35:26 +00:00
2022-01-24 19:16:05 +00:00
cd api/types/events && protoc -I= .:$$ PROTO_INCLUDE \
--gogofast_out= plugins = grpc,$( GOGOPROTO_IMPORTMAP) :. \
2021-01-15 00:13:17 +00:00
events.proto
Events and GRPC API
This commit introduces several key changes to
Teleport backend and API infrastructure
in order to achieve scalability improvements
on 10K+ node deployments.
Events and plain keyspace
--------------------------
New backend interface supports events,
pagination and range queries
and moves away from buckets to
plain keyspace, what better aligns
with DynamoDB and Etcd featuring similar
interfaces.
All backend implementations are
exposing Events API, allowing
multiple subscribers to consume the same
event stream and avoid polling database.
Replacing BoltDB, Dir with SQLite
-------------------------------
BoltDB backend does not support
having two processes access the database at the
same time. This prevented Teleport
using BoltDB backend to be live reloaded.
SQLite supports reads/writes by multiple
processes and makes Dir backend obsolete
as SQLite is more efficient on larger collections,
supports transactions and can detect data
corruption.
Teleport automatically migrates data from
Bolt and Dir backends into SQLite.
GRPC API and protobuf resources
-------------------------------
GRPC API has been introduced for
the auth server. The auth server now serves both GRPC
and JSON-HTTP API on the same TLS socket and uses
the same client certificate authentication.
All future API methods should use GRPC and HTTP-JSON
API is considered obsolete.
In addition to that some resources like
Server and CertificateAuthority are now
generated from protobuf service specifications in
a way that is fully backward compatible with
original JSON spec and schema, so the same resource
can be encoded and decoded from JSON, YAML
and protobuf.
All models should be refactored
into new proto specification over time.
Streaming presence service
--------------------------
In order to cut bandwidth, nodes
are sending full updates only when changes
to labels or spec have occured, otherwise
new light-weight GRPC keep alive updates are sent
over to the presence service, reducing
bandwidth usage on multi-node deployments.
In addition to that nodes are no longer polling
auth server for certificate authority rotation
updates, instead they subscribe to event updates
to detect updates as soon as they happen.
This is a new API, so the errors are inevitable,
that's why polling is still done, but
on a way slower rate.
2018-11-07 23:33:38 +00:00
2022-01-24 19:16:05 +00:00
cd api/types && protoc -I= .:$$ PROTO_INCLUDE \
--gogofast_out= plugins = grpc,$( GOGOPROTO_IMPORTMAP) :. \
2021-12-16 22:20:53 +00:00
types.proto
2022-01-24 19:16:05 +00:00
cd api/types/webauthn && protoc -I= .:$$ PROTO_INCLUDE \
--gogofast_out= plugins = grpc,$( GOGOPROTO_IMPORTMAP) :. \
2021-08-19 19:28:05 +00:00
webauthn.proto
2022-01-24 19:16:05 +00:00
cd api/types/wrappers && protoc -I= .:$$ PROTO_INCLUDE \
--gogofast_out= plugins = grpc,$( GOGOPROTO_IMPORTMAP) :. \
2021-01-14 22:58:44 +00:00
wrappers.proto
2020-07-15 00:15:01 +00:00
cd lib/multiplexer/test && protoc -I= .:$$ PROTO_INCLUDE \
2022-01-24 19:16:05 +00:00
--gogofast_out= plugins = grpc,$( GOGOPROTO_IMPORTMAP) :. \
2021-12-16 22:20:53 +00:00
ping.proto
2020-07-15 00:15:01 +00:00
2020-09-24 17:59:48 +00:00
cd lib/web && protoc -I= .:$$ PROTO_INCLUDE \
2022-01-24 19:16:05 +00:00
--gogofast_out= plugins = grpc,$( GOGOPROTO_IMPORTMAP) :. \
2021-12-16 22:20:53 +00:00
envelope.proto
2021-08-25 18:39:59 +00:00
2022-02-25 11:54:01 +00:00
# grpc-teleterm generates Go, TypeScript and JavaScript gRPC stubs from definitions for Teleport
# Terminal. This target runs in the buildbox-teleterm container.
#
# It exists as a separate target because on M1 MacBooks we must build grpc_node_plugin from source.
# That involves apt-get install of cmake & build-essential as well pulling hundreds of megabytes of
# git repos. It would significantly increase the time it takes to build buildbox for M1 users that
# don't need to generate Teleterm gRPC files.
# TODO(ravicious): incorporate grpc-teleterm into grpc once grpc-tools adds arm64 binary.
# https://github.com/grpc/grpc-node/issues/1405
.PHONY : grpc -teleterm
grpc-teleterm :
$( MAKE) -C build.assets grpc-teleterm
# buildbox-grpc generates GRPC stubs
.PHONY : buildbox -grpc -teleterm
buildbox-grpc-teleterm :
2022-06-06 13:06:57 +00:00
$( CLANG_FORMAT) -i -style= $( CLANG_FORMAT_STYLE) \
lib/teleterm/api/proto/**/*.proto
2022-02-15 20:44:28 +00:00
cd lib/teleterm && buf generate
2022-01-24 19:16:05 +00:00
2017-09-17 23:24:11 +00:00
.PHONY : goinstall
goinstall :
2021-04-01 17:12:53 +00:00
go install $( BUILDFLAGS) \
2017-09-17 23:24:11 +00:00
github.com/gravitational/teleport/tool/tsh \
github.com/gravitational/teleport/tool/teleport \
github.com/gravitational/teleport/tool/tctl
2018-02-24 01:23:09 +00:00
# make install will installs system-wide teleport
2017-09-17 23:24:11 +00:00
.PHONY : install
install : build
@echo "\n** Make sure to run 'make install' as root! **\n"
cp -f $( BUILDDIR) /tctl $( BINDIR) /
cp -f $( BUILDDIR) /tsh $( BINDIR) /
cp -f $( BUILDDIR) /teleport $( BINDIR) /
mkdir -p $( DATADIR)
2018-05-19 23:58:14 +00:00
2020-04-25 00:54:49 +00:00
# Docker image build. Always build the binaries themselves within docker (see
# the "docker" rule) to avoid dependencies on the host libc version.
2018-05-19 23:58:14 +00:00
.PHONY : image
2020-07-20 20:18:00 +00:00
image : clean docker -binaries
2018-06-20 23:36:54 +00:00
cp ./build.assets/charts/Dockerfile $( BUILDDIR) /
2022-07-26 16:14:08 +00:00
cd $( BUILDDIR) && docker build --no-cache . -t $( DOCKER_IMAGE_QUAY) :$( VERSION)
2018-05-19 23:58:14 +00:00
if [ -f e/Makefile ] ; then $( MAKE) -C e image; fi
.PHONY : publish
2020-04-25 00:54:49 +00:00
publish : image
2022-07-26 16:14:08 +00:00
docker push $( DOCKER_IMAGE_QUAY) :$( VERSION)
2018-05-19 23:58:14 +00:00
if [ -f e/Makefile ] ; then $( MAKE) -C e publish; fi
2022-07-26 16:14:08 +00:00
.PHONY : publish -ecr
publish-ecr : image
docker tag $( DOCKER_IMAGE_QUAY) $( DOCKER_IMAGE_ECR)
docker push $( DOCKER_IMAGE_ECR) :$( VERSION)
if [ -f e/Makefile ] ; then $( MAKE) -C e publish-ecr; fi
2020-09-21 17:34:50 +00:00
# Docker image build in CI.
# This is run to build and push Docker images to a private repository as part of the build process.
# When we are ready to make the images public after testing (i.e. when publishing a release), we pull these
# images down, retag them and push them up to the production repo so they're available for use.
# This job can be removed/consolidated after we switch over completely from using Jenkins to using Drone.
.PHONY : image -ci
image-ci : clean docker -binaries
cp ./build.assets/charts/Dockerfile $( BUILDDIR) /
2022-07-26 16:14:08 +00:00
cd $( BUILDDIR) && docker build --no-cache . -t $( DOCKER_IMAGE_STAGING) :$( VERSION)
2020-09-21 17:34:50 +00:00
if [ -f e/Makefile ] ; then $( MAKE) -C e image-ci; fi
.PHONY : publish -ci
publish-ci : image -ci
2022-07-26 16:14:08 +00:00
docker push $( DOCKER_IMAGE_STAGING) :$( VERSION)
2020-09-21 17:34:50 +00:00
if [ -f e/Makefile ] ; then $( MAKE) -C e publish-ci; fi
2022-06-09 09:16:52 +00:00
# Docker image build for Teleport Operator
.PHONY : image -operator -ci
image-operator-ci :
make -C operator docker-build IMG = $( DOCKER_IMAGE_OPERATOR_CI) :$( VERSION)
.PHONY : publish -operator -ci
publish-operator-ci : image -operator -ci
docker push $( DOCKER_IMAGE_OPERATOR_CI) :$( VERSION)
2018-05-19 23:58:14 +00:00
.PHONY : print -version
print-version :
@echo $( VERSION)
.PHONY : chart -ent
chart-ent :
$( MAKE) -C e chart
2019-07-12 17:47:59 +00:00
RUNTIME_SECTION ?=
TARBALL_PATH_SECTION ?=
i f n e q ( "$(RUNTIME)" , "" )
RUNTIME_SECTION := -r $( RUNTIME)
e n d i f
i f n e q ( "$(OSS_TARBALL_PATH)" , "" )
TARBALL_PATH_SECTION := -s $( OSS_TARBALL_PATH)
e n d i f
# build .pkg
.PHONY : pkg
pkg :
2020-07-17 00:43:18 +00:00
mkdir -p $( BUILDDIR) /
2022-06-17 15:05:39 +00:00
cp ./build.assets/build-package.sh ./build.assets/build-common.sh $( BUILDDIR) /
2019-07-12 17:47:59 +00:00
chmod +x $( BUILDDIR) /build-package.sh
# arch and runtime are currently ignored on OS X
# we pass them through for consistency - they will be dropped by the build script
cd $( BUILDDIR) && ./build-package.sh -t oss -v $( VERSION) -p pkg -a $( ARCH) $( RUNTIME_SECTION) $( TARBALL_PATH_SECTION)
if [ -f e/Makefile ] ; then $( MAKE) -C e pkg; fi
2019-12-20 00:42:50 +00:00
# build tsh client-only .pkg
.PHONY : pkg -tsh
pkg-tsh :
2022-05-23 20:56:21 +00:00
./build.assets/build-pkg-tsh.sh -t oss -v $( VERSION) $( TARBALL_PATH_SECTION)
2020-07-17 00:43:18 +00:00
mkdir -p $( BUILDDIR) /
2022-05-23 20:56:21 +00:00
mv tsh*.pkg* $( BUILDDIR) /
2019-12-20 00:42:50 +00:00
2019-07-12 17:47:59 +00:00
# build .rpm
.PHONY : rpm
rpm :
2020-07-17 00:43:18 +00:00
mkdir -p $( BUILDDIR) /
2022-06-17 15:05:39 +00:00
cp ./build.assets/build-package.sh ./build.assets/build-common.sh $( BUILDDIR) /
2019-07-12 17:47:59 +00:00
chmod +x $( BUILDDIR) /build-package.sh
2021-05-31 16:52:30 +00:00
cp -a ./build.assets/rpm $( BUILDDIR) /
2020-10-31 18:27:00 +00:00
cp -a ./build.assets/rpm-sign $( BUILDDIR) /
2019-07-12 17:47:59 +00:00
cd $( BUILDDIR) && ./build-package.sh -t oss -v $( VERSION) -p rpm -a $( ARCH) $( RUNTIME_SECTION) $( TARBALL_PATH_SECTION)
if [ -f e/Makefile ] ; then $( MAKE) -C e rpm; fi
2020-10-31 18:27:00 +00:00
# build unsigned .rpm (for testing)
.PHONY : rpm -unsigned
rpm-unsigned :
$( MAKE) UNSIGNED_RPM = true rpm
2019-07-12 17:47:59 +00:00
# build .deb
.PHONY : deb
deb :
2020-07-17 00:43:18 +00:00
mkdir -p $( BUILDDIR) /
2022-06-17 15:05:39 +00:00
cp ./build.assets/build-package.sh ./build.assets/build-common.sh $( BUILDDIR) /
2019-07-12 17:47:59 +00:00
chmod +x $( BUILDDIR) /build-package.sh
cd $( BUILDDIR) && ./build-package.sh -t oss -v $( VERSION) -p deb -a $( ARCH) $( RUNTIME_SECTION) $( TARBALL_PATH_SECTION)
if [ -f e/Makefile ] ; then $( MAKE) -C e deb; fi
2022-07-26 21:31:35 +00:00
# check binary compatibility with different OSes
.PHONY : test -compat
test-compat :
./build.assets/build-test-compat.sh
2020-04-15 19:35:26 +00:00
.PHONY : ensure -webassets
ensure-webassets :
@if [ ! -d $( shell pwd ) /webassets/teleport/ ] ; then \
$( MAKE) init-webapps-submodules; \
fi ;
.PHONY : ensure -webassets -e
ensure-webassets-e :
@if [ ! -d $( shell pwd ) /webassets/e/teleport ] ; then \
$( MAKE) init-webapps-submodules-e; \
fi ;
.PHONY : init -webapps -submodules
init-webapps-submodules :
echo "init webassets submodule"
git submodule update --init webassets
.PHONY : init -webapps -submodules -e
init-webapps-submodules-e :
echo "init webassets oss and enterprise submodules"
git submodule update --init --recursive webassets
.PHONY : init -submodules -e
init-submodules-e : init -webapps -submodules -e
git submodule init e
2020-04-17 15:57:10 +00:00
git submodule update
2020-07-10 23:42:09 +00:00
2021-03-10 18:53:17 +00:00
# update-webassets updates the minified code in the webassets repo using the latest webapps
# repo and creates a PR in the teleport repo to update webassets submodule.
.PHONY : update -webassets
update-webassets : WEBAPPS_BRANCH ?= 'master '
update-webassets : TELEPORT_BRANCH ?= 'master '
update-webassets :
build.assets/webapps/update-teleport-webassets.sh -w $( WEBAPPS_BRANCH) -t $( TELEPORT_BRANCH)
2021-03-23 01:32:45 +00:00
# dronegen generates .drone.yml config
.PHONY : dronegen
dronegen :
go run ./dronegen
2022-02-01 20:07:23 +00:00
# backport will automatically create backports for a given PR as long as you have the "gh" tool
# installed locally. To backport, type "make backport PR=1234 TO=branch/1,branch/2".
.PHONY : backport
backport :
2022-02-15 01:19:33 +00:00
( cd ./assets/backport && go run main.go -pr= $( PR) -to= $( TO) )