Setup-SMTPGraphRelay.ps1 aktualisiert
This commit is contained in:
1 parent
74400d7d6e
commit
714ad13dae
1 file changed
+18
-18
+18
-18
@@ -1772,8 +1772,8 @@ function Manage-SmtpAuth {
|
|||||||
$p1 = Read-Host "Passwort" -AsSecureString
|
$p1 = Read-Host "Passwort" -AsSecureString
|
||||||
$p2 = Read-Host "Passwort wiederholen" -AsSecureString
|
$p2 = Read-Host "Passwort wiederholen" -AsSecureString
|
||||||
|
|
||||||
$plain1 = ConvertTo-PlainText -SecureString$p1
|
$plain1 = ConvertTo-PlainText -SecureString $2
|
||||||
$plain2 = ConvertTo-PlainText -SecureString$p2
|
$plain2 = ConvertTo-PlainText -SecureString $2
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($plain1.Length -lt 8) {
|
if ($plain1.Length -lt 8) {
|
||||||
@@ -1782,7 +1782,7 @@ function Manage-SmtpAuth {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($plain1 -cne$plain2) {
|
if ($plain1 -cne $2) {
|
||||||
Write-Fail "Passwoerter stimmen nicht ueberein."
|
Write-Fail "Passwoerter stimmen nicht ueberein."
|
||||||
Read-Host "Enter"
|
Read-Host "Enter"
|
||||||
continue
|
continue
|
||||||
@@ -1793,7 +1793,7 @@ function Manage-SmtpAuth {
|
|||||||
$plain2 =$null
|
$plain2 =$null
|
||||||
}
|
}
|
||||||
|
|
||||||
$record = New-SmtpPasswordRecord -Password$p1
|
$record = New-SmtpPasswordRecord -Password $2
|
||||||
|
|
||||||
$newUser = [pscustomobject]@{
|
$newUser = [pscustomobject]@{
|
||||||
Username = $username
|
Username = $username
|
||||||
@@ -1840,8 +1840,8 @@ function Manage-SmtpAuth {
|
|||||||
$p1 = Read-Host "Neues Passwort" -AsSecureString
|
$p1 = Read-Host "Neues Passwort" -AsSecureString
|
||||||
$p2 = Read-Host "Passwort wiederholen" -AsSecureString
|
$p2 = Read-Host "Passwort wiederholen" -AsSecureString
|
||||||
|
|
||||||
$plain1 = ConvertTo-PlainText -SecureString$p1
|
$plain1 = ConvertTo-PlainText -SecureString $2
|
||||||
$plain2 = ConvertTo-PlainText -SecureString$p2
|
$plain2 = ConvertTo-PlainText -SecureString $2
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($plain1.Length -lt 8) {
|
if ($plain1.Length -lt 8) {
|
||||||
@@ -1850,7 +1850,7 @@ function Manage-SmtpAuth {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($plain1 -cne$plain2) {
|
if ($plain1 -cne $2) {
|
||||||
Write-Fail "Passwoerter stimmen nicht ueberein."
|
Write-Fail "Passwoerter stimmen nicht ueberein."
|
||||||
Read-Host "Enter"
|
Read-Host "Enter"
|
||||||
continue
|
continue
|
||||||
@@ -1861,7 +1861,7 @@ function Manage-SmtpAuth {
|
|||||||
$plain2 =$null
|
$plain2 =$null
|
||||||
}
|
}
|
||||||
|
|
||||||
$record = New-SmtpPasswordRecord -Password$p1
|
$record = New-SmtpPasswordRecord -Password $2
|
||||||
$user.Salt =$record.Salt
|
$user.Salt =$record.Salt
|
||||||
$user.PasswordHash =$record.PasswordHash
|
$user.PasswordHash =$record.PasswordHash
|
||||||
$user.Iterations =$record.Iterations
|
$user.Iterations =$record.Iterations
|
||||||
@@ -1897,7 +1897,7 @@ function Manage-SmtpAuth {
|
|||||||
|
|
||||||
"6" {
|
"6" {
|
||||||
$current = @($config.Smtp.AllowUnauthenticatedNetworks) -join ","
|
$current = @($config.Smtp.AllowUnauthenticatedNetworks) -join ","
|
||||||
$input = Read-Default "Netze/IPs ohne AUTH, Komma getrennt; '-' fuer keine" $(if ($current) {$current } else { "-" })
|
$input = Read-Default "Netze/IPs ohne AUTH, Komma getrennt; '-' fuer keine" $(if ($current) { $current } else { "-" })
|
||||||
|
|
||||||
if ($input -eq "-") {
|
if ($input -eq "-") {
|
||||||
$config.Smtp.AllowUnauthenticatedNetworks = @()
|
$config.Smtp.AllowUnauthenticatedNetworks = @()
|
||||||
@@ -1942,7 +1942,7 @@ function Manage-SmtpAuth {
|
|||||||
# Config nach jeder Aenderung neu laden, damit Serialisierung/Arrays exakt
|
# Config nach jeder Aenderung neu laden, damit Serialisierung/Arrays exakt
|
||||||
# dem installierten Zustand entsprechen.
|
# dem installierten Zustand entsprechen.
|
||||||
$config = Get-RelayConfig -TargetPath $InstallPath
|
$config = Get-RelayConfig -TargetPath $InstallPath
|
||||||
$config = Ensure-SmtpAuthConfig -Config$config
|
$config = Ensure-SmtpAuthConfig -Config $2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1950,13 +1950,13 @@ function Manage-SmtpAuth {
|
|||||||
function Invoke-FailureModeTests {
|
function Invoke-FailureModeTests {
|
||||||
Write-Title "SMTPGraphRelay - Failure Mode QA"
|
Write-Title "SMTPGraphRelay - Failure Mode QA"
|
||||||
|
|
||||||
$tester = Join-Path$InstallPath "Test-SMTPGraphRelay-FailureModes.ps1"
|
$tester = Join-Path $2 "Test-SMTPGraphRelay-FailureModes.ps1"
|
||||||
if (-not (Test-Path -LiteralPath $tester)) {
|
if (-not (Test-Path -LiteralPath $tester)) {
|
||||||
Write-Fail "Test-SMTPGraphRelay-FailureModes.ps1 ist nicht installiert."
|
Write-Fail "Test-SMTPGraphRelay-FailureModes.ps1 ist nicht installiert."
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
& $tester -InstallPath$InstallPath
|
& $tester -InstallPath $2
|
||||||
}
|
}
|
||||||
|
|
||||||
function Uninstall-Relay {
|
function Uninstall-Relay {
|
||||||
@@ -1978,7 +1978,7 @@ function Uninstall-Relay {
|
|||||||
Remove-NetFirewallRule -ErrorAction SilentlyContinue
|
Remove-NetFirewallRule -ErrorAction SilentlyContinue
|
||||||
Write-Ok "SMTPGraphRelay Firewallregeln entfernt."
|
Write-Ok "SMTPGraphRelay Firewallregeln entfernt."
|
||||||
|
|
||||||
if ($config -and$config.Graph.CertificateThumbprint) {
|
if ($config -and $2.Graph.CertificateThumbprint) {
|
||||||
if (Confirm-Yes "Lokales Relay-Zertifikat $($config.Graph.CertificateThumbprint) entfernen?") {
|
if (Confirm-Yes "Lokales Relay-Zertifikat $($config.Graph.CertificateThumbprint) entfernen?") {
|
||||||
Remove-Item -LiteralPath "Cert:\LocalMachine\My\$($config.Graph.CertificateThumbprint)" -Force -ErrorAction SilentlyContinue
|
Remove-Item -LiteralPath "Cert:\LocalMachine\My\$($config.Graph.CertificateThumbprint)" -Force -ErrorAction SilentlyContinue
|
||||||
Write-Ok "Lokales Zertifikat entfernt."
|
Write-Ok "Lokales Zertifikat entfernt."
|
||||||
@@ -2019,9 +2019,9 @@ function Uninstall-Relay {
|
|||||||
$currentInstaller = [IO.Path]::GetFullPath($PSCommandPath)
|
$currentInstaller = [IO.Path]::GetFullPath($PSCommandPath)
|
||||||
$targetFull = [IO.Path]::GetFullPath($InstallPath)
|
$targetFull = [IO.Path]::GetFullPath($InstallPath)
|
||||||
|
|
||||||
foreach ($item in Get-ChildItem -LiteralPath$InstallPath -Force -ErrorAction SilentlyContinue) {
|
foreach ($item in Get-ChildItem -LiteralPath $2 -Force -ErrorAction SilentlyContinue) {
|
||||||
try {
|
try {
|
||||||
if ($item.FullName -eq$currentInstaller) {
|
if ($item.FullName -eq $2) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2061,7 +2061,7 @@ function Show-Status {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$failedCount = @(Get-FailedQueueEntries -Config$config).Count
|
$failedCount = @(Get-FailedQueueEntries -Config $2).Count
|
||||||
Write-Host " Failed: $failedCount Mail(s)"
|
Write-Host " Failed: $failedCount Mail(s)"
|
||||||
} catch {}
|
} catch {}
|
||||||
} catch {}
|
} catch {}
|
||||||
@@ -2070,7 +2070,7 @@ function Show-Status {
|
|||||||
Write-Warn "Keine config.json vorhanden."
|
Write-Warn "Keine config.json vorhanden."
|
||||||
}
|
}
|
||||||
|
|
||||||
$task = Get-ScheduledTask -TaskName$TaskName -ErrorAction SilentlyContinue
|
$task = Get-ScheduledTask -TaskName $2 -ErrorAction SilentlyContinue
|
||||||
if ($task) {
|
if ($task) {
|
||||||
Write-Host "Task State: $($task.State)"
|
Write-Host "Task State: $($task.State)"
|
||||||
}
|
}
|
||||||
@@ -2086,7 +2086,7 @@ function Show-Menu {
|
|||||||
|
|
||||||
$installedVersion = Get-InstalledVersion -TargetPath $InstallPath
|
$installedVersion = Get-InstalledVersion -TargetPath $InstallPath
|
||||||
|
|
||||||
if ($installedVersion -and$installedVersion.Version) {
|
if ($installedVersion -and $2.Version) {
|
||||||
Write-Host "Installiert: $($installedVersion.Version)" -ForegroundColor DarkGray
|
Write-Host "Installiert: $($installedVersion.Version)" -ForegroundColor DarkGray
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user