「パスワードSALT」の版間の差分

提供:MoodleDocs
移動先:案内検索
編集の要約なし
52行目: 52行目:
==別のサイトからユーザをインポートする==
==別のサイトからユーザをインポートする==


If you import users from another Moodle site which uses a password salt, you need to add the other site's salt to config.php too. Upto 20 alternate salts may be added
パスワードSALTを使用している別のMoodleサイトからユーザをインポートする場合、あなたは、config.phpに別のサイトのSALTも追加する必要があります。以下のように最大20のSALTを追加することができます。


  $CFG->passwordsaltalt1, $CFG->passwordsaltalt2, ...  $CFG->passwordsaltalt20
  $CFG->passwordsaltalt1, $CFG->passwordsaltalt2, ...  $CFG->passwordsaltalt20

2009年11月26日 (木) 00:29時点における版

作成中です - Mitsuhiro Yoshida 2009年11月25日 (水) 06:06 (UTC)

パスワードSALTとは?

パスワードは、md5 hashと呼ばれる、暗号化された形でMoodle内に保存されます。

パスワードSALTは、md5ハッシュが計算される前、パスワードにランダム文字列を追加して、さらにパスワードを安全にする手法です。パスワードSLATにより、パスワードの推測がさらに難しくなります (ランダム文字列を大きくするほど、推測の困難さが増します)。

パスワードSALTを有効にする

パスワードSALTを設定するには、あなたのconfig.phpファイルに次の行を追加してください:

$CFG->passwordsaltmain = 'ここにランダムな半角文字列を記述してください';

ランダム文字列は、数字および他の文字を混ぜた形で記述してください。適切な長いランダム文字列を取得するため、Moodle Salt Generatorを使用することができます。ストリング長は、少なくとも40文字を推奨します。

注意: セキュリティ上の理由から、config.phpの修正が、パスワードSALTを有効にできる唯一の方法です - Moodleインターフェースにより編集することはできません。

SALTを変更する

どのような理由であれ、あなたがSALTを変更したい場合、新しいSALTと共に、config.php内に古いSALTを保持する必要があります。

以下のように、古いSALT passwordsaltmainpasswordsaltalt1 に変更します (厳密表現を使用する必要があることに留意してください):

$CFG->passwordsaltalt1 = '古いランダム文字列';
$CFG->passwordsaltmain = '新しいランダム文字列';

あなたが将来的に再度SALTを変更する場合、しばらくの間 (すべてのユーザが少なくとも1回ログインして、新しいSALTを使用するようになるまで)、前のSALTを保持する必要があります。前のSALTを20個を保持するため、あなたは、$CFG->passwordsaltalt2、$CFG->passwordsaltalt3 等を使用することができます。

警告: あなたがSALTを変更して、古いSALTをconfig.phpに保持しない場合、あなたのサイトにログインできないようになります!

SALTを無効にする

注意: 推奨できません! パスワードSALTを一旦有効にした場合、パスワードSALTを有効のままにしてください。

パスワードSALTを無効にするには、あなたは、passwordsaltmainの値を削除、コメントアウトまたは空にすることができます。

// 例: 空の文字列を設定
$CFG->passwordsaltmain = '';


// EXAMPLE: コメントアウト
/*
$CFG->passwordsaltmain = '';
*/

しかし、あなたはこれで完了したわけではありません! あなたは、前述の「SALTを変更する」ように、古いSALTを代替値 (alt value) として、移動する必要があります:

$CFG->passwordsaltalt1 = '古いランダムストリング';
$CFG->passwordsaltmain = '';

別のサイトからユーザをインポートする

パスワードSALTを使用している別のMoodleサイトからユーザをインポートする場合、あなたは、config.phpに別のサイトのSALTも追加する必要があります。以下のように最大20のSALTを追加することができます。

$CFG->passwordsaltalt1, $CFG->passwordsaltalt2, ...  $CFG->passwordsaltalt20

パスワードSALTは、どのように動作しますか?

When a password is checked, the code looks for CFG->passwordsaltmain. If set, it appends the user's password to the salt before calculating the md5 hash.

If the unsalted md5 hash of a user's password validates, it is assumed that the salt was set for the first time since the last time the user logged in. The user's password is upgraded, using the salt. The password is salted during the first login after the salt was set in config.php.

If neither the unsalted md5 hash, or the salted md5 hash validates, the code looks for up to 20 alternate salts.

If you change salts, in order not to orphan existing user accounts, you must enter the old salt into one of the alternate slots.

When a user who has an "old salt" password logs in, the first test of their authentication with the new salt will fail... then the code will test any alternate salts, looking for one that allows the password to be proven valid.

If a user is deemed valid, the system will upgrade the user's hashed password to the latest salt.