WordPressのセキュリティキーとソルトについてさらに詳しく知りたいですか?
WordPressは、ハッキングの試みからサイトを保護するためにセキュリティキーを使用します。WordPressのセキュリティを向上させるために、これらをより効率的に使用することができます。
この投稿では、WordPressのセキュリティ・キーとソルトとは何か、そしてなぜそれらを使うべきなのかについて説明します。
WordPressのセキュリティキーとSALTとは何ですか?
WordPressのセキュリティキーは、ログイン情報を解読しにくくすることで保護する暗号化ツールです。
これらのキーは実際のキーと同じように動作し、パスワードなどの暗号化された情報をロックしたり解除したりするために使用され、WordPressサイトを安全に保ちます。
仕組みはこうだ。
基本的に、WordPressサイトにログインすると、あなたのコンピューターにあなたの情報がCookieに保存されます。これにより、ページを読み込むたびにログインする必要がなく、サイトでの作業を続けることができます。
情報はすべて、英数字と特殊文字の文字列に変換され、暗号化されて保存される。
この暗号化されたデータは、WordPressのセキュリティキーを使って翻訳することができる。キーがなければ、このデータを解読することはほぼ不可能です。
これらのセキュリティキーはWordPressサイトによって自動的に生成され、WordPressの設定ファイル(wp-config.php)に保存されます。
セキュリティーキーは全部で4つある:
- AUTH_KEY
- セキュア認証キー
- ログインキー
- ノンスキー
WordPressのセキュリティキーの他に、以下のSALTもあります。
- AUTH_SALT
- secure_auth_salt
- ログイン済みソルト
- ノンス・ソルト
ソルトは暗号化された情報に余分な情報を追加し、暗号化されたデータに別のセキュリティ層を提供します。
なぜWordPressのセキュリティキーを使うのか?
WordPressのセキュリティキーは、パスワードを安全にすることで、ハッキングの試みからサイトを保護します。
例えば、中程度の難易度の通常のパスワードは、ブルートフォースアタックを使えば簡単に解読できる。
一方、「7C17bd5b44d6c9c37c01468b20d89c35e576914c289f98685941accddf67bf32b49」のようなパスワード文字列は、セキュリティキーを知らずに解読するには何年もかかる。
そのため、WordPressのセキュリティ・キーは決して誰とも共有せず、オンライン上の機密情報を保護するのと同じように保護する必要があります。
とはいえ、WordPressサイトを保護するためのWordPressセキュリティキーの使い方を見てみましょう。
WordPressセキュリティキーの使い方
ほとんどの場合、WordPressは自動的にセキュリティ・キーとソルトを生成し、WordPressを新規インストールするたびに使用するので、通常は何もする必要はありません。
FTPクライアントまたはWordPressホスティングアカウントのコントロールパネルのファイルマネージャーアプリを使用して、WordPressのセキュリティキーとソルトを表示できます。
サイトに接続し、wp-config.phpファイルを開きます。その中に、WordPressのセキュリティ・キーが定義されています。
しかし、WordPressの初期インストール方法によっては、サイトにセキュリティキーがすべて定義されていない場合があります。
セキュリティ・キーが空っぽでも心配はいりません。WordPress セキュリティ・キー・ジェネレータのページで新しいキーを生成し、手動で追加することができます。
次に、これらのキーをコピー&ペーストして、wp-config.phpファイル内に貼り付ければ完了です。
同じ方法で、現在のWordPressセキュリティキーを削除し、新しいキーに置き換えることができます。
注:セキュリティーキーを交換すると、すべてのユーザーが再ログインを余儀なくされます。
プラグインを使ってWordPressのセキュリティキーを再生成する
サイトがハッキングされた疑いがある場合は、WordPressのセキュリティキーを再生成し、パスワードを変更する必要があります。
上記のように、新しいセキュリティキーを手動でコピー&ペーストすることができます。しかし、もっと簡単な方法はプラグインを使うことだ。この方法なら、定期的にセキュリティ・キーを自動的に再生成するスケジュールを設定することもできる。
1.Sucuriを使用してWordPressセキュリティキーを更新する。
Sucuriを使用してWordPressセキュリティキーを自動的に再生成する最も簡単な方法です。これは、一般的な脅威からWordPressサイトを保護する市場で最高のWordPressセキュリティプラグインの一つです。
Sucuri Securityプラグインをインストールして有効化するだけです。詳しくは、WordPressプラグインのインストール方法のステップバイステップガイドをご覧ください。
有効化したら、Sucuri Security ” Settingsページにアクセスし、Post-Hack タブに切り替える必要があります。
ここから、「シークレットキーの更新」セクションの下にある「新規セキュリティキーのジェネレータ」ボタンをクリックするだけです。
注:新規セキュリティキーを生成すると、WordPress管理エリアからログアウトしますので、再度ログインする必要があります。
その後、SucuriSecurity ” Settingsページを再度表示し、Post-Hack タブに切り替えてください。
セキュリティキーのセクションで、頻度(毎日、毎週、毎月、毎年)を選択して、シークレットキーの自動更新を有効化します。その後、送信ボタンをクリックします。
Sucuriは、選択した頻度に基づいてWordPressセキュリティキーを自動的にリセットします。
2.Salt Shakerを使ってWordPressのセキュリティキーを更新する
この方法は、Sucuriを使用しておらず、セキュリティキーの再生を自動化する必要があるユーザー向けです。
まず、Salt Shakerプラグインをインストールして有効化する必要があります。詳しくはWordPressプラグインのインストール方法をご覧ください。
有効化した後、ツール ” ソルトシェイカーのページでプラグインの設定を行う必要があります。
ここから、セキュリティ・キーを自動的に生成するスケジュールを設定できます。また、「今すぐ変更」ボタンをクリックするだけで、すぐにセキュリティ・キーを再生成することもできます。
この投稿がWordPressセキュリティキーとは何か、そしてその使い方を理解する一助となれば幸いです。また、WordPress のよくあるエラーの修正方法や、専門家が選んだあなたのサイトに必須の WordPress プラグインもご覧ください。
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Syed Balkhi says
Hey WPBeginner readers,
Did you know you can win exciting prizes by commenting on WPBeginner?
Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
You can get more details about the contest from here.
Start sharing your thoughts below to stand a chance to win!
Mrteesurez says
I am just hearing ‘SALT’ here in this post, what’s the difference between SALT and KEY ?
Can I just update those keys even if I didn’t suspect any hack attempt ?
If yes, when often should it be changed ?? Thanks.
WPBeginner Support says
It depends on your personal preference but they can be as changed as often as weekly or once a quarter depending on how much you would like to focus on changing them.
管理者
Jiří Vaněk says
Regarding security keys, I encountered an issue when migrating the website to a new database. Even after changing the connection in the wp-config.php file, WordPress refused to connect to the new DB, reporting an ‘establishing error.’ Eventually, I had to delete the old wp-config.php, upload a new one from the installation package, re-enter the connection to the new database, and then everything worked fine. It seems that the keys in the wp-config.php file were the culprit.
Josh says
How often do you recommend changing the keys? Quarterly as shown in the screenshot?
WPBeginner Support says
We do not have a specific recommended refresh time at the moment other than after a hack on your site at a minimum.
管理者
Bjornen Nilsson says
Hi,
QUESTION »
Will it affect anything besides “extreme” increased security if one has the web browser set to delete all history, temp, cookies etc. every time it is shut down AND if one changes the SALT in wp-config after logging out each time?
Thanks!
shanderman says
Hi,
I have 2 url product,for 1 product.like this:
example.com/?product=product-name
example.com/product/product-name/
why? how should i fix it? please help me.
WPBeginner Support says
Hi shanderman,
Please visit Settings » Permalinks page to make sure that your WordPress site is using SEO friendly URLs.
After that view your website’s source code and make sure that it is showing the URL format that you like.
The ugly URL structure will still work in WordPress if you typed it in the browser. However, your product’s canonical URL will be the one you choose on the permalinks settings page. This is the URLs that search engines will follow and index.
管理者
sam says
I am a beginner to WordPress , i have a doubt how those keys make the WordPress secure ? i want to know the actual role and working of the keys ?
Kishan Dalsania says
What is the actual benefit of these using the keys in config.php. Can you define how it will work to prevent the hackers?
sam says
Hi , i have used this method and can not log onto my site at all. how do i fix it or remove the issues
WPBeginner Support says
Please take a look at our tutorial on what to do when you are locked out of WordPress admin area.
管理者
kOoLiNuS says
Just a quick question… Why do you suggest to:
Instead of the latter? Have you got some links that dig this approach?
Thank you in advance!
Nick says
In wordpress 3.1 these keys are automatically generated.
MichealKennedy says
Was just gonna ask “why don’t they just automatically generate these for you?” but you answered it
Riese F says
Appreciate this information and quickly updated my files. My concern is the same as Ricks’ from April in that if my wp-config.php file is hacked then these keys are available to whomever is looking at them correct? But then I thought that if my wp file is hacked and someone other than me is looking at them I am already in trouble…
Any precaution is better than just hoping for the best though! Thank you for your work and efforts.
Keith Davis says
Hi
Thanks for a short and informative post.
I notice that in your example there are four secret keys.
There appear to be more secret keys in WordPress 3.0 – can these be added to previous versions of WordPress?
Editorial Staff says
Those keys become available with WordPress 3.0
管理者
Dave says
You’ll need to use 3.0 to utilise all eight secret keys, rather than the former four. The new WordPress random key generator can be found at https://api.wordpress.org/secret-key/1.1/salt
Rick says
Um, so does this change your admin password or what? I don’t understand what this does? Maybe that’s because I’m not a hacker. But, if this is just stored in your config.php file, wouldn’t it be way easier for a hacker just to hack into your ftp site and nab this security key out of the config file?
I want my WordPress sites to be more secure, but I just don’t understand what this is preventing?
Jack says
Nicely said. The directions are pretty easy, but I think the security and safety is understated in the documentation. Thanks for spelling it out and making the web a safer place.
gabrielle says
if you develop multiple wordpress sites do you create a security key for each one or use the same one on all of them?
Editorial Staff says
Use a new one
管理者
Konstantin says
While you’re adt it:
Why not define the salt constants and save yourself some database queries?!
It should look like this:
define('AUTH_SALT', 'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT', 'put your unique phrase here');
define('NONCE_SALT', 'put your unique phrase here');
This article from Digging into WordPress explains the advantages of this practice.
Tony says
Thanks for sharing!
Editorial Staff says
Good idea, didn’t even think of that.
管理者
maged says
very handy and important thanks for sharing