Closed Bug 1562981 Opened 6 years ago Closed 4 years ago

[Ronin Windows] Support to generate admin password script via SSH

Categories

(Infrastructure & Operations :: RelOps: Puppet, task)

task
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: markco, Assigned: markco)

References

Details

https://github.com/mozilla-releng/OpenCloudConfig/blob/master/userdata/OCC-Bootstrap.psm1

function Set-Credentials {
param (
[string] $username,
[string] $password,
[switch] $setautologon
)
begin {
Write-Log -message ('{0} :: begin - {1:o}' -f $($MyInvocation.MyCommand.Name), (Get-Date).ToUniversalTime()) -severity 'DEBUG'
}
process {
if (($username) -and ($password)) {
try {
& net @('user', $username, $password)
Write-Log -message ('{0} :: credentials set for user: {1}.' -f $($MyInvocation.MyCommand.Name), $username) -severity 'INFO'
if ($setautologon) {
Set-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Type 'String' -Name 'DefaultPassword' -Value $password
Write-Log -message ('{0} :: autologon set for user: {1}.' -f $($MyInvocation.MyCommand.Name), $username) -severity 'INFO'
}
}
catch {
Write-Log -message ('{0} :: failed to set credentials for user: {1}. {2}' -f $($MyInvocation.MyCommand.Name), $username, $_.Exception.Message) -severity 'ERROR'
}
} else {
Write-Log -message ('{0} :: empty username or password.' -f $($MyInvocation.MyCommand.Name)) -severity 'ERROR'
}
}
end {
Write-Log -message ('{0} :: end - {1:o}' -f $($MyInvocation.MyCommand.Name), (Get-Date).ToUniversalTime()) -severity 'DEBUG'
}
}

Called here line 2068:
switch -wildcard ($workerType) {
'gecko-t-win7-' {
$runDscOnWorker = $true
if (-not ($isWorker)) {
Remove-LegacyStuff
Set-Credentials -username 'root' -password ('{0}' -f $rootPassword)
}
}
'gecko-t-win10-
' {
$runDscOnWorker = $true
if (-not ($isWorker)) {
Remove-LegacyStuff
Set-Credentials -username 'Administrator' -password ('{0}' -f $rootPassword)
}
}
default {
$runDscOnWorker = $true
if (-not ($isWorker)) {
Set-Credentials -username 'Administrator' -password ('{0}' -f $rootPassword)
}
}
}

Blocks: 1559443

This will be replaced with a method and script that will generate a password through an SSH connection.

Depends on: 1544141
Summary: [Ronin Windows] Set credentials for AWS instances → [Ronin Windows] Support to generate admin password script via SSH

Will reopen in Jira as needed.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.