• This repository has been archived on 26/Apr/2024
  • Stars
    star
    336
  • Rank 121,381 (Top 3 %)
  • Language
    Shell
  • License
    MIT License
  • Created about 5 years ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸ”’ A simple password manager using GPG written in POSIX sh.

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
}

More Repositories

1

pure-bash-bible

πŸ“– A collection of pure bash alternatives to external processes.
Shell
35,948
star
2

neofetch

πŸ–ΌοΈ A command-line system information tool written in bash 3.2+
Shell
20,984
star
3

pywal

🎨 Generate and change color-schemes on the fly.
Python
8,114
star
4

pure-sh-bible

πŸ“– A collection of pure POSIX sh alternatives to external processes.
Shell
6,293
star
5

fff

πŸ“ A simple file manager written in bash.
Shell
4,028
star
6

pfetch

🐧 A pretty system information tool written in POSIX sh.
Shell
2,018
star
7

sowm

An itsy bitsy floating window manager (220~ sloc!).
C
894
star
8

wal

🎨 Generate and change colorschemes on the fly. Deprecated, use pywal instead. -->
Shell
724
star
9

pxltrm

πŸ–ŒοΈ pxltrm - [WIP] A pixel art editor inside the terminal
Shell
642
star
10

dotfiles

πŸ™ dotfiles
Vim Script
541
star
11

writing-a-tui-in-bash

How to write a TUI in BASH
499
star
12

birch

An IRC client written in bash
Shell
312
star
13

torque

πŸš‚ A TUI client for transmission written in pure bash.
Shell
222
star
14

shfm

file manager written in posix shell
Shell
215
star
15

wal.vim

🎨 A vim colorscheme for use with wal
Vim Script
214
star
16

promptless

πŸš€ A super fast and extremely minimal shell prompt.
Shell
186
star
17

paleta

Change terminal colors on-the-fly independent of terminal emulator.
C
182
star
18

bin

πŸ—‘οΈ scripts
Shell
145
star
19

bum

🎡 Download and display album art for mpd/mopidy tracks.
Python
134
star
20

openbox-patched

PKGBUILD and patches for Openbox with Rounded Corners
111
star
21

fff.vim

A plugin for vim/neovim which allows you to use fff as a file opener.
Vim Script
103
star
22

bareutils

A coreutils written in pure bash.
Shell
88
star
23

k

kiss pkg man written in c
C
55
star
24

clutter-home

clutter your home directory!
50
star
25

eiwd

iwd without dbus
C
46
star
26

barsh

Use your terminal as a bar
Shell
38
star
27

nosj

a json parser written in pure bash
Shell
36
star
28

bush

This is an experiment to see how many standard tools and functions we can re-implement in pure bash.
Shell
33
star
29

crayon

🎨 A dark 16 color colorscheme for Vim, Gvim, and Nvim
Vim Script
29
star
30

startpage

πŸ”— Simple start page written in HTML/SCSS
CSS
29
star
31

ryuuko

🎨 A colorscheme~
Vim Script
28
star
32

wiki

KISS Linux - Wiki (The wiki is now a part of the website)
27
star
33

hello-world.rs

πŸš€Memory safe, blazing fast, configurable, minimal hello world written in rust(πŸš€) under 1 line of code with few(774πŸš€) dependenciesπŸš€
Rust
25
star
34

pow

Shell
24
star
35

root.vim

🌴 Automatically set directory to your project's root based on a known dir/file.
Vim Script
22
star
36

nfu

Neofetch Utils - A set of C programs to print system information.
C
22
star
37

wm

xcb wm
C
20
star
38

pkg

Package Manager for Kiss Linux
Shell
18
star
39

dylanaraps

17
star
40

okpal

okpal - Swap on the fly between a bunch of palettes
Shell
15
star
41

neofetch-branding

Logos for Neofetch
15
star
42

codegolf

my bash code golfs
15
star
43

eiwd_old

SEE: https://github.com/dylanaraps/eiwd
C
14
star
44

taskrunner.nvim

πŸƒ Runs Gulp/Gruntfiles in terminal splits
Vim Script
14
star
45

discord-selena

Log all Discord messages for transparency
Python
12
star
46

libdbus-stub

stub libdbus to appease
C
12
star
47

str

C
11
star
48

dylan-kiss

Dylan's KISS repository
Objective-C
11
star
49

kiss-flatpak

flatpak for kiss
Shell
11
star
50

blog

Shell
10
star
51

kiss-initramfs

[WIP] initramfs tool for KISS (help wanted!)
Shell
9
star
52

sowm-patches

READ: https://github.com/dylanaraps/sowm/pull/57
8
star
53

golfetch

simple fetch script for Linux.
Shell
8
star
54

reddit-sidebar-toggle

πŸ‘½ Toggle the sidebar on reddit.com
JavaScript
8
star
55

coal

πŸš‚ A bash script that takes a list of colors and outputs them in various formats for use in other programs.
Shell
8
star
56

dylan.k1ss.org

HTML
7
star
57

wayland-experiment

Shell
6
star
58

uncompress

6
star
59

xyz-redirect

simply a cheeky way to 301 redirect https to another domain leveraging netlify to handle the SSL cert.
HTML
5
star
60

repo

πŸ“¦ Dylan's Cydia Repo
Shell
5
star
61

dlink-ssid-bypass

πŸ“‘ Bypass SSID validation on D-Link DSL-2750B
4
star
62

languages

Shell
4
star
63

pywal-branding

Logos for pywal
Shell
4
star
64

blag

blag
HTML
3
star
65

oldyiayias

Old website for Yiayias Greek Cafe
CSS
3
star
66

kisslinux-irc-logs

Freenode #kisslinux IRC logs (2019-2021)
3
star
67

pascal_lint.nvim

πŸ† Show fpc compiler output in a neovim split.
Vim Script
3
star
68

dylanaraps.github.io-old

πŸ”— My personal website.
HTML
2
star
69

2211

mnml trmnl using vte
C
2
star
70

kiss-submodule-links

Shell
2
star
71

eww-static-test

Rust
1
star
72

yiayias

Recreating Yiayia's website 6 months later
HyPhy
1
star
73

google

Remake of Google.com for an assignment
HTML
1
star