This commit is contained in:
manojampalam 2016-05-14 23:21:33 -07:00
parent adf15dffb5
commit 2d6e648a8f
5 changed files with 46 additions and 19 deletions

View File

@ -95,15 +95,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ssh-add", "ssh-add.vcxproj"
{8660C2FE-9874-432D-B047-E042BB41DBE0} = {8660C2FE-9874-432D-B047-E042BB41DBE0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ssh-pubkey", "ssh-pubkey.vcxproj", "{029797FF-C986-43DE-95CD-2E771E86A0AD}"
ProjectSection(ProjectDependencies) = postProject
{05E1115F-8529-46D0-AAAF-52A404CE79A7} = {05E1115F-8529-46D0-AAAF-52A404CE79A7}
{8F9D3B74-8D33-448E-9762-26E8DCC6B2F4} = {8F9D3B74-8D33-448E-9762-26E8DCC6B2F4}
{DD483F7D-C553-4740-BC1A-903805AD0174} = {DD483F7D-C553-4740-BC1A-903805AD0174}
{0D02F0F0-013B-4EE3-906D-86517F3822C0} = {0D02F0F0-013B-4EE3-906D-86517F3822C0}
{8660C2FE-9874-432D-B047-E042BB41DBE0} = {8660C2FE-9874-432D-B047-E042BB41DBE0}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@ -232,14 +223,6 @@ Global
{029797FF-C986-43DE-95CD-2E771E86AEBC}.Release|x64.Build.0 = Release|x64
{029797FF-C986-43DE-95CD-2E771E86AEBC}.Release|x86.ActiveCfg = Release|Win32
{029797FF-C986-43DE-95CD-2E771E86AEBC}.Release|x86.Build.0 = Release|Win32
{029797FF-C986-43DE-95CD-2E771E86A0AD}.Debug|x64.ActiveCfg = Debug|x64
{029797FF-C986-43DE-95CD-2E771E86A0AD}.Debug|x64.Build.0 = Debug|x64
{029797FF-C986-43DE-95CD-2E771E86A0AD}.Debug|x86.ActiveCfg = Debug|Win32
{029797FF-C986-43DE-95CD-2E771E86A0AD}.Debug|x86.Build.0 = Debug|Win32
{029797FF-C986-43DE-95CD-2E771E86A0AD}.Release|x64.ActiveCfg = Release|x64
{029797FF-C986-43DE-95CD-2E771E86A0AD}.Release|x64.Build.0 = Release|x64
{029797FF-C986-43DE-95CD-2E771E86A0AD}.Release|x86.ActiveCfg = Release|Win32
{029797FF-C986-43DE-95CD-2E771E86A0AD}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -2,6 +2,7 @@
$scriptdir = Split-Path $scriptpath
$sshdpath = Join-Path $scriptdir "sshd.exe"
$sshagentpath = Join-Path $scriptdir "ssh-agent.exe"
if (-not (Test-Path $sshdpath)) {
throw "sshd.exe is not present in script path"
@ -13,5 +14,16 @@ if (Get-Service sshd -ErrorAction SilentlyContinue)
sc.exe delete sshd 1> null
}
New-Service -Name sshd -BinaryPathName $sshdpath -Description "SSH Deamon" -StartupType Manual | Out-Null
Write-Host -ForegroundColor Green "sshd successfully installed"
if (Get-Service ssh-agent -ErrorAction SilentlyContinue)
{
Stop-Service ssh-agent
sc.exe delete ssh-agent 1> null
}
New-Service -Name ssh-agent -BinaryPathName $sshagentpath -Description "SSH Agent" -StartupType Manual | Out-Null
cmd.exe /c 'sc.exe sdset ssh-agent D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)(A;;RP;;;AU)'
New-Service -Name sshd -BinaryPathName $sshdpath -Description "SSH Deamon" -StartupType Manual -DependsOn ssh-agent | Out-Null
sc.exe config sshd obj= "NT SERVICE\SSHD"
Write-Host -ForegroundColor Green "sshd and ssh-agent services successfully installed"

View File

@ -0,0 +1,10 @@
copy .\ssh-lsa.dll $env:windir\system32
$subkey = 'SYSTEM\CurrentControlSet\Control\Lsa'
$value = 'Authentication Packages'
$reg = [Microsoft.Win32.RegistryKey]::OpenBaseKey('LocalMachine', 0)
$key = $reg.OpenSubKey($subkey, $true)
$arr = $key.GetValue($value)
if ($arr -notcontains 'ssh-lsa') {
$arr += 'ssh-lsa'
$key.SetValue($value, [string[]]$arr, 'MultiString')
}

View File

@ -8,3 +8,15 @@ else {
Write-Host -ForegroundColor Yellow "sshd service is not installed"
}
if (Get-Service ssh-agent -ErrorAction SilentlyContinue)
{
Stop-Service ssh-agent
sc.exe delete ssh-agent 1>null
Write-Host -ForegroundColor Green "ssh-agent successfully uninstalled"
}
else {
Write-Host -ForegroundColor Yellow "ssh-agent service is not installed"
}

View File

@ -0,0 +1,10 @@
$subkey = 'SYSTEM\CurrentControlSet\Control\Lsa'
$value = 'Authentication Packages'
$reg = [Microsoft.Win32.RegistryKey]::OpenBaseKey('LocalMachine', 0)
$key = $reg.OpenSubKey($subkey, $true)
$arr = $key.GetValue($value)
if ($arr -contains 'ssh-lsa') {
$tempArryList = New-Object System.Collections.Arraylist(,$arr)
$tempArryList.Remove('ssh-lsa')
$key.SetValue($value, [string[]]$tempArryList, 'MultiString')
}