Purse

drduhMIT活跃维护

用 Bash 和 GnuPG 非对称加密管理密码与敏感信息,支持 YubiKey 硬件密钥,适合在命令行里安全存取机密。

Manage secrets with Bash and GnuPG asymmetric encryption (YubiKey)

3.0发布于 2024-07-05 01:19 UTC616star43fork同步于 2026-11-10 17:57 UTC

怎么上手

由 README 提炼,执行前请确认
wget https://github.com/drduh/Purse/blob/master/purse.sh
./purse.sh
硬件要求按 README 说明

需要已配置好的 GnuPG 身份和 YubiKey(README 指向 drduh/YubiKey-Guide 配置);README 未说明 CPU 或显存要求。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

用 Bash 和 GnuPG 非对称加密管理密码,靠 YubiKey 免输口令

用 Bash 和 GnuPG 非对称加密管理密码与敏感信息,支持 YubiKey 硬件密钥,适合在命令行里安全存取机密。

核心能力

  • 基于 GnuPG 公钥加密,无需记忆主口令
  • 插入 YubiKey 输 PIN 并触碰即可解密
  • 密码带 epoch 时间戳,读取时最新版自动进剪贴板
  • 支持按时间戳读取历史版本密码
  • 可一键生成备份归档并支持恢复

容易踩的坑

使用前必须先按 YubiKey-Guide 配好 GnuPG 身份,否则无法加解密;默认剪贴板命令是 xclip,macOS 需设 PURSE_CLIP=pbcopy;密码默认 10 秒后从剪贴板清除,可调 PURSE_TIME。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本3.0
  1. 3.0Version 3最新正式版2024-07-05 · 2024-07-05 01:19 UTC

    The third stable release of Purse password manager with usability improvements, new features and configuration options (detailed in README).

    Version 3.0 also addresses the following known issues:

    • When creating passwords, having to read the password back after writing it (sometimes only to find it does not meet requirements). The password can now remain on the clipboard for the timeout duration before being saved. If the password is not compatible, just Control-C and generate a new one.
    • Password generated with gpg often lacked special character diversity and did not meet website requirements. The character set is now a configurable tr setting to increase password quality.

    Changelist

    • New option daily_backup: create daily backup archive on write. Off by default.
    • New option pass_copy: keep password on clipboard before write. Helps ensure the password meets requirements before committing. Off by default.
    • New option pass_chars: specify characters to use for password. Default is all alphanumeric and some common allowed special characters.
    • Support for unencrypted comment in safe and index files. Off by default.
    • Support for other clipboards (e.g., primary/control-v clipboard with xclip)
    • Support for systems without clipboard: passwords will print to screen and clear after timeout.
    • Generate username functionality.
    • Generate password with tr instead of gpg to improve compliance with password requirements.
    • Reduce default password length 20->14 characters, remove maximum limit.
    • Increase filename size 8->10 characters.
    • Script exits are trapped for chmod cleanup, now 0000.
    • Re-order action list so Read is first.
    • Error handling and readability improvements.

    Full Changelog: https://github.com/drduh/Purse/compare/2.0b1...3.0

  2. 3.0bVersion 3 Betapre-release2024-03-10 · 2024-03-10 22:28 UTC
    查看更新说明

    The third release of Purse features new usability features and improvements, specifically addressing:

    • When creating passwords, having to read the password back after writing it (sometimes only to find it does not meet requirements). The password can now remain on the clipboard for the timeout duration before being saved. If the password is not compatible, just Control-C and generate a new one.
    • Password generated with gpg often lacked special character diversity and did not meet website requirements. The character set is now a configurable tr setting to increase password quality.

    Currently in beta testing.

    Known Issues:

    • Error handling from decryption operation does not always work
    • No ability to switch between encrypted/plaintext index

    Changelog:

    • New option daily_backup: create daily backup archive on write. Off by default.
    • New option pass_copy: keep password on clipboard before write. Helps ensure the password meets requirements before committing. Off by default.
    • New option pass_chars: specify characters to use for password. Default is all alphanumeric and some common allowed special characters.
    • Generate password with tr instead of gpg to improve compliance with password requirements.
    • Reduce default password length 20->12 characters, remove maximum limit.
    • Increase filename size 8->10 characters.
    • Explicitly unset password variable after write.
    • Minor code readability improvements.
  3. 2.0b1Version 2 Beta 12020-05-25 · 2020-05-25 21:25 UTC
    查看更新说明

    Minor update to the second release. Currently in beta testing. Compatible on Linux, OpenBSD, macOS.

    Known Issues:

    • Newer versions of macOS error with tr: Illegal byte sequence - see issue #4

    Changelist:

    • Purse now uses a GPG keygroup to encrypt secrets to multiple recipients for improved reliability. The program will prompt for key IDs to define the keygroup; a single key ID can still be used.
    • Encrypted index is now optional and off by default, allowing a single touch to encrypt and decrypt secrets instead of two.
    • GPG configuration file is now included in Purse backup archives.
  4. 2.0bVersion 2 Betapre-release2019-12-02 · 2019-12-02 17:27 UTC
    查看更新说明

    The second release of purse.sh features several security and reliability improvements, and is an optional upgrade. Currently in beta testing. Compatible on Linux, OpenBSD, macOS.

    Known issues:

    • Read actions now require two Yubikey touches, if touch to decrypt is enabled - once for the index and twice for the encrypted password file.

    Changelist:

    • Passwords are now encrypted as individual files, rather than all encrypted as a single flat file.
    • Individual password filenames are random, mapped to usernames in an encrypted index file.
    • Index and password files are now "immutable" using chmod while purse.sh is not running.
    • Read passwords are now copied to clipboard and cleared after a timeout, instead of printed to stdout.
    • Use printf instead of echo for improved portability.
    • New option: list passwords in the index.
    • New option: create tar archive for backup.
    • Removed option: delete password; the index is now a permanent ledger.
    • Removed option: read all passwords; no use case for having a single command.
    • Removed option: suppress generated password output; should be read from safe to verify save.
  5. 1.0Version 12019-11-26 · 2019-11-26 23:32 UTC
    查看更新说明

    Original release which has been available for general use and review since June 2018 (forked from pwd.sh dating to 2015). There are no known bugs nor security vulnerabilities identified in this stable version of purse.sh. Compatible on Linux, OpenBSD, macOS.

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Purse is a Bash shell script based on drduh/pwd.sh.

    Both programs use GnuPG to manage secrets in encrypted text files. Purse is based on asymmetric (public-key) authentication, while pwd.sh is based on symmetric (passphrase-based) authentication.

    Purse eliminates the need for a passphrase: plug in the YubiKey, enter PIN and touch it to access secrets.

    [!IMPORTANT] A GnuPG identity is required to use Purse - see drduh/YubiKey-Guide to set one up.

    Install

    Purse is available for download from Releases, or directly from GitHub:

    wget https://github.com/drduh/Purse/blob/master/purse.sh
    

    Use

    Run the script interactively using ./purse.sh or symlink to a directory in PATH:

    • w to create a secret
    • r to access a secret
    • l to list all secrets
    • b to create a backup archive
    • h to print the help text

    Options can also be passed on the command line.

    Create a 20-character password for userName:

    ./purse.sh w userName 20
    

    Read password for userName:

    ./purse.sh r userName
    

    Passwords are stored with an epoch timestamp for revision control. The most recent version is copied to clipboard on read. To list all passwords or read a specific version of a password:

    ./purse.sh l
    
    ./purse.sh r userName@1574723600
    

    Create an archive for backup:

    ./purse.sh b
    

    Restore an archive from backup:

    tar xvf purse*tar
    

    Configure

    See config/gpg.conf for recommended GnuPG options.

    Several customizable options and features are also available, and can be configured with environment variables, for example in the shell rc file:

    VariableDescriptionDefaultAvailable options
    PURSE_CLIPclipboard to usexclippbcopy on macOS
    PURSE_CLIP_ARGSarguments to pass to clipboard commandunset (disabled)-i -selection clipboard to use primary (control-v) clipboard with xclip
    PURSE_TIMEseconds to clear password from clipboard/screen10any valid integer
    PURSE_LENdefault generated password length14any valid integer
    PURSE_COPYcopy password to clipboard before writeunset (disabled)1 or true to enable
    PURSE_DAILYcreate daily backup archive on writeunset (disabled)1 or true to enable
    PURSE_ENCIXencrypt index for additional privacy; 2 YubiKey touches will be required for separate decryption operationsunset (disabled)1 or true to enable
    PURSE_COMMENTunencrypted comment to include in index and safe filesunsetany valid string
    PURSE_CHARScharacter set for passwords[:alnum:]!?@#$%^&*();:+=any valid characters
    PURSE_DESTpassword output destination, will set to screen without clipboardclipboardclipboard or screen
    PURSE_ECHOcharacter used to echo password input*any valid character
    PURSE_SAFEsafe directory namesafeany valid string
    PURSE_INDEXindex file namepurse.indexany valid string
    PURSE_BACKUPbackup archive file namepurse.$hostname.$today.tarany valid string

    [!NOTE] For privacy, the recipient key ID is not included in metadata (using the GnuPG throw-keyids option).