Showing
2 changed files
with
1 additions
and
388 deletions
1 | 1 | # accountmanager.sh |
2 | 2 | |
3 | ------------------------------------------------------------------------- | |
4 | - | |
5 | 3 | ## NAME |
6 | 4 | |
7 | 5 | accountmanager.sh − source all functionality into the current shell |
... | ... | @@ -277,7 +275,7 @@ No known bugs. |
277 | 275 | |
278 | 276 | ## AUTHOR |
279 | 277 | |
280 | -Georg Hopp (georg@steffers.org.in) | |
278 | +Georg Hopp <georg@steffers.org> | |
281 | 279 | |
282 | 280 | ## COPYRIGHT |
283 | 281 | |
... | ... | @@ -285,5 +283,3 @@ Copyright © 2017 Georg Hopp License GPLv3+: GNU GPL version 3 or later |
285 | 283 | <http://gnu.org/licenses/gpl.html>. |
286 | 284 | This is free software: you are free to change and redistribute it. |
287 | 285 | There is NO WARRANTY, to the extent permitted by law. |
288 | - | |
289 | ------------------------------------------------------------------------- | ... | ... |
doc/accountmanager.md
deleted
100644 → 0
1 | -# man | |
2 | - | |
3 | -[NAME](#NAME) | |
4 | -[SYNOPSIS](#SYNOPSIS) | |
5 | -[DESCRIPTION](#DESCRIPTION) | |
6 | -[OPTIONS](#OPTIONS) | |
7 | -[ENVIRONMENT](#ENVIRONMENT) | |
8 | -[DEPENDENCIES](#DEPENDENCIES) | |
9 | -[SEE ALSO](#SEE ALSO) | |
10 | -[BUGS](#BUGS) | |
11 | -[AUTHOR](#AUTHOR) | |
12 | -[COPYRIGHT](#COPYRIGHT) | |
13 | - | |
14 | -* * * | |
15 | - | |
16 | -## NAME<a name="NAME"></a> | |
17 | - | |
18 | -accountmanager.sh − source all functionality into the current shell | |
19 | - | |
20 | -General purpose functions: | |
21 | -random − create a non blocking stream of random data on stdout | |
22 | -rand_printable − create a random string a printable characters | |
23 | - | |
24 | -Database management functions: | |
25 | -amngrdbinit − initialize the SQLite account database | |
26 | -amngrdbdestroy − remove the SQLite account database | |
27 | - | |
28 | -Account management functions: | |
29 | -amngradd − add an account credential to the database | |
30 | -amngrcreate − create a new account credential to the database | |
31 | -amngrcrypt − crypt the given data with GnuPG | |
32 | -amngrdelete − delete an account | |
33 | -amngrgen − generate a encrypted random passphrase | |
34 | -amngrgetoldpass − copy previous password of account to X clipboard | |
35 | -amngrgetolduser − copy previous username of account to X clipboard | |
36 | -amngrgetpass − copy active password of account to X clipboard | |
37 | -amngrgetuser − copy active username of account to X clipboard | |
38 | -amngrid − write the database id of a given account name to stdout | |
39 | -amngrlist − list all accounts | |
40 | -amngrrename − rename an account | |
41 | -amngrsearch − pattern search accounts | |
42 | - | |
43 | -## SYNOPSIS<a name="SYNOPSIS"></a> | |
44 | - | |
45 | -source **${PATH}/accountmanager.sh** | |
46 | - | |
47 | -**random** | |
48 | - | |
49 | -**rand_printable** [_len_] | |
50 | - | |
51 | -**amngrdbinit** [_dbfile_] | |
52 | - | |
53 | -**amngrdbdestroy** [_dbfile_] | |
54 | - | |
55 | -**amngradd -u** _username_ **-p** _password_ [**-d** _description_] [**-D** _dbfile_] [**-r** _recipient_] _account_ | |
56 | - | |
57 | -**amngrcreate -u** _username_ [**-d** _description_] [**-D** _dbfile_] [**-r** _recipient_] _account_ | |
58 | - | |
59 | -**amngrcrypt** [**-r** _recipient_] _password_ | |
60 | - | |
61 | -**amngrdelete** _account_ | |
62 | - | |
63 | -**amngrgen** [**-r** _recipient_] [_len_] | |
64 | - | |
65 | -**amngrgetoldpass** _account_ | |
66 | - | |
67 | -**amngrgetolduser** _account_ | |
68 | - | |
69 | -**amngrgetpass** _account_ | |
70 | - | |
71 | -**amngrgetuser** _account_ | |
72 | - | |
73 | -**amngrid** _account_ | |
74 | - | |
75 | -**amngrlist** [**-s** _separator_] | |
76 | - | |
77 | -**amngrrename** _old_account new_account_ | |
78 | - | |
79 | -**amngrsearch** [**-s** _separator_] _pattern_ | |
80 | - | |
81 | -## DESCRIPTION<a name="DESCRIPTION"></a> | |
82 | - | |
83 | -This file can either be source into the current shell or used as a standalone shell script via the provided symlinks. When used as standalone script it will detect the function to call by the content of **$0**. | |
84 | -All _account_ as well as all _username_ arguments used below are limited to 128 characters. The _account_ argument is always a unique string identifier for the account to manage. The _username_ argument is the username part of a credential which is a (_username_, _password_) pair. | |
85 | - | |
86 | -**random** | |
87 | - | |
88 | - | | |
89 | - | |
90 | -Takes no arguments and connect a non blocking random source to stdout. | |
91 | - | |
92 | - | | |
93 | - | |
94 | -**rand_printable** [_len_] | |
95 | - | |
96 | -Uses **random** to write a string of random printable characters to stdout. All control characters ASCII-0 to ASCII-37 as well as ASCII-177 to 255, single and double quotes are filtered. The single and double quotes are filtered to prevent problems when they are used as string separators after shell expansion as in the SQL here documents used to communicate with the SQLite database. | |
97 | -The optional _len_ argument specifies the string length to be written and defaults to 512. | |
98 | - | |
99 | -**amngrdbinit** [_dbfile_] | |
100 | - | |
101 | -Create the SQLite database file. If the optional _dbfile_ argument is given it specifies the fill path to the file to use, else the value of **$AMNGRDB** environment variable is used. | |
102 | - | |
103 | -**amngrdbdestroy** [_dbfile_] | |
104 | - | |
105 | -Deletes the SQLite database file. If the optional _dbfile_ argument is given it specifies the fill path to the file to use, else the value of **$AMNGRDB** environment variable is used. | |
106 | - | |
107 | -**amngradd -u** _username_ **-p** _password_ [**-d** _description_] [**-D** _dbfile_] [**-r**_ | |
108 | -recipient_] _account_ | |
109 | - | |
110 | -Adds an account credential and marks it as active. If the account already exist, the credential (_username_ and _password_) is added to that account and the previously added credential is marked as old. If there was another even older credential that was already marked as old this will be marked as inactive and this becomes inaccessible with this tools (except for **amngrdelete**). | |
111 | -The necessary option **-u** specifies the username to be stored with this credential pair. | |
112 | -The also necessary option **-p** specifies the password to be stored and the length of _password_ is not limited at all. | |
113 | -With option **-d** one can add a _description_ to the account entry. One can specify the _dbfile_ with the option **-D** if that option is not given the **$AMNGRDB** environment variable is used. | |
114 | - | |
115 | -**amngrcreate -u** _username_ [**-d** _description_] [**-D** _dbfile_] [**-r** _recipient_]_ | |
116 | -account_ | |
117 | - | |
118 | -This will create a password with **amngrgen** and use that to add an credential via **amngradd**. (See there for options description) | |
119 | -The added password will be copied to the X clipboard with **amngrgetpass** for further use. | |
120 | - | |
121 | -**amngrcrypt** [**-r** _recipient_] _password_ | |
122 | - | |
123 | -Crypt the given plain text _password_ with GnuPG and write it to stdout. | |
124 | -The option **-r** specifies the recipient to use with the call to **gpg**. If it is not given the value of the **$AMNGRID** environment variable is used. | |
125 | - | |
126 | -**amngrdelete** _account_ | |
127 | - | |
128 | -Remove the _account_ and all credential associated to it. | |
129 | - | |
130 | -**amngrgen** [**-r** _receipient_] [_len_] | |
131 | - | |
132 | -Generate a password with **rand_printable** and encrypt it via **amngrcrypt**. By default the password will be 10 characters long. That can be modified by the optional _len_ argument. | |
133 | - | |
134 | -**amngrgetoldpass** _account_ | |
135 | - | |
136 | -Read and decrypt the password associated with _account_ that is flagged as old and store it into the X clipboard. | |
137 | - | |
138 | -**amngrgetolduser** _account_ | |
139 | - | |
140 | -Read and decrypt the username associated with _account_ that is flagged as old and store it into the X clipboard. | |
141 | - | |
142 | -**amngrgetpass** _account_ | |
143 | - | |
144 | -Read and decrypt the password associated with _account_ that is flagged as active and store it into the X clipboard. | |
145 | - | |
146 | -**amngrgetuser** _account_ | |
147 | - | |
148 | -Read and decrypt the username associated with _account_ that is flagged as active and store it into the X clipboard. | |
149 | - | |
150 | -**amngrid** _account_ | |
151 | - | |
152 | -(This is primarily for internal use.) Get the database id associated to the given _account_ argument. | |
153 | - | |
154 | -**amngrlist** [**-s** _separator_] | |
155 | - | |
156 | -List all accounts currently stored within the database the output will contain the name of the account, the username and the description delimited by a _separator_ string that can be specified with the **-s** option. If the option is omitted the separator is " => ". Each row is one account. | |
157 | - | |
158 | -**amngrrename** _old_account new_account_ | |
159 | - | |
160 | -Rename the account specified by _old_account_ to _new_account_. | |
161 | - | |
162 | -**amngrsearch** [**-s** _separator_] _pattern_ | |
163 | - | |
164 | -List accounts where _pattern_ exists in either the account name, the username or the account description. The output is like the one described with **amngrlist**. | |
165 | - | |
166 | -## OPTIONS<a name="OPTIONS"></a> | |
167 | - | |
168 | -The options are consistent over all sub commands. However not all sub commands use all options and some sub commands take arguments that other get per option. (See **DESCRIPTION**) | |
169 | - | |
170 | -**-u** | |
171 | - | |
172 | - | | |
173 | - | |
174 | -The login username of the credential for the account. | |
175 | - | |
176 | - | | |
177 | - | |
178 | -**-p** | |
179 | - | |
180 | - | | |
181 | - | |
182 | -The plain text password of the credential for the account. | |
183 | - | |
184 | - | | |
185 | - | |
186 | -**-d** | |
187 | - | |
188 | - | | |
189 | - | |
190 | -The description for the account. | |
191 | - | |
192 | - | | |
193 | - | |
194 | -**-D** | |
195 | - | |
196 | - | | |
197 | - | |
198 | -Select the database file to use instead of the one defined in the **$AMNGRDB** environment variable. | |
199 | - | |
200 | - | | |
201 | - | |
202 | -**-r** | |
203 | - | |
204 | - | | |
205 | - | |
206 | -Select a recipient id for GnuPG encryption to use instead of the one defined in the **$AMNGRID** environment variable. | |
207 | - | |
208 | - | | |
209 | - | |
210 | -**-s** | |
211 | - | |
212 | - | | |
213 | - | |
214 | -The column separator for the **amngrlist** and **amngrsearchcommands.** | |
215 | - | |
216 | - | | |
217 | - | |
218 | -## ENVIRONMENT<a name="ENVIRONMENT"></a> | |
219 | - | |
220 | -**AMNGRDB** | |
221 | - | |
222 | -The default SQLite database file to use. This will be created with **amngrdbinit** as long as the path to that file exists. This can be overruled with the **-D** command line option. | |
223 | - | |
224 | -**AMNGRID** | |
225 | - | |
226 | -The GnuPG recipient id to encrypt against. You should use one where you have both public and private key. Failure to do so will result in not decipherable data. This can be overruled with the **-r** command line option. | |
227 | - | |
228 | -**AMNGRPWLEN** | |
229 | - | |
230 | -The password length to be used when generating new passwords. | |
231 | - | |
232 | -## DEPENDENCIES<a name="DEPENDENCIES"></a> | |
233 | - | |
234 | -A set of POSIX compliant shell utilities including a POSIX compliant shell as well are needed to run this script. | |
235 | - | |
236 | -The functions within this script expect that all the needed tools can be found by the shell, usually that means that the current **$PATH** environment variable is set accordingly or that the tools are a shell internal. | |
237 | - | |
238 | -The existence of a reliable non blocking random source. By default this scripts use **$(cat /dev/urandom)** which can be changed by replacing the alias **random** with something useful for your system. | |
239 | - | |
240 | -For data storage **Sqlite >= 3.6.19** is required. The version requirement comes from the use of foreign key constraints. | |
241 | - | |
242 | -To store the data within the X clipboard the **xclip** is needed. | |
243 | - | |
244 | -**The tools used are** | |
245 | - | |
246 | -• | |
247 | - | |
248 | - | | |
249 | - | |
250 | -**awk** | |
251 | - | |
252 | - | | |
253 | - | |
254 | -• | |
255 | - | |
256 | - | | |
257 | - | |
258 | -**basename** | |
259 | - | |
260 | - | | |
261 | - | |
262 | -• | |
263 | - | |
264 | - | | |
265 | - | |
266 | -**cat** | |
267 | - | |
268 | - | | |
269 | - | |
270 | -• | |
271 | - | |
272 | - | | |
273 | - | |
274 | -**dnsdomainname** | |
275 | - | |
276 | - | | |
277 | - | |
278 | -• | |
279 | - | |
280 | - | | |
281 | - | |
282 | -**echo** | |
283 | - | |
284 | - | | |
285 | - | |
286 | -• | |
287 | - | |
288 | - | | |
289 | - | |
290 | -**getopts** | |
291 | - | |
292 | - | | |
293 | - | |
294 | -• | |
295 | - | |
296 | - | | |
297 | - | |
298 | -**gpg** | |
299 | - | |
300 | - | | |
301 | - | |
302 | -• | |
303 | - | |
304 | - | | |
305 | - | |
306 | -**head** | |
307 | - | |
308 | - | | |
309 | - | |
310 | -• | |
311 | - | |
312 | - | | |
313 | - | |
314 | -**printf** | |
315 | - | |
316 | - | | |
317 | - | |
318 | -• | |
319 | - | |
320 | - | | |
321 | - | |
322 | -**rm** | |
323 | - | |
324 | - | | |
325 | - | |
326 | -• | |
327 | - | |
328 | - | | |
329 | - | |
330 | -**shift** | |
331 | - | |
332 | - | | |
333 | - | |
334 | -• | |
335 | - | |
336 | - | | |
337 | - | |
338 | -**SQLite3** (>= 3.6.19 for foreign key constraints) | |
339 | - | |
340 | - | | |
341 | - | |
342 | -• | |
343 | - | |
344 | - | | |
345 | - | |
346 | -**test** and **[** | |
347 | - | |
348 | - | | |
349 | - | |
350 | -• | |
351 | - | |
352 | - | | |
353 | - | |
354 | -**tr** | |
355 | - | |
356 | - | | |
357 | - | |
358 | -• | |
359 | - | |
360 | - | | |
361 | - | |
362 | -**xclip** | |
363 | - | |
364 | - | | |
365 | - | |
366 | -## SEE ALSO<a name="SEE ALSO"></a> | |
367 | - | |
368 | -gpg2(1), gpg-agent(1) | |
369 | - | |
370 | -## BUGS<a name="BUGS"></a> | |
371 | - | |
372 | -No known bugs. | |
373 | - | |
374 | -## AUTHOR<a name="AUTHOR"></a> | |
375 | - | |
376 | -Georg Hopp (georg@steffers.org.in) | |
377 | - | |
378 | -## COPYRIGHT<a name="COPYRIGHT"></a> | |
379 | - | |
380 | -Copyright © 2017 Georg Hopp License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. | |
381 | -This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. | |
382 | - | |
383 | -* * * |
Please
register
or
login
to post a comment