windawings

Typecho Google Authetication Plugin
#tree{min-height:20px;padding:19px;margin-bottom:20px;bo...
扫描右侧二维码阅读全文
19
2018/05

Typecho Google Authetication Plugin

目录(Index)

引言(Preface)

  Typecho is a PHP Blogging Platform. Simple and Powerful. Typecho 是由两个单词type和echo组成的,在发音的时候也发这两个音 /taɪpˌ'ekoʊ/. —— 摘自Typecho Github和Typecho Docs

typecho
typecho-adventages

  Google Authetication与两步验证功能配合, 可在登录使用Google Authentication的帐户时为平添一重安全保障。启用两步验证之后, 当登录帐户时, 需要提供密码和此应用生成的验证码。配置完成后, 无需网络连接或蜂窝连接即可获得验证码。—— 摘自Google Authenticator from App Store of Apple.

  Google Authetication APP功能包括:—— 摘自Google Authenticator from App Store of Apple.

  • 通过 QR 码自动设置
  • 支持多帐户登录
  • 支持基于时间和基于计数器生成验证码
Google-Authetication

介绍(Introduction)

  Typecho原生登陆没有设置验证码, 也没有其他登陆接口防范措施容易在密码猜解, 密码爆破, 或社会工程学的围攻下被攻破。安全防范一方面可以设置具有隐藏性的后台访问路径, 一方面使得登陆口令满足足够抵御密码猜解和爆破的复杂性和安全性, 再者, 就是接触typecho优秀的生态圈, 选择合适的插件(Plugin)设防。
  本博客即采用Typecho作为博客的构建基础, 一开始考虑采用验证码, 但现有搜集到的Free or Open的plugin难以满足需求(比方介入极客验证码条, 但是验证时可能因为插件设置或代码业务逻辑问题不能正常工作, 或者只配置了过于简陋的验证码进行图灵测试, 这对安全防范依然不够理想), 最后是采用GAuthentication插件用于后台登陆, Github: https://github.com/weicno/typecho-Authenticator.
  不过GAuthentication插件在设置无法看到二维码, 另一方面要看到二维码还必须借助Google API才能查看, 即https://chart.googleapis.com/chart?chs=200x200&chld=M|0&cht=qr&chl=otpauth://totp/Company or Email?secret=SecretCode, 这又带来另一方面的安全性问题(虽然比较牵强, 但是还是希望图片自己显示出来, 也有不希望爬梯子才能看的意图)。原作者使用的是https://github.com/PHPGangsta/GoogleAuthenticator作为验证基础的php插件, 是2016年的最新版本(PHP class to generate and verify Google Authenticator 2-factor authentication http://phpgangsta.de/4376), 代码简短功能倒是够用, 但是没有满足二维码本地生成的需求, 于是在Github上找到了另一个项目Google2FA, 此篇博文发表前两个月依然保持更新, 使用composer require pragmarx/google2facomposer require bacon/bacon-qr-code即可安装, 虽然库大了很多, 不过功能上显得更强大。

Google2FA

  于是, 基于GAuthentication插件Google2FA结合与替换, 以及给Typecho加上Image的Element作为表单, 本文的插件应运而生(其实没改多少, 只是因为作者未接触过php所以改得比较难过)。

下载(Download)

  

技巧(Tips)

  • var文件夹覆盖typecho根目录即可, 新增了Typecho_Widget_Helper_Form_Element_Image
  • GAuthenticator文件夹放入typecho的/usr/plugin中即可被识别
  • 关于Google2FA中对于时间window的时间间隔描述没有看太明白, 只能从其举例中得知0指30s, 1指60s, 2指120s
Last modification:June 22nd, 2019 at 03:29 am
If you think my article is useful to you, please feel free to appreciate

2 comments

  1. WeiCN

    百度来的,插件已经更新,推荐博主更新,体验感+100

    1. windawings
      @WeiCN

      原作者更新还行~滋瓷滋瓷

Leave a Comment

captcha