定制 initiativesolutions/secrets-manager 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

initiativesolutions/secrets-manager

最新稳定版本:1.0.10

Composer 安装命令:

composer require initiativesolutions/secrets-manager

包简介

Encrypt sensitive app data

README 文档

README

The Secrets Manager application is a command-line tool that allows you to encrypt sensitive values for your application's .env files. This ensures that sensitive values are not stored in plain text, enhancing the security of your applications.

This project has two different uses:

  • for token encryption (command line use)
  • to decrypt the tokens from the application (secrets provider)

Installation

For tokens encryption

To install the command line tool application, follow these steps:

  1. Clone this repository: git clone https://github.com/initiativesolutions/secrets-manager.git
  2. Install dependencies: composer install

For tokens provider

From the application where you want to decrypt the tokens :

  1. composer require initiativesolutions/secrets-manager

Usage

For tokens encryption

Ensure you run the application with a user having necessary rights on the machine or server, as the application performs file read and write operations.

Configuration

The default configuration of the application is set in the config.yaml file. Make sure to adjust these values according to your needs.

Example:

encryption_key:
  location: /var/keys/secrets-manager/encryption
  file_name: encrypt.key
secrets_files:
  location: /var/keys/secrets-manager/secrets
  prefix: secrets_
encrypt:
  algorithm: aes256

Commands

Here are the available commands in the application:

  • bin/secretctl encrypt [TOKEN_NAME] -app [APPLICATION_NAME] -env [ENVIRONNEMENT_NAME]: Encrypts token one by one.

  • bin/secretctl encrypt -file [PATH_TO_JSON_TOKENS] -app [APPLICATION_NAME] -env [ENVIRONNEMENT_NAME] [--remove-file]: Encrypts json file by passing path (you can use --remove-file to delete .json file after encryption)

  • bin/secretctl rotate: Re-encrypts tokens and generates a new security key.

  • bin/secretctl delete [TOKEN_NAME] -app [APPLICATION_NAME] -env [ENVIRONNEMENT_NAME]: Delete a token.

  • bin/secretctl list -app [APPLICATION_NAME] -env [ENVIRONNEMENT_NAME]: List tokens.

  • bin/secretctl help: See help for all commands

If you have a problem when running bin/secretctl then run : chmod +x bin/secretctl && sed -i -e 's/\r$//' bin/secretctl

For tokens provider

$tokens = (new SecretsProvider())
    ->decrypt('path/to/encrypt.key', 'path/to/secrets/tokens');
    
$_ENV = array_merge($_ENV, $tokens);

Tests

You can run tests with vendor/bin/phpunit tests/.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2023-08-08