Add teleport agent update

This commit is contained in:
Jonny Ervine
2024-08-15 22:45:43 +08:00
parent c0d65a0afb
commit b76e232ac2
143 changed files with 15355 additions and 676 deletions
+97 -17
View File
@@ -5,6 +5,8 @@ with an existing Teleport cluster:
- Teleport Kubernetes access
- Teleport Application access
- Teleport Database access
- Teleport Kubernetes App Discovery
- Teleport Jamf service
To use it, you will need:
- an existing Teleport cluster (at least proxy and auth services)
@@ -22,7 +24,7 @@ To use it, you will need:
## Combining roles
You can combine multiple roles as a comma-separated list: `--set roles=kube\,db\,app`
You can combine multiple roles as a comma-separated list: `--set roles=kube\,db\,app\,discovery`
Note that commas must be escaped if the values are provided on the command line. This is due to the way that
Helm parses arguments.
@@ -132,14 +134,14 @@ Set the values in the above command as appropriate for your setup.
These are the supported values for the `apps` map:
| Key | Description | Example | Default | Required |
| --- | --- | --- | --- | --- |
| `name` | Name of the app to be accessed | `apps[0].name=grafana` | | Yes |
| `uri` | URI of the app to be accessed | `apps[0].uri=http://localhost:3000` | | Yes |
| `public_addr` | Public address used to access the app | `apps[0].public_addr=grafana.teleport.example.com` | | No |
| `labels.[name]` | Key-value pairs to set against the app for grouping/RBAC | `apps[0].labels.env=local,apps[0].labels.region=us-west-1` | | No |
| `insecure_skip_verify` | Whether to skip validation of TLS certificates presented by backend apps | `apps[0].insecure_skip_verify=true` | `false` | No |
| `rewrite.redirect` | A list of URLs to rewrite to the public address of the app service | `apps[0].rewrite.redirect[0]=https://192.168.1.1` | | No
| Key | Description | Example | Default | Required |
| ---------------------- | ------------------------------------------------------------------------ | ---------------------------------------------------------- | ------- | -------- |
| `name` | Name of the app to be accessed | `apps[0].name=grafana` | | Yes |
| `uri` | URI of the app to be accessed | `apps[0].uri=http://localhost:3000` | | Yes |
| `public_addr` | Public address used to access the app | `apps[0].public_addr=grafana.teleport.example.com` | | No |
| `labels.[name]` | Key-value pairs to set against the app for grouping/RBAC | `apps[0].labels.env=local,apps[0].labels.region=us-west-1` | | No |
| `insecure_skip_verify` | Whether to skip validation of TLS certificates presented by backend apps | `apps[0].insecure_skip_verify=true` | `false` | No |
| `rewrite.redirect` | A list of URLs to rewrite to the public address of the app service | `apps[0].rewrite.redirect[0]=https://192.168.1.1` | | No |
You can add multiple apps using `apps[1].name`, `apps[1].uri`, `apps[2].name`, `apps[2].uri` etc.
@@ -218,20 +220,98 @@ Set the values in the above command as appropriate for your setup.
These are the supported values for the `databases` map:
| Key | Description | Example | Default | Required |
| --- | --- | --- | --- | --- |
| `name` | Name of the database to be accessed | `databases[0].name=aurora` | | Yes |
| `uri` | URI of the database to be accessed | `databases[0].uri=postgres-aurora-instance-1.xxx.us-east-1.rds.amazonaws.com:5432` | | Yes |
| `protocol` | Database protocol | `databases[0].protocol=postgres` | | Yes |
| `description` | Free-form description of the database proxy instance | `databases[0].description='AWS Aurora instance of PostgreSQL 13.0'` | | No |
| `aws.region` | AWS-specific region configuration (only used for RDS/Aurora) | `databases[0].aws.region=us-east-1` | | No |
| `labels.[name]` | Key-value pairs to set against the database for grouping/RBAC | `databases[0].labels.db=postgres-dev,apps[0].labels.region=us-east-1` | | No |
| Key | Description | Example | Default | Required |
| --------------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ------- | -------- |
| `name` | Name of the database to be accessed | `databases[0].name=aurora` | | Yes |
| `uri` | URI of the database to be accessed | `databases[0].uri=postgres-aurora-instance-1.xxx.us-east-1.rds.amazonaws.com:5432` | | Yes |
| `protocol` | Database protocol | `databases[0].protocol=postgres` | | Yes |
| `description` | Free-form description of the database proxy instance | `databases[0].description='AWS Aurora instance of PostgreSQL 13.0'` | | No |
| `aws.region` | AWS-specific region configuration (only used for RDS/Aurora) | `databases[0].aws.region=us-east-1` | | No |
| `labels.[name]` | Key-value pairs to set against the database for grouping/RBAC | `databases[0].labels.db=postgres-dev,apps[0].labels.region=us-east-1` | | No |
You can add multiple databases using `databases[1].name`, `databases[1].uri`, `databases[1].protocol`,
`databases[2].name`, `databases[2].uri`, `databases[2].protocol` etc.
After installing, the new database should show up in `tsh db ls` after a few minutes.
## Kubernetes App Discovery
Teleport can be used to automatically discover apps based on services found in the Kubernetes cluster.
To run Teleport discovery you will need to enabled roles `discovery` and `app` and also provide token that allows access for these roles.
To install the agent, run:
```sh
$ helm install teleport-kube-agent . \
--create-namespace \
--namespace teleport \
--set roles=kube,app,discovery \
--set proxyAddr=${PROXY_ENDPOINT?} \
--set authToken=${JOIN_TOKEN?}
```
With default settings Teleport will try to discovery all apps available in the cluster. To control what namespaces and what service labels
to use for discovery you can use `kubernetesDiscovery` property of the chart.
When discovery is running, `kubeClusterName` should be set in values, since it is used as a name for discovery field and as a target label
for the app service, so it can expose discovered apps.
## Jamf service
To use [Teleport Jamf service](https://goteleport.com/docs/access-controls/device-trust/jamf-integration/),
you will also need:
- provide your Jamf Pro API endpoint
- provide your Jamf Pro API credentials
To install the agent with Jamf API credentials, run:
```sh
$ helm install teleport-kube-agent . \
--create-namespace \
--namespace teleport \
--set roles=jamf \
--set proxyAddr=${PROXY_ENDPOINT?} \
--set authToken=${JOIN_TOKEN?} \
--set jamfApiEndpoint=${JAMF_API_ENDPOINT?} \
--set jamfClientId=${JAMF_CLIENT_ID?} \
--set jamfClientSecret=${JAMF_CLIENT_SECRET?}
```
Set the values in the above command as appropriate for your setup.
The Helm chart will install Secrets by default. To avoid specifying the Jamf API credentials in plain text, it's possible to create a secret containing the password beforehand. To do so, run:
```sh
export JAMF_CLIENT_SECRET=`<jamf client secret> | base64 -w0`
export JAMF_SECRET_NAME=teleport-jamf-api-credentials
export TELEPORT_NAMESPACE=teleport
cat <<EOF > secrets.yaml
---
apiVersion: v1
kind: Secret
metadata:
name: ${JAMF_SECRET_NAME}
namespace: ${TELEPORT_NAMESPACE?}
type: Opaque
data:
jamfSecret: ${JAMF_CLIENT_SECRET?}
EOF
$ kubectl apply -f secret.yaml
$ helm install teleport-kube-agent . \
--create-namespace \
--namespace ${TELEPORT_NAMESPACE?} \
--set roles=jamf \
--set proxyAddr=${PROXY_ENDPOINT?} \
--set authToken=${JOIN_TOKEN?} \
--set jamfApiEndpoint=${JAMF_API_ENDPOINT?} \
--set jamfClientId=${JAMF_CLIENT_ID?} \
--set jamfCredentialsSecret.name=${JAMF_SECRET_NAME?} \
--set jamfCredentialsSecret.create=false
```
## Troubleshooting
If the service for a given role doesn't show up, look into the agent logs with: