migratetoflarum/old-passwords 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

migratetoflarum/old-passwords

Composer 安装命令:

composer require migratetoflarum/old-passwords

包简介

Re-hash passwords from an old platform on the fly

README 文档

README

Build status MIT license Latest Stable Version Total Downloads Donate

This extension allows your users to continue to login with their passwords from a previous platform that was using a different hashing algorithm than Flarum.

Installation

composer require migratetoflarum/old-passwords

Updating

composer update migratetoflarum/old-passwords
php flarum migrate
php flarum cache:clear

Documentation

This extension is meant to be used alongside a migration script. There are no settings accessible from the UI (you still need to keep the extension enabled for it to work !)

The migrations add a migratetoflarum_old_password column to your users table, which can contain old credentials hashed with different algorithms than bcrypt.

This column must contain a valid JSON-serialized object as described below or null to not provide an old password.

Once a user was correctly identified via an old password, the password is re-hashed with bcrypt, stored in Flarum password field and the migratetoflarum_old_password column is set to null.

If you somehow manage to have both a bcrypt-hashed password and migratetoflarum_old_password value in the database for a user, then the user will be able to login with either password. The password used will override the value of password and migratetoflarum_old_password will be set to null.

Compatible hashings

Don't hesitate to open an issue or a PR to suggest a new hashing method. More will be added soon.

While some of these options might be convenient for testing purposes or other shenanigans, some can put your old password's users at risk in case of a breach. These options are labelled with /!\ Insecure. Just as the whole extension, use these at your own risks !

Plain

/!\ Insecure: you can directly salt and hash plain text passwords with bcrypt and store them in password instead.

Example:

{"type":"plain","password":"correcthorsebatterystaple"}

Bcrypt

It probably doesn't make sense to store a bcrypt hash here instead of the password column, but it is possible.

Example (password = bcrypt(correcthorsebatterystaple)):

{"type":"bcrypt","password":"$2y$10$pUdywYeC2WZxZROQK0SPIu7x58OdO/aLxKnHRlfB8lni0aS6EEWdu"}

Phpass

Reads portable and bcrypt hashes created with Phpass.

In order to use this type you need to install the hautelook/phpass package:

composer require hautelook/phpass:^1.1

Example (password = portablehash(correcthorsebatterystaple)):

{"type":"phpass","password":"$P$Bdjwj4JGIZcMz02HOu69ULVYMPOMK5."}

MD5

/!\ Insecure: with or without a salt MD5 stays weak. Consider using the md5-bcrypt option below.

Example (password = md5(correcthorsebatterystaple)):

{"type":"md5","password":"e9f5bd2bae1c70770ff8c6e6cf2d7b76"}

Example with salt before the password (password = md5(12345678correcthorsebatterystaple)):

{"type":"md5","password":"eefda52fc6b3747b14b563cef9c95062","salt-before":"12345678"}

Example with salt after the password (password = md5(correcthorsebatterystaple12345678)):

{"type":"md5","password":"72d4f016727f69dcfb736fee65b079c8","salt-after":"12345678"}

MD5-Bcrypt

This is the preferred method to import MD5 hashes. You have to run every old MD5 password hash through bcrypt and store the resulting value in Flarum.

Example (password = bcrypt(md5(correcthorsebatterystaple))):

{"type":"md5-bcrypt","password":"$2y$10$WTM5g/fgvJULmERFBpuv1.zqupDwav0/orAot5gWTpZ0xSCkW6tkq"}

Example (password = bcrypt(md5(12345678correcthorsebatterystaple))):

{"type":"md5-bcrypt","password":"$2y$10$WTM5g/fgvJULmERFBpuv1.zqupDwav0/orAot5gWTpZ0xSCkW6tkq","salt-before":"12345678"}

You can use salts the same way as described for MD5.

MD5-Double

/!\ Insecure: consider using the md5-double-bcrypt option below.

Same as MD5, but the password is hashed a first time before the salt is added.

Example (password = md5(12345678 + md5(correcthorsebatterystaple))):

{"type":"md5-double","password":"75ed2cf45b78dfaa65915d83b73cee9b","salt-before":"12345678"}

You can use salts the same way as described for MD5.

MD5-Double-Bcrypt

Same as MD5-Double, with an extra bcrypt layer.

Example (password = bcrypt(md5(12345678 + md5(correcthorsebatterystaple)))):

{"type":"md5-double-bcrypt","password":"$2y$10$aws79gtmfZzV8/ikoJSCyuIVLDKlStBRvNDdJqAr1r6k4ZYjZmcC2","salt-before":"12345678"}

SHA1

/!\ Insecure: with or without a salt SHA1 stays weak. Consider using the sha1-bcrypt option below.

Example (password = sha1(correcthorsebatterystaple)):

{"type":"sha1","password":"bfd3617727eab0e800e62a776c76381defbc4145"}

You can use salts the same way as described for MD5.

SHA1-Bcrypt

This is the preferred method to import SHA1 hashes. You have to run every old SHA1 password hash through bcrypt and store the resulting value in Flarum.

Example (password = bcrypt(sha1(correcthorsebatterystaple))):

{"type":"sha1-bcrypt","password":"$2y$10$b.K9J5Cc7FBJxtuy/hL/vuypT/2vn5jM42M6vpCFIKBfz9n.HAG2a"}

You can use salts the same way as described for MD5.

SHA1-Double

/!\ Insecure: consider using the sha1-double-bcrypt option below.

Same as md5-double for sha1.

Example (password = sha1(12345678 + sha1(correcthorsebatterystaple))):

{"type":"sha1-double","password":"7e7247394d9283ce8b0cf6f862eae667668f1489","salt-before":"12345678"}

SHA1-Double-Bcrypt

Same as md5-double-bcrypt for sha1.

Example (password = bcrypt(sha1(12345678 + sha1(correcthorsebatterystaple)))):

{"type":"sha1-double-bcrypt","password":"$2y$10$vtO9973AbQKq2vb9c0zH/OZxUNNagPxrZydMpQelU4L07BJG1Z8cm","salt-before":"12345678"}

KMD5

MD5-based hash used by Unclassified NewsBoard.

Example (password = first16bytes(md5(correcthorsebatterystaple)) + 12 + last16bytes(md5(correcthorsebatterystaple))):

{"type":"kmd5","password":"caecd5d8c1e3fd9212c2c1cb348fedaed1"}

A MigrateToFlarum extension

This is a free extension by MigrateToFlarum, an online forum migration tool (launching soon). Follow us on Twitter for updates https://twitter.com/MigrateToFlarum

Need a custom Flarum extension ? Contact Clark Winkelmann !

Links

migratetoflarum/old-passwords 适用场景与选型建议

migratetoflarum/old-passwords 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.94k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2018 年 01 月 24 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「extension」 「migration」 「passwords」 「flarum」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 migratetoflarum/old-passwords 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 migratetoflarum/old-passwords 我们能提供哪些服务?
定制开发 / 二次开发

基于 migratetoflarum/old-passwords 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 3.94k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 9
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-01-24