Skip to main content

DUO Auth Proxy - Install/Update Latest Version

Summary

The script installs or updates the DUO Authentication Proxy application to the latest available version.

Sample Run

Sample Run 1
Sample Run 2

Dependencies

CW RMM Custom Fields - DUO Auth Proxy Deployment

Task Creation

Create a new Script Editor style script in the system to implement this task.

Task Creation
Task Creation 2

Name: DUO Install & Upgrade - Latest Version
Description: This script will install or update DUO if the currently installed instance is older than the latest released version. This script checks the hash of the installer from the official website before deploying it. This script downloads the latest installer from [https://dl.duosecurity.com/duo-win-login-latest.exe](https://dl.duosecurity.com/duo-win-login-latest.exe).
Category: Application

Task Creation 3

Task

Row 1 Function: PowerShell Script

Add a new Add Row button.

Add Row

Search and select the PowerShell Script function.

PowerShell Script

The following function will pop up on the screen:

PowerShell Function

Paste the following PowerShell script and set the Expected time of script execution in seconds to 900 seconds. Click the Save button.

$ProgressPreference = 'SilentlyContinue'
$ErrorActionPreference = 'Silentlycontinue'
$URL = 'https://dl.duosecurity.com/duoauthproxy-latest.exe'
$WorkingDirectory = 'C:\ProgramData\_Automation\Script\DuoAuthProxy'
$Path = "$WorkingDirectory\DuoAuthProxyInstaller.exe"
$File = (Invoke-WebRequest -uri https://dl.duosecurity.com/duoauthproxy-latest.exe -UseBasicParsing -Method Head).headers.'Content-Disposition'
$DuoVersion = "$(($File -replace '.*duoauthproxy-','' -replace '\.exe"$',''))"
#region Setup - Folder Structure
if ( !(Test-Path $WorkingDirectory) ) {
try {
New-Item -Path $WorkingDirectory -ItemType Directory -Force -ErrorAction Stop | Out-Null
}
catch {
return "ERROR: Failed to Create $WorkingDirectory. Reason: $($Error[0].Exception.Message)"
}
} if (-not ( ( ( Get-Acl $WorkingDirectory ).Access | Where-Object { $_.IdentityReference -Match 'EveryOne' } ).FileSystemRights -Match 'FullControl' ) ) {
$ACl = Get-Acl $WorkingDirectory
$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule('Everyone', 'FullControl', 'ContainerInherit, ObjectInherit', 'none', 'Allow')
$Acl.AddAccessRule($AccessRule)
Set-Acl $WorkingDirectory $Acl
}
#region write script
$response = Invoke-WebRequest -Uri $URL -OutFile $Path -UseBasicParsing
if (!(Test-Path -Path $Path)) {
return 'ERROR: An error occurred and the script was unable to be downloaded. Exiting.'
}
#endregion
$DUOCurrentVersion = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty | Where-Object { $_.DisplayName -match 'DUO Security Authentication Proxy' } | Select-Object -ExpandProperty DisplayVersion
if ($DuoVersion -eq $DUOCurrentVersion) {
return 'DUO Security Authentication Proxy is already up to date.'
}
elseif ($DUOCurrentVersion -match '[0-9]') {
& $Path /S
Start-Sleep -Seconds 120
$DUOCurrentVersion = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty | Where-Object { $_.DisplayName -match 'DUO Security Authentication Proxy' } | Select-Object -ExpandProperty DisplayVersion
if ($DuoVersion -eq $DUOCurrentVersion) {
Write-Output 'DUO Security Authentication Proxy is successfully updated.'
}
else {
return 'ERROR: DUO Security Authentication Proxy is failed to update.'
}
}
else {
& $Path /S
Start-Sleep -Seconds 120
$DUOCurrentVersion = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty | Where-Object { $_.DisplayName -match 'DUO Security Authentication Proxy' } | Select-Object -ExpandProperty DisplayVersion
if ($DuoVersion -eq $DUOCurrentVersion) {
Write-Output 'DUO Security Authentication Proxy is successfully installed.'
}
else {
return 'ERROR: DUO Security Authentication Proxy is failed to install.'
}
}

PowerShell Script 2

Row 2 Logic: If/Then

Add a new If/Then/Else logic from the Add Logic dropdown menu.

If/Then Logic

ROW 2a Condition: Output Contains

Type ERROR: in the Value box.

Output Contains

Row 2b Function: Set Custom Field

Add a new row by clicking the Add Row button.

Add Row 2b

Search and select the Set Custom Field function.

Set Custom Field

The following function will pop up on the screen:

Set Custom Field Function

  • Search and select the Computer-Level Custom Field DUO Auth Proxy Result from the Custom Field dropdown menu.
  • Set Failed in the Value field.
  • Click the Save button.

Set Custom Field Save
Set Custom Field Save 2

Row 2c Function: Script Exit

Add a new row by clicking the Add Row button.

Add Row 2c

A blank function will appear.

Blank Function

Search and select the Script Exit function.

Script Exit
Script Exit 2

The following function will pop up on the screen:

Script Exit Function

In the script exit message, type:

Failed to install the "DUO Security Authentication Proxy" application. Refer to the logs:
%Output%

and click the Save button.

Script Exit Save

Row 3 Function: Script Log

Add a new row by clicking the Add Row button.

Add Row 3

A blank function will appear.

Blank Function 3

Search and select the Script Log function.

Script Log
Script Log 2

The following function will pop up on the screen:

Script Log Function

In the script log message, type:

Successfully installed the "DUO Security Authentication Proxy" application. Refer to the logs:
%Output%

and click the Save button.

Script Log Save

Row 4 Function: Set Custom Field

Add a new row by clicking the Add Row button.

Add Row 4

Search and select the Set Custom Field function.

Set Custom Field 4

The following function will pop up on the screen:

Set Custom Field Function 4

  • Search and select the Computer-Level Custom Field DUO Auth Proxy Result from the Custom Field dropdown menu.
  • Set Success in the Value field.
  • Click the Save button.

Set Custom Field Save 4
Set Custom Field Save 4b

Row 5 Function: Script Exit

Add a new row by clicking the Add Row button.

Add Row 5

A blank function will appear.

Blank Function 5

Search and select the Script Exit function.

Script Exit 5
Script Exit 5b

The following function will pop up on the screen:

Script Exit Function 5

In the script exit message, leave it blank and click the Save button.

Script Exit Save 5

Completed Task

Completed Task

Implementation

It is suggested to run the task once per week against the group DUO Auth Proxy Deployment.

  • Go to Automation > Tasks.
  • Search for the DUO Auth Proxy - Install/Update Latest Version task.
  • Select the concerned task.
  • Click on the Schedule button to schedule the task/script.

Schedule Task

This screen will appear.

Schedule Screen

Select the Schedule button and click the calendar-looking button present in front of the Recurrence option.

Schedule Recurrence

Select the Month(s) for the Repeat, 1 for Dates, and click the OK button to save the schedule.

Schedule Save

Click the Select Targets button to select the concerned target.

Select Targets

Search and select the Duo Auth Proxy Deployment Device Group for the target.

Select Device Group

Click the Run button to initiate the schedule.

Run Task

Output

Script log
Custom field

Output