新聞中心
怎么實現(xiàn) wordpress個人博客 讓別人進去輸入我的域名的時候 要密碼驗證才能進去呢
一。研究wordpress時wordpess的密碼密碼生成與登錄密碼驗證方式很重要
郊區(qū)網(wǎng)站建設(shè)公司成都創(chuàng)新互聯(lián)公司,郊區(qū)網(wǎng)站設(shè)計制作,有大型網(wǎng)站制作公司豐富經(jīng)驗。已為郊區(qū)上千提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設(shè)要多少錢,請找那個售后服務(wù)好的郊區(qū)做網(wǎng)站的公司定做!
WordPress密碼已成為整合的首要目標(biāo),如何征服整合,就得了解WordPress密碼算法。
WordPress系統(tǒng)的用戶密碼是保存在wp_users數(shù)據(jù)表的user_pass字段,密碼是通過Portable PHP password hashing framework類產(chǎn)生的,密碼的形式是隨機且不可逆,同一個明文的密碼在不同時間,產(chǎn)生的密文也不一樣,相對來說較為安全。
二。密碼生成方式
隨機產(chǎn)生一個salt 并將salt和password相加
進行了count次md5 然后和encode64的hash數(shù)值累加
最后得到一個以$P$開頭的密碼,這個密碼每次產(chǎn)生的結(jié)果都不一樣
以下為在wordpress中調(diào)用密碼生成的代碼
[php] view plain copy print?
?php
$password = 'abc';
global $wp_hasher;
if ( empty($wp_hasher) ) {
require_once( './wp-includes/class-phpass.php');
$wp_hasher = new PasswordHash(8, TRUE);
}
echo $wp_hasher-HashPassword($password);
?
三。wordpress密碼生成與登錄驗證
wordpress中位置為\wp-includes\class-phpass.php
以下是wordpress中生成密碼的代碼直接運行可查看密碼的生成以及驗證過程
[php] view plain copy print?
?php
class PasswordHash {
var $itoa64;
var $iteration_count_log2;
var $portable_hashes;
var $random_state;
function PasswordHash($iteration_count_log2, $portable_hashes)
{
$this-itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
if ($iteration_count_log2 4 || $iteration_count_log2 31)
$iteration_count_log2 = 8;
$this-iteration_count_log2 = $iteration_count_log2;
$this-portable_hashes = $portable_hashes;
$this-random_state = microtime() . uniqid(rand(), TRUE); // removed getmypid() for compability reasons
}
function get_random_bytes($count)
{
$output = '';
if ( @is_readable('/dev/urandom')
($fh = @fopen('/dev/urandom', 'rb'))) {
$output = fread($fh, $count);
fclose($fh);
}
if (strlen($output) $count) {
$output = '';
for ($i = 0; $i $count; $i += 16) {
$this-random_state =
md5(microtime() . $this-random_state);
$output .=
pack('H*', md5($this-random_state));
}
$output = substr($output, 0, $count);
}
return $output;
}
function encode64($input, $count)
{
$output = '';
$i = 0;
do {
$value = ord($input[$i++]);
$output .= $this-itoa64[$value 0x3f];
if ($i $count)
$value |= ord($input[$i]) 8;
$output .= $this-itoa64[($value 6) 0x3f];
if ($i++ = $count)
break;
if ($i $count)
$value |= ord($input[$i]) 16;
$output .= $this-itoa64[($value 12) 0x3f];
if ($i++ = $count)
break;
$output .= $this-itoa64[($value 18) 0x3f];
} while ($i $count);
return $output;
}
function gensalt_private($input)
{
$output = '$PXXXXX;
$output .= $this-itoa64[min($this-iteration_count_log2 +
((PHP_VERSION = '5') ? 5 : 3), 30)];
$output .= $this-encode64($input, 6);
return $output;
}
function crypt_private($password, $setting)
{
$output = '*0';
if (substr($setting, 0, 2) == $output)
$output = '*1';
$id = substr($setting, 0, 3);
# We use "$P{1}quot;, phpBB3 uses "$H{1}quot; for the same thing
if ($id != '$PXXXXX $id != '$HXXXXX)
return $output;
$count_log2 = strpos($this-itoa64, $setting[3]);
if ($count_log2 7 || $count_log2 30)
return $output;
$count = 1 $count_log2;
$salt = substr($setting, 4, 8);
if (strlen($salt) != 8)
return $output;
# We're kind of forced to use MD5 here since it's the only
# cryptographic primitive available in all versions of PHP
# currently in use. To implement our own low-level crypto
# in PHP would result in much worse performance and
# consequently in lower iteration counts and hashes that are
# quicker to crack (by non-PHP code).
if (PHP_VERSION = '5') {
$hash = md5($salt . $password, TRUE);
do {
$hash = md5($hash . $password, TRUE);
} while (--$count);
} else {
$hash = pack('H*', md5($salt . $password));
do {
$hash = pack('H*', md5($hash . $password));
} while (--$count);
}
$output = substr($setting, 0, 12);
$output .= $this-encode64($hash, 16);
return $output;
}
function gensalt_extended($input)
{
$count_log2 = min($this-iteration_count_log2 + 8, 24);
# This should be odd to not reveal weak DES keys, and the
# maximum valid value is (2**24 - 1) which is odd anyway.
$count = (1 $count_log2) - 1;
$output = '_';
$output .= $this-itoa64[$count 0x3f];
$output .= $this-itoa64[($count 6) 0x3f];
$output .= $this-itoa64[($count 12) 0x3f];
$output .= $this-itoa64[($count 18) 0x3f];
$output .= $this-encode64($input, 3);
return $output;
}
function gensalt_blowfish($input)
{
# This one needs to use a different order of characters and a
# different encoding scheme from the one in encode64() above.
# We care because the last character in our encoded string will
# only represent 2 bits. While two known implementations of
# bcrypt will happily accept and correct a salt string which
# has the 4 unused bits set to non-zero, we do not want to take
# chances and we also do not want to waste an additional byte
# of entropy.
$itoa64 = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
$output = '$2aXXXXX;
$output .= chr(ord('0') + $this-iteration_count_log2 / 10);
$output .= chr(ord('0') + $this-iteration_count_log2 % 10);
$output .= 'XXXXX;
$i = 0;
do {
$c1 = ord($input[$i++]);
$output .= $itoa64[$c1 2];
$c1 = ($c1 0x03) 4;
if ($i = 16) {
$output .= $itoa64[$c1];
break;
}
$c2 = ord($input[$i++]);
$c1 |= $c2 4;
$output .= $itoa64[$c1];
$c1 = ($c2 0x0f) 2;
$c2 = ord($input[$i++]);
$c1 |= $c2 6;
$output .= $itoa64[$c1];
$output .= $itoa64[$c2 0x3f];
} while (1);
return $output;
}
function HashPassword($password)
{
$random = '';
if (CRYPT_BLOWFISH == 1 !$this-portable_hashes) {
$random = $this-get_random_bytes(16);
$hash =
crypt($password, $this-gensalt_blowfish($random));
if (strlen($hash) == 60)
return $hash;
}
if (CRYPT_EXT_DES == 1 !$this-portable_hashes) {
if (strlen($random) 3)
$random = $this-get_random_bytes(3);
$hash =
crypt($password, $this-gensalt_extended($random));
if (strlen($hash) == 20)
return $hash;
}
if (strlen($random) 6)
$random = $this-get_random_bytes(6);
$hash =
$this-crypt_private($password,
$this-gensalt_private($random));
if (strlen($hash) == 34)
return $hash;
# Returning '*' on error is safe here, but would _not_ be safe
# in a crypt(3)-like function used _both_ for generating new
# hashes and for validating passwords against existing hashes.
return '*';
}
function CheckPassword($password, $stored_hash)
{
$hash = $this-crypt_private($password, $stored_hash);
if ($hash[0] == '*')
$hash = crypt($password, $stored_hash);
return $hash == $stored_hash;
}
}
//原始密碼
$passwordValue = "123456";
//生成密碼
$wp_hasher = new PasswordHash(8, TRUE);
$sigPassword = $wp_hasher-HashPassword($passwordValue);
echo "生成的密碼為:".$sigPassword;
echo "\n";
//驗證密碼
$data = $wp_hasher-CheckPassword($passwordValue,$sigPassword);
if($data){
echo '密碼正確';
}else{
echo '密碼錯誤';
}
?
此為一個wordpres密碼生成與登錄驗證實例,其中HashPassword為生成密碼,CheckPassword為驗證密碼
itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; 為以上提到的生成salt的基礎(chǔ)字符串。
備注:由于csdn代碼顯示插件對特殊字符的限制。 請將以上代碼中 XXXXX替換為 $' 注意有單引號,代碼中一共有5處
wordpress注冊表單的驗證問題
我的是前后臺都驗證了,這個很簡單,首先前臺驗證,直接在那個頁面寫js……
后臺驗證:在注冊后的提交頁面上用php寫判斷……搞定……
為了安全建議前后臺都得驗證……
wordpress怎么添加百度聯(lián)盟驗證要放在那里?
有二個方式添加驗證碼:
上傳文件驗證:
修改首頁驗證:
做完上一步后,在瀏覽器輸入“域名/bdunion.txt”(如),可以看到百度分配的ID號,說明上一步的驗證正確無誤。
wordpress那個認(rèn)證怎么改
越來越多的網(wǎng)站支持添加二步認(rèn)證Two-Factor Authentication以提高安全性,在國內(nèi)更多是以賬號密碼+短信碼的方式,但海外網(wǎng)站可能更多采用二步認(rèn)證的方式。
如果你覺得有必要為你的WordPress網(wǎng)站開啟二步認(rèn)證,則可以繼續(xù)閱讀本教程,了解如何使用Google Authenticator或者SMS短信驗證碼為WordPress添加Two-Factor Authentication。
為什么要為WordPress登錄添加二步驗證?
黑客使用的最常見的技巧之一稱為暴力攻擊。通過使用自動化腳本,黑客會嘗試猜測正確的用戶名和密碼以攻入WordPress 網(wǎng)站。
如果他們竊取了密碼或準(zhǔn)確猜到了密碼,則他們可能會用惡意軟件感染您的網(wǎng)站,比如掛馬、加密數(shù)據(jù)要挾。
保護WordPress網(wǎng)站免遭密碼被盜的最簡單方法之一是添加二步認(rèn)證。這樣,即使有人竊取了密碼,他們無法跳過使用手機輸入安全代碼才能訪問的步驟。
有多種方法設(shè)置WordPress二步認(rèn)證登錄。但是,最安全、最簡單的方法是使用身份驗證器應(yīng)用程序。
方法 1. 使用WP 2FA插件添加二步認(rèn)證(更簡單的方法)
方法 2. 使用Two Factor插件添加二步認(rèn)證
方法 1. 使用WP 2FA插件添加二步認(rèn)證
這種方法最為簡單,推薦大家首選此方法。這個方法很靈活,允許您對所有用戶強制執(zhí)行二步身份驗證。
首先,您需要安裝并啟用WP 2FA – Two-factor Authentication插件。
啟用后,您需要訪問用戶?您的個人資料頁面并向下滾動到“WP 2FA Settings”部分。
點擊“Configure Two-factor authentication (2FA)”按鈕以啟動設(shè)置向?qū)А?/p>
插件將要求您選擇一種身份驗證方法:
使用您選擇的應(yīng)用程序生成的One-time code(推薦)
通過電子郵件發(fā)送給您的One-time code
建議您選擇app方式認(rèn)證,更安全可靠。然后單擊下一步按鈕繼續(xù)。
該插件將向您展示一個二維碼,您需要使用身份驗證器應(yīng)用(authenticator app)掃描該二維碼。
什么是身份驗證器應(yīng)用(Authenticator App)?
身份驗證器應(yīng)用是一種智能手機應(yīng)用程序,可為您保存在其中的帳戶生成一個臨時的一次性密碼。
基本上,應(yīng)用和您的服務(wù)器使用密鑰來加密信息并生成一次性代碼,您可以將其用作第二層保護。
有很多這樣的應(yīng)用可以免費使用。
最受歡迎的是Google Authenticator,但它并不是最好的。雖然它工作得很好,但它不提供可以在手機丟失時使用的備份。
我們建議使用Authy,因為它是一個易于使用且免費的應(yīng)用程序,該應(yīng)用還允許您以加密格式將您的帳戶保存在云中。這樣,如果您丟失了手機,則只需輸入主密碼即可恢復(fù)所有帳戶。
其他密碼管理器(如LastPass、1password等)都帶有自己的身份驗證器版本,它們都比Google身份驗證器要好用得多,因為它們支持恢復(fù)密鑰。
在本教程中,我們將使用Authy作為示例。
首先,單擊身份驗證器應(yīng)用程序中的添加帳戶按鈕:
然后,該應(yīng)用程序?qū)⒄埱笤L問您手機上的相機的權(quán)限。您需要允許此權(quán)限,以便您可以掃描插件設(shè)置頁面上顯示的二維碼。
身份驗證器應(yīng)用現(xiàn)在將保存您的網(wǎng)站帳戶,并開始顯示可用于登錄的一次性密碼。
在插件的設(shè)置向?qū)е校瑔螕簟癐’m Ready”按鈕繼續(xù)。
該插件現(xiàn)在會要求您驗證一次性密碼。只需在身份驗證器應(yīng)用中單擊您的帳戶,它就會顯示一個六位數(shù)的一次性密碼,輸入該密碼。
之后,該插件將為您提供生成和保存?zhèn)浞荽a的選項。如果您無法使用手機,則可以使用這些代碼。您可以打印這些備份代碼并將它們保存在安全的地方。
之后,您可以退出設(shè)置向?qū)А?/p>
為所有WordPress用戶設(shè)置WP 2-FA兩步認(rèn)證登錄
如果您運行多用戶WordPress網(wǎng)站,例如會員網(wǎng)站,則該插件還允許您為網(wǎng)站上的所有用戶啟用或強制執(zhí)行二步認(rèn)證登錄驗證。
只需轉(zhuǎn)到設(shè)置?Two-factor Authentication頁面即可配置插件設(shè)置。
該插件支持為所有用戶啟用二步認(rèn)證登錄,強制所有用戶登錄,并給用戶足夠的時間進行設(shè)置。
如果您的WordPress網(wǎng)站使用自定義登錄表單頁面,那么您還可以創(chuàng)建一個自定義頁面,用戶無需訪問WordPress管理后臺即可在其中管理其二步認(rèn)證身份驗證器設(shè)置。
不要忘記單擊“保存更改”按鈕來存儲您的新設(shè)置。
以下是用戶輸入常規(guī)WordPress密碼后,WordPress默認(rèn)登錄界面要求輸入二步認(rèn)證身份驗證代碼。
方法 2. 使用Two Factor插件添加二步認(rèn)證
這種方法不太靈活,因為該插件不支持為所有用戶強制執(zhí)行兩步認(rèn)證登錄。每個用戶都必須自己設(shè)置,并且可以從他們的個人資料中禁用它。
首先,您需要安裝并啟用Two Factor插件。
啟用插件后,訪問用戶?個人資料頁面并向下滾動到Two-Factor Options部分。
從這里,您需要選擇一個二步認(rèn)證登錄選項。該插件支持使用電子郵件、身份驗證器應(yīng)用和FIDO U2F安全密鑰方法。
我們建議使用身份驗證器應(yīng)用方法。只需下載Google Authenticator、Authy 或 LastPass Authenticator等身份驗證器應(yīng)用,然后掃描屏幕上顯示的二維碼。
掃描二維碼后,應(yīng)用程序?qū)⑾蚰@示驗證碼,您需要在插件選項中輸入該驗證碼,然后單擊提交按鈕。
該插件現(xiàn)在將設(shè)置密鑰。您可以隨時從設(shè)置頁面重置此密鑰以重新掃描二維碼。
不要忘記單擊“Update Profile”按鈕以保存您的設(shè)置。
現(xiàn)在,每次您登錄WordPress網(wǎng)站時,系統(tǒng)都會要求您輸入手機上應(yīng)用生成的驗證碼。
關(guān)于WordPress中二步認(rèn)證 (2FA) 的常見問題
以下是有關(guān)在WordPress中使用兩步認(rèn)證登錄的一些常見問題的解答。
1. 如果無法訪問手機,如何登錄?
如果您使用的是帶有Authy等云備份選項的身份驗證器應(yīng)用,那么您也可以在筆記本電腦上安裝該應(yīng)用程序。
即使沒有隨身攜帶手機,您可以訪問身份驗證代碼。它還支持在購買新手機時恢復(fù)您的密鑰。
上面提到的兩種方法還支持您生成備份代碼。當(dāng)您無法使用手機時,這些代碼也可用作一次性密碼。
2. 如何不用密碼登錄?
如果您無權(quán)訪問手機、筆記本電腦或備用代碼,則只能通過禁用該插件來登錄。
停用所有插件后,它還將禁用二步身份驗證插件,您將能夠登錄到您的WordPress網(wǎng)站。登錄后,您可以重新啟用插件并重置二步身份驗證設(shè)置。
3. 我還需要密碼保護WordPress管理文件夾嗎?
從使用HTTPS和安全WordPress托管等基礎(chǔ)知識開始,當(dāng)您擁有多層安全保護來保護您的網(wǎng)站時,網(wǎng)站安全效果最佳。二步認(rèn)證的主要目的是加強WordPress登錄安全,但您可以通過密碼保護WordPress管理后臺使其更加安全。
如果的WordPress網(wǎng)站是一個會員網(wǎng)站、在線商店或在線課程網(wǎng)站,就更應(yīng)該做二步認(rèn)證登錄。
關(guān)于WordPress安全,建議大家可以閱讀“如何有效地保護您的WordPress站點免受攻擊入侵”和“WordPress網(wǎng)站免費SSL證書申請及配置教程”,來進一步完善WordPress安全防護措施。
原創(chuàng)文章,作者:微想小云,如若轉(zhuǎn)載,請注明出處:
Wordpress下載Wordpress主機推薦Wordpress使用心得Wordpress怎么建站W(wǎng)ordpress插件Wordpress虛擬主機Wordpress問題解決
贊 (0)
生成海報
如何有效地保護您的WordPress站點免受攻擊入侵
上一篇2022年 9月 24日 am8:13
如何正確地刪除WordPress
網(wǎng)頁題目:驗證wordpress 驗證碼收不到怎么解決
當(dāng)前URL:http://www.ef60e0e.cn/article/dojshis.html