Skip to content

Two factor authentication zh TW

ArchiBot edited this page Jul 8, 2023 · 73 revisions

雙重驗證

Steam含有被稱為「Escrow」的雙重驗證系統,在執行帳號相關的行為時,需要額外的確認資料。 您可以在​這裡​以及​這裡​閱讀來了解更多相關資訊。 本頁面主要介紹雙重驗證系統,與我們對它的整合方案,即ASF雙重驗證。


ASF 邏輯

不論您是否使用ASF雙重驗證,ASF都包含正確的邏輯,且完全了解受標準雙重驗證保護的帳號。 它會在需要時,向您請求所需的詳細資訊(例如在登入期間)。 但是,這些請求可以使用ASF雙重驗證自動生成所需權杖,為您省去麻煩並啟用額外功能(見下文所述)。


ASF 雙重驗證

ASF雙重驗證是一個內建模組,負責為ASF程序提供雙重驗證功能,例如生成權杖及接受交易確認。 它的運作方式是複製您現有驗證器內的詳細資訊,所以您可以同時使用原有的驗證器與ASF雙重驗證。

您可以執行​2fa指令​來驗證您的Bot帳號是否已啟用ASF雙重驗證。 除非您已將驗證器匯入成ASF雙重驗證,否則所有標準​2fa​指令都沒有作用,也就是說,您的帳號未啟用ASF雙重驗證,因此對於需要此模組的進階功能也無法運作。


建議事項

有很多方式能讓ASF雙重驗證發揮作用,在這裡,我們依據了您的當前情形來提供一些建議:

  • 若您當前使用的是SteamDesktopAuthenticator、WinAuth或其他任何使您能夠輕易地匯出雙重驗證詳細資料的第三方應用程式,則只需將它們​匯入​至ASF中即可。
  • 若您當前使用的是官方應用程式,且您也不在意重置您的雙重驗證憑證,最好的方式就是停用雙重驗證,然後再透過​聯合驗證器​來​建立​一個新的雙重驗證憑證,這會使您能夠同時使用官方應用程式及ASF雙重驗證。 這個方式不需要Root或艱深的知識來達成,只需依說明操作即可。
  • If you're using official app and don't want to recreate your 2FA credentials, your options are very limited, typically you'll need root and extra fiddling around to import those details, and even with that it might be impossible.
  • If you're not using 2FA yet and don't care, you can use ASF 2FA with standalone authenticator, third-party app duplicating to ASF (recommendation #1), or joint authenticator with official app (recommendation #2).

Below we discuss all possible options and known to us methods.


建立

In general, we strongly recommend duplicating your existing authenticator, since that's the main purpose ASF 2FA was designed for. However, ASF comes with an official MobileAuthenticator plugin that further extends ASF 2FA, allowing you to link a completely new authenticator as well. This can be useful in case you're unable or unwilling to use other tools and do not mind ASF 2FA becoming your main (and maybe only) authenticator.

There are two possible scenarios for adding a two-factor authenticator with the MobileAuthenticator plugin: standalone or joint with the official Steam mobile app. In the second scenario, you will end up with the same authenticator on both the ASF and mobile app; both will generate the same codes, and both will be able to confirm trade offers, Steam Community Market transactions, etc.

Common steps for both scenarios

No matter if you plan to use ASF as the standalone authenticator or want the same authenticator on the official Steam mobile app, you need to do those initialization steps:

  1. Create an ASF bot for the target account, start it, and log in, which you probably already did.
  2. Assign a working and operational phone number to the account here to be used by the bot. A phone number is absolutely required, as there is no way to add 2FA without it.
  3. Ensure you're not using 2FA yet for your account, if you do, disable it first.
  4. Execute the 2fainit [Bot] command, replacing [Bot] with your bot's name.

假設您得到成功的回應,就會發生下列兩件事:

  • ASF會在您的​config​資料夾中生成一個新的​<Bot>.maFile.PENDING​檔案。
  • Steam會向您為上述帳號綁定的手機號碼傳送一封簡訊。

The authenticator details are not operational yet, however, you can review the generated file if you'd like to. If you want to be double safe, you can, for example, already write down the revocation code. The next steps will depend on your selected scenario.

Standalone authenticator

If you want to use ASF as your main (or even only) authenticator, now you need to do the finalization step:

  1. Execute the 2fafinalize [Bot] <ActivationCode> command, replacing [Bot] with your bot's name and <ActivationCode> with the code you've received through SMS in the previous step.

Joint authenticator

If you want to have the same authenticator in both ASF and the official Steam mobile app, now you need to do the next steps:

  1. Ignore the SMS that you received after the previous step.
  2. Install the Steam mobile app if it's not installed yet, and open it. Navigate to the Steam Guard tab and add a new authenticator by following the app's instructions.
  3. After your authenticator in the mobile app is added and working, return to ASF. You now need to tell ASF that finalization is done with the help of one of the two commands below:
  • Wait until the next 2fa code is shown in the Steam mobile app, and use the command 2fafinalized [Bot] <2fa_code_from_app> replacing [Bot] with your bot's name and <2fa_code_from_app> with the code you currently see in the Steam mobile app. If the code generated by ASF and the code you provided are the same, ASF assumes that an authenticator was added correctly and proceeds with importing your newly created authenticator.
  • We strongly recommend to do the above in order to ensure that your credentials are valid. However, if you don't want to (or can't) check if codes are the same and you know what you're doing, you can instead use the command 2fafinalizedforce [Bot], replacing [Bot] with your bot's name. ASF will assume that the authenticator was added correctly and proceed with importing your newly created authenticator.

After finalization

Assuming everything worked properly, the previously generated <Bot>.maFile.PENDING file was renamed to <Bot>.maFile.NEW. 這代表您的雙重驗證憑證現在是有效且正確的了。 We recommend that you create a copy of that file and keep it in a secure and safe location. In addition to that, we recommend you open the file in your editor of choice and write down the revocation_code, which will allow you to, as the name implies, revoke the authenticator in case you lose it.

In regard to technical details, the generated maFile includes all details that we have received from the Steam server during linking the authenticator, and in addition to that, the device_id field, which may be needed for other authenticators. The file is fully compatible with SDA for import.

ASF automatically imports your authenticator once the procedure is done, and therefore 2fa and other related commands should now be operational for the bot account you linked the authenticator to.


匯入

匯入過程需要您已經擁有並綁訂了受到ASF支援的可用驗證器。 除了您能自行手動提供所需的憑證外,ASF目前還支援幾種不同的官方或非官方雙重驗證來源:Android、iOS、SteamDesktopAuthenticator與WinAuth。 若您還沒有任何驗證器,則需要先選擇一個可用的驗證器應用程式,並進行設定。 如果您不知道該選擇哪個,我們建議您使用WinAuth,但只要您依說明操作,上述任何一個都能正常運作。

以下所有指南都需要您已擁有上述工具/應用程式中在運作且可供使用的驗證器。 若您匯入了無效的資料,ASF雙重驗證會無法正常運作,因此在嘗試匯入前,請確認您的驗證器能夠正常運作。 這包含測試並驗證下列驗證器功能是否能正常運作:

  • 您能生成權杖,且Steam網路接受這些權杖
  • 您能獲得交易確認,且您的行動驗證器能夠收到它們
  • 您能接受這些交易確認,且Steam網路能夠正確辨識它們為已確認/已拒絕

檢查上述操作是否有效,來保證您的驗證器運作正常⸺若它們不正常,那麼它們也不會在ASF中運作,您只會浪費時間並給自己帶來額外麻煩。


Android 手機

The below instructions apply to Steam app in version 2.X, there are currently limited resources on extracting required details from version 3.0 onwards. 一旦找到普遍可用的方法,我們將更新本章節。 As of today, a workaround would be to intentionally install older version of Steam app, register 2FA and extract the required details first, after which it's possible to update the application to latest version - existing authenticator will continue to work.

在一般情形下,若要從您的Android手機匯入驗證器,您需要擁有​Root​權限。 不同的設備具有不同的Root方法,所以無法告訴您如何Root您的設備。 可以造訪​XDA​查詢相關指南,以及與Root相關的一般資訊。 若您找不到適用於您設備的指南,請在Google中搜尋。

理論上來說,若沒有Root權限,則無法讀取受保護的Steam檔案。 目前唯一正式的不需要Root來提取Steam檔案的方法是,以某種方式來製作未加密的​/data​備份,然後在PC上手動提取所需的檔案,但這種方法高度依靠您的手機製造商,且​不屬於​Android標準,因此我們不會在此討論。 若您幸運擁有這種功能,您可以使用它,但大多數使用者並沒有這樣的機會。

也有無需Root權限的非正式方法,透過安裝或降級您的Steam應用程式到​2.1​(或更早)版本,設定行動驗證器,然後透過​adb backup​建立應用程式快照(與我們所需的​data​檔案一起),來提取所需的檔案。 但由於這是一個嚴重的安全漏洞,而且提取檔案的方法完全不受支援,因此我們不會在此詳細說明。Valve在新版本中移除了這個安全漏洞是有原因的,我們只是提到這個方法是種可能。 儘管如此,仍然可以乾淨安裝這個舊版本,綁定新的驗證器,提取所需檔案,然後升級應用程式。這理論上能夠使用,但需要您自行嘗試。

假設您已成功Root您的手機,接下來您應下載應用程式商店上任何可用的Root檔案總管,例如​這個​(或任何您偏好的)。 您還可以透過ADB(Android Debug Bridge)或其他任何可行的方式來存取受保護的檔案。我們使用檔案總管,因為它對使用者來說,絕對是最友好的方式。

打開Root檔案總管後,前往​/data/data​資料夾。 請注意,​/data/data​資料夾受到保護,若您沒有Root權限,將會無法存取。 然後找到​com.valvesoftware.android.steam.community​資料夾,把它複製到您的​/sdcard​中,也就是您的內部儲存空間。 之後,您應該能夠將手機插入至PC上,並像平常一樣從內部儲存空間中複製資料夾出來。 若您確定已將資料夾複製到正確的位置,但仍無法看到該資料夾,請先嘗試重新啟動手機。

現在,您可以選擇是先將驗證器匯入WinAuth,然後再匯入ASF,或是直接匯入ASF。 第一個選項更加友善,能使您在PC上也複製一份驗證器,可以讓您從3個不同的地方(手機、PC與ASF)進行交易確認及生成權杖。 若您想這樣做,只需打開WinAuth,加入新的Steam驗證器,選擇從Android匯入,然後依照說明存取您在上述過程中取得的檔案。 完成後,您可以從WinAuth將此驗證器匯入ASF,這將在下面WinAuth章節有專門的說明。

若您不想或不需要使用WinAuth,那麼只需從受保護的資料夾中複製​files/Steamguard-<SteamID>​檔案,其中​SteamID​是您要加入的帳號的64位元Steam ID(可能有多個。若您只有一個帳號,那麼就只有一個檔案)。 您需要將該檔案放在ASF的​config​資料夾中。 完成後,將檔案重新命名成​BotName.maFile​,其中​BotName​是您要加入ASF雙重驗證的Bot名稱。 最後,開啟ASF⸺它將會偵測到​.maFile​並將其匯入。

[*] INFO: ImportAuthenticator() <1> 正在將 .maFile 轉換成 ASF 格式…
[*] INFO: ImportAuthenticator() <1> 成功匯入行動驗證器!

就是這樣。假設您已匯入具有有效密鑰的正確檔案,應該一切都運作正常,您可以使用​2fa​指令來驗證。 若您做錯了,隨時可以刪除​Bot.db​來重新開始。


iOS

對於iOS而言,您可以使用​ios-steamguard-extractor​。 這能夠做到是因為您可以製作一份解密備份,放到您的PC上,並使用該工具來提取原本無法獲得的Steam資料(由於iOS的加密機制,至少在沒有越獄的情形下無法做到)。

前往​發布頁面​下載這個程式的最新版本。 提取資料後,您可以把它放進WinAuth中,然後從WinAuth複製到ASF(但您也可以將生成的.json裡面,從​{​起始到​}​結尾的部分複製到​BotName.maFile​再繼續)。 若您詢問,我會強烈建議先匯入到WinAuth,然後確保生成權杖與接受確認都正常運作,這樣您就能確定到目前為止沒有出問題。 若您的憑證無效,ASF雙重驗證將不會正常運作,所以最好最後再匯入至ASF中。

如有任何問題,請造訪​Issues​頁面。

請注意,上面的工具並非官方工具,您需要自行承擔風險。 若它無法正常運作,我們亦不提供技術支援⸺我們收到一些跡象表明它匯出無效的雙重驗證憑證⸺在將資料匯入ASF前,確認一下交易確認在WinAuth等驗證器中是否有效!


SteamDesktopAuthenticator

若您已有執行於SDA中的驗證器,您應該已注意到​maFiles​資料夾中有​steamID.maFile​檔案。 確保​maFile​是未加密的格式,因為ASF無法解密SDA檔案⸺未加密的檔案應以​{​字元開頭,並以​}​字元結尾。 如果需要,您可以先在SDA的設定中移除加密,然後在您完成使用後重新啟用。 在檔案變成未加密的形式後,將它複製到ASF的​config資料夾中。

現在您可以將ASF的config資料夾中的​steamID.maFile​檔案重新命名成​BotName.maFile​,其中​BotName​是您要加入ASF雙重驗證的Bot名稱。 或者您亦可保持原樣,ASF會在登入後自動偵測到它。 若您協助ASF重新命名,就可以在登入前使用ASF雙重驗證,否則只有在ASF登入成功後才能讀取檔案(因為ASF在實際登入前,無法知道您帳號的​steamID​)。

若您做的完全正確,啟動ASF,您應該會看到:

[*] INFO: ImportAuthenticator() <1> 正在將 .maFile 轉換成 ASF 格式…
[*] INFO: ImportAuthenticator() <1> 成功匯入行動驗證器!

從現在開始,您帳號的ASF雙重驗證已經可以使用了。


WinAuth

首先,在ASF的config資料夾中新增一個空的​BotName.maFile​,其中​BotName​是您要加入ASF雙重驗證的Bot名稱。 記住,檔案名稱應為​BotName.maFile​,而不是​BotName.maFile.txt​,Windows預設會隱藏副檔名。 若您提供錯誤的檔名,ASF將無法偵測到它。

現在像平常一樣啟動WinAuth。 右鍵點擊Steam圖示,然後選擇「Show SteamGuard and Recovery Code」。 然後選擇「Allow copy」。 您應該能在視窗底部發現以​{​開頭的JSON結構。 複製整個本文到上一步您所建立的​BotName.maFile​檔案中。

若您做的完全正確,啟動ASF,您應該會看到:

[*] INFO: ImportAuthenticator() <1> 正在將 .maFile 轉換成 ASF 格式…
[*] INFO: ImportAuthenticator() <1> 成功匯入行動驗證器!

從現在開始,您帳號的ASF雙重驗證已經可以使用了。


完成

從此之後,所有​2fa​指令都會像在原本的雙重驗證設備上一樣運作。 您可以使用ASF雙重驗證及其他(Android、iOS、SDA或WinAuth驗證器)來生成權杖及接受交易確認。

若您的手機上有驗證器,您也可以選擇移除SteamDesktopAuthenticator和/或WinAuth,因為我們不再需要它了。 不過,我建議將它們留下以防萬一,而且它們比普通的Steam驗證器更為好用。 請注意,ASF雙重驗證​並不是​一個通用驗證器,它沒有含有驗證器應當擁有的所有資料,而只擁有原本​maFile​的部分資料。 無法將ASF雙重驗證轉換回原本的驗證器,因此請永遠確保您在其他地方擁有完整功能的通用驗證器或​maFile​,例如WinAuth、SDA或您的手機。


常見問題

ASF 如何使用雙重驗證模組?

如果ASF雙重驗證可以使用,ASF將用它自動確認由ASF發起/接受的交易提案。 它還能在需要時自動生成雙重驗證權杖,例如在登入的時候。 除此之外,擁有ASF雙重驗證也能讓您使用​2fa​指令。 如果我沒有忘記說,應該就是現在這些了⸺基本上ASF會依據需要,使用雙重驗證模組。


假如我需要雙重驗證權杖?

您需要雙重驗證權杖才能存取受到雙重驗證保護的帳號,這也包含每個使用ASF雙重驗證的帳號。 您應該在用於匯入的驗證器生成權杖,但您也可以透過聊天向指定Bot傳送​2fa​指令,來生成臨時權杖。 您還可以使用​2fa <BotNames>​指令來為指定的Bot實例生成臨時權杖。 在透過瀏覽器等存取Bot帳號時,這方法應該夠用了,但如上所述⸺您應該使用更友善的驗證器(Android、iOS、SDA或WinAuth)。


匯入 ASF 雙重驗證後,我可以使用原本的驗證器嗎?

可以,您原有的驗證器依然保有功能,而且能與ASF雙重驗證一起使用。 整個過程的重點是:我們匯入您的驗證器憑證到ASF,使ASF能夠使用它們並代表您接受所選的交易確認。


ASF 行動裝置驗證器儲存在哪裡?

ASF行動驗證器儲存在config資料夾的​BotName.db​檔案中,這個檔案也包含指定帳號的其他關鍵資料。 若您想移除ASF雙重驗證,請閱讀下文。


如何移除 ASF 雙重驗證?

只需要關閉ASF,並刪除想要移除ASF雙重驗證的Bot的​BotName.db​檔案。 這個選項會移除ASF與匯入的雙重驗證的關聯,但不會使您的驗證器解除綁定。 若您打算將您的驗證器解除綁定,除了首先要把它從ASF刪除外,您還需要在原有的設備上(Android、iOS、SDA或WinAuth)解除綁定。若是您因某些原因已無法使用,則應在Steam網站上使用綁定驗證器時收到的恢復代碼。 您不能使用ASF來取消您的驗證器連結,這就是您為什麼要使用通用驗證器。


我將驗證器綁定到 SDA/WinAuth,然後匯入 ASF。 我可以解除綁定,並重新綁定到我的手機上嗎?

不能​。 ASF是為了​匯入​才使用您的驗證器資料。 若您解除綁定驗證器,不論您是否像上文所述將它移除,都會使ASF雙重驗證失效。 若您想在您的手機及ASF上同時使用驗證器(包含SDA/WinAuth),那麼您需要從手機中​匯入​您的驗證器,而不是在SDA或WinAuth中建立新的驗證器。 您只能擁有​一個​綁定的驗證器,這就是為什麼ASF是​匯入​驗證器及其資料來作為ASF雙重驗證⸺它與原本的驗證器​相同​,只是存在兩個地方。 若您解除綁定您的行動驗證器憑證⸺不論用何種方法,ASF雙重驗證都會停止運作,因為之前複製的行動驗證器憑證將不再有效。 如上所述,若要同時使用ASF雙重驗證與手機上的驗證器,您必須從Android/iOS中匯入它。


使用 ASF 雙重驗證是否比 WinAuth/SDA/其他驗證器更適合接受所有確認?

是的​,有以下幾種原因。 第一個也是最重要的一點:使用ASF雙重驗證能​顯著​提高安全性,因為ASF雙重驗證模組會保證ASF只自動接受它自己的交易確認,所以,即使攻擊者發起了有害的交易提案,ASF雙重驗證也​不會​接受這類交易,因為它不是由ASF生成的。 除了更加安全,使用ASF雙重驗證還對效能/最佳化有益,因為ASF雙重驗證在生成交易提案後,會立即獲得並接受交易確認,而不是像SDA或WinAuth一樣,低效地每X分鐘才完成一輪交易確認。 長話短說,若您打算自動確認來自ASF的交易提案,那就沒有理由在ASF雙重驗證上使用第三方驗證器⸺這正是ASF雙重驗證的作用,且您在使用其他驗證器確認交易時,它也不會與其衝突。 我們強烈建議對所有ASF行為都使用ASF雙重驗證⸺這比任何其他解決方案都更加安全。


進階

若您是進階使用者,您也可以手動生成maFile。 若您想從上述以外的其他來源匯入驗證器,則可以使用此方法。 它應有的​有效JSON結構​如下:

{
  "shared_secret": "STRING",
  "identity_secret": "STRING"
}

標準的驗證器資料擁有更多欄位⸺ASF會在匯入過程完全忽略它們,因為它們不是必需的。 您不需刪除它們⸺只要JSON裡面包含上述2個有效的必填欄位即可,ASF會忽略其他欄位(如果存在)。 當然,您需要將上述範例中的​STRING​佔位符取代成您帳號的實際有效值。 每個​STRING​都應是由相應私鑰的Base64編碼形式字元組成。

Clone this wiki locally