X-Git-Url: https://git.josue.xyz/?p=webi-installers%2F.git;a=blobdiff_plain;f=ssh-utils%2Fssh-pubkey.ps1;fp=ssh-utils%2Fssh-pubkey.ps1;h=14d6c6ceae565bac3ed746545e57728cff4e1524;hp=e86a858f07a6e5fdc446465bcf9062f4e0866da0;hb=91512157ab426c87e0a82b594620e90e324b23a3;hpb=b1d3b44f966332434d8ec49b2a0df569e9bf8c16 diff --git a/ssh-utils/ssh-pubkey.ps1 b/ssh-utils/ssh-pubkey.ps1 deleted file mode 100644 index e86a858..0000000 --- a/ssh-utils/ssh-pubkey.ps1 +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env pwsh - -# TODO: can we use some of this? -# https://github.com/PowerShell/openssh-portable/blob/latestw_all/contrib/win32/openssh/FixUserFilePermissions.ps1 - -if (!(Test-Path -Path "$Env:USERPROFILE/.ssh")) -{ - New-Item -Path "$Env:USERPROFILE/.ssh" -ItemType Directory -Force | out-null - #& icacls "$Env:USERPROFILE/.ssh" /inheritance:r - #& icacls "$Env:USERPROFILE/.ssh" /grant:r "$Env:USERNAME":"(F)" -} - -if (!(Test-Path -Path "$Env:USERPROFILE/.ssh/config")) -{ - New-Item -Path "$Env:USERPROFILE/.ssh/config" -ItemType "file" -Value "" - #& icacls "$Env:USERPROFILE/.ssh/config" /inheritance:r - #& icacls "$Env:USERPROFILE/.ssh/config" /grant:r "$Env:USERNAME":"(F)" -} - -#if (!(Test-Path -Path "$Env:USERPROFILE/.ssh/authorized_keys")) -#{ -# New-Item -Path "$Env:USERPROFILE/.ssh/authorized_keys" -ItemType "file" -Value "" -# #& icacls "$Env:USERPROFILE/.ssh/authorized_keys" /inheritance:r -# #& icacls "$Env:USERPROFILE/.ssh/authorized_keys" /grant:r "$Env:USERNAME":"(F)" -#} - -if (!(Test-Path -Path "$Env:USERPROFILE/.ssh/id_rsa")) -{ - & ssh-keygen -b 2048 -t rsa -f "$Env:USERPROFILE/.ssh/id_rsa" -q -N """" - echo "" -} - -if (!(Test-Path -Path "$Env:USERPROFILE/.ssh/id_rsa.pub")) -{ - & ssh-keygen -y -f "$Env:USERPROFILE/.ssh/id_rsa" > "$Env:USERPROFILE/.ssh/id_rsa.pub" - echo "" -} - -# TODO use the comment (if any) for the name of the file -echo "" -echo "~/Downloads/id_rsa.$Env:USERNAME.pub": -echo "" -#rm -f "$Env:USERPROFILE/Downloads/id_rsa.$Env:USERNAME.pub": -Copy-Item -Path "$Env:USERPROFILE/.ssh/id_rsa.pub" -Destination "$Env:USERPROFILE/Downloads/id_rsa.$Env:USERNAME.pub" -& type "$Env:USERPROFILE/Downloads/id_rsa.$Env:USERNAME.pub" -echo "" diff --git a/ssh-utils/ssh-pubkey.ps1 b/ssh-utils/ssh-pubkey.ps1 new file mode 120000 index 0000000..14d6c6c --- /dev/null +++ b/ssh-utils/ssh-pubkey.ps1 @@ -0,0 +1 @@ +../ssh-pubkey/ssh-pubkey.ps1 \ No newline at end of file