Commit Graph
12 Commits
Author SHA1 Message Date
Hugo Shaka 59ded01eb3 Add install script using teleport-update and oneoff.sh (#52155) 2025-02-21 15:22:43 +00:00
Gavin Frazar d88e549070 use pre-release cdn and image repo for aws integration flows (#47474) 2024-10-11 22:05:24 +00:00
Marco Dinis 6b9334c3bd Script oneoff: add optional command prefix (sudo) (#43234)
* Script oneoff: add optional command prefix (sudo)

We are converting the installer script used for Server Auto Discover to
use go instead of shell script.

As an example, in EC2 Auto Discover, the script runs as `ssm-user` which
has access to using `sudo`.

This script is currently using `sudo` to change system wide
configurations (adding repos, installing packages, create file locks,
....).
In order to convert this script into go code, we must also run with
elevated privileges.

This PR changes the `oneoff` script to optionally run with a prefix.
Only `sudo` can be used as a command prefix.

* use t.cleanup and fix sudo usage when testing
2024-06-25 11:17:10 +00:00
Marco Dinis f5cdc233ee Use user directory instead of /tmp for downloading teleport (#43029)
Some systems have a very restricted size in `/tmp`.
When doing some tests, we found out that Amazon Linux 2023 EC2 instance
only has 475MB (possibly related to using an instance with 1GB of RAM?),
and that's not enough to download and uncompress the tarball.
We tried to optimize that and only extract the `teleport/teleport`
binary, but there's not enough space for that as well.

So, instead, we are now storing the teleport binary in the user's cache
dir.

Another change is that we also remove the created folder when the script
exits.
2024-06-19 14:42:11 +00:00
Marco Dinis a6a7683068 Allow arguments for the oneoff script (#42621)
The oneoff script downloads teleport and runs a teleport command.
In order to use the oneoff script for Server Auto Discover we must allow
it to receive a token as an argument.
You can see how the script is meant to be executed:
lib/cloud/aws/ssm_document.EC2DiscoverySSMDocument
2024-06-12 15:18:59 +00:00
Marco Dinis 508109b81a Use sh in oneoff script (#42633)
oneoff script intends to be as simple and compatible as possible.
Using `sh` allows us to be even more compatible, not only with more
specific systems but also allows it to be used by the teleport discovery
script (which uses `/bin/sh <my-script.sh`)
2024-06-11 07:08:28 +00:00
Zac Bergquist 44a6bb1933 Use pkg slices from the standard library (#35905)
Prefer the stdlib version of the experimental package.
Includes a depguard update to prevent future regressions,
as well as an e-ref update to appease depguard.

Generated with:

    $ gofmt -w -r '"golang.org/x/exp/slices" -> "slices"' . && \
        make fix-imports
2023-12-19 23:06:53 +00:00
fheinecke b178b8b732 Updated Teleport codebase to AGPL3 license (#35259)
Signed-off-by: Fred Heinecke <fred.heinecke@goteleport.com>
2023-12-01 17:48:14 +00:00
Marco André Dinis c3550a24e6 OneOff Script: use ent build if cluster is Enterprise (#33061)
* OneOff Script: use ent build if cluster is Enterprise

We were always using the OSS version of teleport in the one-off scripts.

This PR changes that to pick the correct version depending on the
running version in the Proxy.

* use gzip bestspeed for compressing files
2023-10-09 13:44:30 +00:00
Marco André Dinis c2948bd40c OneOff: add success message (#30425)
When the OneOff script completes, print a success message to let the
user know that everything worked as expected and what their next action
should be.
2023-08-16 07:01:43 +00:00
Marco André Dinis 4f2d9b066a DeployService IAM Configure: unescape arguments (#28807)
We were escaping the command arguments with double quotes.
It works with bash4.3+.

However, AWS CloudShell has bash 4.2 which:
>
> zz. When using the pattern substitution word expansion, bash now runs the
>     replacement string through quote removal, since it allows quotes in that
>     string to act as escape characters.  This is not backwards compatible, so
>     it can be disabled by setting the bash compatibility mode to 4.2.

http://tiswww.case.edu/php/chet/bash/CHANGES

When running this script in bash 4.2, the arguments end up being `"xyz"`
instead of `xyz`.
So, errors like this happen:
```
ERROR: operation error STS: GetCallerIdentity, https response error StatusCode: 0, RequestID: , request send failed, Post "https://sts.\"us-east-1\".amazonaws.com/": dial tcp: lookup sts."us-east-1".amazonaws.com: no such host
```

Removing the quotes means it will work on older and newer bash versions:

Demo:

```
> ./bin/teleport integration configure deployservice-iam --cluster=kimlisa.cloud.gravitational.io --name=r0mant --aws-region=us-east-1 --role=r0mant-oidc --task-role=Test+1=2,3.4@5-6_7
2023/07/07 08:04:05 TaskRole: Boundary Policy "Test+1=2,3.4@5-6_7Boundary" created.
2023/07/07 08:04:05 TaskRole: Role "Test+1=2,3.4@5-6_7" created with Boundary "arn:aws:iam::278576220453:policy/Test+1=2,3.4@5-6_7Boundary".
2023/07/07 08:04:05 TaskRole: IAM Policy "Test+1=2,3.4@5-6_7" added to Role "Test+1=2,3.4@5-6_7".
2023/07/07 08:04:05 IntegrationRole: IAM Policy "DeployService" added to Role "r0mant-oidc"
```
2023-07-12 22:11:24 +00:00
Marco André Dinis 0ef626308c Teleport One Off Script (#27852)
* Teleport One Off Script

This PR creates an endpoint that returns a script.
This script does the following:
- detects the correct os/arch, downloads and extracts the teleport
  binary package
- runs teleport with arguments defined in the endpoint's query param

This will allow the Discover wizard to give bash scripts in the form of
`bash -c "$(curl ..../oneoff... )"` to the user.
The user is then asked to run those commands.

One use case for those commands is the creation of specific AWS Roles
which are then used to give Teleport extra access to other AWS Services
/ Actions.
This specific command will come in a later PR.

* remove endpoint

* disable shellcheck for go templated vars

* use bintest v3
2023-06-27 12:14:23 +00:00