Commit Graph
16 Commits
Author SHA1 Message Date
Ryan Clark 31bf9a4a4d Fix the version yaml in configure-ad.ps1 (#17266) 2022-10-12 15:50:05 +00:00
Ryan Clark 806a568ada Introduce config v3, add auth_server and proxy_server, remove auth_addresses (#15761) 2022-09-28 15:30:15 +00:00
Łukasz Kozłowski 69197efb1d Add webapi endpoints for desktop access configuration 2022-09-21 14:52:10 +02:00
Alan Parra a75fcc21d8 Update golangci-lint to 1.49.0 (#16507)
Update metalinter, fix a few lint warnings and replace deprecated linters.

`deadcode`, `structcheck` and `varcheck` are abandoned and now replaced by [`unused`][1].

Since 1.19, `go fmt` reformats godocs according to https://go.dev/doc/comment. I've done a bulk-reformatting of the codebase to keep the linter happy. Backporting is mostly harmless (the exception being `lib/services/role_test.go`, that for some reason breaks the _old_ linter using the new format).

[1]: https://golangci-lint.run/usage/linters/

* Bump golangci-lint version
* Replace abandoned linters
* Fix bodyclose on lib/auth/github.com
* Fix bodyclose on lib/kube/proxy/streamproto/proto_test.go
* Fix bodyclose on lib/srv/alpnproxy/proxy_test.go
* Fix bodyclose on lib/web/conn_upgrade_test.go
* Silence staticcheck on lib/kube/proxy/forwarder_test.go
* Silence staticcheck on lib/utils/certs_test.go
* Address BuildNameToCertificate deprecation warnings
* Run `go fmt ./...`
* Run `go fmt ./...` on api/
* Ignore formatting in role_test.go
* Remove redundant initializers in lib/srv/uacc/
* Update e/
2022-09-19 22:38:59 +00:00
Marco André Dinis 3c74cee5b9 NodeJoin script: fix when no labels are provided (#15709)
Recently we added a way to add labels on newly added nodes based on the
token.
https://github.com/gravitational/teleport/pull/15114
Each token now has a list of SuggestedLabels, which are used to feed
that list.

However, if that list is empty, the generated script would trigger the
following error when running the `teleport node configure ...` command: 
`teleport: error: unexpected`

This happens because the command is generating an empty argument `""`
when running the `teleport node configure ...` command.
So it looks like this:
```bash
${TELEPORT_BINARY_DIR}/teleport node configure \
      --token token \
      joinmethod \
      --ca-pin pin \
      --auth-server host:port \
      "" \
      --output someport
```
That empty argument breaks things.

So, in order to fix it, we are going to change the default value when no
labels are provided.
Instead of an empty string, we'll use an empty array.

Demo (teleport node configure message removed for brev
No label
```bash
$ LABELS_FLAG=(); f=$(mktemp -d)/node.yaml; teleport node configure --auth-server w:1 "${LABELS_FLAG[@]}" --output $f && yq .s
sh_service.labels $f

enabled: "yes"
commands:
  - name: hostname
    command: [hostname]
    period: 1m0s

```

Single label
```bash
$ LABELS_FLAG=(--labels x=y); f=$(mktemp -d)/node.yaml; teleport node configure --auth-server w:1 "${LABELS_FLAG[@]}" --output $f && yq .ssh_service $f

enabled: "yes"
labels:
  x: "y"
commands:
  - name: hostname
    command: [hostname]
    period: 1m0s

```

Multiple labels
```bash
$ LABELS_FLAG=(--labels x=y,dev=prod); f=$(mktemp -d)/node.yaml; teleport node configure --auth-server w:1 "${LABELS_FLAG[@]}" --output $f && yq .ssh_service $f

enabled: "yes"
labels:
  dev: prod
  x: "y"
commands:
  - name: hostname
    command: [hostname]
    period: 1m0s
```
2022-08-23 08:07:28 +01:00
Steven Martin ab6f430095 Added sles as another identifier for suse in auto install (#15659)
Added sles as another identifies for suse installation to support Suse 12 installs
2022-08-21 00:58:13 +00:00
Vitor Enes 1afb7d5832 Use the absolute path of the teleport binary in node join script (#15466) 2022-08-12 13:18:06 +00:00
Marco André Dinis 117d7d2d40 Add Suggested Labels to Provision Tokens (#15114)
For Teleport Discover, the user will be able to test connecting to a
resource right after adding it.

The flow should look like this:
- User selects the resource type - in this case Server/Nodes
- WebUI generates a new Token
- WebUI shows the `sudo bash .../<token>/install.sh` to the user
- When the user runs this command, and assuming everything works out,
  the WebUI should be able to receive the Server/Node that was
  generated from that specific Token.

To achieve this, here's a more detailed flow, which this PR implements
- User selects the resource type - in this case Server/Nodes
- WebUI generates a new Token
  This generates a Provision Token which contains a RefResourceID
  WebUI receives back that ID
- WebUI shows the `sudo bash .../<token>/install.sh` to the user
  This generates a script which includes setting the labels as part of
  the `teleport configure` command:
  `$ teleport configure ... --labels teleport.internal/resource-id=<refResourceID> ...`
- User runs the provided command on the target host
- WebUI should be able to query the Servers/Nodes which contain that
  specific `<resource-id>` and allow the user to connect to it.

Demo:
![image](https://user-images.githubusercontent.com/689271/182440692-97c75ae0-1e14-4f76-b9ff-d41060c73ed0.png)
2022-08-08 17:06:41 +00:00
Marco André Dinis 61c39a9e2b Detect M1/M2 ARM CPUs when using the install script (#15195) 2022-08-05 07:47:01 +00:00
Zac Bergquist bf6e8af33a Validate token for node join script (#14726)
The token value is provided via the HTTP request
and fed into the node join script. This could allow an attacker
to generate a node-join script with malicious code included.

Fix this by validating that tokens are valid and exist in the backend.

Additionally, we recently added the ability to specify labels via the
node-labels query parameter, which is also user-controlled. Since this
functionality was never integrated in the UI, we remove it here and
will add an alternative implementation in the future.

Also use single quotes in script to prevent expansion
2022-07-27 15:51:41 +00:00
Jeff Pihach a4059c2c1b Do not add configure flags if no values are provided (#14191)
Do not add configure flags if no values are provided (#14156)
2022-07-11 17:44:45 +00:00
Jeff Pihach abe58746df Update install.sh to use new 'teleport node configure' command (#13127)
* Update install.sh to use new 'teleport node configure' command
2022-06-08 17:20:50 +00:00
Matheus fa2eb69e45 Disable ssh_service for app configs (#12520) 2022-05-09 19:21:03 +00:00
57cc2ed355 Allow requesting a join token with IAM method from the web api (#11339)
Co-authored-by: Jim Bishopp <jamesbishopp@gmail.com>
Co-authored-by: Nic Klaassen <nic@goteleport.com>
2022-04-19 12:59:08 +00:00
Jeff Pihach 4c0df63633 Move the install.sh script into the oss version and import it on build instead of requiring a copy/paste to update. (#11352) 2022-03-24 19:22:48 +00:00
Jeff Pihach 3cd8109ad5 Migrate the joined-tokens code to the OSS release. (#10288)
* Migrate the joined-tokens code to the OSS release.

* migrate install node scripts from enterprise to oss.

* Add missing licenses

* add missing license.

* update require.nil to require.noError.
2022-02-15 17:14:50 +00:00