javascript
Web
RDP Free Github + Tailscale
Code Workflow untuk membuat RDP gratis seumur hidup, tapi dengan waktu 6jam (bisa buat ulang lagi)
#rdpfree#rdpgratis#workflow#github#tailscale#remotedesktop
javascript
| 1 | name: RDP |
| 2 | |
| 3 | on: |
| 4 | workflow_dispatch: |
| 5 | |
| 6 | jobs: |
| 7 | secure-rdp: |
| 8 | # Agar aapne GitHub par custom 32GB RAM wala runner khareeda hai, |
| 9 | # to 'windows-latest' ko uske naam se replace kar dein. |
| 10 | runs-on: windows-latest |
| 11 | timeout-minutes: 3600 |
| 12 | |
| 13 | steps: |
| 14 | - name: Configure Core RDP Settings |
| 15 | run: | |
| 16 | # Enable Remote Desktop and disable Network Level Authentication (if needed) |
| 17 | Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' ` |
| 18 | -Name "fDenyTSConnections" -Value 0 -Force |
| 19 | Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' ` |
| 20 | -Name "UserAuthentication" -Value 0 -Force |
| 21 | Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' ` |
| 22 | -Name "SecurityLayer" -Value 0 -Force |
| 23 | |
| 24 | # Remove any existing rule with the same name to avoid duplication |
| 25 | netsh advfirewall firewall delete rule name="RDP-Tailscale" |
| 26 | |
| 27 | # For testing, allow any incoming connection on port 3389 |
| 28 | netsh advfirewall firewall add rule name="RDP-Tailscale" ` |
| 29 | dir=in action=allow protocol=TCP localport=3389 |
| 30 | |
| 31 | # (Optional) Restart the Remote Desktop service to ensure changes take effect |
| 32 | Restart-Service -Name TermService -Force |
| 33 | |
| 34 | - name: Create RDP User with Custom Password |
| 35 | run: | |
| 36 | # Set Custom Credentials |
| 37 | $password = "SpoilersHub0" |
| 38 | $securePass = ConvertTo-SecureString $password -AsPlainText -Force |
| 39 | |
| 40 | New-LocalUser -Name "RDP" -Password $securePass -AccountNeverExpires |
| 41 | Add-LocalGroupMember -Group "Administrators" -Member "RDP" |
| 42 | Add-LocalGroupMember -Group "Remote Desktop Users" -Member "RDP" |
| 43 | |
| 44 | echo "RDP_CREDS=User: RDP | Password: $password" >> $env:GITHUB_ENV |
| 45 | |
| 46 | if (-not (Get-LocalUser -Name "RDP")) { |
| 47 | Write-Error "User creation failed" |
| 48 | exit 1 |
| 49 | } |
| 50 | |
| 51 | - name: Install Tailscale |
| 52 | run: | |
| 53 | $tsUrl = "https://pkgs.tailscale.com/stable/tailscale-setup-1.82.0-amd64.msi" |
| 54 | $installerPath = "$env:TEMP\tailscale.msi" |
| 55 | |
| 56 | Invoke-WebRequest -Uri $tsUrl -OutFile $installerPath |
| 57 | Start-Process msiexec.exe -ArgumentList "/i", "`"$installerPath`"", "/quiet", "/norestart" -Wait |
| 58 | Remove-Item $installerPath -Force |
| 59 | |
| 60 | - name: Establish Tailscale Connection |
| 61 | run: | |
| 62 | # Bring up Tailscale with the provided auth key and set a unique hostname |
| 63 | & "$env:ProgramFiles\Tailscale\tailscale.exe" up --authkey=${{ secrets.TAILSCALE_AUTH_KEY }} --hostname=gh-runner-$env:GITHUB_RUN_ID |
| 64 | |
| 65 | # Wait for Tailscale to assign an IP |
| 66 | $tsIP = $null |
| 67 | $retries = 0 |
| 68 | while (-not $tsIP -and $retries -lt 10) { |
| 69 | $tsIP = & "$env:ProgramFiles\Tailscale\tailscale.exe" ip -4 |
| 70 | Start-Sleep -Seconds 5 |
| 71 | $retries++ |
| 72 | } |
| 73 | |
| 74 | if (-not $tsIP) { |
| 75 | Write-Error "Tailscale IP not assigned. Exiting." |
| 76 | exit 1 |
| 77 | } |
| 78 | echo "TAILSCALE_IP=$tsIP" >> $env:GITHUB_ENV |
| 79 | |
| 80 | - name: Verify RDP Accessibility |
| 81 | run: | |
| 82 | Write-Host "Tailscale IP: $env:TAILSCALE_IP" |
| 83 | |
| 84 | # Test connectivity using Test-NetConnection against the Tailscale IP on port 3389 |
| 85 | $testResult = Test-NetConnection -ComputerName $env:TAILSCALE_IP -Port 3389 |
| 86 | if (-not $testResult.TcpTestSucceeded) { |
| 87 | Write-Error "TCP connection to RDP port 3389 failed" |
| 88 | exit 1 |
| 89 | } |
| 90 | Write-Host "TCP connectivity successful!" |
| 91 | |
| 92 | - name: Maintain Connection |
| 93 | run: | |
| 94 | Write-Host "`n=== RDP ACCESS ===" |
| 95 | Write-Host "Address: $env:TAILSCALE_IP" |
| 96 | Write-Host "Username: RDP" |
| 97 | Write-Host "Password: SpoilersHub0" |
| 98 | Write-Host "==================`n" |
| 99 | |
| 100 | # Keep runner active indefinitely (or until manually cancelled) |
| 101 | while ($true) { |
| 102 | Write-Host "[$(Get-Date)] RDP Active - Use Ctrl+C in workflow to terminate" |
| 103 | Start-Sleep -Seconds 300 |
| 104 | } |
name: RDP
on:
workflow_dispatch:
jobs:
secure-rdp:
# Agar aapne GitHub par custom 32GB RAM wala runner khareeda hai,
# to 'windows-latest' ko uske naam se replace kar dein.
runs-on: windows-latest
timeout-minutes: 3600
steps:
- name: Configure Core RDP Settings
run: |
# Enable Remote Desktop and disable Network Level Authentication (if needed)
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' `
-Name "fDenyTSConnections" -Value 0 -Force
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' `
-Name "UserAuthentication" -Value 0 -Force
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' `
-Name "SecurityLayer" -Value 0 -Force
# Remove any existing rule with the same name to avoid duplication
netsh advfirewall firewall delete rule name="RDP-Tailscale"
# For testing, allow any incoming connection on port 3389
netsh advfirewall firewall add rule name="RDP-Tailscale" `
dir=in action=allow protocol=TCP localport=3389
# (Optional) Restart the Remote Desktop service to ensure changes take effect
Restart-Service -Name TermService -Force
- name: Create RDP User with Custom Password
run: |
# Set Custom Credentials
$password = "SpoilersHub0"
$securePass = ConvertTo-SecureString $password -AsPlainText -Force
New-LocalUser -Name "RDP" -Password $securePass -AccountNeverExpires
Add-LocalGroupMember -Group "Administrators" -Member "RDP"
Add-LocalGroupMember -Group "Remote Desktop Users" -Member "RDP"
echo "RDP_CREDS=User: RDP | Password: $password" >> $env:GITHUB_ENV
if (-not (Get-LocalUser -Name "RDP")) {
Write-Error "User creation failed"
exit 1
}
- name: Install Tailscale
run: |
$tsUrl = "https://pkgs.tailscale.com/stable/tailscale-setup-1.82.0-amd64.msi"
$installerPath = "$env:TEMP\tailscale.msi"
Invoke-WebRequest -Uri $tsUrl -OutFile $installerPath
Start-Process msiexec.exe -ArgumentList "/i", "`"$installerPath`"", "/quiet", "/norestart" -Wait
Remove-Item $installerPath -Force
- name: Establish Tailscale Connection
run: |
# Bring up Tailscale with the provided auth key and set a unique hostname
& "$env:ProgramFiles\Tailscale\tailscale.exe" up --authkey=${{ secrets.TAILSCALE_AUTH_KEY }} --hostname=gh-runner-$env:GITHUB_RUN_ID
# Wait for Tailscale to assign an IP
$tsIP = $null
$retries = 0
while (-not $tsIP -and $retries -lt 10) {
$tsIP = & "$env:ProgramFiles\Tailscale\tailscale.exe" ip -4
Start-Sleep -Seconds 5
$retries++
}
if (-not $tsIP) {
Write-Error "Tailscale IP not assigned. Exiting."
exit 1
}
echo "TAILSCALE_IP=$tsIP" >> $env:GITHUB_ENV
- name: Verify RDP Accessibility
run: |
Write-Host "Tailscale IP: $env:TAILSCALE_IP"
# Test connectivity using Test-NetConnection against the Tailscale IP on port 3389
$testResult = Test-NetConnection -ComputerName $env:TAILSCALE_IP -Port 3389
if (-not $testResult.TcpTestSucceeded) {
Write-Error "TCP connection to RDP port 3389 failed"
exit 1
}
Write-Host "TCP connectivity successful!"
- name: Maintain Connection
run: |
Write-Host "`n=== RDP ACCESS ==="
Write-Host "Address: $env:TAILSCALE_IP"
Write-Host "Username: RDP"
Write-Host "Password: SpoilersHub0"
Write-Host "==================`n"
# Keep runner active indefinitely (or until manually cancelled)
while ($true) {
Write-Host "[$(Get-Date)] RDP Active - Use Ctrl+C in workflow to terminate"
Start-Sleep -Seconds 300
}
Komentar (0)
Masuk untuk ikut berkomentar.
- Belum ada komentar.