feat: add web RDP module
parent
838ec95875
commit
c5c521fabd
@ -0,0 +1,5 @@
|
||||
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M31 6V22C31 23.65 29.65 25 28 25H4C2.35 25 1 23.65 1 22V6C1 4.35 2.35 3 4 3H28C29.65 3 31 4.35 31 6Z" fill="#2197F3"/>
|
||||
<path d="M21 27H17V24C17 23.4478 16.5522 23 16 23C15.4478 23 15 23.4478 15 24V27H11C10.4478 27 10 27.4478 10 28C10 28.5522 10.4478 29 11 29H21C21.5522 29 22 28.5522 22 28C22 27.4478 21.5522 27 21 27Z" fill="#FFC10A"/>
|
||||
<path d="M31 17V22C31 23.65 29.65 25 28 25H4C2.35 25 1 23.65 1 22V17H31Z" fill="#3F51B5"/>
|
||||
</svg>
|
After Width: | Height: | Size: 540 B |
@ -0,0 +1,28 @@
|
||||
---
|
||||
display_name: Windows RDP
|
||||
description: RDP Server and Web Client powered by Devolutions
|
||||
icon: ../.icons/desktop.svg
|
||||
maintainer_github: coder
|
||||
verified: false
|
||||
tags: [windows, ide, web]
|
||||
---
|
||||
|
||||
# Windows RDP
|
||||
|
||||
Enable Remote Desktop + a web based client on Windows workspaces
|
||||
|
||||
<!-- TODO: Add GIF -->
|
||||
|
||||
## Usage
|
||||
|
||||
```tf
|
||||
module "code-server" {
|
||||
source = "registry.coder.com/modules/code-server/coder"
|
||||
version = "1.0.10"
|
||||
agent_id = coder_agent.example.id
|
||||
}
|
||||
```
|
||||
|
||||
## Tested on
|
||||
|
||||
- ✅ GCP with Windows Server 2022: [Example template](#TODO)
|
@ -0,0 +1,98 @@
|
||||
terraform {
|
||||
required_version = ">= 1.0"
|
||||
|
||||
required_providers {
|
||||
coder = {
|
||||
source = "coder/coder"
|
||||
version = ">= 0.17"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
variable "agent_id" {
|
||||
type = string
|
||||
description = "The ID of a Coder agent."
|
||||
}
|
||||
|
||||
resource "coder_script" "windows-rdp" {
|
||||
agent_id = var.agent_id
|
||||
display_name = "web-rdp"
|
||||
icon = "https://svgur.com/i/158F.svg" # TODO: add to Coder icons
|
||||
script = <<EOF
|
||||
function Set-AdminPassword {
|
||||
param (
|
||||
[string]$adminPassword
|
||||
)
|
||||
# Set admin password
|
||||
Get-LocalUser -Name "Administrator" | Set-LocalUser -Password (ConvertTo-SecureString -AsPlainText $adminPassword -Force)
|
||||
# Enable admin user
|
||||
Get-LocalUser -Name "Administrator" | Enable-LocalUser
|
||||
}
|
||||
|
||||
function Configure-RDP {
|
||||
# Enable RDP
|
||||
New-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -Name "fDenyTSConnections" -Value 0 -PropertyType DWORD -Force
|
||||
# Disable NLA
|
||||
New-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name "UserAuthentication" -Value 0 -PropertyType DWORD -Force
|
||||
New-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name "SecurityLayer" -Value 1 -PropertyType DWORD -Force
|
||||
# Enable RDP through Windows Firewall
|
||||
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
|
||||
}
|
||||
|
||||
function Install-DevolutionsGateway {
|
||||
# Define the module name and version
|
||||
$moduleName = "DevolutionsGateway"
|
||||
$moduleVersion = "2024.1.5"
|
||||
|
||||
# Install the module with the specified version for all users
|
||||
# This requires administrator privileges
|
||||
Install-Module -Name $moduleName -RequiredVersion $moduleVersion -Force
|
||||
|
||||
# Construct the module path for system-wide installation
|
||||
$moduleBasePath = "C:\Windows\system32\config\systemprofile\Documents\PowerShell\Modules\$moduleName\$moduleVersion"
|
||||
$modulePath = Join-Path -Path $moduleBasePath -ChildPath "$moduleName.psd1"
|
||||
|
||||
# Import the module using the full path
|
||||
Import-Module $modulePath
|
||||
Install-DGatewayPackage
|
||||
|
||||
# Configure Devolutions Gateway
|
||||
$Hostname = "localhost"
|
||||
$HttpListener = New-DGatewayListener 'http://*:7171' 'http://*:7171'
|
||||
$WebApp = New-DGatewayWebAppConfig -Enabled $true -Authentication None
|
||||
$ConfigParams = @{
|
||||
Hostname = $Hostname
|
||||
Listeners = @($HttpListener)
|
||||
WebApp = $WebApp
|
||||
}
|
||||
Set-DGatewayConfig @ConfigParams
|
||||
New-DGatewayProvisionerKeyPair -Force
|
||||
|
||||
# Configure and start the Windows service
|
||||
Set-Service 'DevolutionsGateway' -StartupType 'Automatic'
|
||||
Start-Service 'DevolutionsGateway'
|
||||
}
|
||||
|
||||
Set-AdminPassword -adminPassword "coderRDP!"
|
||||
Configure-RDP
|
||||
Install-DevolutionsGateway
|
||||
|
||||
EOF
|
||||
|
||||
run_on_start = true
|
||||
}
|
||||
|
||||
resource "coder_app" "windows-rdp" {
|
||||
agent_id = var.agent_id
|
||||
slug = "web-rdp"
|
||||
display_name = "Web RDP"
|
||||
url = "http://localhost:7171"
|
||||
icon = "https://svgur.com/i/158F.svg"
|
||||
subdomain = true
|
||||
|
||||
healthcheck {
|
||||
url = "http://localhost:${var.port}"
|
||||
interval = 5
|
||||
threshold = 15
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue