Files
elysium/ElysiumSettings.txt.sample
tomas.kracmar 06bcd22430 refactor(storage): one HTTP storage path; server-verified uploads; parallel on 5.1
Client storage access had four implementations: raw SAS HTTP and
native SigV4 for downloads, Az.Storage cmdlets and SigV4 or AWS Tools
for the hash export upload, plus separate serial and parallel download
loops. The parallel loop needed PowerShell 7 (ForEach-Object -Parallel)
and injected helper functions into its runspaces as text through
Invoke-Expression.

Now Private/Storage.ps1 has one path:
- Get-StorageConfig: provider settings, validated up front (Azure
  account/container/SAS, S3 endpoint/bucket/keys; s3Region defaults to
  us-east-1, s3ForcePathStyle to true).
- New-StorageRequest: GET/PUT request for Azure (SAS URI) or S3
  (SigV4). A PUT carries a digest the service verifies before storing:
  Content-MD5 on Azure, the signed x-amz-content-sha256 on S3.
- Invoke-StorageDownload: streams to disk; retries network errors and
  408/429/5xx (5 attempts, 2-30 s backoff), fails at once on other
  statuses (previously a 403/404 was retried for ~30 s).
- Invoke-StorageUpload: one PUT, service error body surfaced.
- Invoke-InModuleRunspace: runs a module function per parameter set in
  a runspace pool whose sessions import the module normally - works on
  Windows PowerShell 5.1 and 7, no code injection, failures collected
  and rethrown after all workers finish.

Update-ElysiumKhdb (434 -> 186 lines) fetches the manifest with
Invoke-StorageDownload and runs Receive-KhdbShard (download, size and
SHA-256 check, move into place) per shard through the pool, so
-MaxParallelTransfers now works on 5.1 too.

Send-ElysiumHashExport (230 -> 132 lines) validates storage settings
before replicating anything and uploads with Invoke-StorageUpload. The
download-back comparison, the delete-on-mismatch branch and the
Az.Storage container probe are gone: a mismatched body is rejected by
the service and never stored, and the credentials no longer need read
or list access to the upload location.

Removed: Get-FunctionDefinitionText, New-HttpClient,
Invoke-DownloadWithRetry, Invoke-S3HttpDownloadWithRetry,
Ensure-AWSS3Module, New-S3Client, Invoke-S3PutFile/GetToFile/DeleteFile,
Get-FileSha256Hex, Get-FileChecksum; the s3UseAwsTools setting. TLS
1.2 is set once at module import.

Known limit, marked in code: MD5 is unavailable on FIPS-enforced
Windows, so Azure uploads would fail there (S3 is unaffected);
Test-ElysiumPasswordQuality already refuses FIPS hosts.

Tests now run the real HttpClient/SigV4/runspace code against
tests/FakeStorage.ps1, an S3-style store on HttpListener that, like S3,
only accepts a PUT whose body matches x-amz-content-sha256. Covered:
incremental sync with 1/2/4 runspaces, a tampered shard failing the
run while keeping the previous KHDB, the publish -> update round trip
with 8 runspaces, Azure PUT headers (Content-MD5, block blob), up-front
settings validation, an S3 upload with no read-back, a rejected upload
surfacing the service error, 404 failing without retry, and a 503
retried once. 30/30 pass on pwsh 7; mutations (404 treated as
transient, worker failures dropped) each fail exactly the matching
test. Windows PowerShell 5.1 runs are still to do.
2026-11-04 13:20:31 +01:00

88 lines
3.0 KiB
Plaintext

##################################################
## ____ ___ ____ _____ _ _ _____ _____ ##
## / ___/ _ \| _ \| ____| | \ | | ____|_ _| ##
## | | | | | | |_) | _| | \| | _| | | ##
## | |__| |_| | _ <| |___ _| |\ | |___ | | ##
## \____\__\_\_| \_\_____(_)_| \_|_____| |_| ##
## Move fast and fix things. ##
##################################################
## Project: Elysium ##
## File: ElysiumSettings.txt ##
## Support: support@cqre.net ##
##################################################
# Storage Settings
##################
# Select storage provider: Azure or S3 (S3 = S3-compatible like IDrive e2)
# Default is Azure when not set.
StorageProvider = Azure
# Azure (if StorageProvider=Azure)
storageAccountName =
containerName =
sasToken =
# S3-compatible (if StorageProvider=S3)
# Example for IDrive e2: set endpoint URL to the region endpoint you were given.
# Access key/secret correspond to your S3-compatible credentials.
s3EndpointUrl =
s3Region = us-east-1
s3BucketName =
s3AccessKeyId =
s3SecretAccessKey =
# Many S3-compatible providers require path-style addressing
# (true recommended for MinIO/IDrive e2/Wasabi). Set to true/false.
s3ForcePathStyle = true
# KHDB Shard Settings
#####################
# The KHDB update script downloads a manifest plus per-prefix shards (default shard size 2).
# These values control the remote object names and local storage directory.
KhdbManifestPath=khdb/manifest.json
KhdbShardPrefix=khdb/shards
KhdbLocalShardDir=khdb-shards
# Application Settings
######################
InstallationPath=
ReportPathBase=Reports
WeakPasswordsDatabase=khdb.txt
# CheckOnlyEnabledUsers=true
# Lithnet Password Protection Settings
######################################
LithnetStorePath=
LithnetSyncHibp=false
LithnetHashSources=khdb.txt
LithnetPlaintextSources=
LithnetBannedWordSources=
# Telemetry (optional)
######################
# These values are empty by default so no telemetry is sent.
# Provide a pre-signed URL (for example, an S3 PUT) to receive a single beacon
# when the weak-password test starts. Only script name, version, and timestamp
# are transmitted; you can set UsageBeaconInstanceId to differentiate deployments.
UsageBeaconUrl=
UsageBeaconMethod=GET # GET, POST, or PUT
UsageBeaconInstanceId=
UsageBeaconTimeoutSeconds=5
# Notes:
# - Required PowerShell modules: DSInternals, ActiveDirectory
# (Azure and S3 transfers use built-in .NET HttpClient; no Az/AWS modules needed.)
# - Storage credentials: the KHDB download needs read access to the KHDB paths only; the hash
# export needs write access only (uploads are checksum-verified by the storage service).
# - AD account permissions: Replication Directory Changes and Replication Directory Changes All
# on the domain (DCSync-equivalent) are sufficient; full Domain Admin not required.
# Domain Settings
#################
# Domain 1 (domain1.local)
Domain1Name=domain1.local
Domain1DC=xxx.rdm.cz
# Domain 2 (domain2.com)
Domain2Name=domain2.com
Domain2DC=yyy.st.sk