$password = Convertto-Securestring -String "PowerShellRocks!" -AsPlainText -Force
ConvertFrom-SecureString $password
์ค๋ฅ ์์
๋ค์ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
PS /home/chythu/temp> ConvertFrom-SecureString $password ConvertFrom-SecureString : Unable to load DLL 'CRYPT32.dll': The specified
module could not be found.
(Exception from HRESULT: 0x8007007E)
At line:1 char:1
- ConvertFrom-SecureString $password
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : NotSpecified: (:) [ConvertFrom-SecureString], Dl
lNotFoundException
- FullyQualifiedErrorId : System.DllNotFoundException,Microsoft.PowerShell
.Commands.ConvertFromSecureStringCommand
Name Value
---
PSVersion 5.1.10032.0
PSEdition PowerShellCore
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 3.0.0.0
GitCommitId v6.0.0-alpha.7
CLRVersion
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
> $PSVersionTable
Name Value
---- -----
PSVersion 6.0.2
PSEdition Core
GitCommitId v6.0.2
OS Darwin 17.5.0 Darwin Kernel Version 17.5.0: M...
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
๋ค์ ์ํ
```Powershell
$ ํค = (3,4,2,3,56,34,254,222,1,1,2,23,42,54,33,233,1,34,2,7,6,5,35,43)
$ s | ConvertFrom-SecureString-ํค $ Key
```
๋ถ์กฑํ CoreCLR ์ธ ๊ฒ ๊ฐ์ต๋๋ค.
@ KrishnaV-MSFT ์ด์ผ๊ธฐ Azure ๋ฐ๋ชจ์๋ ํ์ํ์ง ์์ต๋๋ค. Alpha.10 ๋ฐ์ผ๋ก ์ด๋
MacOS 10.12 ๋ฒ ํ (16A270f)์์ ๋์ผํ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค.
๊ทธ๋ฅ ์๋ง์ผ๋ก ๋ง๋ค์์ต๋๋ค.
PS> $User="Jared"
PS> $PWord = ConvertTo-SecureString โString "TestString" โAsPlainText -Force
PS> $Cred = New-Object -TypeName "System.Management.Automation.PSCredential" โArgumentList $User, $PWord
PS> ConvertFrom-SecureString -SecureString ($Cred.Password)
๊ฒฐ๊ณผ:
ConvertFrom-SecureString : Unable to load DLL 'CRYPT32.dll': The specified module could not be found.
(Exception from HRESULT: 0x8007007E)
At line:1 char:1
+ ConvertFrom-SecureString -SecureString ($Cred.Password)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [ConvertFrom-SecureString], DllNotFoundException
+ FullyQualifiedErrorId : System.DllNotFoundException,Microsoft.PowerShell.Commands.ConvertFromSecureStringComman
์๋ ํ์ธ์,
๋งคํ ๋ ์ธ์ฆ์๋ฅผ ์ฌ์ฉํ๋ ค๊ณ ํ ๋ ๋์ผํ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ค๋ฅ : psdrive :
Get-ChildItem Cert:/LocalMachine/
์ค๋ฅ:
get-childitem : 'crypt32.dll'DLL์๋ก๋ ํ ์ ์์ : ์ง์ ๋ ๋ชจ๋์ ์ฐพ์ ์ ์์ต๋๋ค.
(HRESULT ์์ธ : 0x8007007E)
์ค : 1 char : 1
- get-childitem ์ธ์ฆ์ : / LocalMachine /
~~~~~~~~~
- CategoryInfo : ์ง์ ๋์ง ์์ : (:) [Get-ChildItem], DllNotFoundException
- FullyQualifiedErrorId : System.DllNotFoundException, Microsoft.PowerShell.Commands.GetChildItemCommand
@ 35359595 ์ข์ ๋ฐ๊ฒฌ! ์ค๋ฅ๋ ํ์คํ ๋ ์น๊ทผํด์ผํฉ๋๋ค. Linux ๋ฐ macOS์์ Cert:/
๊ณต๊ธ์๋ ์ฌ๊ฒํ ๊ฐ ํ์ํฉ๋๋ค. ์ด ๋ ์์คํ
์ด ์ธ์ฆ์๋ฅผ ์ ์ฅํ๋ ๋ฐฉ์์ ์๋ก ์์ ํ ๋ค๋ฆ
๋๋ค.
์ฐธ๊ณ ๋ก PowerShell v6 alpha 14๋ฅผ ์ฌ์ฉํ๋ 16.04.1์๋ ์ฌ์ ํ ๋์ผํ ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
์ด๊ฒ์ ๋ด ๋ชจ๋์ Linux๋ก ๊ฐ์ ธ ์ค๋ ๊ฒ์ ๋ฐฉํดํฉ๋๋ค. Windows๋ฟ๋ง ์๋๋ผ ๋ชจ๋ OS์์ Web API ํค๋ฅผ ์์ ํ๊ฒ ์ ์ฅํ ์ ์๊ธฐ๋ฅผ ๋ฐ๋๋๋ค.
์ด๊ฒ์ SecureString์ ๋ค์ ๊ฐ์ ธ ์ค๋ .NET Standard 2.0 API๋ก๋ง ํ์ฑํ ํ ์์๋ ๊ฒ์ ๋๋ค.
ConvertFrom-SecureString
๋ฐ ConvertTo-SecureString
์ ์์กด System.Security.Cryptography.ProtectedData
์์ง ๊ฐ๋ฅํ์ง ์๋ค netstandard2.0
.
๋ฐ๋ผ์์ด ๋ cmdlet์ Unix ํ๋ซํผ์์ ๋ค์ ์์
ํด์ผํฉ๋๋ค.
์ด ๊ธฐ๋ฅ์ด .Net Core์ ์ค๋ฉด ์ ๋ง ๊ฐ์ฌํ๊ฒ ์ต๋๋ค.
์ฐ๋ฆฌ๋ WinRM์ ์์กดํ๊ณ PSCredential์ ์ฌ์ฉํ์ฌ ์ธ์ฆํฉ๋๋ค. Linux ๋๋ MacOS์์ ์คํฌ๋ฆฝํธ๋ฅผ ์คํํ๋ ๊ฒ์ ํ์ฌ ๋ถ๊ฐ๋ฅํ๋ฉฐ ์ฐ๋ฆฌ๋ฅผ ์กฐ๊ธ ๋ฐฉํดํฉ๋๋ค.
์ฐ๋ฆฌ๊ฐ ๋ณด๋ ์ค๋ฅ :
ConvertTo-SecureString : DLL 'CRYPT32.dll'์ (๋ฅผ)๋ก๋ ํ ์ ์์ต๋๋ค : ์ง์ ๋ ๋ชจ๋์ ์ฐพ์ ์ ์์ต๋๋ค.
(HRESULT ์์ธ : 0x8007007E)
@ reddwarf666 System.Security.Cryptography.ProtectedData
ํจํค์ง๋ nuget.org์์ ์ฌ์ฉํ ์ ์์ผ๋ฉฐ netstandard2.0 ๋ถ๋ง ์ฌํญ์ด์ง๋ง Unix ํ๋ซํผ์ ๋ํ ๊ตฌํ์ด ์์ต๋๋ค. Unix ํ๋ซํผ์์ 'PlatformNotSupportedException'์ด ๋ฐ์ํฉ๋๋ค. ๋ฐ๋ผ์ ConvertFrom/ConvertTo-SecureString
๋ Unix ์ฉ์ผ๋ก ๋ค์ ์์ฑํด์ผํฉ๋๋ค. Unix์์ ๋์ผํ ์์
์ ์ํํ๋ ๋ฐฉ๋ฒ์ ๋ํ .NET Core ํ์ ์ง์นจ์ ์ป์ผ๋ ค๊ณ ๋
ธ๋ ฅํ ๊ฒ์
๋๋ค. / cc @joeyaiello
[System.Runtime.InteropServices.Marshal] :: SecureStringToBSTR ๋ฐ [System.Runtime.InteropServices.Marshal] :: PtrToStringAuto๊ฐ ํจ๊ป ํ ๊ฐ๋ฅ์ฑ์ด ์์ต๋๊น?
SecureString cmdlet์ ์ฌ์ฉํ ๋ Mac ๋ฐ Linux์ 6.0.0-beta3์์ ์ฌ์ ํ์ด ๋ฌธ์ ๊ฐ ํ์๋ฉ๋๋ค.
ConvertFrom-SecureString : 'CRYPT32.dll'DLL์๋ก๋ ํ ์ ์์ : ์ง์ ๋
๋ชจ๋ ๋๋ ํด๋น ์ข
์์ฑ ์ค ํ๋๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค.
(HRESULT ์์ธ : 0x8007007E)
Linux debian (jessie 64 ๋นํธ)์์ convertfrom-securestring ๋ฐ convertto-securestring (v6.0.0-beta.3)๊ณผ ๋์ผํฉ๋๋ค.
PS /> $PSVersionTable
Name Value
---- -----
PSVersion 6.0.0-beta
PSEdition Core
GitCommitId v6.0.0-beta.3
OS Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2+deb8u2 (2017-06-26)
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
PS />
PS /> read-host -assecurestring | convertfrom-securestring | out-file securestring.txt
********
convertfrom-securestring : Unable to load DLL 'CRYPT32.dll': The specified module or one of its dependencies could not be found.
(Exception from HRESULT: 0x8007007E)
At line:1 char:29
+ read-host -assecurestring | convertfrom-securestring | out-file secur ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [ConvertFrom-SecureString], DllNotFoundException
+ FullyQualifiedErrorId : System.DllNotFoundException,Microsoft.PowerShell.Commands.ConvertFromSecureStringCommand
md5-cc0d4e3d925c664b6904e6cd6297ae12
PS /> $pass = cat securestring.txt | convertto-securestring
convertto-securestring : Unable to load DLL 'CRYPT32.dll': The specified module or one of its dependencies could not be found.
(Exception from HRESULT: 0x8007007E)
At line:1 char:32
+ $pass = cat securestring.txt | convertto-securestring
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [ConvertTo-SecureString], DllNotFoundException
+ FullyQualifiedErrorId : System.DllNotFoundException,Microsoft.PowerShell.Commands.ConvertToSecureStringCommand
md5-afb1baa637f2a1134516e0960e48b6df
PS /> [Reflection.Assembly]::LoadFrom("CRYPT32.dll")
Exception calling "LoadFrom" with "1" argument(s): "Bad IL format."
At line:1 char:1
+ [Reflection.Assembly]::LoadFrom("CRYPT32.dll")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : BadImageFormatException
md5-cc0d4e3d925c664b6904e6cd6297ae12
PS /> Add-Type -Path 'CRYPT32.dll'
Add-Type : Bad IL format.
At line:1 char:1
+ Add-Type -Path 'CRYPT32.dll'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-Type], BadImageFormatException
+ FullyQualifiedErrorId : System.BadImageFormatException,Microsoft.PowerShell.Commands.AddTypeCommand
/opt/microsoft/powershell/6.0.0-beta.3/์ ๋ณต์ฌํ๊ณ ์ ๋ ๊ฒฝ๋ก๋ฅผ ์ง์ ํ ๊ฒฝ์ฐ์๋ ์์ ๋์ผํ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
๊ฐ๋ฅํ / ์๋ ค์ง ํด๊ฒฐ ๋ฐฉ๋ฒ์ด ์์ต๋๊น? ์๋๋ฉด์ด ๋ฌธ์ ๊ฐ ํด๊ฒฐ ๋ ๋๊น์ง ๊ธฐ๋ค๋ ค์ผํฉ๋๊น?
@vchrizz Windows์ Unix๋ ๋ฐ์ด๋๋ฆฌ ํธํ์ด๋์ง ์์ผ๋ฉฐ Unix์์ Windows dll์ ์ฌ์ฉํ ์ ์์ต๋๋ค. ๋ฐ๋ผ์ CoreFX๋ฅผ ๊ธฐ๋ค๋ ค์ผํฉ๋๋ค.
@iSazonov ๋๋ ์ด๊ฒ์ ์๊ณ ์์ผ๋ฉฐ /opt/microsoft/powershell/6.0.0-beta.3/์ .dll ํ์ผ ๋๋ฌธ์ ๊ถ๊ธํดํ์ง๋ง ๋ค์์ ๋ฐ๊ฒฌํ์ต๋๋ค.
linux .dll ํ์ผ :
"PE32 ์คํ ํ์ผ (DLL) (์ฝ์) Intel 80386 Mono / .Net ์ด์
๋ธ๋ฆฌ, MS Windows ์ฉ"
"PE32 + ์คํ ๊ฐ๋ฅ (DLL) (์ฝ์) Mono / .Net ์ด์
๋ธ๋ฆฌ, MS Windows ์ฉ"
Windows CRYPT32.dll ํ์ผ :
"PE32 ์คํ ํ์ผ (DLL) (GUI) Intel 80386, MS Windows ์ฉ"
์ด์ ํด๊ฒฐ ๋ฐฉ๋ฒ์ ์ฐพ๊ณ Export-Clixml์์ ๋์ผํ ๋ฌธ์ ๋ฅผ ๋ฐ๊ฒฌํ์ต๋๋ค.
PS /> $cred=Get-Credential โcredential "myuser" | Export-Clixml SecureCredentials.xml
Windows PowerShell credential request
Enter your credentials.
Password for user myuser: **********
Export-Clixml : Unable to load DLL 'CRYPT32.dll': The specified module or one of its dependencies could not be found.
(Exception from HRESULT: 0x8007007E)
At line:1 char:45
+ ... Credential โcredential "myuser" | Export-Clixml SecureCredentials.xml
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Export-Clixml], DllNotFoundException
+ FullyQualifiedErrorId : System.DllNotFoundException,Microsoft.PowerShell.Commands.ExportClixmlCommand
@vchrizz ํ์ฌ .Net CLI๋ ๋ชจ๋ ์ด์ ๋ธ๋ฆฌ๋ฅผ Unix ํจํค์ง์ ๋ฃ์ต๋๋ค. # 3961 Unix ํจํค์ง์ ์ถ์ ํฉ๋๋ค.
@ daxian-dbw OpenSSH ๋ฅผ ์ฌ์ฉํ์ฌ ๋ฐ์ดํฐ๋ฅผ ๋ณดํธ / ๋ณดํธ ํด์ ํ ์ ์์ต๋๋ค.
Windows๊ฐ ์๋ ๊ฒฝ์ฐ ์ฌ์ฉ์ ์ง์ ์์ ์ ์ํํ์ง ์๋ ๊ฒ์ด ์ข์ต๋๋ค. Nuget ํ๋ ์ด๊ฒ์ ์๊ตฌํ๋ ๊ฒ ๊ฐ์ต๋๋ค.
@ SteveL-MSFT๋ ๊ธฐ๋ฅ์ด ๋๋ฝ ๋ ๊ฒ์ผ๋ก ์ ๊ธฐ ํ ์ฌ๋์ด๋ฏ๋ก Nuget ํ์ด ํ์๋กํ๋์ง ํ์ธํ ์ ์์ต๋๋ค (NuGet / Home # 1851).
@ SteveL-MSFT @psmulovics CoreFX ํ์ด ๋ซํ ๋ฌธ์ ๋ฅผ ์ ํ ์ถ์ ํ์ง ์๋ ๊ฒ ๊ฐ์ต๋๋ค. ์ง์ ์ ์ํ๋ฉด ์๋ก์ด ๋ฌธ์ ๋ฅผ ์ด์ด์ผํ๋ค๊ณ ์๊ฐํฉ๋๋ค.
์๋ก์ด ์ด์ ์์ฑ https://github.com/dotnet/corefx/issues/22510
์๋ํ์ต๋๋ค! ๐ ์ด์ ์ฐ๋ฆฌ๋ ๋ต์ ์ป์์ต๋๋ค.
์ฐ๋ฆฌ๋ ์ด๊ฒ์ ํ ๊ณํ์ด ์์ต๋๋ค. Windows์์๋ง ์ฌ์ฉํ ์์๋ OS ๊ธฐ๋ฅ์ด ํ์ํฉ๋๋ค.
..
.NET Core์์๋ ๊ฒ์ ๋ถ๋ช ํฉ๋๋ค. Windows์์๋ DPAPI๊ฐ ์ํํ๋ ๋ชจ๋ ์์ ์ ์ํํฉ๋๋ค. Windows๊ฐ ์๋ ๊ฒฝ์ฐ์๋ ์กด์ฌํ์ง ์๋ ํ๋ซํผ์์ Windows DPAPI๊ฐ ์ํํ๋ ์์ ์ ์ํํฉ๋๋ค.
๋ฐ๋ผ์ ๊ฒฐ๋ก ์ ๋ด๋ ค์ผํฉ๋๋ค.
System.Security.Cryptography.ProtectedData
ํจํค์ง๋ฅผ ์ฌ์ฉํ๊ณ ๋ค๋ฅธ ๊ณํ ์์์์ ๊ธฐ๋ฅ์ ์ฐจ๋จํฉ๋๋ค.์กฐ์ฌํด ์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค.
@iSazonov ๋ ์ต์ 2๋ System.Runtime.InteropServices.Marshal์ ๊ฐ์ ธ์ฌ ๊ฒ์ ๋๊น?
@iSazonov ์ ์ด๋ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ๋์ ์๋ฃ๋์ง ์๋ ์ด์ ์ ๋ํ ๋ช ํ์ฑ์ด ์๋ค๊ณ ์๊ฐํฉ๋๋ค. ์ด๊ฒ์ ์์ ์์ ํญ๋ชฉ์ด ์๋๋ฏ๋ก 6.1.0์ ๋ํด ์ดํด ๋ณด๊ฒ ์ต๋๋ค.
@ SteveL-MSFT Windows PowerShell๊ณผ์ ์ญ ํธํ์ฑ์ ์ํด ์ค๋ System.Security.Cryptography.ProtectedData๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ด ์ข๋ค๊ณ ์๊ฐํฉ๋๋ค.
@ngetchell CoreFX ๋ฌธ์ ์ ์ค๋ช ๋ ํด๊ฒฐ ๋ฐฉ๋ฒ์ ๋๋ฌด ๋ง์ ํน์ ์์ ์ด ํ์ํ๋ฏ๋ก CoreFX๋ฅผ ๊ธฐ๋ค๋ ค์ผํฉ๋๋ค. Unix ์์คํ ์ ๋ํ ๊ฐ๋ฅํ ํด๊ฒฐ ๋ฐฉ๋ฒ์ Windows ์์คํ ์ ๋ํ ์๊ฒฉ ์ฐ๊ฒฐ์ ์ฌ์ฉํ๋ ๊ฒ์ ๋๋ค.
@iSazonov ์ฌํ์ Windows์์ beta.4๋ก ๋๋ฅผ ์ํด ์๋ํ๋ฉฐ ํ์ฌ Windows๊ฐ ์๋ ๊ฒฝ์ฐ์๋ง ๋ฌธ์ ๊ฐ ์๋ค๊ณ ์๊ฐํฉ๋๋ค.
@ SteveL-MSFT System.Security.Cryptography.ProtectedData์์ ๋ถ์ ํํ๊ฒ ์ฃ์กํฉ๋๋ค. _CoreFX package_๋ฅผ ์๋ฏธํ์ต๋๋ค. ํ์ฌ ์ฐ๋ฆฌ๋ ๋ด๋ถ ๊ตฌํ์ ์ฌ์ฉํฉ๋๋ค. ์ง๋ฌธ์-๋ด๋ถ ์ฝ๋๋ฅผ ์ ๊ฑฐํ๊ณ ํจํค์ง๋ก ๋ง์ด๊ทธ๋ ์ด์ ํด์ผํฉ๋๊น? Unix์์ * -SecureString cmdlet์ ์ ๊ฑฐํด์ผํฉ๋๊น?
@iSazonov ๊ณต์ ํจํค์ง๋ก ์ด๋ํด์ผํ๋ค๊ณ ์๊ฐํฉ๋๋ค. ์ ๋์ค์ ๊ฒฝ์ฐ ์ฌ๋ฐ๋ฅธ ๋ฐฉ๋ฒ์ ์ ๊ฑฐํ๋ ๊ฒ ๊ฐ์ต๋๋ค. cc @joeyaiello
์ด ์ด์ผ๊ธฐ๋ฅผ ๋ค์ ํ ํ๊ณ ์ถ์ต๋๋ค.
์ฌ์ ํ ConvertTo / ConvertFrom SecureString cmdlet์ _remove_ ํ ๊ณํ์
๋๊น?
Import / Export CliXml์์ Credentials ๋ฐ SecureStrings ์ฒ๋ฆฌ๋ ์ด๋ป์ต๋๊น?
์ด๋ค ๋ชจ๋๋ ์ฌ์ ํ HRESULT์์ ๋งค์ฐ ๋น์ฐํธ์ ์ธ DllNotFoundException์ ๋์ง๊ณ ์์ต๋๋ค ...
Export-Clixml cmdlet์ ์ฌ์ฉํ ๋ Linux์์ CRYPT32.dll ์ค๋ฅ์ ๋์ผํ ๋ฌธ์ ๊ฐ ์์ต๋๋ค. PS ๋ฒ์ 6.0.0
์ฌ๊ธฐ๋ ๋ง์ฐฌ๊ฐ์ง์
๋๋ค. ์ผ๋ถ ์คํฌ๋ฆฝํธ์ ์ด์์ฑ์ ๋ํด ๋
ผ์ํ๊ณ ์๊ธฐ ๋๋ฌธ์ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํด์ผํ๋์ง ์๋๋ฉด pwsh
๋๋ CoreFX
์ชฝ ( ํ์๋ ๊ทธ๋ ์ง ์์ ๊ฒ ๊ฐ์ต๋๋ค).
@cenit ์๋ง๋ ์ฐ๋ฆฌ๋ Windows ํธํ ๊ธฐ๋ฅ ํฉ์ ์ฌ์ฉํ ๊ฒ์ ๋๋ค
@iSazonov SecureString์ Windows ํธํ ๊ธฐ๋ฅ ํฉ์ ์ผ๋ถ๊ฐ ์๋ ๋น Windows์์๋ ์ฌ์ฉํ ์์๋ ํน์ OS ์ง์์ ์์กดํ๋ค๋ ๊ฒ์ ์๊ณ ์์ต๋๋ค.
์๋ํ์ง ์๋๋ผ๋ ๋ ๋์ ์ค๋ฅ ๋ฉ์์ง๋ฅผ ์ ๊ณตํด์ผํฉ๋๋ค.
์ ๊ฑฐ ๋ ๊ฒฝ์ฐ Unix์ * -SecureString cmdlet์ ๋ํ ๊ฐ๋ฅํ ๋์์ด ์์ต๋๊น?
๋์น ๊ฒฝ์ฐ ์ฃ์กํฉ๋๋ค. ์ ๋์ค์์๋ ๋ถ๊ฐ๋ฅํ ์ด์ ๋ฅผ ์๋ ค์ฃผ์ญ์์ค. ์ ๋์ค์์ ์๊ตฌ๋๋ ๋๋ฝ ๋ "OS ํน์ "๋ถ๋ถ์ ๋ฌด์์
๋๊น?
๋ค๋ฅธ ๋ฐฉ๋ฒ์ผ๋ก ์๊ฒฉ ์ฆ๋ช
์ ์ฒ๋ฆฌํ์ฌ ์ฌ๋ฐ๋ฅธ ํ์์ผ๋ก ๋ง๋ค๊ณ ์ถ๊ฐ๋ก ์ฌ์ฉํ ์ ์์ต๋๊น?
CoreFX์์ด ๋ฌธ์ ๋ ์๋ฒฝํ๊ฒ ์์ฝํ๋ค๊ณ ์๊ฐํฉ๋๋ค : https://github.com/dotnet/corefx/issues/22510
์ํ๊น๊ฒ๋ ์ง์ ์ด์๋ ๊ฒ ๊ฐ์ต๋๋ค.
๊ฐ์ฌํฉ๋๋ค. ์์ฃผ ์ ์ค๋ช ํด์ค๋๋ค.
@ SteveL-MSFT WCP๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ๊ณตํต ํจํด if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { ... }
์ฌ์ฉ ๊ฐ์
WCP์ ์ผ๋ถ API๊ฐ ์์ผ๋ฉด WCP ๋ฆฌํฌ์งํ ๋ฆฌ์์ ํผ๋๋ฐฑ ํ ์ ์์ต๋๋ค. ๊ทธ๋ฌ๋ ๊ทธ๊ฒ ์์ด๋ ์ฐ๋ฆฌ๋ #if !UNIX
๊ณผ ๊ฒฐํฉ ๋ ๊ณตํต ํจํด์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
@iSazonov ์ด ํน์ ๋ฌธ์ ์ ๋ํด SecureString ์ ํ์ด ์ค์ ๋ก ๋น Windows์์ ๋น ๊ตฌํ์ด๋ฏ๋ก WCP๊ฐ ์ด๊ฒ์ ํด๊ฒฐํ ๊ฒ์ด๋ผ๊ณ ์๊ฐํ์ง ์์ต๋๋ค.
์ด์จ๋ ์ข์์. ๐
์ข์, ๋ด๊ฐ ๋๋ฐ๋ก ์ก์๋์ง ํ์ธํ๊ธฐ ์ํด ์ด๊ฒ์ ํธ์งํ๊ณ ์๋ค ...
18 ๊ฐ์ ์ ์ ์กฐ๊ธฐ ๊ฒฝ๊ณ ์๋ ๋ถ๊ตฌํ๊ณ
6 ๊ฐ์ ์ .Net Framework ํ์ _ ๋งค์ฐ ๋ถ๋ช ํ _ ๋ฉ์์ง์๋ ๋ถ๊ตฌํ๊ณ .
๐
ํต์ฌ์ .NET ํ๋ ์ ์ํฌ (๋ฐ PowerShell)์ ํฌ๋ก์ค ํ๋ซํผ ๋ฐ์ดํฐ ๋ณดํธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ํ์ํ๋ค๋ ๊ฒ์ ๋๋ค. ์๋ํ๋ฉด ๊ฐ๋ฐ / ์ด์์ด ๋น๋ฐ์ ์ ์ฅํด์ผํ๋ ์ด์ ๋ ์ฐ๋ฆฌ๊ฐ ์๋ก์ด OS๋ฅผ ๋ฏน์ค์ ์ถ๊ฐํ์ ๋ ๊ฐ์๊ธฐ ์ฌ๋ผ์ง์ง ์์๊ณ ํญ์ ์ค์ฉ์ ์ด์ง ์๊ธฐ ๋๋ฌธ์ ๋๋ค. Azure KeyVault, RED ID ๊ด๋ฆฌ ๋๋ Thycotic Secret Server์ ๊ฐ์ ์น ์๋น์ค์ ์์กดํฉ๋๋ค. ๐
.NET ํ์ ์ฌ๊ธฐ์์ ํน๋ณํ ๋์์ด๋์ง ์๋ ๊ฒ ๊ฐ์ต๋๋ค.
ASP.NET์ด ์์ฒด DataProtection ํญ๋ชฉ์ ์์ฑํ์์ ์๊ณ ์์ง๋ง ์๋นํ ์ด์ํ๊ณ ํน์ ์๋๋ฆฌ์ค๋ก ์ฌ์ฉ์ ์ ํํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
์ฐ๋ฆฌ๊ฐ ์์์ผ ํ ๊ฒ์ :
๊ทธ๋ ์ง ์์ ๊ฒฝ์ฐ ์ ํ ์๋ํ์ง ์๋ cmdlet์ ์ ๊ฑฐํ๊ณ CliXML์ ๋ํด ํ์ฌ "์ฌ์ฉ ๊ฐ๋ฅํ Crypto dll ๋ง ์๋ค๋ฉด"์ค๋ฅ๋ณด๋ค ๋ ๋์ ์ค๋ฅ ๋ฉ์์ง๋ฅผ ์ ๊ณตํ์ญ์์ค.
๊ด๋ จ ํญ๋ชฉ์ ํ์ธํ์ญ์์ค.
NuGet / Home # 1851
dotnet / corefx # 6746
ASP.NET DataProtection์ ์ฌ์ฉํ ์ ์์ต๋๋ค. ์ด๊ฒ์ ์ค๋๋ ์ฌ์ฉ ๊ฐ๋ฅํ ๊ฒ ์ค ๊ฐ์ฅ ์ ๋ขฐํ ์์๋ ๊ฒ์ ๋๋ค. ํนํ ์ฐ๋ฆฌ๋ ๊ฝค ๋ง์ด ํ์ํฉ๋๋ค.
MySQL ๋ช ๋ น ์ค์ ์ ๋ฌํ๊ธฐ ์ํด ์์ ํ๊ฒ ์ํธ๋ฅผ ์ฝ์ผ๋ ค๊ณ ํฉ๋๋ค. ์ํธ๋ฅผ ์ ๋ ฅ ํ ๋ ์ฝ์์ ์ํธ๊ฐ ํ์๋์ง ์๋๋ก ๊ถ์ฅ๋๋ ๋์์ ๋ฌด์์ ๋๊น?
$str = Read-Host -AsSecureString
ConvertFrom-SecureString -SecureString $str
ConvertFrom-SecureString : Unable to load DLL 'CRYPT32.dll': The specified module or one of its dependencies could not be found.
(Exception from HRESULT: 0x8007007E)
At line:1 char:1
+ ConvertFrom-SecureString -SecureString $str
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [ConvertFrom-SecureString], DllNotFoundException
+ FullyQualifiedErrorId : System.DllNotFoundException,Microsoft.PowerShell.Commands.ConvertFromSecureStringCommand
@ pcgeek86 ์ด๊ฒ์ Linux์ ๋ณด์ ๋ฌธ์์ด์์ ์ผ๋ฐ ํ ์คํธ ๋ฌธ์์ด์ ์ป๋ ํ๋์ ์๋ฃจ์ ์ ๋๋ค.
$str = Read-Host -AsSecureString
$plaintext = [System.Net.NetworkCredential]::new('',$str).Password
์ค๋ช ์ ๋ค๋ฅธ ํด๊ฒฐ ๋ฐฉ๋ฒ์ ์ถ๊ฐํ์ต๋๋ค.
Linux์์ ๋น๋ฐ์ ๋ค๋ฃจ๋ ๊ฒ์ ๊ฝค ์๋ง์ธ ๊ฒ ๊ฐ์ต๋๋ค. ๋ง์ ๊ตฌํ ๋ ธ๋ ฅ๊ณผ ์ค๋๋ ํ๋ก์ ํธ๊ฐ ์์ต๋๋ค.
Gnome์ด Secret Service API๋ฅผ ์ฌ์ฉํ๊ฑฐ๋ ์ฌ์ฉํ๊ณ ์๋ ๊ฒ ๊ฐ์ต๋๋ค. libsecret ์ Secret Service ๋ฒ์ค๋ฅผ ์ฌ์ฉํ์ฌ ๋น๋ฐ์ ์ก์ธ์คํ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ธ ๊ฒ ๊ฐ์ต๋๋ค.
Mac OS X์์๋ security
๋ช
๋ น ์ค ์ ํธ๋ฆฌํฐ๋ฅผ ํตํด ๋๋ ํค ์ฒด์ธ ์๋น์ค ๋ฅผ ํตํด ํ๋ก๊ทธ๋๋ฐ ๋ฐฉ์์ผ๋ก ํค ์ฒด์ธ๊ณผ ์ํธ ์์ฉํ ์ ์์ต๋๋ค.
QtKeychain ์ Linux (libsecret ์ฌ์ฉ), Mac OS X (ํค ์ฒด์ธ ์ฌ์ฉ) ๋ฐ Windows (Windows Credential Store ์ฌ์ฉ)์ ๋ํ ํ๋ซํผ ๋ ๋ฆฝ์ ์ธ ์ํธ ๋ฐ ๋น๋ฐ ๊ด๋ฆฌ์๋ฅผ ์์ฑํ๋ ์ ๊ทผ ๋ฐฉ์์ด๋ฉฐ ์๋ง๋ PowerShell์ ํ์ํ ๊ฒ๊ณผ ๊ฐ์ฅ ๊ฐ๊น์ต๋๋ค. ์ด๊ฒ์ ์์์ ์ผ๋ก ์ฌ์ฉํ ์ ์์ต๋๊น?
์ด ๋ฌธ์ ๊ฐ ํด๊ฒฐ ๋ ๋๊น์ง ๋ฐฑ๊ทธ๋ผ์ด๋ ์์ ์ ์๊ฒฉ ์ฆ๋ช ์ ์์ ํ๊ฒ ์ ๋ฌํ๋ ์ฝ๋๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
$credentialKey = New-Object 'byte[]' (256/8)
$rng = New-Object 'Security.Cryptography.RNGCryptoServiceProvider'
$rng.GetBytes($credentialKey)
$serializableCredential = [pscustomobject]@{
UserName = $credential.UserName;
Password = ConvertFrom-SecureString -SecureString $credential.Password -Key $credentialKey
}
$job = Start-Job {
param(
[Parameter(Mandatory)]
[byte[]]
$Key
)
$serializedCredential = $using:serializableCredential
$password = ConvertTo-SecureString -String $serializedCredential.Password -Key $Key
$credential = New-Object 'PSCredential' ($serializedCredential.UserName,$password)
[Array]::Clear($Key,0,$Key.Length)
} -ArgumentList (,$credentialKey) | Wait-Job | Receive-Job
[Array]::Clear($credentialKey,0,$credentialKey.Length)
์ํธ = ConvertFrom-SecureString -SecureString $ credential.Password -Key $ credentialKey
์ด๊ฒ์ด ๋ฌธ์ ๊ฐ์๋ ๊ฒฝ์ฐ ์ด๋ป๊ฒ ์๋ํด์ผํฉ๋๊น?
์ด์จ๋ ์คํฌ๋ฆฝํธ๋ฅผ ์๋ํ์ง๋ง ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค.
ConvertFrom-SecureString : Cannot bind argument to parameter 'SecureString' because it is null.
At /home/myusername/powershell.ps1:7 char:99
+ ... = ConvertFrom-SecureString -SecureString $credential.Password -Key $c ...
+ ~~~~~~~~~~~~~~~~~~~~
๊ทธ๋์ ๋๋ ๋ณ์์ ์ฌ์ฉ์ ์ด๋ฆ๊ณผ ์ํธ๋ฅผ ์ ์ํ๋ ค๊ณ ํ์ง๋ง :
ConvertFrom-SecureString : Cannot bind parameter 'SecureString'. Cannot convert the "testpassword" value of type "System.String" to type "System.Security.SecureString".
psremote๋ฅผ ํตํด ๋ณด์ ๋ฌธ์์ด์ ์ ๋ฌํ๋ ๋ฐ ๋ณ๋์ ๋ฌธ์ ๊ฐ์๋ ์ด์ ๋ ๋ฌด์์
๋๊น? ์ด๋ฆฐ ๋ชจ๋ ๋ฌธ์ ๋ ์ด๊ฒ์ ์ค๋ณต์ผ๋ก ๋ง๊ฐ๋์์ต๋๋ค. ์ ์๊ฐ์๋ ๋ฌธ์ ๊ฐ ๋ค๋ฆ
๋๋ค.
Linux์์ CryptoAPI ๊ตฌํ์ด ์๊ธฐ ๋๋ฌธ์ ํค ๊ตํ ์ค์ PSRemote๊ฐ ์ค๋จ๋ฉ๋๋ค.
๊ด์ฌ์ด์๋ ์ฌ๋์ ์ฌ๊ธฐ์ ์์ต๋๋ค.
Btw, ์ฐ๋ฆฌ๋ ๋ณด์ ๋ฌธ์์ด์ด ์์ง ์ง์๋์ง ์๋๋ค๋ ๋ฉ์์ง๋ฅผ ๋ณด์ฌ์ฃผ๋ ์์ธ ์ฒ๋ฆฌ๊ธฐ๋ฅผ ์ถ๊ฐ ํ ์ ์์ต๋๋ค ^ ๊ทธ๋ ๊ฒ ๋ฉ์ถ๋ค๋ฉด ๋ณด์ ๋ฌธ์์ด๊ณผ ๊ด๋ จ์ด ์๋ค๋ ๊ฒ์ ๊นจ๋ซ๊ธฐ๊ฐ ๋งค์ฐ ์ด๋ ต์ต๋๋ค.
๋์ค์ ์ฌ์ฉํ๊ธฐ ์ํด ์ปดํจํฐ์ ํค๋ฅผ ์ ์ฅํ ํ์๊ฐ ์๊ธฐ ๋๋ฌธ์ ConvertFrom-SecureString
์ปค๋งจ๋ ๋ ์ ์์ ํ์ง ์๊ณ ๋ psremoting์ ์์ ํ ์ ์๋ค๊ณ ์๊ฐํฉ๋๋ค. rsa 2048 ํค ์์ ์์ฑํ๊ณ , rsa๋ฅผ ์ฌ์ฉํ์ฌ ์ํธํ / ๋ณตํธํํ๊ณ , AES CBC ๊ต์ฐจ ํ๋ซํผ์ ์ฌ์ฉํ์ฌ ์ํธ ํด๋
๋งํ๋ฉด๋ฉ๋๋ค.
๋ช ๊ฐ์ง ์ข์ ์์์ ํฌ๋ก์ค ํ๋ซํผ ํด๊ฒฐ ๋ฐฉ๋ฒ์
๋๋ค.
PSRemoting์ ๋ํ ํด๊ฒฐ ๋ฐฉ๋ฒ
์์ ํ ๋ฌธ์์ด ์ ์ง์ํ๋ PSRP
@KKomarov repo ๋จ๊ณ ๋ฐ ์ ์์ผ๋ก ์๋ก์ด ๋ฌธ์ ๋ฅผ์ฌ์ญ์์ค.
@KKomarov ๋ PSCore6.2-RC์์ https://github.com/PowerShell/PowerShell/issues/8723์ ์ผ๋ถ๋ก ์ด๋ฏธ ์์ ๋์์ต๋๋ค. Windows๊ฐ ์๋ ๊ฒฝ์ฐ ์ค์ ๋ก ๋ณด์ ๋ฌธ์์ด์ ๋ณด๋ด๋ ๊ธฐ๋ฅ์ ๋ณ๋์ ๋ฌธ์ ์ฌ์ผํฉ๋๋ค.
DE0001 : SecureString์ ์ฌ์ฉํ๋ฉด ์๋ฉ๋๋ค.
https://github.com/dotnet/platform-compat/blob/master/docs/DE0001.md#de0001 -securestring-shouldnt-be-used
๋ฟก ๋นต๋จ
DE0001 : SecureString์ ์ฌ์ฉํ๋ฉด ์๋ฉ๋๋ค.
https://github.com/dotnet/platform-compat/blob/master/docs/DE0001.md#de0001 -securestring-shouldnt-be-used
์ด๊ฒ์ด ์๋ฒฝํ ์์ํ ์ธ๊ณ์์๋ ์ข์ง๋ง Powershell์์๋ ์ง์์ ์ผ๋ก ์ฌ๋ฌ ๊ฐ์ง๋ฅผ ๊ฒฐํฉํ๊ณ ์์ผ๋ฉฐ ๋๋จธ์ง API, ๊ธฐ๋ณธ ์ธ์ฆ ๋ง ์ง์ํ๋ ๋ ๊ฑฐ์ ์ ํ๋ฆฌ์ผ์ด์ ๋ฑ ์ ํ๋ฆฌ์ผ์ด์ ์ ํ์ํ ํ์์ผ๋ก ์ธ์ฆํด์ผํฉ๋๋ค. ์ด ๊ถ์ฅ ์ฌํญ์ ๋ช ์๋๋๋ก ๋ชจ๋ ํญ๋ชฉ์ "Windows ์๊ฒฉ ์ฆ๋ช ๋๋ ์ธ์ฆ์ ์ฌ์ฉ"์ ์ ์ฑ์ ๊ฐ๋ฐํ๊ธฐ์ํ ์ข์ ๊ถ์ฅ ์ฌํญ์ด์ง๋ง powershell์ ์ฌ์ฉํ๋ ์ฉ๋๋ ์๋๋๋ค.
PSCredential์ด SecureString์ ๊ตฌํ ์ธ ๊ณณ์ผ๋ก๊ฐ๋ ๊ฒ๊ณผ๋ ๋ค๋ฆ ๋๋ค. ๋ฐ๋ผ์ .net ์ฝ์ด์ TPM์ ์ฌ์ฉํ์ฌ ํค ๋ฑ์ ์ํธํ ํ ์์๋ ๋ฌด์ธ๊ฐ๊ฐ์์ ๋๊น์ง "์ถฉ๋ถํ ์ข์"์ต์ ์ด ํ์ํฉ๋๋ค.
AES256์ ์ฌ์ฉํ๊ณ ์ํธํ ํค๊ฐ ๋น Windows ํ์ผ ์์คํ ์์ 600 ๊ถํ์ด ๋ถ์ฌ ๋ ํ์ผ์ด๋๋๋กํ๋ ๊ฒ๊ณผ ๊ฐ์ ๊ฒ์ Windows์์ Crypto API๋ฅผ ์ฌ์ฉํ๋ ๊ฒ๋ณด๋ค ํจ์ฌ ๋์์ง ์์ ์์์ผ ์ ์์ต๋๋ค.
์ ๋ณด ์ฉ์ผ๋ก ๋งํฌ๋ฅผ ์ถ๊ฐํ์ต๋๋ค.
๋ณธ์ง์ ์ผ๋ก :
์ด๊ธฐ์ @ PowerShell / powershell-committee๋ ๋ ๋ค ์์ ํ์ง ์๋๋ผ๋ SecureString
์ ๊ธฐ๋ฅ์ ์๊ตฌ๋ฅผ ๋์ฒดํ๊ธฐ ์ํด SensitiveString
๋์
์ ๋ํด ๋
ผ์ํ์ต๋๋ค ( SecureString
์ ํ์ ์ฌ์ ํ โโํ์ํฉ๋๋ค. ์ด์ ๋ฒ์ ๊ณผ์ ํธํ์ฑ์ ์ํด). ์ ํ ( "Sensitive"๋๋ "Secure"๊ฐ ์
๋ ฅ์ ์์ฝํ์ง ์๊ณ ํ๋กฌํํธํ๋๋ก PowerShell์ ํ์ํ๋ ๋ฐ ํ์ํ์ง ์ฌ๋ถ์ ๊ด๊ณ์์ด ์๊ฒฉ์๋ง ์ฌ์ฉ๋๋ ๊ฒ ์ด์์ผ๋ก ์ฌ์ฉ๋ฉ๋๋ค.์ด ๋ฒ๊ทธ์ ์๋ ๋ฌธ์ ๋ ์์ ๋์ง ์์์ต๋๋ค. ๋ ์ด์ ์ค๋ฅ๊ฐ ๋ฐ์ ํจ) SecureString์ด ๋ด๋ถ์ ์ผ๋ก ์ผ๋ฐ ํ
์คํธ์์ ๋ช
์ฌํ์ญ์์ค.
์
๋ฐ์ดํธ ํด์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค.
์ด๋ฅผ ํ์ฉํ ์์์ ๊ฒ์ผ๋ก ์์๋๋ ๋๋ต์ ์ธ ์๊ฐ ํ๋ ์์ ์์ฒญํ ์ ์์ต๋๊น (์ : microsoft-debian-stretch-prod ๋ฐ๋น์ ์ ์ฅ์์์)?
์ด ๋ฒ๊ทธ์ ์๋ ๋ฌธ์ ๋์ด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์์ต๋๋ค (๋ ์ด์ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ง ์์). SecureString์ด ๋ด๋ถ์ ์ผ๋ก ์ผ๋ฐ ํ ์คํธ๋ผ๋ ์ ์ ๋ช ์ฌํ์ญ์์ค.
๋๊ตฌ๋ ์ง ์์ ์ ๋ํ ๋งํฌ๊ฐ ์๊ฑฐ๋ ์ด๋ค ๋ฆด๋ฆฌ์ค ๋ฒ์ ์์ ์ฌ์ฉํ ์ ์๋์ง ์๊ณ ์์ต๋๊น? powershell_6.1.3-1.ubuntu.16.04_amd64.deb์์ ์ฌ์ ํ crypt32.dll ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค (6.2.0-rc.1 ๋ฏธ๋ฆฌ๋ณด๊ธฐ ํจํค์ง์ ๋์ผํ ๊ฑฐ๋).
๋ํ ์ง๋ ฌํ ํ ๋ฐ์ดํฐ์ SecureString ๋๋ PSCredential ๊ฐ์ฒด๊ฐ ํฌํจ๋์ด์์ ๋์ด ์์ ์ด Import / Export-CliXml์ ์ด๋ค ์ํฅ์ ๋ฏธ์น๋์ง ๊ถ๊ธํฉ๋๋ค.
@rmbolger ์ต์ ๋น๋ (6.2.0-RC)๋ก ํ์ธํด ์ฃผ์๊ฒ ์ต๋๊น?
@rmbolger ์ ๋๊ฐ์ ๊ฒ์๋ณด๊ณ ์์ต๋๋ค.
/home/hillr
03-20 23:44:55 31ms 11> $PSVersionTable
Name Value
---- -----
PSVersion 6.2.0-rc.1
PSEdition Core
GitCommitId 6.2.0-rc.1
OS Linux 4.4.0-17763-Microsoft #379-Microsoft Wed Mar 06 19:16:00 PST 2019
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0โฆ}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
/home/hillr
03-21 00:47:45 35ms 12> ConvertFrom-SecureString -SecureString $ss
ConvertFrom-SecureString : Unable to load shared library 'CRYPT32.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libCRYPT32.dll: cannot open shared object file: No such file or directory
At line:1 char:1
+ ConvertFrom-SecureString -SecureString $ss
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [ConvertFrom-SecureString], DllNotFoundException
+ FullyQualifiedErrorId : System.DllNotFoundException,Microsoft.PowerShell.Commands.ConvertFromSecureStringCommand
cmdlet์ CRYPT32.dll์ ์ง์ ๋ก๋ํฉ๋๋ค.
https://github.com/PowerShell/PowerShell/blob/8763c0b1d11ce3ee8639e9386383f158976490e0/src/Microsoft.PowerShell.Security/security/SecureStringCommands.cs#L169
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
ํต์ฌ์ .NET ํ๋ ์ ์ํฌ (๋ฐ PowerShell)์ ํฌ๋ก์ค ํ๋ซํผ ๋ฐ์ดํฐ ๋ณดํธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ํ์ํ๋ค๋ ๊ฒ์ ๋๋ค. ์๋ํ๋ฉด ๊ฐ๋ฐ / ์ด์์ด ๋น๋ฐ์ ์ ์ฅํด์ผํ๋ ์ด์ ๋ ์ฐ๋ฆฌ๊ฐ ์๋ก์ด OS๋ฅผ ๋ฏน์ค์ ์ถ๊ฐํ์ ๋ ๊ฐ์๊ธฐ ์ฌ๋ผ์ง์ง ์์๊ณ ํญ์ ์ค์ฉ์ ์ด์ง ์๊ธฐ ๋๋ฌธ์ ๋๋ค. Azure KeyVault, RED ID ๊ด๋ฆฌ ๋๋ Thycotic Secret Server์ ๊ฐ์ ์น ์๋น์ค์ ์์กดํฉ๋๋ค. ๐
.NET ํ์ ์ฌ๊ธฐ์์ ํน๋ณํ ๋์์ด๋์ง ์๋ ๊ฒ ๊ฐ์ต๋๋ค.
ASP.NET์ด ์์ฒด DataProtection ํญ๋ชฉ์ ์์ฑํ์์ ์๊ณ ์์ง๋ง ์๋นํ ์ด์ํ๊ณ ํน์ ์๋๋ฆฌ์ค๋ก ์ฌ์ฉ์ ์ ํํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
์ฐ๋ฆฌ๊ฐ ์์์ผ ํ ๊ฒ์ :
PowerShell ํ์ SecureString ์ง๋ ฌํ์ ํฌ๋ก์ค ํ๋ซํผ ๊ตฌํ์ ๋ง๋ค ๊ณํ์ ๋๊น?
๊ทธ๋ ์ง ์์ ๊ฒฝ์ฐ ์ ํ ์๋ํ์ง ์๋ cmdlet์ ์ ๊ฑฐํ๊ณ CliXML์ ๋ํด ํ์ฌ "์ฌ์ฉ ๊ฐ๋ฅํ Crypto dll ๋ง ์๋ค๋ฉด"์ค๋ฅ๋ณด๋ค ๋ ๋์ ์ค๋ฅ ๋ฉ์์ง๋ฅผ ์ ๊ณตํ์ญ์์ค.