Skip to content

Commit

Permalink
+14 - add key protection
Browse files Browse the repository at this point in the history
  • Loading branch information
SunSerega committed Aug 16, 2024
1 parent a43bd9b commit 96ddc68
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions .github/workflows/upstream pretest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,36 @@ jobs:
Get-Service -Name ssh-agent | Set-Service -StartupType Manual
Start-Service -Name ssh-agent
Write-Host "UserName: $env:UserName"
Write-Host "UserProfile: $env:UserProfile"
# Set Key File Variable:
New-Variable -Name Key -Value "$env:UserProfile\.ssh\id_rsa"
$ssh_key = '${{ secrets.SSH_KEY }}'
$ssh_key | Set-Content 'ssh_key'
ssh-add 'ssh_key'
$ssh_key | Set-Content $Key
# Remove Inheritance:
Icacls $Key /c /t /Inheritance:d
# Set Ownership to Owner:
# Key's within $env:UserProfile:
Icacls $Key /c /t /Grant ${env:UserName}:F
# Key's outside of $env:UserProfile:
TakeOwn /F $Key
Icacls $Key /c /t /Grant:r ${env:UserName}:F
# Remove All Users, except for Owner:
Icacls $Key /c /t /Remove:g Administrator "Authenticated Users" BUILTIN\Administrators BUILTIN Everyone System Users
# Verify:
Icacls $Key
ssh-add $Key
# Remove Variable:
Remove-Variable -Name Key
# - uses: webfactory/[email protected]
# with:
# ssh-private-key: ${{ secrets.SSH_KEY }}
Expand Down

0 comments on commit 96ddc68

Please sign in to comment.