nedsbeds/blt-secrets-management 问题修复 & 功能扩展

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

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

nedsbeds/blt-secrets-management

Composer 安装命令:

composer require nedsbeds/blt-secrets-management

包简介

Easy secret management for Acquia BLT.

README 文档

README

This is an Acquia BLT plugin providing an easy way to control secrets storage .

This plugin is community-created and community-supported. Acquia does not provide any direct support for this software or provide any warranty as to its stability.

The plugin uses ansible and ansible-vault to store secrets credentials encrypted in your repository. It then allows you to deploy these credentials in a secure and repeatable way, ensuring that secret settings files have correct syntax and are up to date.

Installation and usage

To use this plugin, you must already have a Drupal project using BLT. The plugin assumes your drush aliases have ssh hostnames and usernames, and that you have SSH keys to access those environments already configured.

In your project, require the plugin with Composer:

composer require nedsbeds/blt-secrets-management

Creating a new vault

Initialize the new vault by calling secrets:vault:init which will prompt you for a new password to encrypt your vault. It will create a minimal vault file for adding your secrets.

Editing your vault

Call the command secrets:edit which will prompt for your password to decrypt the vault file. Your default editor will open with a temp file where you can make your changes. Once done, save and close the file for it to be re-enccrypted. You should now commit the vault file to your repository

Note: You can change the default editor by setting the environment variable DEFAULT_EDITOR

e.g. export DEFAULT_EDITOR=subl -w

Diff command

Call the command secrets:diff with a drush alias and the plugin will first create your secrets.settings.php file from your encrypted information, then run a php lint to ensure it is valid PHP. It will then show you any differences between the generated settings file and the file on that environment.

Deploy command

Call the command secrets:deploy with a drush alias and the plugin will first create your secrets.settings.php file from your encrypted information, then run a php lint to ensure it is valid PHP. It will then overwrite the settings file on that environment with your new values.

Adding new settings

The plugin requires to elements.

  • the vault-file with your credentials
  • A settings.secrets.php template to show how your credentials are used

The vault file is in JSON format and allows you to have a different credential per environment.

{
  "secrets": {
    "example_api_key": {
      "@local": "localsecret",
      "@dev": "devsecret",
      "@test": "stagesecret",
      "@prod": "prodsecret"
      }
    }
}

You should add your own credentials in the secrets array, and update the environment names to match your drush aliases

To edit this file, run secrets:edit

The secrets.settings.php template is located in /secrets/secrets.settings.php.j2 and uses the jinja templating language.

<?php

// Example setting
$settings['example_api_key'] = '{{secrets['example_api_key'][drush_alias]}}';

The jinja variable {{secrets['example_api_key'][drush_alias]}} will get data from your vault.

Add new settings as needed.

Passwords in keychain

To make dealing with the vault easier, you can run secrets:keychain:init which will prompt you for your vault password, add it to your keychain and then use that in future instead of prompting for your password each time.

Example workflow

The imagined workflow for this tool is

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

nedsbeds/blt-secrets-management 适用场景与选型建议

nedsbeds/blt-secrets-management 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 97.29k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2020 年 05 月 19 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 nedsbeds/blt-secrets-management 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-2.0
  • 更新时间: 2020-05-19