Commit 6e48b6a9764c26bce488951cde1d7cd702a3f79e
1 parent
83d7e0ff
some cleanups in generated README.md
Showing
1 changed file
with
73 additions
and
247 deletions
1 | -man | ||
2 | -=== | ||
3 | - | ||
4 | -[NAME](#NAME) | ||
5 | - [SYNOPSIS](#SYNOPSIS) | ||
6 | - [DESCRIPTION](#DESCRIPTION) | ||
7 | - [OPTIONS](#OPTIONS) | ||
8 | - [ENVIRONMENT](#ENVIRONMENT) | ||
9 | - [DEPENDENCIES](#DEPENDENCIES) | ||
10 | - [SEE ALSO](#SEE%20ALSO) | ||
11 | - [BUGS](#BUGS) | ||
12 | - [AUTHOR](#AUTHOR) | ||
13 | - [COPYRIGHT](#COPYRIGHT) | 1 | +# accountmanager.sh |
14 | 2 | ||
15 | ------------------------------------------------------------------------ | 3 | ------------------------------------------------------------------------ |
16 | 4 | ||
17 | -NAME | ||
18 | ----- | 5 | +## NAME |
19 | 6 | ||
20 | accountmanager.sh − source all functionality into the current shell | 7 | accountmanager.sh − source all functionality into the current shell |
21 | 8 | ||
22 | General purpose functions: | 9 | General purpose functions: |
23 | - random − create a non blocking stream of random data on stdout | ||
24 | - rand\_printable − create a random string a printable characters | 10 | + - random − create a non blocking stream of random data on stdout |
11 | + - rand\_printable − create a random string a printable characters | ||
25 | 12 | ||
26 | Database management functions: | 13 | Database management functions: |
27 | - amngrdbinit − initialize the SQLite account database | ||
28 | - amngrdbdestroy − remove the SQLite account database | 14 | + - amngrdbinit − initialize the SQLite account database |
15 | + - amngrdbdestroy − remove the SQLite account database | ||
29 | 16 | ||
30 | Account management functions: | 17 | Account management functions: |
31 | - amngradd − add an account credential to the database | ||
32 | - amngrcreate − create a new account credential to the database | ||
33 | - amngrcrypt − crypt the given data with GnuPG | ||
34 | - amngrdelete − delete an account | ||
35 | - amngrgen − generate a encrypted random passphrase | ||
36 | - amngrgetoldpass − copy previous password of account to X clipboard | ||
37 | - amngrgetolduser − copy previous username of account to X clipboard | ||
38 | - amngrgetpass − copy active password of account to X clipboard | ||
39 | - amngrgetuser − copy active username of account to X clipboard | ||
40 | - amngrid − write the database id of a given account name to stdout | ||
41 | - amngrlist − list all accounts | ||
42 | - amngrrename − rename an account | ||
43 | - amngrsearch − pattern search accounts | ||
44 | - | ||
45 | -SYNOPSIS | ||
46 | --------- | 18 | + - amngradd − add an account credential to the database |
19 | + - amngrcreate − create a new account credential to the database | ||
20 | + - amngrcrypt − crypt the given data with GnuPG | ||
21 | + - amngrdelete − delete an account | ||
22 | + - amngrgen − generate a encrypted random passphrase | ||
23 | + - amngrgetoldpass − copy previous password of account to X clipboard | ||
24 | + - amngrgetolduser − copy previous username of account to X clipboard | ||
25 | + - amngrgetpass − copy active password of account to X clipboard | ||
26 | + - amngrgetuser − copy active username of account to X clipboard | ||
27 | + - amngrid − write the database id of a given account name to stdout | ||
28 | + - amngrlist − list all accounts | ||
29 | + - amngrrename − rename an account | ||
30 | + - amngrsearch − pattern search accounts | ||
31 | + | ||
32 | +## SYNOPSIS | ||
47 | 33 | ||
48 | source **${PATH}/accountmanager.sh** | 34 | source **${PATH}/accountmanager.sh** |
49 | 35 | ||
@@ -55,10 +41,10 @@ source **${PATH}/accountmanager.sh** | @@ -55,10 +41,10 @@ source **${PATH}/accountmanager.sh** | ||
55 | 41 | ||
56 | **amngrdbdestroy** \[*dbfile*\] | 42 | **amngrdbdestroy** \[*dbfile*\] |
57 | 43 | ||
58 | -**amngradd -u** *username* **-p** *password* \[**-d** *description*\] | 44 | +**amngradd** **-u** *username* **-p** *password* \[**-d** *description*\] |
59 | \[**-D** *dbfile*\] \[**-r** *recipient*\] *account* | 45 | \[**-D** *dbfile*\] \[**-r** *recipient*\] *account* |
60 | 46 | ||
61 | -**amngrcreate -u** *username* \[**-d** *description*\] \[**-D** | 47 | +**amngrcreate** **-u** *username* \[**-d** *description*\] \[**-D** |
62 | *dbfile*\] \[**-r** *recipient*\] *account* | 48 | *dbfile*\] \[**-r** *recipient*\] *account* |
63 | 49 | ||
64 | **amngrcrypt** \[**-r** *recipient*\] *password* | 50 | **amngrcrypt** \[**-r** *recipient*\] *password* |
@@ -83,35 +69,22 @@ source **${PATH}/accountmanager.sh** | @@ -83,35 +69,22 @@ source **${PATH}/accountmanager.sh** | ||
83 | 69 | ||
84 | **amngrsearch** \[**-s** *separator*\] *pattern* | 70 | **amngrsearch** \[**-s** *separator*\] *pattern* |
85 | 71 | ||
86 | -DESCRIPTION | ||
87 | ------------ | 72 | +## DESCRIPTION |
88 | 73 | ||
89 | This file can either be source into the current shell or used as a | 74 | This file can either be source into the current shell or used as a |
90 | standalone shell script via the provided symlinks. When used as | 75 | standalone shell script via the provided symlinks. When used as |
91 | standalone script it will detect the function to call by the content of | 76 | standalone script it will detect the function to call by the content of |
92 | -**$0**. | ||
93 | - All *account* as well as all *username* arguments used below are | 77 | +**$0**. |
78 | + | ||
79 | +All *account* as well as all *username* arguments used below are | ||
94 | limited to 128 characters. The *account* argument is always a unique | 80 | limited to 128 characters. The *account* argument is always a unique |
95 | string identifier for the account to manage. The *username* argument is | 81 | string identifier for the account to manage. The *username* argument is |
96 | the username part of a credential which is a (*username*, *password*) | 82 | the username part of a credential which is a (*username*, *password*) |
97 | pair. | 83 | pair. |
98 | 84 | ||
99 | -<table> | ||
100 | -<colgroup> | ||
101 | -<col width="25%" /> | ||
102 | -<col width="25%" /> | ||
103 | -<col width="25%" /> | ||
104 | -<col width="25%" /> | ||
105 | -</colgroup> | ||
106 | -<tbody> | ||
107 | -<tr class="odd"> | ||
108 | -<td align="left"></td> | ||
109 | -<td align="left"><p><strong>random</strong></p></td> | ||
110 | -<td align="left"></td> | ||
111 | -<td align="left"><p>Takes no arguments and connect a non blocking random source to stdout.</p></td> | ||
112 | -</tr> | ||
113 | -</tbody> | ||
114 | -</table> | 85 | +**random** |
86 | + | ||
87 | +Takes no arguments and connect a non blocking random source to stdout. | ||
115 | 88 | ||
116 | **rand\_printable** \[*len*\] | 89 | **rand\_printable** \[*len*\] |
117 | 90 | ||
@@ -121,7 +94,7 @@ to 255, single and double quotes are filtered. The single and double | @@ -121,7 +94,7 @@ to 255, single and double quotes are filtered. The single and double | ||
121 | quotes are filtered to prevent problems when they are used as string | 94 | quotes are filtered to prevent problems when they are used as string |
122 | separators after shell expansion as in the SQL here documents used to | 95 | separators after shell expansion as in the SQL here documents used to |
123 | communicate with the SQLite database. | 96 | communicate with the SQLite database. |
124 | - The optional *len* argument specifies the string length to be written | 97 | +The optional *len* argument specifies the string length to be written |
125 | and defaults to 512. | 98 | and defaults to 512. |
126 | 99 | ||
127 | **amngrdbinit** \[*dbfile*\] | 100 | **amngrdbinit** \[*dbfile*\] |
@@ -137,8 +110,7 @@ given it specifies the fill path to the file to use, else the value of | @@ -137,8 +110,7 @@ given it specifies the fill path to the file to use, else the value of | ||
137 | **$AMNGRDB** environment variable is used. | 110 | **$AMNGRDB** environment variable is used. |
138 | 111 | ||
139 | **amngradd -u** *username* **-p** *password* \[**-d** *description*\] | 112 | **amngradd -u** *username* **-p** *password* \[**-d** *description*\] |
140 | -\[**-D** *dbfile*\] \[**-r** * | ||
141 | - recipient*\] *account* | 113 | +\[**-D** *dbfile*\] \[**-r** *recipient*\] *account* |
142 | 114 | ||
143 | Adds an account credential and marks it as active. If the account | 115 | Adds an account credential and marks it as active. If the account |
144 | already exist, the credential (*username* and *password*) is added to | 116 | already exist, the credential (*username* and *password*) is added to |
@@ -146,28 +118,27 @@ that account and the previously added credential is marked as old. If | @@ -146,28 +118,27 @@ that account and the previously added credential is marked as old. If | ||
146 | there was another even older credential that was already marked as old | 118 | there was another even older credential that was already marked as old |
147 | this will be marked as inactive and this becomes inaccessible with this | 119 | this will be marked as inactive and this becomes inaccessible with this |
148 | tools (except for **amngrdelete**). | 120 | tools (except for **amngrdelete**). |
149 | - The necessary option **-u** specifies the username to be stored with | 121 | +The necessary option **-u** specifies the username to be stored with |
150 | this credential pair. | 122 | this credential pair. |
151 | - The also necessary option **-p** specifies the password to be stored | 123 | +The also necessary option **-p** specifies the password to be stored |
152 | and the length of *password* is not limited at all. | 124 | and the length of *password* is not limited at all. |
153 | - With option **-d** one can add a *description* to the account entry. | 125 | +With option **-d** one can add a *description* to the account entry. |
154 | One can specify the *dbfile* with the option **-D** if that option is | 126 | One can specify the *dbfile* with the option **-D** if that option is |
155 | not given the **$AMNGRDB** environment variable is used. | 127 | not given the **$AMNGRDB** environment variable is used. |
156 | 128 | ||
157 | **amngrcreate -u** *username* \[**-d** *description*\] \[**-D** | 129 | **amngrcreate -u** *username* \[**-d** *description*\] \[**-D** |
158 | -*dbfile*\] \[**-r** *recipient*\] * | ||
159 | - account* | 130 | +*dbfile*\] \[**-r** *recipient*\] *account* |
160 | 131 | ||
161 | This will create a password with **amngrgen** and use that to add an | 132 | This will create a password with **amngrgen** and use that to add an |
162 | credential via **amngradd**. (See there for options description) | 133 | credential via **amngradd**. (See there for options description) |
163 | - The added password will be copied to the X clipboard with | 134 | +The added password will be copied to the X clipboard with |
164 | **amngrgetpass** for further use. | 135 | **amngrgetpass** for further use. |
165 | 136 | ||
166 | **amngrcrypt** \[**-r** *recipient*\] *password* | 137 | **amngrcrypt** \[**-r** *recipient*\] *password* |
167 | 138 | ||
168 | Crypt the given plain text *password* with GnuPG and write it to | 139 | Crypt the given plain text *password* with GnuPG and write it to |
169 | stdout. | 140 | stdout. |
170 | - The option **-r** specifies the recipient to use with the call to | 141 | +The option **-r** specifies the recipient to use with the call to |
171 | **gpg**. If it is not given the value of the **$AMNGRID** environment | 142 | **gpg**. If it is not given the value of the **$AMNGRID** environment |
172 | variable is used. | 143 | variable is used. |
173 | 144 | ||
@@ -224,62 +195,23 @@ List accounts where *pattern* exists in either the account name, the | @@ -224,62 +195,23 @@ List accounts where *pattern* exists in either the account name, the | ||
224 | username or the account description. The output is like the one | 195 | username or the account description. The output is like the one |
225 | described with **amngrlist**. | 196 | described with **amngrlist**. |
226 | 197 | ||
227 | -OPTIONS | ||
228 | -------- | 198 | +## OPTIONS |
229 | 199 | ||
230 | The options are consistent over all sub commands. However not all sub | 200 | The options are consistent over all sub commands. However not all sub |
231 | commands use all options and some sub commands take arguments that other | 201 | commands use all options and some sub commands take arguments that other |
232 | get per option. (See **DESCRIPTION**) | 202 | get per option. (See **DESCRIPTION**) |
233 | 203 | ||
234 | -<table> | ||
235 | -<colgroup> | ||
236 | -<col width="25%" /> | ||
237 | -<col width="25%" /> | ||
238 | -<col width="25%" /> | ||
239 | -<col width="25%" /> | ||
240 | -</colgroup> | ||
241 | -<tbody> | ||
242 | -<tr class="odd"> | ||
243 | -<td align="left"></td> | ||
244 | -<td align="left"><p><strong>-u</strong></p></td> | ||
245 | -<td align="left"></td> | ||
246 | -<td align="left"><p>The login username of the credential for the account.</p></td> | ||
247 | -</tr> | ||
248 | -<tr class="even"> | ||
249 | -<td align="left"></td> | ||
250 | -<td align="left"><p><strong>-p</strong></p></td> | ||
251 | -<td align="left"></td> | ||
252 | -<td align="left"><p>The plain text password of the credential for the account.</p></td> | ||
253 | -</tr> | ||
254 | -<tr class="odd"> | ||
255 | -<td align="left"></td> | ||
256 | -<td align="left"><p><strong>-d</strong></p></td> | ||
257 | -<td align="left"></td> | ||
258 | -<td align="left"><p>The description for the account.</p></td> | ||
259 | -</tr> | ||
260 | -<tr class="even"> | ||
261 | -<td align="left"></td> | ||
262 | -<td align="left"><p><strong>-D</strong></p></td> | ||
263 | -<td align="left"></td> | ||
264 | -<td align="left"><p>Select the database file to use instead of the one defined in the <strong>$AMNGRDB</strong> environment variable.</p></td> | ||
265 | -</tr> | ||
266 | -<tr class="odd"> | ||
267 | -<td align="left"></td> | ||
268 | -<td align="left"><p><strong>-r</strong></p></td> | ||
269 | -<td align="left"></td> | ||
270 | -<td align="left"><p>Select a recipient id for GnuPG encryption to use instead of the one defined in the <strong>$AMNGRID</strong> environment variable.</p></td> | ||
271 | -</tr> | ||
272 | -<tr class="even"> | ||
273 | -<td align="left"></td> | ||
274 | -<td align="left"><p><strong>-s</strong></p></td> | ||
275 | -<td align="left"></td> | ||
276 | -<td align="left"><p>The column separator for the <strong>amngrlist</strong> and <strong>amngrsearchcommands.</strong></p></td> | ||
277 | -</tr> | ||
278 | -</tbody> | ||
279 | -</table> | ||
280 | - | ||
281 | -ENVIRONMENT | ||
282 | ------------ | 204 | + - **-u** The login username of the credential for the account. |
205 | + - **-p** The plain text password of the credential for the account. | ||
206 | + - **-d** The description for the account. | ||
207 | + - **-D** Select the database file to use instead of the one defined in the | ||
208 | + **$AMNGRDB** environment variable. | ||
209 | + - **-r** Select a recipient id for GnuPG encryption to use instead of the one | ||
210 | + defined in the **$AMNGRID** environment variable. | ||
211 | + - **-s** The column separator for the **amngrlist** and | ||
212 | + **amngrsearchcommands**. | ||
213 | + | ||
214 | +## ENVIRONMENT | ||
283 | 215 | ||
284 | **AMNGRDB** | 216 | **AMNGRDB** |
285 | 217 | ||
@@ -298,8 +230,7 @@ option. | @@ -298,8 +230,7 @@ option. | ||
298 | 230 | ||
299 | The password length to be used when generating new passwords. | 231 | The password length to be used when generating new passwords. |
300 | 232 | ||
301 | -DEPENDENCIES | ||
302 | ------------- | 233 | +## DEPENDENCIES |
303 | 234 | ||
304 | A set of POSIX compliant shell utilities including a POSIX compliant | 235 | A set of POSIX compliant shell utilities including a POSIX compliant |
305 | shell as well are needed to run this script. | 236 | shell as well are needed to run this script. |
@@ -313,150 +244,45 @@ The existence of a reliable non blocking random source. By default this | @@ -313,150 +244,45 @@ The existence of a reliable non blocking random source. By default this | ||
313 | scripts use **$(cat /dev/urandom)** which can be changed by replacing | 244 | scripts use **$(cat /dev/urandom)** which can be changed by replacing |
314 | the alias **random** with something useful for your system. | 245 | the alias **random** with something useful for your system. |
315 | 246 | ||
316 | -For data storage **Sqlite >= 3.6.19** is required. The version | 247 | +For data storage **Sqlite >= 3.6.19** is required. The version |
317 | requirement comes from the use of foreign key constraints. | 248 | requirement comes from the use of foreign key constraints. |
318 | 249 | ||
319 | To store the data within the X clipboard the **xclip** is needed. | 250 | To store the data within the X clipboard the **xclip** is needed. |
320 | 251 | ||
321 | **The tools used are** | 252 | **The tools used are** |
322 | 253 | ||
323 | -<table> | ||
324 | -<colgroup> | ||
325 | -<col width="20%" /> | ||
326 | -<col width="20%" /> | ||
327 | -<col width="20%" /> | ||
328 | -<col width="20%" /> | ||
329 | -<col width="20%" /> | ||
330 | -</colgroup> | ||
331 | -<tbody> | ||
332 | -<tr class="odd"> | ||
333 | -<td align="left"></td> | ||
334 | -<td align="left"><p>•</p></td> | ||
335 | -<td align="left"></td> | ||
336 | -<td align="left"><p><strong>awk</strong></p></td> | ||
337 | -<td align="left"></td> | ||
338 | -</tr> | ||
339 | -<tr class="even"> | ||
340 | -<td align="left"></td> | ||
341 | -<td align="left"><p>•</p></td> | ||
342 | -<td align="left"></td> | ||
343 | -<td align="left"><p><strong>basename</strong></p></td> | ||
344 | -<td align="left"></td> | ||
345 | -</tr> | ||
346 | -<tr class="odd"> | ||
347 | -<td align="left"></td> | ||
348 | -<td align="left"><p>•</p></td> | ||
349 | -<td align="left"></td> | ||
350 | -<td align="left"><p><strong>cat</strong></p></td> | ||
351 | -<td align="left"></td> | ||
352 | -</tr> | ||
353 | -<tr class="even"> | ||
354 | -<td align="left"></td> | ||
355 | -<td align="left"><p>•</p></td> | ||
356 | -<td align="left"></td> | ||
357 | -<td align="left"><p><strong>dnsdomainname</strong></p></td> | ||
358 | -<td align="left"></td> | ||
359 | -</tr> | ||
360 | -<tr class="odd"> | ||
361 | -<td align="left"></td> | ||
362 | -<td align="left"><p>•</p></td> | ||
363 | -<td align="left"></td> | ||
364 | -<td align="left"><p><strong>echo</strong></p></td> | ||
365 | -<td align="left"></td> | ||
366 | -</tr> | ||
367 | -<tr class="even"> | ||
368 | -<td align="left"></td> | ||
369 | -<td align="left"><p>•</p></td> | ||
370 | -<td align="left"></td> | ||
371 | -<td align="left"><p><strong>getopts</strong></p></td> | ||
372 | -<td align="left"></td> | ||
373 | -</tr> | ||
374 | -<tr class="odd"> | ||
375 | -<td align="left"></td> | ||
376 | -<td align="left"><p>•</p></td> | ||
377 | -<td align="left"></td> | ||
378 | -<td align="left"><p><strong>gpg</strong></p></td> | ||
379 | -<td align="left"></td> | ||
380 | -</tr> | ||
381 | -<tr class="even"> | ||
382 | -<td align="left"></td> | ||
383 | -<td align="left"><p>•</p></td> | ||
384 | -<td align="left"></td> | ||
385 | -<td align="left"><p><strong>head</strong></p></td> | ||
386 | -<td align="left"></td> | ||
387 | -</tr> | ||
388 | -<tr class="odd"> | ||
389 | -<td align="left"></td> | ||
390 | -<td align="left"><p>•</p></td> | ||
391 | -<td align="left"></td> | ||
392 | -<td align="left"><p><strong>printf</strong></p></td> | ||
393 | -<td align="left"></td> | ||
394 | -</tr> | ||
395 | -<tr class="even"> | ||
396 | -<td align="left"></td> | ||
397 | -<td align="left"><p>•</p></td> | ||
398 | -<td align="left"></td> | ||
399 | -<td align="left"><p><strong>rm</strong></p></td> | ||
400 | -<td align="left"></td> | ||
401 | -</tr> | ||
402 | -<tr class="odd"> | ||
403 | -<td align="left"></td> | ||
404 | -<td align="left"><p>•</p></td> | ||
405 | -<td align="left"></td> | ||
406 | -<td align="left"><p><strong>shift</strong></p></td> | ||
407 | -<td align="left"></td> | ||
408 | -</tr> | ||
409 | -<tr class="even"> | ||
410 | -<td align="left"></td> | ||
411 | -<td align="left"><p>•</p></td> | ||
412 | -<td align="left"></td> | ||
413 | -<td align="left"><p><strong>SQLite3</strong> (>= 3.6.19 for foreign key constraints)</p></td> | ||
414 | -<td align="left"></td> | ||
415 | -</tr> | ||
416 | -<tr class="odd"> | ||
417 | -<td align="left"></td> | ||
418 | -<td align="left"><p>•</p></td> | ||
419 | -<td align="left"></td> | ||
420 | -<td align="left"><p><strong>test</strong> and <strong>[</strong></p></td> | ||
421 | -<td align="left"></td> | ||
422 | -</tr> | ||
423 | -<tr class="even"> | ||
424 | -<td align="left"></td> | ||
425 | -<td align="left"><p>•</p></td> | ||
426 | -<td align="left"></td> | ||
427 | -<td align="left"><p><strong>tr</strong></p></td> | ||
428 | -<td align="left"></td> | ||
429 | -</tr> | ||
430 | -<tr class="odd"> | ||
431 | -<td align="left"></td> | ||
432 | -<td align="left"><p>•</p></td> | ||
433 | -<td align="left"></td> | ||
434 | -<td align="left"><p><strong>xclip</strong></p></td> | ||
435 | -<td align="left"></td> | ||
436 | -</tr> | ||
437 | -</tbody> | ||
438 | -</table> | ||
439 | - | ||
440 | -SEE ALSO | ||
441 | --------- | 254 | + - **awk** |
255 | + - **basename** | ||
256 | + - **cat** | ||
257 | + - **dnsdomainname** | ||
258 | + - **echo** | ||
259 | + - **getopts** | ||
260 | + - **gpg** | ||
261 | + - **head** | ||
262 | + - **printf** | ||
263 | + - **rm | ||
264 | + - **shift** | ||
265 | + - **SQLite3** (>= 3.6.19 for foreign key constraints) | ||
266 | + - **test** and **[** | ||
267 | + - **tr** | ||
268 | + - **xclip** | ||
269 | + | ||
270 | +## SEE ALSO | ||
442 | 271 | ||
443 | gpg2(1), gpg-agent(1) | 272 | gpg2(1), gpg-agent(1) |
444 | 273 | ||
445 | -BUGS | ||
446 | ----- | 274 | +## BUGS |
447 | 275 | ||
448 | No known bugs. | 276 | No known bugs. |
449 | 277 | ||
450 | -AUTHOR | ||
451 | ------- | 278 | +## AUTHOR |
452 | 279 | ||
453 | Georg Hopp (georg@steffers.org.in) | 280 | Georg Hopp (georg@steffers.org.in) |
454 | 281 | ||
455 | -COPYRIGHT | ||
456 | ---------- | 282 | +## COPYRIGHT |
457 | 283 | ||
458 | Copyright © 2017 Georg Hopp License GPLv3+: GNU GPL version 3 or later | 284 | Copyright © 2017 Georg Hopp License GPLv3+: GNU GPL version 3 or later |
459 | -<http://gnu.org/licenses/gpl.html>. | 285 | +<http://gnu.org/licenses/gpl.html>. |
460 | This is free software: you are free to change and redistribute it. | 286 | This is free software: you are free to change and redistribute it. |
461 | There is NO WARRANTY, to the extent permitted by law. | 287 | There is NO WARRANTY, to the extent permitted by law. |
462 | 288 |
Please
register
or
login
to post a comment