Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f9941b0807 | ||
|
|
c768e1be6b |
@@ -7,6 +7,39 @@ param(
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
function Initialize-OCSentinelTls {
|
||||
$protocols = [Net.SecurityProtocolType]::Tls12
|
||||
if ([Enum]::GetNames([Net.SecurityProtocolType]) -contains "Tls13") {
|
||||
$protocols = $protocols -bor [Net.SecurityProtocolType]::Tls13
|
||||
}
|
||||
|
||||
[Net.ServicePointManager]::SecurityProtocol = $protocols
|
||||
[Net.ServicePointManager]::Expect100Continue = $false
|
||||
}
|
||||
|
||||
function Get-OCSentinelManifest {
|
||||
param([Parameter(Mandatory)][string]$Uri)
|
||||
|
||||
$parameters = @{ Method = "Get"; Uri = $Uri; TimeoutSec = 60 }
|
||||
if ((Get-Command Invoke-RestMethod).Parameters.ContainsKey("UseBasicParsing")) {
|
||||
$parameters.UseBasicParsing = $true
|
||||
}
|
||||
|
||||
for ($attempt = 1; $attempt -le 3; $attempt++) {
|
||||
try {
|
||||
return Invoke-RestMethod @parameters
|
||||
}
|
||||
catch {
|
||||
if ($attempt -eq 3) {
|
||||
throw "Could not retrieve the OCSentinel release manifest after 3 attempts. Verify that the device can reach gitea.officecom.cloud with TLS 1.2 or newer. Last error: $($_.Exception.Message)"
|
||||
}
|
||||
Start-Sleep -Seconds (3 * $attempt)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Initialize-OCSentinelTls
|
||||
|
||||
$installRoot = Join-Path ${env:ProgramFiles} "OCSentinel"
|
||||
$appExe = Join-Path $installRoot "app\OCSentinelCli.exe"
|
||||
$installScript = Join-Path $installRoot "scripts\install-ocsentinel.ps1"
|
||||
@@ -66,7 +99,7 @@ if ([string]::IsNullOrWhiteSpace($ManifestUrl)) {
|
||||
$resolvedManifestUrl = Resolve-ManifestUrl -ManifestUrl $ManifestUrl -Channel $Channel
|
||||
Write-Host "Checking update manifest: $resolvedManifestUrl"
|
||||
|
||||
$manifest = Invoke-RestMethod -Method Get -Uri $resolvedManifestUrl -TimeoutSec 60
|
||||
$manifest = Get-OCSentinelManifest -Uri $resolvedManifestUrl
|
||||
if (-not $manifest.version -or -not $manifest.artifactUrl -or -not $manifest.sha256) {
|
||||
throw "Update manifest is missing required fields: version, artifactUrl, sha256."
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"channel": "stable",
|
||||
"version": "1.3.3",
|
||||
"publishedAtUtc": "2026-07-26T18:25:32.8762198Z",
|
||||
"artifactUrl": "https://gitea.officecom.cloud/officecom/oc-sentinel/releases/download/v1.3.3/OCSentinelClient-win-x64.zip",
|
||||
"sha256": "9bb2b2dc25c59bc6faf53ded6095667ac73640038cfd426a74f3bf6aca81bd86",
|
||||
"version": "1.3.4",
|
||||
"publishedAtUtc": "2026-07-26T19:13:59.3121556Z",
|
||||
"artifactUrl": "https://gitea.officecom.cloud/officecom/oc-sentinel/releases/download/v1.3.4/OCSentinelClient-win-x64.zip",
|
||||
"sha256": "36b2ea0ce6b017bb46539eeb397ce013679155ce4805e526df983db8d3fca65f",
|
||||
"minUpdaterVersion": "1.0.0"
|
||||
}
|
||||
|
||||
@@ -8,7 +8,39 @@ param(
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$ProgressPreference = "SilentlyContinue"
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
|
||||
function Initialize-OCSentinelTls {
|
||||
$protocols = [Net.SecurityProtocolType]::Tls12
|
||||
if ([Enum]::GetNames([Net.SecurityProtocolType]) -contains "Tls13") {
|
||||
$protocols = $protocols -bor [Net.SecurityProtocolType]::Tls13
|
||||
}
|
||||
|
||||
[Net.ServicePointManager]::SecurityProtocol = $protocols
|
||||
[Net.ServicePointManager]::Expect100Continue = $false
|
||||
}
|
||||
|
||||
function Get-OCSentinelManifest {
|
||||
param([Parameter(Mandatory)][string]$Uri)
|
||||
|
||||
$parameters = @{ Method = "Get"; Uri = $Uri; TimeoutSec = 60 }
|
||||
if ((Get-Command Invoke-RestMethod).Parameters.ContainsKey("UseBasicParsing")) {
|
||||
$parameters.UseBasicParsing = $true
|
||||
}
|
||||
|
||||
for ($attempt = 1; $attempt -le 3; $attempt++) {
|
||||
try {
|
||||
return Invoke-RestMethod @parameters
|
||||
}
|
||||
catch {
|
||||
if ($attempt -eq 3) {
|
||||
throw "Could not retrieve the OCSentinel release manifest after 3 attempts. Verify that the device can reach gitea.officecom.cloud with TLS 1.2 or newer. Last error: $($_.Exception.Message)"
|
||||
}
|
||||
Start-Sleep -Seconds (3 * $attempt)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Initialize-OCSentinelTls
|
||||
|
||||
$installRoot = Join-Path $env:ProgramFiles "OCSentinel"
|
||||
$updaterPath = Join-Path $installRoot "scripts\update-ocsentinel.ps1"
|
||||
@@ -54,7 +86,7 @@ if (Test-Path -LiteralPath $updaterPath) {
|
||||
}
|
||||
else {
|
||||
Write-Host "Reading OCSentinel release manifest: $ManifestUrl"
|
||||
$manifest = Invoke-RestMethod -Method Get -Uri $ManifestUrl -TimeoutSec 60
|
||||
$manifest = Get-OCSentinelManifest -Uri $ManifestUrl
|
||||
if ([string]::IsNullOrWhiteSpace($manifest.version) -or [string]::IsNullOrWhiteSpace($manifest.artifactUrl) -or [string]::IsNullOrWhiteSpace($manifest.sha256)) {
|
||||
throw "Release manifest is missing version, artifactUrl, or sha256."
|
||||
}
|
||||
|
||||
@@ -7,7 +7,39 @@ param(
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$ProgressPreference = "SilentlyContinue"
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
|
||||
function Initialize-OCSentinelTls {
|
||||
$protocols = [Net.SecurityProtocolType]::Tls12
|
||||
if ([Enum]::GetNames([Net.SecurityProtocolType]) -contains "Tls13") {
|
||||
$protocols = $protocols -bor [Net.SecurityProtocolType]::Tls13
|
||||
}
|
||||
|
||||
[Net.ServicePointManager]::SecurityProtocol = $protocols
|
||||
[Net.ServicePointManager]::Expect100Continue = $false
|
||||
}
|
||||
|
||||
function Get-OCSentinelManifest {
|
||||
param([Parameter(Mandatory)][string]$Uri)
|
||||
|
||||
$parameters = @{ Method = "Get"; Uri = $Uri; TimeoutSec = 60 }
|
||||
if ((Get-Command Invoke-RestMethod).Parameters.ContainsKey("UseBasicParsing")) {
|
||||
$parameters.UseBasicParsing = $true
|
||||
}
|
||||
|
||||
for ($attempt = 1; $attempt -le 3; $attempt++) {
|
||||
try {
|
||||
return Invoke-RestMethod @parameters
|
||||
}
|
||||
catch {
|
||||
if ($attempt -eq 3) {
|
||||
throw "Could not retrieve the OCSentinel release manifest after 3 attempts. Verify that the device can reach gitea.officecom.cloud with TLS 1.2 or newer. Last error: $($_.Exception.Message)"
|
||||
}
|
||||
Start-Sleep -Seconds (3 * $attempt)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Initialize-OCSentinelTls
|
||||
|
||||
function Get-NinjaValue {
|
||||
param([Parameter(Mandatory)][string]$Name)
|
||||
@@ -26,7 +58,7 @@ if ([string]::IsNullOrWhiteSpace($WebhookUrl) -or [string]::IsNullOrWhiteSpace($
|
||||
throw "WebhookUrl and SecretValue must be set as NinjaOne script variables."
|
||||
}
|
||||
|
||||
$manifest = Invoke-RestMethod -Method Get -Uri $ManifestUrl -TimeoutSec 60
|
||||
$manifest = Get-OCSentinelManifest -Uri $ManifestUrl
|
||||
if ([string]::IsNullOrWhiteSpace($manifest.artifactUrl) -or [string]::IsNullOrWhiteSpace($manifest.sha256)) {
|
||||
throw "The release manifest is incomplete."
|
||||
}
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
<RootNamespace>OCSentinelCli</RootNamespace>
|
||||
<Product>OfficeCom Sentinel</Product>
|
||||
<Company>OfficeCom</Company>
|
||||
<Version>1.3.4</Version>
|
||||
<AssemblyVersion>1.3.4.0</AssemblyVersion>
|
||||
<FileVersion>1.3.4.0</FileVersion>
|
||||
<InformationalVersion>1.3.4</InformationalVersion>
|
||||
<Version>1.3.5</Version>
|
||||
<AssemblyVersion>1.3.5.0</AssemblyVersion>
|
||||
<FileVersion>1.3.5.0</FileVersion>
|
||||
<InformationalVersion>1.3.5</InformationalVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user