Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v15] Docs: add explicit token name and rbac rules for installers #41865

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/pages/auto-discovery/servers/ec2-discovery.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ discovery_service:
aws:
- types: ["ec2"]
regions: ["us-east-1","us-west-1"]
install:
join_params:
token_name: aws-discovery-iam-token
method: iam
tags:
"env": "prod" # Match EC2 instances where tag:env=prod
```
Expand Down
22 changes: 22 additions & 0 deletions docs/pages/includes/server-access/custom-installer.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
{{ cloud="foo" matcher="bar" matchTypes="baz" }}
To customize an installer, your user must have a role that allows `list`, `create`, `read` and `update` verbs on the `installer` resource.

Create a file called `installer-manager.yaml` with the following content:
```yaml
kind: role
version: v5
metadata:
name: installer-manager
spec:
allow:
rules:
- resources: [installer]
verbs: [list, create, read, update]
```

```code
$ tctl create -f installer-manager.yaml
# role 'installer-manager' has been created
```

The preset `editor` role has the required permissions by default.

To customize the default installer script, execute the following command on
your workstation:

Expand Down
39 changes: 39 additions & 0 deletions lib/config/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4561,6 +4561,45 @@ func TestDiscoveryConfig(t *testing.T) {
SSM: &types.AWSSSM{DocumentName: types.AWSInstallerDocument},
}},
},
{
desc: "AWS section is filled using the example config in docs",
expectError: require.NoError,
expectEnabled: require.True,
mutate: func(cfg cfgMap) {
cfg["discovery_service"].(cfgMap)["enabled"] = "yes"
cfg["discovery_service"].(cfgMap)["aws"] = []cfgMap{
{
"types": []string{"ec2"},
"regions": []string{"us-east-1", "us-west-1"},
"install": map[string]map[string]string{
"join_params": {
"token_name": "aws-discovery-iam-token",
"method": "iam",
},
},
"tags": cfgMap{
"discover_teleport": "yes",
},
},
}
},
expectedAWSMatchers: []types.AWSMatcher{{
Types: []string{"ec2"},
Regions: []string{"us-east-1", "us-west-1"},
Tags: map[string]apiutils.Strings{
"discover_teleport": []string{"yes"},
},
Params: &types.InstallerParams{
JoinMethod: types.JoinMethodIAM,
JoinToken: types.IAMInviteTokenName,
SSHDConfig: "/etc/ssh/sshd_config",
ScriptName: installers.InstallerScriptName,
InstallTeleport: true,
EnrollMode: types.InstallParamEnrollMode_INSTALL_PARAM_ENROLL_MODE_SCRIPT,
},
SSM: &types.AWSSSM{DocumentName: types.AWSInstallerDocument},
}},
},
{
desc: "AWS section is filled with custom configs",
expectError: require.NoError,
Expand Down
Loading