Two-Factor Authentication
การตั้งค่า Two-Factor Authentication (2FA)

1. สร้าง Secret Key
ใช้คำสั่ง googleauth-gen
โดยพิมพ์คำสั่ง Docker run ดังนี้
$ docker run --rm -v $PWD:/iwallet ghcr.io/jittagornp/iwallet googleauth-gen
ตัวอย่าง
$ docker run --rm -v $PWD:/iwallet ghcr.io/jittagornp/iwallet googleauth-gen
Generating QR code and config...
Output QR code file "google-authenticator/qr.png"
Output config file "google-authenticator/config.json"
$ cat google-authenticator/config.json
{
"secretKey" : "ZGYLMHUQUN4ZWNKKTSSFARNCGNGJTJON",
"account" : "iwallet",
"issuer" : "iWallet",
"barcode" : "otpauth://totp/iWallet%3Aiwallet?secret=ZGYLMHUQUN4ZWNKKTSSFARNCGNGJTJON&issuer=iWallet",
"qrcodeFile" : "qr.png"
}
หมายเหตุ
เวอร์ชัน Free เปลี่ยน Repository จาก
ghcr.io/jittagornp/iwallet
เป็นjittagornp/iwallet
ระบบจะสร้างไฟล์ขึ้นมาให้ 2 ไฟล์ได้แก่
QR Code (google-authenticator/qr.png)
Config File (google-authenticator/config.json)

2. Mobile
ในฝั่งของ Mobile ให้เปิดโปรแกรม Google Authenticator
จากนั้นให้ทำการ Scan QR Code ที่เราได้สร้างไว้ในข้อ 1 ก็เป็นอันเสร็จเรียบร้อย

ถ้าไม่สามารถ Scan QR Code ได้ ให้ใช้ Secret Key จากไฟล์ config.json ในข้อ 1 มากรอกเองดังนี้

3. การ Run Bot
ตอน Run bot ให้เพิ่ม Environment Variable IWALLET_GOOGLEAUTH_SECRET_KEY
นี้เข้าไปด้วย
$ docker run -d \
-p 8080:8080 \
-v $PWD:/iwallet \
-e IWALLET_DATABASE_USERNAME="<YOUR_DATABASE_USERNAME>" \
-e IWALLET_DATABASE_PASSWORD="<YOUR_DATABASE_PASSWORD>" \
-e IWALLET_APP_SECRET="<YOUR_APP_SECRET>" \
-e IWALLET_ALLOW_DOMAINS="<YOUR_DOMAIN_NAME>"
-e IWALLET_GOOGLEAUTH_SECRET_KEY="<YOUR_GOOGLEAUTH_SECRET_KEY>" \
--restart=always \
--name iwallet ghcr.io/jittagornp/iwallet
IWALLET_GOOGLEAUTH_SECRET_KEY
กำหนดค่าเป็น Secret Key ที่ได้จากข้อ 1
Last updated
Was this helpful?