Skip to content

Commit d859f54

Browse files
committed
add pass ssh 0.1
1 parent 08735cd commit d859f54

File tree

6 files changed

+479
-1
lines changed

6 files changed

+479
-1
lines changed

.travis.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
dist: trusty
2+
sudo: false
3+
4+
language: bash
5+
6+
env:
7+
- PASS_VERSION=1.7
8+
- PASS_VERSION=master
9+
10+
addons:
11+
apt:
12+
sources:
13+
- debian-sid
14+
packages:
15+
- shellcheck
16+
- tree
17+
18+
before_script:
19+
- wget https://git.zx2c4.com/password-store/snapshot/password-store-$PASS_VERSION.tar.xz
20+
- tar -xvf password-store-$PASS_VERSION.tar.xz
21+
- ln -s password-store-$PASS_VERSION/src/password-store.sh pass
22+
- export PATH="$PATH:$PWD"
23+
24+
install: true
25+
26+
script:
27+
- make lint

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# 0.1
2+
3+
* Choose between rofi and fzf.
4+
* By default pick rofi, fallback to fzf.
5+
* If selected keyfile does not exist, generate a keypair with a passphrase stored in pass.

Makefile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
PROG ?= ssh
2+
PREFIX ?= /usr
3+
DESTDIR ?=
4+
LIBDIR ?= $(PREFIX)/lib
5+
SYSTEM_EXTENSION_DIR ?= $(LIBDIR)/password-store/extensions
6+
MANDIR ?= $(PREFIX)/share/man
7+
8+
all:
9+
@echo "pass-$(PROG) is a shell script and does not need compilation, it can be simply executed."
10+
@echo ""
11+
@echo "To install it try \"make install\" instead."
12+
@echo
13+
@echo "To run pass $(PROG) one needs to have some tools installed on the system:"
14+
@echo " password store"
15+
16+
install:
17+
@install -v -d "$(DESTDIR)$(MANDIR)/man1" && install -m 0644 -v pass-$(PROG).1 "$(DESTDIR)$(MANDIR)/man1/pass-$(PROG).1"
18+
@install -v -d "$(DESTDIR)$(SYSTEM_EXTENSION_DIR)/"
19+
@install -Dm0755 $(PROG).bash "$(DESTDIR)$(SYSTEM_EXTENSION_DIR)/$(PROG).bash"
20+
@echo
21+
@echo "pass-$(PROG) is installed succesfully"
22+
@echo
23+
24+
uninstall:
25+
@rm -vrf \
26+
"$(DESTDIR)$(SYSTEM_EXTENSION_DIR)/$(PROG).bash" \
27+
"$(DESTDIR)$(MANDIR)/man1/pass-$(PROG).1" \
28+
29+
test:
30+
make -C tests
31+
32+
lint:
33+
shellcheck -s bash $(PROG).bash
34+
35+
36+
.PHONY: install uninstall lint test

README.md

Lines changed: 120 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,120 @@
1-
# pass ssh
1+
# pass ssh 0.1 [![build status][build-img]][build-url]
2+
3+
A [pass](https://www.passwordstore.org/) extension that lets you quickly
4+
create ssh keypairs and output public keys using
5+
[fzf](https://github.com/junegunn/fzf) or
6+
[rofi](https://davedavenport.github.io/rofi/).
7+
8+
9+
## Usage
10+
11+
```
12+
pass ssh [--help,-h]
13+
[--fzf,-f]|[--rofi,-r] [--ssh-dir <s>,-d <s>]
14+
[--pass-prefix <s>,-p <s>] [--passphrase-no-symbols,-n] [--passphrase-length <s>,-l <s>]
15+
[--ssh-t <s>] [--ssh-b <s>]
16+
```
17+
18+
`pass-ssh` provides an interactive solution to create ssh private
19+
and public keypairs with passphrases stored in `pass` as well as
20+
write the public key to stdout. It will show all available ssh keys in
21+
either `fzf` or `rofi`, wait for the user to select one and
22+
write the public key to stdout.
23+
24+
The user can select `fzf` or `rofi` by giving either `--fzf`
25+
or `--rofi`. By default, `rofi` will be selected and
26+
`pass-ssh` will fallback to `fzf`.
27+
28+
If the selected key file does not exist under the directory given by
29+
`--ssh-dir`, first a passphrase will be generated in `pass`
30+
under the prefix given by `--pass-prefix`. Specific passphrase
31+
length can be given using `--passphrase-length` and no symbols can
32+
be activated with `--passphrase-no-symbols`. Second, a new private
33+
and public keypair will be generated with the aforementioned passphrase
34+
and with `ssh-keygen`'s `-t` and `-b` option given
35+
respectively by `--ssh-t` and `--ssh-b`. Lastly, the public key
36+
is written to stdout.
37+
38+
If the selected key exists, the public key is simply written to stdout.
39+
40+
41+
## Options
42+
* `-f`, `--fzf` Use fzf to select pass-name.
43+
* `-r`, `--rofi` Use rofi to select pass-name.
44+
* `-d`, `--ssh-dir` Directory holding ssh keyfiles, default $HOME/.ssh.
45+
* `-p`, `--pass-prefix` Prefix under which passphrase are stored in pass, default sshkey-passphrase.
46+
* `-n`, `--no-symbols` Do not use any non-alphanumeric characters.
47+
* `-l <size>`, `--length=<size>` Provide a password length.
48+
* `--ssh-t` ssh-keygen's -t option, the type of key to create.
49+
* `--ssh-b` ssh-keygen's -b option, the number of bits in the key to create.
50+
* `-h`, `--help` Show usage message.
51+
52+
53+
## Examples
54+
55+
Combined with a clipboard manager like [`xclip`](https://github.com/astrand/xclip):
56+
```
57+
pass ssh | xclip -in -selection clipboard
58+
```
59+
60+
61+
## Installation
62+
63+
64+
### ArchLinux
65+
66+
```sh
67+
pacaur -S pass-ssh
68+
```
69+
70+
71+
### Other linuxes
72+
73+
```sh
74+
git clone https://github.com/ibizaman/pass-ssh/
75+
cd pass-ssh
76+
sudo make install
77+
```
78+
79+
80+
### Requirements
81+
82+
* `pass 1.7.0` or greater.
83+
* If you do not want to install this extension as system extension, you need to
84+
enable user extension with `PASSWORD_STORE_ENABLE_EXTENSIONS=true pass`. You can
85+
create an alias in `.bashrc`: `alias pass='PASSWORD_STORE_ENABLE_EXTENSIONS=true pass'`
86+
87+
88+
## Contribution
89+
90+
Feedback, contributors, pull requests are all very welcome.
91+
92+
93+
## Acknowledgments
94+
95+
Thanks to [roddhjav](https://github.com/roddhjav) for creating
96+
[pass-update](https://github.com/roddhjav/pass-update) from which this
97+
script is heavily inspired.
98+
99+
100+
## License
101+
102+
```
103+
Copyright (C) 2017 Pierre PENNINCKX
104+
105+
This program is free software: you can redistribute it and/or modify
106+
it under the terms of the GNU General Public License as published by
107+
the Free Software Foundation, either version 3 of the License, or
108+
(at your option) any later version.
109+
110+
This program is distributed in the hope that it will be useful,
111+
but WITHOUT ANY WARRANTY; without even the implied warranty of
112+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
113+
GNU General Public License for more details.
114+
115+
You should have received a copy of the GNU General Public License
116+
along with this program. If not, see <http://www.gnu.org/licenses/>.
117+
```
118+
119+
[build-img]: https://travis-ci.org/ibizaman/pass-ssh.svg?branch=master
120+
[build-url]: https://travis-ci.org/ibizaman/pass-ssh

pass-ssh.1

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
.TH pass-ssh 1 "June 2017" "pass-ssh"
2+
3+
.SH NAME
4+
pass ssh - A \fBpass\fP(1) extension that lets you quickly create ssh
5+
keypairs and output public keys using \fBfzf\fP(1) or \fBrofi\fP(1).
6+
7+
.SH SYNOPSIS
8+
\fBpass ssh\fP [--help,-h]
9+
[--fzf,-f]|[--rofi,-r] [--ssh-dir <s>,-d <s>]
10+
[--pass-prefix <s>,-p <s>] [--passphrase-no-symbols,-n] [--passphrase-length <s>,-l <s>]
11+
[--ssh-t <s>] [--ssh-b <s>]
12+
13+
.SH DESCRIPTION
14+
\fBpass-ssh\fP Provide an interactive solution to create ssh private
15+
and public keypairs with passphrases stored in \fIpass\fP as well as
16+
write the public key to stdout. It will show all available ssh keys in
17+
either \fIfzf\fP or \fIrofi\fP, wait for the user to select one and
18+
write the public key to stdout.
19+
20+
The user can select \fIfzf\fP or \fIrofi\fP by giving either \fI--fzf\fP
21+
or \fI--rofi\fP. By default, \fIrofi\fP will be selected and
22+
\fBpass-ssh\fP will fallback to \fIfzf\fP.
23+
24+
If the selected key file does not exist under the directory given by
25+
\fI--ssh-dir\fP, first a passphrase will be generated in \fBpass\fP
26+
under the prefix given by \fI--pass-prefix\fP. Specific passphrase
27+
length can be given using \fI--passphrase-length\fP and no symbols can
28+
be activated with \fI--passphrase-no-symbols\fP. Second, a new private
29+
and public keypair will be generated with the aforementioned passphrase
30+
and with \fBssh-keygen\fP's \fI-t\fP and \fI-b\fP option given
31+
respectively by \fI--ssh-t\fP and \fI--ssh-b\fP. Lastly, the public key
32+
is written to stdout.
33+
34+
If the selected key exists, the public key is simply written to stdout.
35+
36+
.SH OPTIONS
37+
38+
.TP
39+
\fB\-f\fB, \-\-fzf\fR
40+
Use fzf to select pass-name.
41+
42+
.TP
43+
\fB\-r\fB, \-\-rofi\fR
44+
Use rofi to select pass-name.
45+
46+
.TP
47+
\fB\-d\fB, \-\-ssh\-dir\fR
48+
Directory holding ssh keyfiles, default $HOME/.ssh.
49+
50+
.TP
51+
\fB\-p\fB, \-\-pass\-prefix\fR
52+
Prefix under which passphrase are stored in pass, default
53+
sshkey-passphrase.
54+
55+
.TP
56+
\fB\-n\fB, \-\-no-symbols\fR
57+
Do not use any non-alphanumeric characters.
58+
59+
.TP
60+
\fB\-l <size>\fB, \-\-length=<size>\fR
61+
Provide a password length.
62+
63+
.TP
64+
\fB--ssh-t\fB\fR
65+
ssh-keygen's -t option, the type of key to create.
66+
67+
.TP
68+
\fB--ssh-b\fB\fR
69+
ssh-keygen's -b option, the number of bits in the key to create.
70+
71+
.TP
72+
\fB\-h\fB, \-\-help\fR
73+
Show usage message.
74+
75+
.SH EXAMPLES
76+
Combined with a clipboard manager like \fBxclip\fR:
77+
78+
.PP
79+
.nf
80+
.RS
81+
pass ssh | xclip -in -selection clipboard
82+
.RE
83+
.fi
84+
.PP
85+
86+
87+
.SH SEE ALSO
88+
.BR fzf(1),
89+
.BR pass(1),
90+
.BR rofi(1),
91+
.BR ssh-keygen(1),
92+
.BR xclip(1),
93+
94+
.SH AUTHORS
95+
.B pass ssh
96+
was written by
97+
98+
Pierre PENNINCKX
99+
.ME .
100+
101+
.SH ACKNOWLEDGMENTS
102+
Thanks to
103+
.B roddhjav
104+
https://github.com/roddhjav for creating
105+
.BR pass-update(1)
106+
https://github.com/roddhjav/pass-update from which this script is heavily inspired.
107+
108+
.SH COPYING
109+
This program is free software: you can redistribute it and/or modify
110+
it under the terms of the GNU General Public License as published by
111+
the Free Software Foundation, either version 3 of the License, or
112+
(at your option) any later version.
113+
114+
This program is distributed in the hope that it will be useful,
115+
but WITHOUT ANY WARRANTY; without even the implied warranty of
116+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
117+
GNU General Public License for more details.
118+
119+
You should have received a copy of the GNU General Public License
120+
along with this program. If not, see <http://www.gnu.org/licenses/>.

0 commit comments

Comments
 (0)