-
Notifications
You must be signed in to change notification settings - Fork 0
/
spm.1
154 lines (154 loc) · 3.24 KB
/
spm.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
.Dd April 21, 2017
.Dt SPM 1
.Sh NAME
.Nm spm
.Nd simple password manager
.Sh SYNOPSIS
.Nm
.Cm add Oo Ar group/ Oc Ns Ar entry
.Nm
.Cm del Ar expression
.Nm
.Cm help
.Nm
.Cm list Oo Fl g Oc Op Ar group
.Nm
.Cm search Ar expression
.Nm
.Cm show Ar expression
.Sh DESCRIPTION
.Nm
is a fully POSIX shell compliant script using
.Xr gpg2 1
for encryption.
.sp
Entries are stored in a classical filesystem hierarchy where passwords
are encrypted as individual files and directories may be used as groups.
This way users can control access through file ownership, share entries
entries with symbolic links and more just like any other files.
.sp
Group and entry names or expressions are considered relative to the
storage root directoy.
.Ar expression
is interpreted as basic regular expression according to
.Xr re_format 7 .
The following commands are available:
.Bl -tag -width Ds
.It Cm add
Prompt for a password if standard output is a terminal otherwise read
from standard input and store it as
.Ar entry .
If
.Ar group
is specified, non-existing groups are created automatically and the
password is stored under
.Ar group/ Ns Op Ar ../ .
.It Cm del
Ask for confirmation and delete the entry matching
.Ar expression
on success.
.It Cm help
Print a short usage and refer to this manual page.
.It Cm list
Print a recursive, indented tree-style list of all entries in
.Ar group .
If
.Ar group
is omitted, the entire storage root is listed.
If the
.Fl g
flag is passed only subgroups are shown.
.It Cm search
Print the absoloute paths of all entries matching
.Ar expression
one per line.
.It Cm show
Print the password to standard output if
.Ar expression
uniquely matches an entry and prompt for the decryption passphrase if
it is not cached by
.Xr gpg-agent 1
already.
.El
.Sh ENVIRONMENT
The following environment variables will be used by
.Nm
if they are set and not empty:
.Bl -tag -width Ds
.It Ev PASSWORD_STORE_DIR
The storage root directory.
This should be an absoloute path.
.It Ev PASSWORD_STORE_KEY
Key ID used for de/encryption.
Refer to
.Xr gpg2 1
for accepted formats.
.El
.Sh FILES
.Bl -tag -width Ds
.It Pa ~/.spm/
The default storage root directory.
.El
.Sh EXIT STATUS
.Nm
exits 1 if an error occurs otherwise 0.
.Sh EXAMPlES
Add Alice's password to the group
.Em users :
.Bd -literal -offset indent
$ spm add users/alice
Password for 'users/alice':
.Ed
.sp
Make sure she is an admin as well:
.Bd -literal -offset indent
$ (cd ~/.spm
> mkdir admins
> ln -s ../members/alice admins/alice)
.Ed
.sp
Copy her password into the X selection ready to be pasted somewhere:
.Bd -literal -offset indent
$ spm show admins/alice | xclip -i
.Ed
.sp
Find all admins starting with
.Dq a
or
.Dq b :
.Bd -literal -offset indent
$ spm search admins/[ab]
/home/alice/.spm/admins/alice
/home/alice/.spm/admins/bob
.Ed
.sp
List all users:
.Bd -literal -offset indent
$ spm list users
/home/alice/.spm/users
|-- alice
|-- bob
|-- temporary/
| |-- tim
| `-- tom
.Ed
.sp
Find entries interactively using
.Xr dmenu 1 :
.Bd -literal -offset indent
$ spm show "$(spm search . | dmenu -l 10)"
.Ed
.Sh SEE ALSO
.Xr dmenu 1,
.Xr gpg2 1 ,
.Xr gpg-agent 1 ,
.Xr tpm 1 ,
.Xr tree 1 ,
.Xr re_format 7
.Sh CAVEATS
Groups have to be deleted manually using
.Xr rmdir 1 .
.Sh AUTHORS
.Nm
is written by
.An Klemens Nanni Aq Mt [email protected] .