-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNew-SSHKey.ps1
980 lines (847 loc) · 42.5 KB
/
New-SSHKey.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
<#
.SYNOPSIS
This function creates a new SSH Public/Private Key Pair. Optionally, add it to the ssh-agent.
Optionally add the public key to a Remote Host's ~/.ssh/authorized_keys file.
.DESCRIPTION
See .SYNOPSIS
.NOTES
.PARAMETER NewSSHKeyName
This parameter is MANDATORY.
This parameter takes a string that represents the file name that you would like to give to the new
SSH User/Client Keys.
.PARAMETER NewSSHKeyPurpose
This parameter is OPTIONAL.
This parameter takes a string that represents a very brief description of what the new SSH Keys
will be used for. This description will be added to the Comment section when the new keys are
created.
.PARAMETER NewSSHKeyPwd
This parameter is OPTIONAL.
This parameter takes a SecureString that represents the password used to protect the new
Private Key file that is created.
.PARAMETER BlankSSHPrivateKeyPwd
This parameter is OPTIONAL.
This parameter is a switch. Use it to ensure that the newly created Private Key is NOT password
protected.
.PARAMETER AddToSSHAgent
This parameter is OPTIONAL, but recommended.
This parameter is a switch. If used, the new SSH Key Pair will be added to the ssh-agent service.
.PARAMETER RemovePrivateKey
This parameter is OPTIONAL. This parameter should only be used in conjunction with the
-AddtoSSHAgent switch.
This parameter is a switch. If used, the newly created Private Key will be added to the ssh-agent
and deleted from the filesystem.
.PARAMETER RemoteHost
This parameter is OPTIONAL. This parameter should only be used in conjunction with the
-AddToRemoteHostAuthKeys switch.
This parameter takes a string that represents the IP Address of DNS-Resolvable name of a Remote Host.
The newly created public key will be added to the Remote Host's ~/.ssh/authorized_keys file. The
Remote Host can be either Windows or Linux (as long as you can ssh to it from the local host).
.PARAMETER AddToRemoteHostAuthKeys
This parameter is OPTIONAL.
This parameter is a switch. If used, the newly created Public Key will be added to the Remote Host's
~/.ssh/authorized_keys file. (Specify the Remote Host using the -RemoteHost parameter)
.PARAMETER RemoteHostUserName
This parameter is OPTIONAL. This parameter should only be used in conjunction with the
-AddToRemoteHostAuthKeys parameter.
This parameter takes a string that represents the name of the user with ssh access to
the Remote Host (specified by the -RemoteHost parameter).
.EXAMPLE
# Open an elevated PowerShell Session, import the module, and -
PS C:\Users\zeroadmin> $SplatParams = @{
NewSSHKeyName = "ToRHServ01"
NewSSHKeyPurpose = "ForSSHToRHServ01"
AddToSSHAgent = $True
}
PS C:\Users\zeroadmin> New-SSHKey @SplatParams
#>
function New-SSHKey {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True)]
[string]$NewSSHKeyName,
[Parameter(Mandatory=$False)]
[securestring]$NewSSHKeyPwd,
[Parameter(Mandatory=$False)]
[ValidatePattern("^\w*$")] # No spaces allowed
[string]$NewSSHKeyPurpose,
[Parameter(Mandatory=$False)]
[switch]$AddToSSHAgent,
[Parameter(Mandatory=$False)]
[switch]$RemovePrivateKey,
#[Parameter(Mandatory=$False)]
#[switch]$ShowNextSteps,
[Parameter(Mandatory=$False)]
[string]$RemoteHost,
[Parameter(Mandatory=$False)]
[switch]$AddToRemoteHostAuthKeys,
[Parameter(Mandatory=$False)]
[string]$RemoteHostUserName
)
#region >> Helper Functions
function Get-Elevation {
if ($PSVersionTable.PSEdition -eq "Desktop" -or $PSVersionTable.Platform -eq "Win32NT" -or $PSVersionTable.PSVersion.Major -le 5) {
[System.Security.Principal.WindowsPrincipal]$currentPrincipal = New-Object System.Security.Principal.WindowsPrincipal(
[System.Security.Principal.WindowsIdentity]::GetCurrent()
)
[System.Security.Principal.WindowsBuiltInRole]$administratorsRole = [System.Security.Principal.WindowsBuiltInRole]::Administrator
if($currentPrincipal.IsInRole($administratorsRole)) {
return $true
}
else {
return $false
}
}
if ($PSVersionTable.Platform -eq "Unix") {
if ($(whoami) -eq "root") {
return $true
}
else {
return $false
}
}
}
function Install-LinuxPackage {
[CmdletBinding()]
Param (
[Parameter(Mandatory=$True)]
[string[]]$PossiblePackageNames,
[Parameter(Mandatory=$True)]
[string]$CommandName
)
if (!$(command -v $CommandName)) {
foreach ($PackageName in $PossiblePackageNames) {
if ($(command -v pacman)) {
$null = sudo pacman -S $PackageName --noconfirm *> $null
}
elseif ($(command -v yum)) {
$null = sudo yum -y install $PackageName *> $null
}
elseif ($(command -v dnf)) {
$null = sudo dnf -y install $PackageName *> $null
}
elseif ($(command -v apt)) {
$null = sudo apt-get -y install $PackageName *> $null
}
elseif ($(command -v zypper)) {
$null = sudo zypper install $PackageName --non-interactive *> $null
}
if ($(command -v $CommandName)) {
break
}
}
if (!$(command -v $CommandName)) {
Write-Error "Unable to find the command $CommandName! Install unsuccessful! Halting!"
$global:FunctionResult = "1"
return
}
else {
Write-Host "$PackageName was successfully installed!" -ForegroundColor Green
}
}
else {
Write-Warning "The command $CommandName is already available!"
return
}
}
#endregion >> Helper Functions
#region >> Prep
if ($PSVersionTable.Platform -eq "Unix" -or $PSVersionTable.OS -match "Darwin") {
if (Get-Elevation) {
Write-Error "You cannot run the $($PSCmdlet.MyInvocation.MyCommand) function as root! Halting!"
$global:FunctionResult = "1"
return
}
}
if (!$PSVersionTable.Platform -or $PSVersionTable.Platform -eq "Win32NT") {
try {
if ($(Get-Module -ListAvailable).Name -notcontains 'WinSSH') {$null = Install-Module WinSSH -ErrorAction Stop}
if ($(Get-Module).Name -notcontains 'WinSSH') {$null = Import-Module WinSSH -ErrorAction Stop}
Import-Module "$($(Get-Module WinSSH).ModuleBase)\Await\Await.psd1" -ErrorAction Stop
}
catch {
Write-Error $_
$global:FunctionResult = "1"
return
}
try {
$null = Stop-AwaitSession
}
catch {
Write-Verbose $_.Exception.Message
}
}
if ($PSVersionTable.Platform -eq "Unix" -or $PSVersionTable.OS -match "Darwin") {
# Determine if we have required Linux commands
[System.Collections.ArrayList]$LinuxCommands = @(
"echo"
"expect"
)
[System.Collections.ArrayList]$CommandsNotPresent = @()
foreach ($CommandName in $LinuxCommands) {
$CommandCheckResult = command -v $CommandName
if (!$CommandCheckResult) {
$null = $CommandsNotPresent.Add($CommandName)
}
}
if ($CommandsNotPresent.Count -gt 0) {
[System.Collections.ArrayList]$FailedInstalls = @()
if ($CommandsNotPresent -contains "echo") {
try {
$null = Install-LinuxPackage -PossiblePackageNames "coreutils" -CommandName "echo"
}
catch {
$null = $FailedInstalls.Add("coreutils")
}
}
if ($CommandsNotPresent -contains "expect") {
try {
$null = Install-LinuxPackage -PossiblePackageNames "expect" -CommandName "expect"
}
catch {
$null = $FailedInstalls.Add("expect")
}
}
if ($FailedInstalls.Count -gt 0) {
Write-Error "The following Linux packages are required, but were not able to be installed:`n$($FailedInstalls -join "`n")`nHalting!"
$global:FunctionResult = "1"
return
}
}
[System.Collections.ArrayList]$CommandsNotPresent = @()
foreach ($CommandName in $LinuxCommands) {
$CommandCheckResult = command -v $CommandName
if (!$CommandCheckResult) {
$null = $CommandsNotPresent.Add($CommandName)
}
}
if ($CommandsNotPresent.Count -gt 0) {
Write-Error "The following Linux commands are required, but not present on $env:ComputerName:`n$($CommandsNotPresent -join "`n")`nHalting!"
$global:FunctionResult = "1"
return
}
}
if (!$(Get-Command ssh-keygen -ErrorAction SilentlyContinue)) {
Write-Error "Unable to find ssh-keygen! Halting!"
$global:FunctionResult = "1"
return
}
if ($AddToSSHAgent) {
if (!$(Get-Command ssh-add -ErrorAction SilentlyContinue)) {
Write-Error "Unable to find ssh-add! Halting!"
$global:FunctionResult = "1"
return
}
if (!$PSVersionTable.Platform -or $PSVersionTable.Platform -eq "Win32NT") {
if ($(Get-Service ssh-agent).Status -ne "Running") {
$SSHDErrMsg = "The ssh-agent service is NOT curently running! No ssh key pair has been created. Please ensure that the " +
"ssh-agent and sshd services are running and try again. Halting!'"
Write-Error $SSHDErrMsg
$global:FunctionResult = "1"
return
}
}
}
if ($AddToRemoteHostAuthKeys -and !$RemoteHost) {
$RemoteHost = Read-Host -Prompt "Please enter an IP, FQDN, or DNS-resolvable Host Name that represents the Remote Host you would like to share your new public key with."
}
if ($RemoteHost -and !$AddToRemoteHostAuthKeys) {
$AddToRemoteHostAuthKeys = $True
}
if ($RemoteHost) {
try {
$RemoteHostNetworkInfo = ResolveHost -HostNameOrIP $RemoteHost -ErrorAction Stop
}
catch {
Write-Error "Unable to resolve $RemoteHost! Halting!"
$global:FunctionResult = "1"
return
}
}
if ($RemoteHost -or $AddToRemoteHostAuthKeys -and !$RemoteHostUserName) {
$RemoteHostUserName = Read-Host -Prompt "Please enter a UserName that has access to $RemoteHost"
}
$UserSSHDir = Join-Path $HOME ".ssh"
if (!$(Test-Path $UserSSHDir)) {
$null = New-Item -Type Directory -Path $UserSSHDir
}
$SSHKeyOutFile = Join-Path $UserSSHDir $NewSSHKeyName
if ($NewSSHKeyPwd) {
$NewSSHKeyPwdPT = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($NewSSHKeyPwd))
}
if ($NewSSHKeyPurpose) {
#$SSHKeyGenArgumentsString = "-t rsa -b 2048 -f `"$SSHKeyOutFile`" -q -N `"$NewSSHKeyPwdPT`" -C `"$NewSSHKeyPurpose`""
$NewSSHKeyPurpose = $NewSSHKeyPurpose -replace "[\s]",""
$SSHKeyGenArgumentsString = "-t rsa -b 2048 -f `"$SSHKeyOutFile`" -q -C `"$NewSSHKeyPurpose`""
$SSHKeyGenArgumentsStringForExpect = "-t rsa -b 2048 -f \`"$SSHKeyOutFile\`" -q -C \`"$NewSSHKeyPurpose\`""
}
else {
#$SSHKeyGenArgumentsString = "-t rsa -b 2048 -f `"$SSHKeyOutFile`" -q -N `"$NewSSHKeyPwd`""
$SSHKeyGenArgumentsString = "-t rsa -b 2048 -f `"$SSHKeyOutFile`" -q"
$SSHKeyGenArgumentsStringForExpect = "-t rsa -b 2048 -f \`"$SSHKeyOutFile\`" -q"
}
#endregion >> Prep
#region >> Main
if (!$PSVersionTable.Platform -or $PSVersionTable.Platform -eq "Win32NT") {
$sshkeygenParentDir = $(Get-Command ssh-keygen).Source | Split-Path -Parent
#region >> Await Attempt 1 of 2
# Create new public/private keypair
$null = Start-AwaitSession
Start-Sleep -Seconds 1
$null = Send-AwaitCommand '$host.ui.RawUI.WindowTitle = "PSAwaitSession"'
$PSAwaitProcess = $($(Get-Process | Where-Object {$_.Name -eq "powershell"}) | Sort-Object -Property StartTime -Descending)[0]
Start-Sleep -Seconds 1
$null = Send-AwaitCommand "`$env:Path = '$env:Path'; Push-Location '$sshkeygenParentDir'"
Start-Sleep -Seconds 1
$null = Send-AwaitCommand -Command $([scriptblock]::Create("ssh-keygen $SSHKeyGenArgumentsString; Test-Path $SSHKeyOutFile"))
Start-Sleep -Seconds 2
$PassphraseOrOverwriteExistingKey = Receive-AwaitResponse
[System.Collections.ArrayList]$CheckForExpectedResponses = @()
$null = $CheckForExpectedResponses.Add($PassphraseOrOverwriteExistingKey)
$Counter = 0
while (![bool]$($($CheckForExpectedResponses -split "`n") -match [regex]::Escape("Enter passphrase (empty for no passphrase):")) -and
![bool]$($($CheckForExpectedResponses -split "`n") -match [regex]::Escape("Overwrite (y/n)?")) -and $Counter -le 30
) {
$PassphraseOrOverwriteExistingKey = Receive-AwaitResponse
$null = $CheckForExpectedResponses.Add($PassphraseOrOverwriteExistingKey)
if ($CheckResponsesOutput -match "must be greater than zero" -or @($CheckResponsesOutput)[-1] -notmatch "[a-zA-Z]") {
break
}
Start-Sleep -Seconds 1
$Counter++
}
if ($Counter -eq 31) {
Write-Verbose "sshkeygen attempt timed out!"
if ($PSAwaitProcess.Id) {
try {
$null = Stop-AwaitSession
}
catch {
if ($PSAwaitProcess.Id -eq $PID) {
Write-Error "The PSAwaitSession never spawned! Halting!"
$global:FunctionResult = "1"
return
}
else {
if ([bool]$(Get-Process -Id $PSAwaitProcess.Id -ErrorAction SilentlyContinue)) {
Stop-Process -Id $PSAwaitProcess.Id -ErrorAction SilentlyContinue
}
$Counter = 0
while ([bool]$(Get-Process -Id $PSAwaitProcess.Id -ErrorAction SilentlyContinue) -and $Counter -le 15) {
Write-Verbose "Waiting for Await Module Process Id $($PSAwaitProcess.Id) to end..."
Start-Sleep -Seconds 1
$Counter++
}
}
}
$PSAwaitProcess = $null
}
}
#endregion >> Await Attempt 1 of 2
$CheckResponsesOutput = $CheckForExpectedResponses | foreach {$_ -split "`n"}
#region >> Await Attempt 2 of 2
# If $CheckResponsesOutput contains the string "must be greater than zero", then something broke with the Await Module.
# Most of the time, just trying again resolves any issues
if ($CheckResponsesOutput -match "must be greater than zero" -or @($CheckResponsesOutput)[-1] -notmatch "[a-zA-Z]" -or
$CheckResponsesOutput -match "background process reported an error") {
if ($PSAwaitProcess.Id) {
try {
$null = Stop-AwaitSession
}
catch {
if ($PSAwaitProcess.Id -eq $PID) {
Write-Error "The PSAwaitSession never spawned! Halting!"
$global:FunctionResult = "1"
return
}
else {
if ([bool]$(Get-Process -Id $PSAwaitProcess.Id -ErrorAction SilentlyContinue)) {
Stop-Process -Id $PSAwaitProcess.Id -ErrorAction SilentlyContinue
}
$Counter = 0
while ([bool]$(Get-Process -Id $PSAwaitProcess.Id -ErrorAction SilentlyContinue) -and $Counter -le 15) {
Write-Verbose "Waiting for Await Module Process Id $($PSAwaitProcess.Id) to end..."
Start-Sleep -Seconds 1
$Counter++
}
}
}
}
# Create new public/private keypair
$null = Start-AwaitSession
Start-Sleep -Seconds 1
$null = Send-AwaitCommand '$host.ui.RawUI.WindowTitle = "PSAwaitSession"'
$PSAwaitProcess = $($(Get-Process | Where-Object {$_.Name -eq "powershell"}) | Sort-Object -Property StartTime -Descending)[0]
Start-Sleep -Seconds 1
$null = Send-AwaitCommand "`$env:Path = '$env:Path'; Push-Location '$sshkeygenParentDir'"
Start-Sleep -Seconds 1
$null = Send-AwaitCommand -Command $([scriptblock]::Create("ssh-keygen $SSHKeyGenArgumentsString"))
Start-Sleep -Seconds 2
$PassphraseOrOverwriteExistingKey = Receive-AwaitResponse
[System.Collections.ArrayList]$CheckForExpectedResponses = @()
$null = $CheckForExpectedResponses.Add($PassphraseOrOverwriteExistingKey)
$Counter = 0
while (![bool]$($($CheckForExpectedResponses -split "`n") -match [regex]::Escape("Enter passphrase (empty for no passphrase):")) -and
![bool]$($($CheckForExpectedResponses -split "`n") -match [regex]::Escape("Overwrite (y/n)?")) -and $Counter -le 30
) {
$PassphraseOrOverwriteExistingKey = Receive-AwaitResponse
$null = $CheckForExpectedResponses.Add($PassphraseOrOverwriteExistingKey)
Start-Sleep -Seconds 1
$Counter++
}
if ($Counter -eq 31) {
Write-Error "sshkeygen attempt timed out!"
$global:FunctionResult = "1"
#$CheckForExpectedResponses
if ($PSAwaitProcess.Id) {
try {
$null = Stop-AwaitSession
}
catch {
if ($PSAwaitProcess.Id -eq $PID) {
Write-Error "The PSAwaitSession never spawned! Halting!"
$global:FunctionResult = "1"
return
}
else {
if ([bool]$(Get-Process -Id $PSAwaitProcess.Id -ErrorAction SilentlyContinue)) {
Stop-Process -Id $PSAwaitProcess.Id -ErrorAction SilentlyContinue
}
$Counter = 0
while ([bool]$(Get-Process -Id $PSAwaitProcess.Id -ErrorAction SilentlyContinue) -and $Counter -le 15) {
Write-Verbose "Waiting for Await Module Process Id $($PSAwaitProcess.Id) to end..."
Start-Sleep -Seconds 1
$Counter++
}
}
}
}
return
}
}
#endregion >> Await Attempt 2 of 2
$CheckResponsesOutput = $CheckForExpectedResponses | foreach {$_ -split "`n"}
# At this point, if we don't have the expected output, we need to fail
if ($CheckResponsesOutput -match "must be greater than zero" -or @($CheckResponsesOutput)[-1] -notmatch "[a-zA-Z]" -or
$CheckResponsesOutput -match "background process reported an error") {
if ($CheckResponsesOutput -match "must be greater than zero" -or @($CheckResponsesOutput)[-1] -notmatch "[a-zA-Z]") {
Write-Error "Something went wrong with the PowerShell Await Module! Halting!"
}
if ($CheckResponsesOutput -match "background process reported an error") {
Write-Error "Please check your credentials! Halting!"
}
$global:FunctionResult = "1"
if ($PSAwaitProcess.Id) {
try {
$null = Stop-AwaitSession
}
catch {
if ($PSAwaitProcess.Id -eq $PID) {
Write-Error "The PSAwaitSession never spawned! Halting!"
$global:FunctionResult = "1"
return
}
else {
if ([bool]$(Get-Process -Id $PSAwaitProcess.Id -ErrorAction SilentlyContinue)) {
Stop-Process -Id $PSAwaitProcess.Id -ErrorAction SilentlyContinue
}
$Counter = 0
while ([bool]$(Get-Process -Id $PSAwaitProcess.Id -ErrorAction SilentlyContinue) -and $Counter -le 15) {
Write-Verbose "Waiting for Await Module Process Id $($PSAwaitProcess.Id) to end..."
Start-Sleep -Seconds 1
$Counter++
}
}
}
}
return
}
# Now we should either have a prompt to accept the host key, a prompt for a password, or it already worked...
if ($CheckResponsesOutput -match [regex]::Escape("Overwrite (y/n)?")) {
$null = Send-AwaitCommand "y"
Start-Sleep -Seconds 3
# This will either not prompt at all or prompt for a password
$PassphraseOrOverwriteExistingKey = Receive-AwaitResponse
[System.Collections.ArrayList]$CheckExpectedSendYesOutput = @()
$null = $CheckExpectedSendYesOutput.Add($PassphraseOrOverwriteExistingKey)
$Counter = 0
while (![bool]$($($CheckExpectedSendYesOutput -split "`n") -match [regex]::Escape("Enter passphrase (empty for no passphrase):")) -and $Counter -le 30) {
$PassphraseOrOverwriteExistingKey = Receive-AwaitResponse
$null = $CheckExpectedSendYesOutput.Add($PassphraseOrOverwriteExistingKey)
Start-Sleep -Seconds 1
$Counter++
}
if ($Counter -eq 31) {
Write-Error "Sending 'y' to overwrite the existing ssh key timed out!"
$global:FunctionResult = "1"
$CheckForExpectedResponses
if ($PSAwaitProcess.Id) {
try {
$null = Stop-AwaitSession
}
catch {
if ($PSAwaitProcess.Id -eq $PID) {
Write-Error "The PSAwaitSession never spawned! Halting!"
$global:FunctionResult = "1"
return
}
else {
if ([bool]$(Get-Process -Id $PSAwaitProcess.Id -ErrorAction SilentlyContinue)) {
Stop-Process -Id $PSAwaitProcess.Id -ErrorAction SilentlyContinue
}
$Counter = 0
while ([bool]$(Get-Process -Id $PSAwaitProcess.Id -ErrorAction SilentlyContinue) -and $Counter -le 15) {
Write-Verbose "Waiting for Await Module Process Id $($PSAwaitProcess.Id) to end..."
Start-Sleep -Seconds 1
$Counter++
}
}
}
}
return
}
$CheckSendYesOutput = $CheckExpectedSendYesOutput | foreach {$_ -split "`n"}
}
if ($CheckSendYesOutput -match [regex]::Escape("Enter passphrase (empty for no passphrase):") -or
$CheckResponsesOutput -match [regex]::Escape("Enter passphrase (empty for no passphrase):")
) {
if ($NewSSHKeyPwd) {
$null = Send-AwaitCommand $NewSSHKeyPwdPT
}
else {
$null = Send-AwaitCommand ""
}
Start-Sleep -Seconds 3
$PassphraseOrOverwriteExistingKey = Receive-AwaitResponse
[System.Collections.ArrayList]$CheckExpectedSendPwdOutput = @()
$null = $CheckExpectedSendPwdOutput.Add($PassphraseOrOverwriteExistingKey)
$Counter = 0
while (![bool]$($CheckExpectedSendPwdOutput -match [regex]::Escape("Enter same passphrase again:")) -and $Counter -le 30) {
$PassphraseOrOverwriteExistingKey = Receive-AwaitResponse
$null = $CheckExpectedSendPwdOutput.Add($PassphraseOrOverwriteExistingKey)
Start-Sleep -Seconds 1
$Counter++
}
if ($Counter -eq 31) {
Write-Error "Sending the initial password for the private key timed out!"
$global:FunctionResult = "1"
$CheckExpectedSendPwdOutput
if ($PSAwaitProcess.Id) {
try {
$null = Stop-AwaitSession
}
catch {
if ($PSAwaitProcess.Id -eq $PID) {
Write-Error "The PSAwaitSession never spawned! Halting!"
$global:FunctionResult = "1"
return
}
else {
if ([bool]$(Get-Process -Id $PSAwaitProcess.Id -ErrorAction SilentlyContinue)) {
Stop-Process -Id $PSAwaitProcess.Id -ErrorAction SilentlyContinue
}
$Counter = 0
while ([bool]$(Get-Process -Id $PSAwaitProcess.Id -ErrorAction SilentlyContinue) -and $Counter -le 15) {
Write-Verbose "Waiting for Await Module Process Id $($PSAwaitProcess.Id) to end..."
Start-Sleep -Seconds 1
$Counter++
}
}
}
}
return
}
$CheckSendPwdOutput = $CheckExpectedSendPwdOutput | foreach {$_ -split "`n"}
if ($CheckSendPwdOutput -match [regex]::Escape("Enter same passphrase again:")) {
if ($NewSSHKeyPwd) {
$null = Send-AwaitCommand $NewSSHKeyPwdPT
}
else {
$null = Send-AwaitCommand ""
}
Start-Sleep -Seconds 3
$PassphraseOrOverwriteExistingKey = Receive-AwaitResponse
if (!$OutputPrep) {
[System.Collections.ArrayList]$OutputPrep = @()
if (![System.String]::IsNullOrWhiteSpace($SuccessOrAcceptHostKeyOrPwdPrompt)) {
$null = $OutputPrep.Add($SuccessOrAcceptHostKeyOrPwdPrompt)
}
}
$Counter = 0
while (![bool]$($($OutputPrep -split "`n") -match "True") -and $Counter -le $CounterLimit) {
$PassphraseOrOverwriteExistingKey = Receive-AwaitResponse
$null = $OutputPrep.Add($PassphraseOrOverwriteExistingKey)
Start-Sleep -Seconds 1
$Counter++
}
if ($Counter -eq 31) {
Write-Error "Sending the password again timed out!"
$global:FunctionResult = "1"
$OutputPrep
if ($PSAwaitProcess.Id) {
try {
$null = Stop-AwaitSession
}
catch {
if ($PSAwaitProcess.Id -eq $PID) {
Write-Error "The PSAwaitSession never spawned! Halting!"
$global:FunctionResult = "1"
return
}
else {
if ([bool]$(Get-Process -Id $PSAwaitProcess.Id -ErrorAction SilentlyContinue)) {
Stop-Process -Id $PSAwaitProcess.Id -ErrorAction SilentlyContinue
}
$Counter = 0
while ([bool]$(Get-Process -Id $PSAwaitProcess.Id -ErrorAction SilentlyContinue) -and $Counter -le 15) {
Write-Verbose "Waiting for Await Module Process Id $($PSAwaitProcess.Id) to end..."
Start-Sleep -Seconds 1
$Counter++
}
}
}
}
return
}
}
}
$SSHKeyGenOutput = $OutputPrep
}
if ($PSVersionTable.Platform -eq "Unix" -or $PSVersionTable.OS -match "Darwin") {
if ($AddToSSHAgent) {
# Check to see if the ssh-agent is running
#[scriptblock]::Create('ssh-add -L').InvokeReturnAsIs()
$SSHAgentProcesses = Get-Process -Name ssh-agent -IncludeUserName -ErrorAction SilentlyContinue | Where-Object {$_.UserName -eq $env:USER}
if ($SSHAgentProcesses.Count -gt 0) {
$LatestSSHAgentProcess = $(@($SSHAgentProcesses) | Sort-Object StartTime)[-1]
$env:SSH_AUTH_SOCK = $(Get-ChildItem /tmp -Recurse -File | Where-Object {$_.FullName -match "\.$($LatestSSHAgentProcess.Id-1)"}).FullName
$env:SSH_AGENT_PID = $LatestSSHAgentProcess.Id
}
else {
$SSHAgentInfo = ssh-agent
$env:SSH_AUTH_SOCK = $($($($SSHAgentInfo -match "AUTH_SOCK") -replace 'SSH_AUTH_SOCK=','') -split ';')[0]
$env:SSH_AGENT_PID = $($($($SSHAgentInfo -match "SSH_AGENT_PID") -replace 'SSH_AGENT_PID=','') -split ';')[0]
}
}
[System.Collections.ArrayList]$ExpectScriptPrep = @(
'expect - << EOF'
'set timeout 20'
)
if ($NewSSHKeyPwdPT) {
$null = $ExpectScriptPrep.Add("set password $NewSSHKeyPwdPT")
}
[System.Collections.ArrayList]$ExpectScriptPrep2 = @(
'set prompt \"(>|:|#|\\\\\\$)\\\\s+\\$\"'
"spawn ssh-keygen $SSHKeyGenArgumentsStringForExpect"
'match_max 100000'
'expect {'
' \"*Overwrite (y*\" {'
' send -- \"y\r\"'
' exp_continue'
' }'
' \"*(empty for no passphrase)*\" {'
)
if ($NewSSHKeyPwdPT) {
$null = $ExpectScriptPrep2.Add(' send -- \"\$password\r\"')
}
else {
$null = $ExpectScriptPrep2.Add(' send -- \"\r\"')
}
[System.Collections.ArrayList]$ExpectScriptPrep3 = @(
' expect \"*Enter same passphrase again*\"'
' }'
'}'
)
if ($NewSSHKeyPwdPT) {
$null = $ExpectScriptPrep3.Add('send -- \"\$password\r\"')
}
else {
$null = $ExpectScriptPrep3.Add('send -- \"\r\"')
}
foreach ($Line in $ExpectScriptPrep2) {
$null = $ExpectScriptPrep.Add($Line)
}
foreach ($Line in $ExpectScriptPrep3) {
$null = $ExpectScriptPrep.Add($Line)
}
$null = $ExpectScriptPrep.Add('expect eof')
$null = $ExpectScriptPrep.Add('EOF')
$ExpectScript = $ExpectScriptPrep -join "`n"
#Write-Host "`$ExpectScript is:`n$ExpectScript"
#$ExpectScript | Export-CliXml "$HOME/ExpectScriptA.xml"
# The below $ExpectOutput is an array of strings
$ExpectOutput = bash -c "$ExpectScript"
$SSHKeyGenOutput = $ExpectOutput
}
$PubPrivKeyPairFiles = Get-ChildItem -Path $UserSSHDir -File | Where-Object {$_.Name -match "$NewSSHKeyName"}
$PubKey = $PubPrivKeyPairFiles | Where-Object {$_.Extension -eq ".pub"}
$PrivKey = $PubPrivKeyPairFiles | Where-Object {$_.Extension -ne ".pub"}
if (!$PubKey -or !$PrivKey) {
if (!$PSVersionTable.Platform -or $PSVersionTable.Platform -eq "Win32NT") {
$Counter = 0
if ($PSAwaitProcess.Id) {
try {
$null = Stop-AwaitSession
}
catch {
if ($PSAwaitProcess.Id -eq $PID) {
Write-Error "The PSAwaitSession never spawned! Halting!"
$global:FunctionResult = "1"
return
}
else {
if ([bool]$(Get-Process -Id $PSAwaitProcess.Id -ErrorAction SilentlyContinue)) {
Stop-Process -Id $PSAwaitProcess.Id -ErrorAction SilentlyContinue
}
$Counter = 0
while ([bool]$(Get-Process -Id $PSAwaitProcess.Id -ErrorAction SilentlyContinue) -and $Counter -le 15) {
Write-Verbose "Waiting for Await Module Process Id $($PSAwaitProcess.Id) to end..."
Start-Sleep -Seconds 1
$Counter++
}
}
}
}
}
Write-Error "The New SSH Key Pair was NOT created! Please review the output of ssh-keygen below. Halting!"
$global:FunctionResult = "1"
$SSHKeyGenOutput
return
}
if ($AddToSSHAgent) {
# Add the New Private Key to the ssh-agent
$null = [scriptblock]::Create("ssh-add $($PrivKey.FullName)").InvokeReturnAsIs()
if ($LASTEXITCODE -ne 0) {
Write-Warning $Error[0].Exception.Message
Write-Warning "There was a problem adding $($PrivKey.FullName) to the ssh-agent PID $env:SSH_AGENT_PID!"
}
[System.Collections.ArrayList]$PublicKeysAccordingToSSHAgent = @()
$(ssh-add -L) | foreach {
$null = $PublicKeysAccordingToSSHAgent.Add($_)
}
$ThisPublicKeyAccordingToSSHAgent = $PublicKeysAccordingToSSHAgent | Where-Object {$_ -match "$NewSSHKeyName$"}
[System.Collections.ArrayList]$CharacterCountArray = @()
$ThisPublicKeyAccordingToSSHAgent -split " " | foreach {
$null = $CharacterCountArray.Add($_.Length)
}
$LongestStringLength = $($CharacterCountArray | Measure-Object -Maximum).Maximum
$ArrayPositionBeforeComment = $CharacterCountArray.IndexOf([int]$LongestStringLength)
$PublicKeySansCommentFromSSHAgent = $($ThisPublicKeyAccordingToSSHAgent -split " ")[0..$ArrayPositionBeforeComment] -join " "
$ThisPublicKeyAccordingToFile = Get-Content $PubKey.FullName
[System.Collections.ArrayList]$CharacterCountArray = @()
$ThisPublicKeyAccordingToFile -split " " | foreach {
$null = $CharacterCountArray.Add($_.Length)
}
$LongestStringLength = $($CharacterCountArray | Measure-Object -Maximum).Maximum
$ArrayPositionBeforeComment = $CharacterCountArray.IndexOf([int]$LongestStringLength)
$PublicKeySansCommentFromFile = $($ThisPublicKeyAccordingToFile -split " ")[0..$ArrayPositionBeforeComment] -join " "
if ($PublicKeySansCommentFromSSHAgent -ne $PublicKeySansCommentFromFile) {
Write-Warning "The public key according to the ssh-agent does NOT match the public key content in $($PubKey.FullName)! It appears the private key was never added to the ssh-agent!"
}
Write-Host "The Private Key $PublicKeyLocationFinal has been added to the ssh-agent service." -ForegroundColor Green
if (!$RemovePrivateKey) {
Write-Host "It is now safe to delete the private key (i.e. $($PrivKey.FullName)) since it has been added to the ssh-agent." -ForegroundColor Green
}
}
if ($AddToRemoteHostAuthKeys) {
if ($RemoteHostNetworkInfo.FQDN) {
$RemoteHostLocation = $RemoteHostNetworkInfo.FQDN
}
elseif ($RemoteHostNetworkInfo.HostName) {
$RemoteHostLocation = $RemoteHostNetworkInfo.HostName
}
elseif ($RemoteHostNetworkInfo.IPAddressList[0]) {
$RemoteHostLocation = $RemoteHostNetworkInfo.IPAddressList[0]
}
try {
Add-PublicKeyToRemoteHost -PublicKeyPath $PubKey.FullName -RemoteHost $RemoteHostLocation -RemoteHostUserName $RemoteHostUserName -ErrorAction Stop
}
catch {
Write-Error "Unable to add the public key to the authorized_keys file on $RemoteHost! Halting!"
$global:FunctionResult = "1"
return
}
if (!$AddToSSHAgent) {
Write-Host "You can now ssh to $RemoteHost using public key authentication using the following command:" -ForegroundColor Green
Write-Host " ssh -i $PubKey.FullName $RemoteHostUserName@$RemoteHostLocation" -ForegroundColor Green
}
else {
Write-Host "You can now ssh to $RemoteHost using public key authentication using the following command:" -ForegroundColor Green
Write-Host " ssh $RemoteHostUserName@$RemoteHostLocation" -ForegroundColor Green
}
}
[pscustomobject]@{
PublicKeyFilePath = $PubKey.FullName
PrivateKeyFilePath = if (!$RemovePrivateKey) {$PrivKey.FullName} else {"PrivateKey was deleted after being added to the ssh-agent"}
PublicKeyContent = Get-Content $(Join-Path $UserSSHDir "$NewSSHKeyName.pub")
}
##### END Main Body #####
}
# SIG # Begin signature block
# MIIMiAYJKoZIhvcNAQcCoIIMeTCCDHUCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUaMr0H+D0yzNKBN4q3CEv+l6Z
# 2t+gggn9MIIEJjCCAw6gAwIBAgITawAAAB/Nnq77QGja+wAAAAAAHzANBgkqhkiG
# 9w0BAQsFADAwMQwwCgYDVQQGEwNMQUIxDTALBgNVBAoTBFpFUk8xETAPBgNVBAMT
# CFplcm9EQzAxMB4XDTE3MDkyMDIxMDM1OFoXDTE5MDkyMDIxMTM1OFowPTETMBEG
# CgmSJomT8ixkARkWA0xBQjEUMBIGCgmSJomT8ixkARkWBFpFUk8xEDAOBgNVBAMT
# B1plcm9TQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDCwqv+ROc1
# bpJmKx+8rPUUfT3kPSUYeDxY8GXU2RrWcL5TSZ6AVJsvNpj+7d94OEmPZate7h4d
# gJnhCSyh2/3v0BHBdgPzLcveLpxPiSWpTnqSWlLUW2NMFRRojZRscdA+e+9QotOB
# aZmnLDrlePQe5W7S1CxbVu+W0H5/ukte5h6gsKa0ktNJ6X9nOPiGBMn1LcZV/Ksl
# lUyuTc7KKYydYjbSSv2rQ4qmZCQHqxyNWVub1IiEP7ClqCYqeCdsTt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