Skip to content

fix(installer): honor unsecured certificate flag in installer download steps (#3924) - #218

Open
Samuel Hassine (SamuelHassine) wants to merge 1 commit into
mainfrom
issue/3924-installer-self-signed
Open

fix(installer): honor unsecured certificate flag in installer download steps (#3924)#218
Samuel Hassine (SamuelHassine) wants to merge 1 commit into
mainfrom
issue/3924-installer-self-signed

Conversation

@SamuelHassine

Copy link
Copy Markdown
Member

Summary

When the OpenAEV platform runs with a self-signed certificate, agent installation fails before the agent is even installed: the installer download step always enforces TLS certificate validation, even though the administrator explicitly enabled the platform's unsecured certificate flag. The platform already substitutes ${OPENAEV_UNSECURED_CERTIFICATE} (literal true/false) into these script templates for the agent's own config - this PR makes the download commands honor it too.

  • Linux/macOS (12 scripts: installer + upgrade, service / service-user / session-user): a curl_insecure variable is set to -k only when the substituted flag is true, and passed to every platform download curl (including the OpenBAS -> OpenAEV migration paths in the upgrade scripts).
  • Windows (6 scripts: installer + upgrade, service / service-user / session-user): when the flag is true, [System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true } is set around the download and the previous callback is restored afterwards (in finally for the installers). This is PowerShell 5.1 compatible - Invoke-WebRequest -SkipCertificateCheck only exists on PowerShell 6+.

Security posture: TLS validation is bypassed ONLY when the admin explicitly set the unsecured certificate flag on the platform. With the flag false, the scripts behave exactly as before.

Note: the Caldera executor install snippet (which uses System.Net.WebClient) lives in the platform repository frontend (InstructionSelector.tsx), not in this repository, and is not covered by this PR.

Test plan

  • bash -n passes on all 12 modified .sh scripts (POSIX syntax check).
  • [System.Management.Automation.Language.Parser]::ParseFile reports zero errors on all 6 modified .ps1 scripts.
  • Repo lint installer/windows/Run-Lint.ps1 (PSScriptAnalyzer): no issues found.
  • Simulated the substituted gating logic: flag true yields curl -sSfL -k <url>, flag false yields the exact previous command with no extra argument.
  • Manual test suggestion: deploy a platform with a self-signed certificate and openaev.unsecured-certificate=true, then run the generated install command on each OS; the download step should succeed. With the flag false, behavior must be unchanged (download fails against an untrusted certificate, as designed).

Fixes OpenAEV-Platform/openaev#3924

…d steps (#3924)

When the OpenAEV platform runs with a self-signed certificate, the
installer and upgrade scripts failed at the download step: the platform
substitutes ${OPENAEV_UNSECURED_CERTIFICATE} into the script templates,
but the download commands (curl on Linux/macOS, Invoke-WebRequest on
Windows) always enforced TLS certificate validation.

- Linux/macOS (12 scripts): add "-k" to the platform download curl
  commands only when the substituted flag is "true".
- Windows (6 scripts): when the flag is "true", set
  [System.Net.ServicePointManager]::ServerCertificateValidationCallback
  around the download and restore the previous callback afterwards.
  This works on PowerShell 5.1, which does not support
  Invoke-WebRequest -SkipCertificateCheck (PS 6+ only).

TLS validation is bypassed only when the administrator explicitly
enabled the unsecured certificate flag on the platform; the default
path is unchanged.

Fixes OpenAEV-Platform/openaev#3924
Copilot AI lite review requested due to automatic review settings August 11, 2026 12:55
@github-actions github-actions Bot added the filigran team Item from the Filigran team. label Aug 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the agent installer/upgrade script templates to honor the platform’s OPENAEV_UNSECURED_CERTIFICATE flag during download steps, allowing installation/upgrade to work when the platform is served with a self-signed (untrusted) TLS certificate.

Changes:

  • Linux/macOS: introduce a curl_insecure flag (-k only when the substituted flag is "true") and pass it to platform download curl calls.
  • Windows: when the substituted flag is "true", temporarily override ServicePointManager.ServerCertificateValidationCallback to accept all certificates during download, then restore the previous callback.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
installer/windows/agent-upgrade.ps1 Temporarily disables TLS validation based on substituted flag for upgrade downloads.
installer/windows/agent-upgrade-session-user.ps1 Same TLS-validation override pattern for session-user upgrade flow.
installer/windows/agent-upgrade-service-user.ps1 Same TLS-validation override pattern for service-user upgrade flow.
installer/windows/agent-installer.ps1 Wraps installer download with conditional TLS-validation bypass and restores in finally.
installer/windows/agent-installer-session-user.ps1 Same conditional TLS bypass for session-user installer download and restore in finally.
installer/windows/agent-installer-service-user.ps1 Same conditional TLS bypass for service-user installer download and restore in finally.
installer/macos/agent-upgrade.sh Adds conditional curl -k usage for upgrade downloads and migration installer download.
installer/macos/agent-upgrade-session-user.sh Adds conditional curl -k usage for session-user upgrade downloads and migration installer download.
installer/macos/agent-upgrade-service-user.sh Adds conditional curl -k usage for service-user upgrade download.
installer/macos/agent-installer.sh Adds conditional curl -k usage for installer download.
installer/macos/agent-installer-session-user.sh Adds conditional curl -k usage for session-user installer download.
installer/macos/agent-installer-service-user.sh Adds conditional curl -k usage for service-user installer download.
installer/linux/agent-upgrade.sh Adds conditional curl -k usage for upgrade downloads and migration installer download.
installer/linux/agent-upgrade-session-user.sh Adds conditional curl -k usage for session-user upgrade downloads and migration installer download.
installer/linux/agent-upgrade-service-user.sh Adds conditional curl -k usage for service-user upgrade download.
installer/linux/agent-installer.sh Adds conditional curl -k usage for installer download.
installer/linux/agent-installer-session-user.sh Adds conditional curl -k usage for session-user installer download.
installer/linux/agent-installer-service-user.sh Adds conditional curl -k usage for service-user installer download.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 51 to +62
Invoke-WebRequest -Uri "${OPENAEV_URL}/api/tenants/${OPENAEV_TENANT_ID}/agent/executable/openaev/windows/${architecture}" -OutFile $AgentUpgradedPath;

sc.exe stop $AgentName;

Remove-Item -Force $AgentPath;
Move-Item $AgentUpgradedPath $AgentPath;

sc.exe start $AgentName;
sc.exe start $AgentName;

if ("${OPENAEV_UNSECURED_CERTIFICATE}" -eq "true") {
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = $previousCertificateValidationCallback
}
Comment on lines +2 to +7
if ("${OPENAEV_UNSECURED_CERTIFICATE}" -eq "true") {
# Skip TLS certificate validation: the platform explicitly runs with an
# unsecured (e.g. self-signed) certificate (PowerShell 5.1 compatible)
$previousCertificateValidationCallback = [System.Net.ServicePointManager]::ServerCertificateValidationCallback
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }
}
Comment on lines +2 to +7
if ("${OPENAEV_UNSECURED_CERTIFICATE}" -eq "true") {
# Skip TLS certificate validation: the platform explicitly runs with an
# unsecured (e.g. self-signed) certificate (PowerShell 5.1 compatible)
$previousCertificateValidationCallback = [System.Net.ServicePointManager]::ServerCertificateValidationCallback
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

filigran team Item from the Filigran team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: OBAS Agent problems when using self-signed certificates

2 participants