[Ronin Windows] Support to generate admin password script via SSH
Categories
(Infrastructure & Operations :: RelOps: Puppet, task)
Tracking
(Not tracked)
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)
}
}
}
| Assignee | ||
Comment 1•6 years ago
|
||
This will be replaced with a method and script that will generate a password through an SSH connection.
| Assignee | ||
Comment 2•4 years ago
|
||
Will reopen in Jira as needed.
Description
•