Giter VIP home page Giter VIP logo

pash's Introduction

pash

A simple password manager using GPG written in POSIX sh.

  • Written in safe and shellcheck compliant POSIX sh.
  • Only 120~ LOC (minus blank lines and comments).
  • Compatible with pass's password store.
  • Clears the clipboard after a timeout.
  • Configurable password generation using /dev/urandom.
  • Guards against set -x, ps and /proc leakage.
  • Easily extendible through the shell.

Table of Contents

Dependencies

  • gpg or gpg2

Clipboard Support:

  • xclip (can be customized through PASH_CLIP).

Usage

Examples: pash add web/gmail, pash list, pash del google, pash show github, pash copy github.

SYNOPSIS

pash [ add|del|show|list|copy ] [name]

COMMANDS

[a]dd  [name] - Create a new password entry.
[c]opy [name] - Copy entry to the clipboard.
[d]el  [name] - Delete a password entry.
[l]ist        - List all entries.
[s]how [name] - Show password for an entry.
[t]ree        - List all entries in a tree.

OPTIONS

Using a key pair:  export PASH_KEYID=XXXXXXXX
Password length:   export PASH_LENGTH=50
Password pattern:  export PASH_PATTERN=_A-Z-a-z-0-9
Store location:    export PASH_DIR=~/.local/share/pash
Clipboard tool:    export PASH_CLIP='xclip -sel c'
Clipboard timeout: export PASH_TIMEOUT=15 ('off' to disable)

FAQ

How does this differ from pass or etc?

I was looking for a CLI password manager (written in shell) and wasn't happy with the options I had found. They either had multiple instances of eval (on user inputted data), lots of unsafe shell (nowhere near being shellcheck compliant.) or they were overly complex. The opposites for what I'd want in a password manager.

I decided to write my own. pash is written in POSIX sh and the codebase is minimal (120~ LOC minus blank lines and comments).

Where are passwords stored?

The passwords are stored in GPG encrypted files located at ${XDG_DATA_HOME:=$HOME/.local/share}/pash}.

How can I use a public key?

Set the environment variable PASH_KEYID to the ID of the key you'd like to encrypt and decrypt passwords with.

Example:

# Default: 'unset'.
export PASH_KEYID=XXXXXXXX

# This can also be an email.
export [email protected]

# This can also be used as a one-off.
PASH_KEYID=XXXXXXXX pash add github

How do I change the password length?

Set the environment variable PASH_LENGTH to a valid integer.

Example:

# Default: '50'.
export PASH_LENGTH=50

# This can also be used as a one-off.
PASH_LENGTH=10 pash add github

How do I change the password generation pattern?

Set the environment variable PASH_PATTERN to a valid tr string.

# Default: '_A-Z-a-z-0-9'.
export PASH_PATTERN=_A-Z-a-z-0-9

# This can also be used as a one-off.
PASH_PATTERN=_A-Z-a-z-0-9 pash add hackernews

How do I change the password store location?

Set the environment variable PASH_DIR to a directory.

# Default: '~/.local/share/pash'.
export PASH_DIR=~/.local/share/pash

# This can also be used as a one-off.
PASH_DIR=/mnt/drive/pash pash list

How do I change the clipboard tool?

Set the environment variable PASH_CLIP to a command.

NOTE: I advise that you disable clipboard history in managers like KDE's klipper before copying passwords through pash. Your Desktop Environment's clipboard manager may read entries from the X clipboard when xclip is used.

NOTE: pash will correctly clear all clipboards which have history disabled.

# Default: 'xclip -sel c'.
export PASH_CLIP='xclip -sel c'

# This can also be used as a one-off.
PASH_CLIP='xclip -sel c' pash copy github

How do I change the clipboard timeout?

Set the environment variable PASH_TIMEOUT to a valid sleep interval or off to disable the feature.

# Default: '15'
export PASH_TIMEOUT=15

# Disable timeout.
export PASH_TIMEOUT=off

# This can also be used as a one-off.
PASH_TIMEOUT=5 pash copy github

How do I rename an entry?

It's a file! Standard UNIX utilities can be used here.

How can I migrate from pass to pash?

I cannot guarantee 100% compatibility with the stores from pass as pash wasn't written as a 1:1 replacement, however users have reported that pash does in fact work fine with pass' store.

Add the following to your .shellrc or .profile.

read -r PASH_KEYID < "$PASH_DIR/.gpg-id"

export PASH_DIR=${PASSWORD_STORE_DIR:-$HOME/.password-store}
export PASH_KEYID

How can I extend pash?

A shell function can be used to add new commands and functionality to pash. The following example adds pash git to execute git commands on the password store.

pash() {
    case $1 in
        g*)
            cd "${PASH_DIR:=${XDG_DATA_HOME:=$HOME/.local/share}/pash}"
            shift
            git "$@"
        ;;

        *)
            command pash "$@"
        ;;
    esac
}

pash's People

Contributors

al-x avatar dylanaraps avatar noocsharp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pash's Issues

gpg: error with agent

I get this error when trying to create a new password entry:

โžœ pash a dev/stackoverflow
Generate a password? [y/n]: y
gpg: problem with the agent: Not a tty
gpg: error creating passphrase: Operation cancelled
gpg: symmetric encryption of '[stdin]' failed: Operation cancelled

Environment info:

  • distro: alpine linux

Everything seems to be working on my Arch installation however.

Duplicate effort?

This seems an awful lot like: https://www.passwordstore.org/

Password management should be simple and follow Unix philosophy. With pass, each password lives inside of a gpg encrypted file whose filename is the title of the website or resource that requires the password. These encrypted files may be organized into meaningful folder hierarchies, copied from computer to computer, and, in general, manipulated using standard command line file management utilities.

Are there [planned] fundamental differences?

pash is unusable

Sorry, but pash is unusable. The user interface is confusing and anti-intuitive.

For instance, I want to create a new entry:

pash a test
Generate a password? [y/n]:

WTF ? what password ?
I don't understand. I want to use my public gpg key to encrypt new entry. What password is pash asking for ?

Next step:

Generate a password? [y/n]: n
Enter password:
Enter password (again):

and then it launches gpg agent and asks yet for another password. But what password ?

Really confusing.

I really wanted to like pash, but I don't understand how it is supposed to work. I used pass before, and had no issues.

Man page?

Loving pash, but it could use a man page for documentation.

I could help with this; I'll have time in a couple weeks.

pash show also when using absolute filenames

This errors out:

pash show /data/cloud/passwords/.pashword-store/internet/someurl.gpg
error: Pass file '/data/cloud/passwords/.pashword-store/internet/someurl.gpg' doesn't exist.

This could be an alternative way to use bash' filename auto-completion.

[usage] What's the popup for?

Just tried out pash, like it a lot :)

Was just wondering why the GPG 'enter your passcode' thing is there for. Is that where I enter my master password or the website password?

Improved heredoc syntax

This syntax:

pash/pash

Lines 50 to 53 in 79b5513

"$gpg" "$@" -o "$name.gpg" <<-EOF && \
printf '%s\n' "Saved '$name' to the store."
$pass
EOF

I would say is highly confusing. Here is a simple example replicating the
syntax:

grep -q day <<eof && \
echo pass
sunday monday
eof

This would be better written like this:

grep -q day <<eof && echo pass
sunday monday
eof

or better yet:

grep -q day <<eof &&
sunday monday
eof
echo pass

why use bash?

I like the idea but wouldn't POSIX sh make it more portable?
Just asking, currently I have no bash on my metal :)

Add autocomplete for passwords in directories

Hi,
I love the simplicity in comparison to pass, but one thing that I'm missing is the autocomplete when searching for a password that is stored in a directory, it would be a great feature to implement :)

GPG: Invalid IPC response

Thanks for rewritting in sh, I have tried to run it on FreeBSD but I got this:

Invalid IPC response

on this line

  echo "$pass" | GPG_TTY=$(tty) "$gpg" "$@" -o "$name.gpg" &&
        printf '%s\n' "Saved '$name' to the store."

I can send full 'traceback' tomorrow as of now I am not on the same machine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.