Skip to content

Commit 8d6f0d4

Browse files
chore(e2e): Added the option to make member server kerberos only (#5997)
* chore(e2e): Added the option to make member server kerberos only
1 parent 8647e3f commit 8d6f0d4

File tree

5 files changed

+21
-11
lines changed

5 files changed

+21
-11
lines changed

enos/enos-scenario-e2e-aws-rdp-base.hcl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ scenario "e2e_aws_rdp_base" {
1414
]
1515

1616
matrix {
17-
builder = ["local", "crt"]
18-
client = ["win10", "win11"]
17+
builder = ["local", "crt"]
18+
client = ["win10", "win11"]
19+
kerberos_only = ["true", "false"]
1920
# Windows Server 2016 does not support OpenSSH, but it's relied on for some
2021
# parts of setup. If 2016 is selected, the member server will be created as
2122
# 2016, but the domain controller and worker will be 2019.
@@ -266,6 +267,7 @@ scenario "e2e_aws_rdp_base" {
266267
variables {
267268
vpc_id = step.create_base_infra.vpc_id
268269
server_version = matrix.rdp_server
270+
kerberos_only = matrix.kerberos_only == "true" ? true : false
269271
active_directory_domain = step.create_rdp_domain_controller.domain_name
270272
domain_controller_aws_keypair_name = step.create_rdp_domain_controller.keypair_name
271273
domain_controller_ip = step.create_rdp_domain_controller.private_ip

enos/modules/aws_rdp_domain_controller/main.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ data "aws_subnets" "infra" {
3636
}
3737

3838
locals {
39-
username = split(":", data.aws_caller_identity.current.user_id)[1]
39+
username = split(":", data.aws_caller_identity.current.user_id)[1]
40+
domain_parts = split(".", var.active_directory_domain)
41+
domain_sld = local.domain_parts[0] # second-level domain (example.com --> example)
4042
}
4143

4244
// We need a keypair to obtain the local administrator credentials to an AWS Windows based EC2 instance. So we generate it locally here
@@ -273,7 +275,7 @@ resource "aws_instance" "domain_controller" {
273275
Add-WindowsFeature -name ad-domain-services -IncludeManagementTools
274276
275277
# causes the instance to reboot
276-
Install-ADDSForest -CreateDnsDelegation:$false -DomainMode 7 -DomainName ${var.active_directory_domain} -DomainNetbiosName ${var.active_directory_netbios_name} -ForestMode 7 -InstallDns:$true -NoRebootOnCompletion:$false -SafeModeAdministratorPassword $password -Force:$true
278+
Install-ADDSForest -CreateDnsDelegation:$false -DomainMode 7 -DomainName ${var.active_directory_domain} -DomainNetbiosName ${local.domain_sld} -ForestMode 7 -InstallDns:$true -NoRebootOnCompletion:$false -SafeModeAdministratorPassword $password -Force:$true
277279
</powershell>
278280
EOF
279281

enos/modules/aws_rdp_domain_controller/variables.tf

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,4 @@ variable "active_directory_domain" {
4646
type = string
4747
description = "The name of the Active Directory domain to be created on the Windows Domain Controller."
4848
default = "mydomain.com"
49-
}
50-
51-
variable "active_directory_netbios_name" {
52-
type = string
53-
description = "Ostensibly the short-hand for the name of the domain."
54-
default = "mydomain"
55-
}
49+
}

enos/modules/aws_rdp_member_server/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,12 @@ ${var.domain_admin_password}
192192
(Get-WmiObject Win32_ComputerSystem).Domain
193193
Get-Process -Name *ssh* -ErrorAction SilentlyContinue
194194
195+
# Enable Kerberos only authentication if required
196+
%{if var.kerberos_only~}
197+
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0" -Name RestrictSendingNTLMTraffic -Value 2
198+
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0" -Name RestrictReceivingNTLMTraffic -Value 2
199+
%{endif~}
200+
195201
# Enable audio
196202
Set-Service -Name "Audiosrv" -StartupType Automatic
197203
Start-Service -Name "Audiosrv"

enos/modules/aws_rdp_member_server/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,9 @@ variable "domain_controller_sec_group_id_list" {
7171
type = list(any)
7272
description = "ID's of AWS Network Security Groups created during creation of the domain controller."
7373
}
74+
75+
variable "kerberos_only" {
76+
type = bool
77+
description = "Only allow kerberos auth"
78+
default = false
79+
}

0 commit comments

Comments
 (0)