Commit graph

335 commits

Author SHA1 Message Date
Alan Parra 0baf1d38d3
Drop libudev-dev from buildbox dependencies (#16099)
We use a manually-built libudev-zero, so that dependency is not required.
2022-09-02 15:54:06 +00:00
Trent Clarke e076f7835c
Adds slack channel alert to Teleport Connect build (#15937)
WARNING: Due to issues with the windows drone executor's poor escaping when it echoes commands, I have moved the error message functionality into the PS build functions in build.assets/windows/build.ps1. This means that any failures that occur during the code checkout step will not be reported.

I'm not sure that this is the correct tradeoff, but it may well suffice for now.
2022-08-31 11:32:31 +10:00
Alan Parra d5e57f8cd1
Apply linters to legacy protos (#15879)
Applies linters to legacy protos and adds a few additional Makefile targets to
make it easier to manage protos locally.

Proto linters now run in CI.

#15187

* Apply linters to legacy protos
* Handle new folders in genproto.sh, reset gen/proto if exists
* Lint and format lib/teleterm as part of protos/all
2022-08-29 20:54:32 +00:00
Alan Parra 49e3c0d6d0
Use Buf linters and formatter on lib/teleterm protos (#15877)
Similarly to #15856, moves lib/teleterm fully to Buf.

#15187

* Fix buf lint warnings on lib/teleterm
* Enable buf build and lint for lib/teleterm
* Use buildbox Buf in Connect, enable build/lint/format
* Reformat protos
* Update generated protos
2022-08-29 19:45:03 +00:00
Trent Clarke 1f58333531
Build Teleport Connect for Windows (#15292)
Uses Drone to build Teleport Connect for Windows on a Native 
Windows builder.

This PR adds 2 pipelines to the Drone YAML:

1. `push-build-native-windows-amd64`: Invoked on a push to master, 
   branch/v*, etc., and asserts that Teleport Connect can be built, and
   
2. `build-native-windows-amd64`: Invoked when a branch tag is 
   committed to the teleport Repo. Builds Teleport Connect and uploads 
   it to dronestorage
   
These builds are run on a native windows builder (as opposed to tsh, 
which is built in a linux environment and cross-compiled for Windows)
2022-08-29 16:56:55 +10:00
Alan Parra 0b76b44973
Use to Buf to lint, format and generate api/ protos (#15856)
Change the proto layout of `api/` to a more standard setup, allowing the use of
modern tools (like Buf) to format/lint (and maybe, one day, generate sources).

The new layout looks like this:

``` api/ proto/       <- root of protos and proto imports teleport/  <- base
package for Teleport protos (akin to "google/" or "gogoproto/") legacy/  <- root
of "legacy" protos (most linters disabled) client/ proto/ types/ events/
webauthn/ wrappers/ ```

Non-legacy `api/` protos are expected to follow this layout:

``` api/ proto/ teleport/ mynewpackage/  <- package name v1/          <- protos
explicitly versioned gen/      proto/  <- root for generated sources
(multi-language possible, separate from hand-written code) go/ mynewpackage/ v1
<- generate Go sources go here. ```

Some outstanding issues, like lack of `go_package` declarations and non-standard
import paths (`import "github.com/gravitational/teleport/.../some.proto"`) are
fixed.

Legacy protos still have irregular package declarations. It's possible to fix
that, but it's a bit harder to reason about, as generated sources change in
possibly-meaningful ways.

Future iterations could change legacy packages to match the directory structure
and apply a similar change to protos within lib/ packages, but this seems
sufficient for a first step.

* Add Buf to buildbox
* Unify API protos under Buf
* Fix proto generation
* Reformat protos
* Update generated protos
* Generate protos using Buf
* Appease linter
* Review: make sure gogo protobuf versions are in sync
* Clean leftovers from previous attempts
* Fix operator/Makefile
* Rename internal make gRPC targets to `*/host`
* Sort `make fix-license` targets (nit)
2022-08-26 18:11:38 +00:00
Rafał Cieślak b4c94ebf9b
Add drone pipeline for building Connect with signed tsh.app (#15763)
* Add proof of concept of Connect pipeline

The proof of concept includes a lot of copy-pasted lines which will get
cleared up in subsequent commits.

* Extract copying artifacts into separate functions

The tag pipeline no longer needs to worry about Connect artifacts.

* Reuse steps to install & cleanup toolchains

* Share toolchain configuration commands between pipelines

* Share build commands among different pipelines

* Download webapps only if a pipeline builds Connect

As seen by the changes to .drone.yml, this removes unnecessary webapps
clones from these tag pipelines: build-darwin-amd64, build-darwin-amd64-pkg,
build-darwin-amd64-pkg-tsh. None of them needs webapps to function anymore
and the pkg pipelines never needed webapps in the first place.
2022-08-24 16:38:42 +02:00
Zac Bergquist ac4d7fe651
Build Teleport Connect for Linux (#15509)
In order to do so, we add a new make target:

    make teleterm

This (temporarily) assumes that the gravitational/webapps repo is
cloned at the right version as a sibling to the teleport repo.
(We'll be able to get rid of this when we merge webapps into Teleport)

Additionally, update dronegen to include the name of the calling
function that generated the snippet instead of the line number.
This gets rid of lots of superfluous diffs in the generated
.drone.yml file.

Lastly, rewrite the Go program for getting the right webapps version
in bash, because Go is not available at this step of the drone pipeline.

Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2022-08-23 13:57:22 -06:00
Trent Clarke a72d1c7285
Adds CI hooks for GLibc compatibility check (#15547)
Adds the GCB build yaml for controlling the build, and updates the test script
to work in both the GCB environment and on a local dev machine.

Also changes the centos buildbox to leave the default user as root. When
GCB mounts the workspace into the container, the source code is owned
by root, and there is no way to change this. This means that the build will
fail when the non-root user specified in the build image attempt to write files
into the workspace. Setting the root user fixes this.

See-Also: #15186
2022-08-23 10:02:35 +10:00
Logan Davis 830794a9cf
Replace quay.io with amazon ECR where appropriate (#15382) 2022-08-19 10:24:15 -05:00
Logan Davis 76606fc18b
Update buildbox to push to ECR (#15058) 2022-08-16 21:07:07 +00:00
Logan Davis 1f0b4a744b
Update fpm images to use amazon ECR (#15274) 2022-08-15 23:28:34 +00:00
Zac Bergquist 17eee19bd5
Simplify webassets script (#15100)
Now that we have automation in place for updating the webassets
repo, this script no longer needs to build webassets. Instead,
it just updates the webassets submodule to point at the tip of
whatever branch is specified and opens the Teleport PR.
2022-08-03 20:26:59 +00:00
fheinecke b022fea56b
Added YUM implementation of OS package build tool (#14203)
* Added YUM implementation of OS package build tool

* Addressed PR comments

* Added YUM migrations

* Added curl to YUM dependencies

* Changed pipelines to use golang:1.18.4-bullseye for Go

* Implemented proper repo downloading logic

* Fixed other merge conflicts

* Added artifacts cleanup

* Removed delete on s3 sync

* Added RPM migrations

* v8 migrations

* Partial v8 migration

* Migration remainder

* Reduced requested resources

* Updated resource limits per step

* Added k8s stage resource limits to drone

* Fixed format issue

* Removed resource requests

* Added `depends_on` support to dronegen

* v8.3 migrations

* Fixed parallelism

* Removed migration parallelism

* Fixed RPM base arch lookup

* v6 and v7 YUM migration

* Fixed missing ISA

* Updated repo file path

* Added logging

* Removed vars from repo file

* v8.3 migration first batch

* v8.3 migration second batch

* v9.0 migration

* v9.1 migration

* v9.2 migration

* v9.3 first migration

* v9.3 second migration

* v10.0 migration

* Removed migrations

* Disabled shell linting non-issues

* Fixed linter problem

* More linter fixes
2022-08-02 21:32:59 +00:00
Alan Parra 0f386f273b
Make tsh installer non relocatable and drop version from app (#15018)
This is a twofold change with the aim of reducing possible pains with the tsh
installer.

- Dropping the version number from "tsh.app" makes it more alike other apps
  (including Connect)
- Making the installer non-relocatable makes it easy to reason about (and
  ensures our postinstall script is correct!)

A relocatable installer will look for the app in places other the specified
install path, according to the bundle ID. This means that if the user moves or
renames the app, the installer will overwrite it no matter where it is. It also
means our path assumptions can be wrong.

Note that the installer itself is still numbered, so it won't break Houston or
change the downloads page.
2022-07-29 11:18:27 -03:00
Jakub Nyckowski cb7194092a
Add binary compatibility checking script (#14539)
Co-authored-by: Marek Smoliński <marek@goteleport.com>
2022-07-26 21:31:35 +00:00
Logan Davis b6c2598473
Add old cron job file for v8 (#14666) 2022-07-20 16:56:51 +00:00
Trent Clarke 1686a71c8a
Remove centralised port allocation for tests (#13658)
Ports used by the unit tests have been allocated by pulling them out of a list, with no guarantee that the port is not actually in use. This central allocation point also means that tests cannot be split into separate packages to be run in parallel, as the ports allocated between the various packages will be allocated multiple times and end up intermittently clashing.

There is also no guarantee, even when the tests are run serially, that the ports will not clash with services already running on the machine.

This patch (largely) replaces the use of this centralised port allocation with pre-created listeners injected into the test via the file descriptor import mechanism use by Teleport to pass open ports to child processes.

There are still some cases where the old port allocation system is still in use. I felt this was already getting beyond the bounds of sensibly reviewable, so I have left those for a further PR after this.

See-Also: #12421
See-Also: #14408
2022-07-20 12:04:54 +10:00
Edoardo Spadolini 0985151b02
Build-time cbindgen (#14177) 2022-07-19 20:10:27 +00:00
Noah Stride 704009f4de
Add tbot to nightly build (#14630) 2022-07-19 14:09:16 +00:00
Noah Stride b433cdbace
Bundle tbot into the built docker images (#14308)
Bundle tbot into the built docker images
2022-07-14 12:35:49 +00:00
Jakub Nyckowski c3dde989cc
Update protoc to v3.20.1 (#14097)
Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>
2022-07-07 23:21:32 +00:00
Trent Clarke e3ced072b7
Trims the buildbox (#14036)
- Enables the docker BuildKit in an attempt to speed up builds
 - Trims slightly under 2GB off image size
 - Break more dependencies out into separate build stages
 - Adds some simple supply-chain protections for dependencies sourced
   via git. The Docker build now checks that the commit SHAs are what
   we expect, and not just assume that the tags haven't changed.
 - Moves the `cbindgen` build to a stage to avoid pulling in extra
   dependencies not needed for the Teleport build
 - Combines the `gcloud` and firestore emulator install into one step to
   reduce the layer count.
 - Ports some of the above the Centos7 Dockerfile.
2022-07-07 12:28:35 +10:00
Jakub Nyckowski d03f8db0ca
Use CentOS 7 for building release binaries (#14062)
Switch to CenOS 7 as a base for Teleport releases.

Co-authored-by: Roman Tkachenko <roman@goteleport.com>
2022-07-02 02:11:37 +00:00
Alan Parra c206824be1
Drop v from macOS tsh installer version number (#13896)
Drop the `v` from the tsh installer version number, which was inadvertently
changed by #12751. Makes the installer reappear as a download option in Houston.

Note that the final .app name still has the `v`. Ie:

* tsh-10.0.0-dev.pkg (installer)
* tsh-10.0.0-dev.pkg.sha256 (installer hash)
* tsh-v10.0.0-dev.app (Application package)
2022-06-28 14:21:30 +00:00
Zac Bergquist 61463166c1
Remove tctl roletester (#13863)
This code was unmaintained, created issues with our build system,
and didn't actually match the behavior of Teleport's RBAC engine.

We will revisit this functionality in the future when we investigate
"acess policies as code."
2022-06-25 04:01:21 +00:00
Roman Tkachenko 423c005c7d
Fix tsh package build (#13813) 2022-06-25 00:16:46 +00:00
Alan Parra 1552e1a826
Use .json extension for Gon config file (#13667)
Gon configuration files need a proper extension, otherwise it errors.
2022-06-21 20:03:32 +00:00
Alan Parra 97a2dd2a5d
Rebuild FIDO2 dependencies on failure (#13410)
Attempt to detect builder environment inconsistencies by compiling a toy FIDO2
program - if this fails, then clear the cache and try again.

Builders are sometimes getting into inconsistent states, this should help
avoiding manual intervention in order to fix them.
2022-06-21 18:30:54 +00:00
Jakub Nyckowski 8470e473fa
Remove Clang from CentOS 7 Docker buildbox (#13614) 2022-06-17 22:14:34 +00:00
Zac Bergquist 8c7eb94c4b
Fix CentOS 7 builds after upgrading prost (#13579)
Recent Rust dependency upgrades include a newer version of prost.
This new version no longer ships embedded protoc binaries, and
instead tries to build protoc from source. This would require us
to install cmake on our buildboxes. We want to avoid this and
instead leverage the version of protoc already installed.

This change was made to the standard buildbox, but the CentOS 7
buildbox was missed.

Additionally, I noticed that Rust was installed in
Dockerfile-centos7-fips, but not in Dockerfile-fips, which means
the FIPS binaries have different functionality depending on which
version you use. To correct this, I removed Rust from the CentOS 7
FIPS builds (since the Rust features are not FIPS compliant anyway).
2022-06-17 15:05:39 +00:00
Zac Bergquist 895ed4d5dc
⬇️ downgrade Rust to 1.58.1 (#13544)
Newer versions of Rust increase our minimum GLIBC requirement,
which is not acceptable at this time.
2022-06-16 19:49:26 +00:00
Roman Tkachenko 683d11d23e
Update versions to 11 (#13528) 2022-06-15 23:28:08 +00:00
Alan Parra 29d3f80261
Use make release-windows on Drone, make it similar to make release (#13532)
Switch from `make release-amd64` to make release-windows in Drone builds, making
release builds similar to "regular" builds (that already use
`make release-windows-unsigned`).

Fixes current woes caused by FIDO2=yes in Windows release builds. (Note that
ARCH is implied by the build.)

* Use `make release-windows` on Drone, make it similar to `make release`
* Update .drone.yaml
2022-06-15 19:59:34 +00:00
Jakub Nyckowski c9277ab8f0
Add libbpf and Clang to Centos 7 image (#13261)
Enable BPF for CentOS 7 builds.

Co-authored-by: Alan Parra <alan.parra@goteleport.com>
2022-06-15 18:54:02 +00:00
Joel 3b394ae431
fix master CD by pointing prost at protoc (#13461) 2022-06-14 10:53:33 +00:00
Alex McGrath 5ef7270111
Add sudo to the Dockerfile (#13334) 2022-06-09 14:57:47 +00:00
Jakub Nyckowski b5ccc21aba
Update libbpf to 0.7.0-teleport (#13201) 2022-06-06 23:41:57 +00:00
Rafał Cieślak fabdabb2d7
Dockerfile-teleterm: Fix NODE_URL & NODE_PATH (#13192)
After recent changes in #12257, Dockerfile-teleterm was made to accept
NODE_VERSION passed from a build arg.

The problem is that NODE_VERSION used to follow the format of `vX.Y.Z`,
while NODE_VERSION in build.assets/Makefile follows the `X.Y.Z` format.

This commit adds the missing `v`s to NODE_URL and NODE_PATH.
2022-06-06 15:40:48 +00:00
Alan Parra c865e7ea92
Add icon to macOS tsh.app (#13022)
Icons file generated using a 512x512 base image and `makeicns`.

#9160
2022-06-03 21:12:00 +00:00
fheinecke 6a693b9ce7
RFD 58: Package Distribution (#10746)
* Wrote RFD and implementation for APT repos.
2022-06-03 14:36:56 -05:00
fheinecke 6045b6922d
Added debugging packages to Docker images (#13124) 2022-06-03 09:47:36 -05:00
Zac Bergquist 86f3a3d618
Build Teleport Connect on darwin/amd64 (#12257)
This commit updates drone to build Teleport Connect by:

* cloning `gravitational/webapps` as a sibling directory to
  gravitational/teleport
* checkout out the right version of webapps by running a simple
  Go program (this step is only necessary until we move webapps
  into the teleport repo)
* Running the Teleport Connect build and copying artifacts

Code signing should run on tag builds automatically as part the
electron build, assuming the Apple Account credentials are
properly loaded into the keychain.

Notarization will also happen automatically if both 
`$APPLE_USERNAME` and `$APPLE_PASSWORD` are set.

In order to make the above happen, this patch also includes:

* Installing and removing a per-build Node instance in the 
  toolchain directory on Darwin
* Moving the toolchain temporary directory out of ~/ and into /tmp.

Drone usually sets `$HOME` to a temporary directory for each build,
but unfortunately we need it to point to the actual build user's 
home directory in order for the notarisation tooling to find the
right keychain. Having $HOME point to a long-lived directory risks
both pollution from build detritus and builds stomping on one another.

In an in an attempt to isolate the builds from each other and protect
`~build` as best we can, as much of the build state as possible 
(including ephemeral toolchains) has been moved under `/tmp`.

Co-authored-by: Trent Clarke <trent@goteleport.com>
2022-06-03 12:19:42 +10:00
Zac Bergquist ff4c307453
Update to Go 1.18.3 (#13103) 2022-06-02 16:10:57 +00:00
Alan Parra 8b104d1860
Consistently set macOS min version (#13070)
Set the macOS deployment target, ensuring that statically linked libfido2 `tsh`
builds run correctly on older macOS versions.

#9160

* Consistently set macOS min version
* Bump min macOS version to 10.13
2022-06-02 15:13:24 +00:00
Zac Bergquist 1286528748
Update Rust to 1.61.0 (#12779) 2022-06-01 22:24:21 +00:00
Alan Parra 1af3c11acf
Make sure LIB_CACHE exists before creating temp dir inside it (#13035)
Fixes Drone breakage.

#9160
2022-05-31 19:22:17 +00:00
Alan Parra 8302d467d1
Improved touch ID availability and diagnostics (#12963)
Since #12794 we now build `tsh` binaries with touch ID capabilities. This calls
for a more sophisticated mechanism to determine if touch ID functions should be
enabled, as compile-time support only is not enough.

I've added the following checks, on top of compile-time / `touchid` build tag:

Binary is signed
Binary has entitlements
Machine is touch ID capable
Machine has a Secure Enclave
Put together this give us a much better proxy on whether to enable touch ID.

I've also added the `tsh touchid diag` command, mentioned in the Passwordless
macOS RFD (see
https://github.com/gravitational/teleport/blob/master/rfd/0054-passwordless-macos.md#tsh-support-commands).

#9160

* Improved touch ID availability and diagnostics
* Add the `tsh touchid diag` command
* Set min macOS version to 10.12 (macOS Sierra)
2022-05-31 17:10:06 +00:00
Alan Parra 7567c5502d
Build tsh with static libfido2 for macOS (#13001)
Add a script to build libfido2 (and its dependencies) on macOS and enable FIDO2
static builds.

I decided to build all dependencies instead of pulling from Homebrew for a few
reasons:

1. There is no libcbor.a in a brew package
2. This captures library versions within the Teleport source code, allowing us
   to build binaries against different versions of libfido2 (and its
   dependencies).

I've also bumped libfido2 to 1.11.0. I've been running it locally and we are
still pre-release, so it seems like a good time to do it.
(See https://developers.yubico.com/libfido2/Release_Notes.html.)

#9160

* Build libfido2 and dependencies for macOS
* Build tsh with static fido2 on Drone
* Bump libfido2 versions in all builds
* Attempt to appease linters
* Use temp dirs inside LIB_CACHE
* Move LIB_CACHE outside of HOME

HOME is reassigned in macOS builders, but we want a "stable" cache
directory. /tmp is used by build-package.sh and build-pkg-tsh.sh.

* Rename script to build-fido2-macos.sh
* Regenerate Drone files
2022-05-31 14:50:56 +00:00
Alan Parra 99ad5c59a4
Build macOS installer for tsh.app (#12751)
Changes how `make pkg-tsh` works so instead of building an installer for the
`tsh` binary, placed under `/usr/local/bin`, we install an app to
`/Applications/tsh-vXXX.app` and link its `tsh` binary to `/usr/local/bin`.

The app shell is necessary to distribute a provisioning profile along with the
signed/entitled/notarized binary. All of that is required for Touch ID to work.
Naked `tsh` binaries are unable to use Touch ID, even if built with the correct
build tags.

I've elected to split the logic from `build-package.sh` into a separate script -
it already does too much as-is. `build-pkg-tsh.sh` is more idiomatic, clears
additional `shellcheck` rules and is easier to dry-run.

#9160

* Build macOS installer for tsh.app
* Add resources to build the tshdev app
Moved from e/

* Add resources to build the tsh app (prod)
* Use production values
* Remove 'tsh' mode from build-package.tsh
* Appease buildbox linter
* Clarify one-time setup
2022-05-23 20:56:21 +00:00