Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
#+title: bashpass
#+author: michaeltd
#+date: <2019-08-18 Sun>
#+description: password generator, storage and reference for the terminal and/or X.
#+options: toc:t num:t
#+html: <p align="center"><img src="assets/password.jpg"/></p>
password generator, storage and reference for the terminal and/or X.
* Use Case
1. I can create passwords
2. \slash \slash recall passwords
3. \slash \slash update passwords
4. \slash \slash delete accounts
5. \slash \slash import a csv file
6. \slash \slash export a csv file
** Using [[file:assets/bp.png][terminal]]
#+html: <p align="center"><img src="assets/bp.png"/></p>
** Using [[file:assets/dp.png][dialog]], cdialog
#+html: <p align="center"><img src="assets/dp.png"/></p>
** Using [[file:assets/xp.png][Xdialog]]
#+html: <p align="center"><img src="assets/xp.png"/></p>
** Using [[file:assets/zn.png][zenity]]
#+html: <p align="center"><img src="assets/zn.png"/></p>
** Using [[file:assets/yd.png][yad]]
#+html: <p align="center"><img src="assets/yd.png"/></p>
* Files
1. [[file:bashpass][bashpass]]
main script
2. [[file:srcs/][srcs]]
Accompanied functions.
Namely general, backend and ?UI specific
3. [[file:examples/][examples]]
Create DB script and import example files.
- [[file:examples/create.sql][create.sql]]
SQLite database create example script
- [[file:examples/import.csv][import.csv]]
Accounts import example format
4. [[file:tests.bats][test.bats]]
Bats tests file.
Needs [[https://github.com/bats-core/bats-core][bats]] installed to run.
5. [[file:readme.org][readme.org]]
This file
6. [[file:license][license]]
A License
* Dependencies
1. GNU/BSD based distro
2. BASH v4
A recent Bash installation with a major version no less than 4.
3. SQLite v3
SQLite3 installed and ~sqlite3~ available in ~${PATH}.~
4. GNU Privacy Guard
You need gnupg installed, ~gpg2~ or ~gpg~ executable readily available in ~${PATH}.~
5. Optionally...
1. yad,zenity,Xdialog for an X client.
2. cdialog,dialog for a tty TUI.
3. finally, xclip for some middle click password pasting functionality.
* Usage
** Disclaimer - Use at your own risk.
* This author makes no claims, guarantees or promises of any kind.
* This project is nothing more than a UI/CRUD/SQL/PGP playground.
* Not tested for production use at any load or capacity.
* This script assumes you can secure the safety of your computer hardware/software at least for the duration of its operations.
* There is no backwards compatibility maintanance plan between batabases of different versions of this script.
So if you thinking of a git pull/fetch, make sure to hit that csv export menu option first.
** [[https://www.gnupg.org/gph/en/manual/c14.html][gpg2 keyring]]
If you don't already have one, make a [[https://www.gnupg.org/gph/en/manual/c14.html][gpg2 keyring]].
** Basic usage:
~bashpass [default.gpg] [yad|zenity|Xdialog|cdialog|dialog|terminal] [--debug] [--help]~
** Optional command line arguments
- You can provide a gpg2 encrypted SQLite3 database create script for use with ~bashpass~.
(It is the same file that SQLite3 will output when given the ~.dump~ command).
That script needs to be encrypted to your personal keyring, have a ~.gpg~ extension and reside in [[file:dbs/][dbs]] folder.
If no such option is given the script will use ~default.gpg~.
If no such file is available (eg: first time use, new db request) it'll be created.
You can only have one instance of each ~*.gpg~ file open at any given time for obvious reasons.
This is internally enforced by MUTEX implementation.
- If you'd like to test other UI options try: ~bashpass [yad|zenity|Xdialog|cdialog|dialog]~, needless to say they have to be installed.
If not, ~bashpass~ will default to the highest available option in that order.
- The ~debug~ option will ~set -vx~ to ~bashpass~, enabling it to echo commands in the terminal.
To say the least: It's noisy!
- Help will print Usage and exit.
* Notes
1. Consider launching [[file:bashpass][bashpass]] with launch from terminal option enabled
(where available, eg in dmenu: ~xterm -hold -e /path/to/bashpass [default.gpg]~)
as it will not run otherwise.
For SQLite session availability (highly insecure), gnupg input and debugging purposes.
2. Passwords generated by [[file:bashpass][bashpass]] are 16 character long ~[:graph:]~ type
random strings from ~/dev/urandom~, with some exceptions: ~\ `$|,'"~,
namely: backslash, backtick, pound, colon, comma, quotes(both).
* TO-DOS [5/8] [62%]
** DONE ✔ Encryption
CLOSED: [2019-08-22 Thu 01:43]
Add pgp encryption
** DONE ✔ Clipboard
CLOSED: [2019-11-27 Wed 02:21]
Depending on xclip availability on Xdialog mode and upon single record
Create, Retrieve and Update operations selected password will be copied to
~XA_PRIMARY~ xclip target (pasteable with middle mouse button),
with it's trailing newline ('\n') removed.
** DONE ✔ Modular UI [3/3] [100%]
CLOSED: [2019-08-22 Thu 01:43]
Depending on the environment.
*** DONE ✔ GUI
CLOSED: [2019-08-22 Thu 01:44]
Based on availability
*** DONE ✔ GUI/TUI
CLOSED: [2019-08-22 Thu 01:44]
Based on X
*** DONE ✔ zenity/yad support
CLOSED: [2021-08-22 Sun 01:45]
Done.
** DONE ✔ NULL values
CLOSED: [2021-10-01 Fri 23:42]
Central null value handling for various ?UIs list building consistency.
Moved to ${be} insert function.
** DONE ✔ In memory only SQLite3 db
CLOSED: [2021-10-02 Sat 23:42]
For security reasons
Done!
** TODO pass mode
Add a menu option for pass (password-store) compatibility mode
** TODO l10n support
Source a ~l10n.src~ file that will feed translated strings according to ~${LANG}~ settings.
** TODO Selectable back ends
Like: csv, xml, json etc...
This repo may help: [[https://github.com/dbohdan/structured-text-tools][structured-text-tools]]
* Updates
** <2019-11-27 Wed>
Depending on xclip availability and on single record operations,
you'll be able to paste affected passwords via middle-click.
** <2021-09-06 Mon>
~setup~ script went BB and got replaced with ~func_setup~,
for less repeated code and a more compact design.
** <2021-09-06 Mon>
Changes to gpg2 encryption options.
You can launch bashpass like so:
BP_KEY="my@email.net" ./bashpass mygpgfile.gpg # or
BP_EML="my@email.net" ./bashpass mygpgfile.gpg
Alternatively use an RC file to store email details,
see [[file:.bashpass.rc.example][.bashpass.rc.example]] and don't forget to rename it to use it:
~echo "BP_KEY=\"my@email.net\"" > .bashpass.rc~ $BP_KEY will encrypt to your personal keyring, or
~echo "BP_EML=\"my@email.net\"" > .bashpass.rc~ $BP_EML will encrypt with a conventional symmetric algorithm.
On RC file and envar absence this script will default
to symmetric encryption to a gpg key provided by you (via gpg2 prompt).
Another small detail that could lead to misconceptions:
RC file should be located in ~bashpass~'s dirname folder (as all other relative files)
and not ${HOME} or ${XDG_CONFIG_HOME:-${HOME}/.config}.
So this time literally, It's not a bug... It's a feature!
** <2021-09-08 Wed>
From now on the update function will be able to modify all available account fields, not only passwords.
** <2021-09-09 Thu>
Basic data input validation for all account fields has been implemented (see [[Notes]] #3, No ~\ `$|,'"~ chars.)
** <2021-09-10 Fri>
Persistant edits have been implemented.
On create/update functions on charachter validity/password mismatch errors
the user will be returned to create/update forms to trouble-shoot accordingly with his edits preserved.
The default option thus far was to repeat the proccess from scratch.
** <2021-09-12 Sun>
Zenity:
No way to set default values on zenity forms,
so with that in mind, an editable list was the best way to go.
** <2021-10-02 Sat>
For security reasons SQLite3 will work in :memory: mode only.
** <2021-10-05 Tue>
Basic file checks for csv import/export functions impemented.
* Contributing [[http://unmaintained.tech/][http://unmaintained.tech/badge.svg]]
Typos, syntactic and grammar welcome, other than that all PR's will be reviewed.
In the rare case that you really *must* contribute, feel free
to buy me some coffee in [[https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3THXBFPG9H3YY&source=michaeltd/.emacs.d][\euro]] or [[bitcoin:19TznUEx2QZF6hQxL64bf3x15VWNy8Xitm][₿]] (bitcoin:19TznUEx2QZF6hQxL64bf3x15VWNy8Xitm).
* [[file:license][ISC License]] [[https://opensource.org/licenses/ISC][https://img.shields.io/badge/License-ISC-yellow.svg]]