Skip to content

Commit

Permalink
adding note about terraform mappings for create_host_user_mode to hos…
Browse files Browse the repository at this point in the history
…t user creation guide
  • Loading branch information
eriktate committed Oct 3, 2024
1 parent e3ed941 commit 2c743ec
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 22 deletions.
2 changes: 1 addition & 1 deletion api/proto/teleport/legacy/types/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2939,7 +2939,7 @@ message RoleOptions {
(gogoproto.customtype) = "BoolOption"
];

// CreateHostUser allows users to be automatically created on a host
// Deprecated: Should use CreateHostUserMode instead.
BoolValue CreateHostUser = 20 [
(gogoproto.nullable) = true,
(gogoproto.jsontag) = "create_host_user,omitempty",
Expand Down
2 changes: 1 addition & 1 deletion api/types/types.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,7 @@
"snowsql",
"spacectl",
"spacelift",
"specoptions",
"spfile",
"spiffe",
"splunkd",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,20 @@ permission to restart the Nginx service as root. In Teleport 16.4.0 and later,
the default shell for a created user can be configured with `create_host_user_default_shell`.
Otherwise the host's default shell will be used.

<Admonition type="note">

When using the terraform provider, the values for `create_host_user_mode` are represented numerically
as reflected in the
[role reference](/reference/terraform-provider/resources/role/#nested-schema-for-specoptions).

Possible values are:
- `0` is `unspecified`.
- `1` is `off`.
- `2` is `keep`.
- `4` is `insecure-drop`.

</Admonition>

{/*TODO (ptgott): We should move the information below into a reference guide*/}
<Details title="Customizing host user creation">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ resource, which you can apply after installing the Teleport Kubernetes operator.
|create_db_user|boolean|CreateDatabaseUser enabled automatic database user creation.|
|create_db_user_mode|string or integer|CreateDatabaseUserMode allows users to be automatically created on a database when not set to off. 0 is "unspecified", 1 is "off", 2 is "keep", 3 is "best_effort_drop". Can be either the string or the integer representation of each option.|
|create_desktop_user|boolean|CreateDesktopUser allows users to be automatically created on a Windows desktop|
|create_host_user|boolean|CreateHostUser allows users to be automatically created on a host|
|create_host_user|boolean|Deprecated: Should use CreateHostUserMode instead.|
|create_host_user_default_shell|string|CreateHostUserDefaultShell is used to configure the default shell for newly provisioned host users.|
|create_host_user_mode|string or integer|CreateHostUserMode allows users to be automatically created on a host when not set to off. 0 is "unspecified"; 1 is "off"; 2 is "drop" (removed for v15 and above), 3 is "keep"; 4 is "insecure-drop". Can be either the string or the integer representation of each option.|
|desktop_clipboard|boolean|DesktopClipboard indicates whether clipboard sharing is allowed between the user's workstation and the remote desktop. It defaults to true unless explicitly set to false.|
Expand Down Expand Up @@ -723,7 +723,7 @@ resource, which you can apply after installing the Teleport Kubernetes operator.
|create_db_user|boolean|CreateDatabaseUser enabled automatic database user creation.|
|create_db_user_mode|string or integer|CreateDatabaseUserMode allows users to be automatically created on a database when not set to off. 0 is "unspecified", 1 is "off", 2 is "keep", 3 is "best_effort_drop". Can be either the string or the integer representation of each option.|
|create_desktop_user|boolean|CreateDesktopUser allows users to be automatically created on a Windows desktop|
|create_host_user|boolean|CreateHostUser allows users to be automatically created on a host|
|create_host_user|boolean|Deprecated: Should use CreateHostUserMode instead.|
|create_host_user_default_shell|string|CreateHostUserDefaultShell is used to configure the default shell for newly provisioned host users.|
|create_host_user_mode|string or integer|CreateHostUserMode allows users to be automatically created on a host when not set to off. 0 is "unspecified"; 1 is "off"; 2 is "drop" (removed for v15 and above), 3 is "keep"; 4 is "insecure-drop". Can be either the string or the integer representation of each option.|
|desktop_clipboard|boolean|DesktopClipboard indicates whether clipboard sharing is allowed between the user's workstation and the remote desktop. It defaults to true unless explicitly set to false.|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ resource, which you can apply after installing the Teleport Kubernetes operator.
|create_db_user|boolean|CreateDatabaseUser enabled automatic database user creation.|
|create_db_user_mode|string or integer|CreateDatabaseUserMode allows users to be automatically created on a database when not set to off. 0 is "unspecified", 1 is "off", 2 is "keep", 3 is "best_effort_drop". Can be either the string or the integer representation of each option.|
|create_desktop_user|boolean|CreateDesktopUser allows users to be automatically created on a Windows desktop|
|create_host_user|boolean|CreateHostUser allows users to be automatically created on a host|
|create_host_user|boolean|Deprecated: Should use CreateHostUserMode instead.|
|create_host_user_default_shell|string|CreateHostUserDefaultShell is used to configure the default shell for newly provisioned host users.|
|create_host_user_mode|string or integer|CreateHostUserMode allows users to be automatically created on a host when not set to off. 0 is "unspecified"; 1 is "off"; 2 is "drop" (removed for v15 and above), 3 is "keep"; 4 is "insecure-drop". Can be either the string or the integer representation of each option.|
|desktop_clipboard|boolean|DesktopClipboard indicates whether clipboard sharing is allowed between the user's workstation and the remote desktop. It defaults to true unless explicitly set to false.|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ resource, which you can apply after installing the Teleport Kubernetes operator.
|create_db_user|boolean|CreateDatabaseUser enabled automatic database user creation.|
|create_db_user_mode|string or integer|CreateDatabaseUserMode allows users to be automatically created on a database when not set to off. 0 is "unspecified", 1 is "off", 2 is "keep", 3 is "best_effort_drop". Can be either the string or the integer representation of each option.|
|create_desktop_user|boolean|CreateDesktopUser allows users to be automatically created on a Windows desktop|
|create_host_user|boolean|CreateHostUser allows users to be automatically created on a host|
|create_host_user|boolean|Deprecated: Should use CreateHostUserMode instead.|
|create_host_user_default_shell|string|CreateHostUserDefaultShell is used to configure the default shell for newly provisioned host users.|
|create_host_user_mode|string or integer|CreateHostUserMode allows users to be automatically created on a host when not set to off. 0 is "unspecified"; 1 is "off"; 2 is "drop" (removed for v15 and above), 3 is "keep"; 4 is "insecure-drop". Can be either the string or the integer representation of each option.|
|desktop_clipboard|boolean|DesktopClipboard indicates whether clipboard sharing is allowed between the user's workstation and the remote desktop. It defaults to true unless explicitly set to false.|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1133,8 +1133,7 @@ spec:
created on a Windows desktop
type: boolean
create_host_user:
description: CreateHostUser allows users to be automatically created
on a host
description: 'Deprecated: Should use CreateHostUserMode instead.'
type: boolean
create_host_user_default_shell:
description: CreateHostUserDefaultShell is used to configure the
Expand Down Expand Up @@ -2465,8 +2464,7 @@ spec:
created on a Windows desktop
type: boolean
create_host_user:
description: CreateHostUser allows users to be automatically created
on a host
description: 'Deprecated: Should use CreateHostUserMode instead.'
type: boolean
create_host_user_default_shell:
description: CreateHostUserDefaultShell is used to configure the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1136,8 +1136,7 @@ spec:
created on a Windows desktop
type: boolean
create_host_user:
description: CreateHostUser allows users to be automatically created
on a host
description: 'Deprecated: Should use CreateHostUserMode instead.'
type: boolean
create_host_user_default_shell:
description: CreateHostUserDefaultShell is used to configure the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1136,8 +1136,7 @@ spec:
created on a Windows desktop
type: boolean
create_host_user:
description: CreateHostUser allows users to be automatically created
on a host
description: 'Deprecated: Should use CreateHostUserMode instead.'
type: boolean
create_host_user_default_shell:
description: CreateHostUserDefaultShell is used to configure the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1133,8 +1133,7 @@ spec:
created on a Windows desktop
type: boolean
create_host_user:
description: CreateHostUser allows users to be automatically created
on a host
description: 'Deprecated: Should use CreateHostUserMode instead.'
type: boolean
create_host_user_default_shell:
description: CreateHostUserDefaultShell is used to configure the
Expand Down Expand Up @@ -2465,8 +2464,7 @@ spec:
created on a Windows desktop
type: boolean
create_host_user:
description: CreateHostUser allows users to be automatically created
on a host
description: 'Deprecated: Should use CreateHostUserMode instead.'
type: boolean
create_host_user_default_shell:
description: CreateHostUserDefaultShell is used to configure the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1136,8 +1136,7 @@ spec:
created on a Windows desktop
type: boolean
create_host_user:
description: CreateHostUser allows users to be automatically created
on a host
description: 'Deprecated: Should use CreateHostUserMode instead.'
type: boolean
create_host_user_default_shell:
description: CreateHostUserDefaultShell is used to configure the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1136,8 +1136,7 @@ spec:
created on a Windows desktop
type: boolean
create_host_user:
description: CreateHostUser allows users to be automatically created
on a host
description: 'Deprecated: Should use CreateHostUserMode instead.'
type: boolean
create_host_user_default_shell:
description: CreateHostUserDefaultShell is used to configure the
Expand Down
1 change: 1 addition & 0 deletions lib/services/access_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,7 @@ func (a *accessChecker) HostUsers(s types.Server) (*HostUsersInfo, error) {
}

createHostUserMode := role.GetOptions().CreateHostUserMode
//nolint:staticcheck // this field is preserved for existing deployments, but shouldn't be used going forward
createHostUser := role.GetOptions().CreateHostUser
if createHostUserMode == types.CreateHostUserMode_HOST_USER_MODE_UNSPECIFIED {
createHostUserMode = types.CreateHostUserMode_HOST_USER_MODE_OFF
Expand Down
1 change: 1 addition & 0 deletions lib/srv/regular/sshserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2848,6 +2848,7 @@ func newUpack(testSvr *auth.TestServer, username string, allowedLogins []string,
role.SetRules(types.Allow, rules)
opts := role.GetOptions()
opts.PermitX11Forwarding = types.NewBool(true)
//nolint:staticcheck // this field is preserved for existing deployments, but shouldn't be used going forward
opts.CreateHostUser = types.NewBoolOption(true)
role.SetOptions(opts)
role.SetLogins(types.Allow, allowedLogins)
Expand Down

0 comments on commit 2c743ec

Please sign in to comment.