Passer au contenu principal
  • Passer des commandes rapidement et facilement
  • Afficher les commandes et suivre l’état de votre expédition
  • Profitez de récompenses et de remises réservées aux membres
  • Créez et accédez à une liste de vos produits
  • Gérer vos sites, vos produits et vos contacts au niveau des produits Dell EMC à l’aide de la rubrique Gestion des informations de l’entreprise.

Dell Command PowerShell Providerセキュア パスワード機能

Résumé: Dell Command |PowerShell Provider Secure Password機能、ConvertTo-SecureString、ConvertFrom-SecureString

Cet article a peut-être été traduit automatiquement. Si vous avez des commentaires concernant sa qualité, veuillez nous en informer en utilisant le formulaire au bas de cette page.

Contenu de l’article


Symptômes

対象製品:

  • Dell Command | PowerShell Provider

Cause

-

Résolution

安全なパスワードの背後にある概念は、本番スクリプトでは、重要なパスワードをプレーン ビューとして渡してはならないということです。これは深刻なセキュリティの欠如です。PowerShellを使用すると、パスワードを保護するか、少なくともパスワードの可視性を減らすことができます。まず、セキュア文字列の一般的な側面について説明してから、Dell Command PowerShell Provider(DCPP)がPowerShellの本質的な機能を活用してパスワードを保護する方法について説明します。

コンソールでユーザー名とパスワードをユーザーから読み取りたいとします。ユーザー名は一般的にセキュリティを必要とせず、すべてのユーザーに表示できることを認識しています。しかし、パスワードについては、ユーザーのパスワードを知らせるべきではありません。次のコマンドを使用して、この要件を容易にすることができます。

$user = Read-Host "Enter Username"

$pass = Read-Host "Enter Password" -AsSecureString

上記は、パスワードなどの重要な情報を保護する必要がある場合に、セキュリティを強化する方法の概要です。上記の例では、$pass変数は タイプ System.Security.SecureStringです。DcPPの側面に触れる前に、PowerShellが提供する他の2つの広く使用されているコマンドレットを紹介します。

2つのコマンドは と ConvertTo-SecureStringConvertFrom-SecureStringです。ConvertTo-SecureString プレーン テキストをタイプ System.Security.SecureStringに変換します。以下に例を示します。

"P@ssword1" | ConvertTo-SecureString -AsPlainText -Force

上の例では、プレーン テキスト P@assword1 がタイプ System.Security.SecureStringに変換されています。これは多くの情報であり、広く使用されている場合と使用されていない場合があります。

次のコマンドレット ConvertFrom-SecureString は、セキュアな文字列を暗号化された標準文字列に変換するために使用される、より広く使用されているコマンドレットです。の ConvertTo-SecureString 主な制限事項は、出力を将来使用するためにファイルに直接書き込むことができないことです。この制限を ConvertFrom-SecureString 克服するために、ファイルに簡単に保存できる暗号化された標準文字列に変換 System.Security.SecureString する必要があります。

プレーン テキスト P@ssword1 を安全な文字列に変換し、出力をパイプ処理して ConvertFrom-SecureString 暗号化された文字列を取得します。これにより、安全かつ便利にファイルに保存できます。

例として、管理者パスワードが設定されていて、これをファイルに保存する必要がある場合は、コンピューターでとします。これを行うには、次の手順を実行します。

Read-Host "Enter Admin Password" -AsSecureString |
ConvertFrom-SecureString | Out-File "C:\Scripts\AdminPassword.txt"

次のように、この管理者パスワードを安全なオブジェクトとして変数に戻すことができます。

$pass = Get-Content "C:\Scripts\AdminPassword.txt" | ConvertTo-SecureString

次に、DCPPの安全なパスワードを活用する方法を検討します。DCPPでは、ユーザーのコンピューターにシステムパスワードまたは管理者パスワードが設定されている場合、すべての set コマンドに対してそれぞれのパスワードを渡す必要があります。このパスワードを平文として入力すると、セキュリティが侵害されます。そのため、パスワードを「 .」と System.Security.SecureString入力する必要があります。また、パスワードをSecureString渡すときは、通常–Passwordのスイッチではなく、スイッチでパスワードを-PasswordSecure渡す必要があります。次の例は、ユーザーがパスワードをに設定AdvancedBatteryChargeCfgして渡SecureStringそうとしている場合ですDisabled

Set-item AdvancedBatteryChargeCfg disabled –PasswordSecure $pass

ここでは、$passはシステムパスワードと管理者パスワードを保持しており、タイプ System.Security.SecureStringは です。上記のディスカッションと同様に、次のように読 $pass むことができます。

$pass = Read-Host "Enter system/admin password" –AsSecureString

必要に応じて、次のようにファイルに保存 $pass できます。

$pass| ConvertFrom-SecureString | Out-File "C:\Scripts\AdminPassword.txt

Informations supplémentaires

Propriétés de l’article


Produit concerné

Dell Command | Powershell Provider

Dernière date de publication

11 sept. 2023

Version

7

Type d’article

Solution