|
|
|
@ -14,7 +14,6 @@ Database management functions: |
|
|
|
|
|
|
|
Account management functions: |
|
|
|
- **amngradd** − add an account credential to the database |
|
|
|
- **amngrcreate** − create a new account credential to the database |
|
|
|
- **amngrcrypt** − crypt the given data with GnuPG |
|
|
|
- **amngrdelete** − delete an account |
|
|
|
- **amngrgen** − generate a encrypted random passphrase |
|
|
|
@ -23,7 +22,6 @@ Account management functions: |
|
|
|
- **amngrgetpass** − copy active password of account to X clipboard |
|
|
|
- **amngrgetuser** − copy active username of account to X clipboard |
|
|
|
- **amngrid** − write the database id of a given account name to stdout |
|
|
|
- **amngrlist** − list all accounts |
|
|
|
- **amngrrename** − rename an account |
|
|
|
- **amngrsearch** − pattern search accounts |
|
|
|
|
|
|
|
@ -33,39 +31,35 @@ source **${PATH}/accountmanager.sh** |
|
|
|
|
|
|
|
**random** |
|
|
|
|
|
|
|
**rand\_printable** \[*len*\] |
|
|
|
**rand\_printable** \[**-h**\] \[*len*\] |
|
|
|
|
|
|
|
**amngrdbinit** \[*dbfile*\] |
|
|
|
**amngrdbinit** \[**-h**\] \[*dbfile*\] |
|
|
|
|
|
|
|
**amngrdbdestroy** \[*dbfile*\] |
|
|
|
**amngrdbdestroy** \[**-h**\] \[*dbfile*\] |
|
|
|
|
|
|
|
**amngradd** **-u** *username* **-p** *password* \[**-d** *description*\] |
|
|
|
\[**-D** *dbfile*\] \[**-r** *recipient*\] *account* |
|
|
|
**amngradd** \[**-h**\] \[**-d** *description*\] \[**-D** *dbfile*\] |
|
|
|
\[**-r** *recipient*\] *account* \[*username* \[*password*\]\] |
|
|
|
|
|
|
|
**amngrcreate** **-u** *username* \[**-d** *description*\] \[**-D** |
|
|
|
*dbfile*\] \[**-r** *recipient*\] *account* |
|
|
|
**amngrcrypt** \[**-h**\] \[**-r** *recipient*\] *password* |
|
|
|
|
|
|
|
**amngrcrypt** \[**-r** *recipient*\] *password* |
|
|
|
**amngrdelete** \[**-h**\] \[**-D** *dbfile*\] *account* |
|
|
|
|
|
|
|
**amngrdelete** *account* |
|
|
|
**amngrgen** \[**-h**\] \[**-r** *recipient*\] \[*len*\] |
|
|
|
|
|
|
|
**amngrgen** \[**-r** *recipient*\] \[*len*\] |
|
|
|
**amngrgetoldpass** \[**-h**\] \[**-D** *dbfile*\] *account* |
|
|
|
|
|
|
|
**amngrgetoldpass** *account* |
|
|
|
**amngrgetolduser** \[**-h**\] \[**-c**\] \[**-D** *dbfile*\] *account* |
|
|
|
|
|
|
|
**amngrgetolduser** *account* |
|
|
|
**amngrgetpass** \[**-h**\] \[**-D** *dbfile*\] *account* \[*state*\] |
|
|
|
|
|
|
|
**amngrgetpass** *account* |
|
|
|
**amngrgetuser** \[**-h**\] \[**-c**\] \[**-D** *dbfile*\] *account* \[*state*\] |
|
|
|
|
|
|
|
**amngrgetuser** *account* |
|
|
|
**amngrid** \[**-h**\] \[**-D** *dbfile*\] *account* |
|
|
|
|
|
|
|
**amngrid** *account* |
|
|
|
**amngrrename** \[**-h**\] \[**-D** *dbfile*\] *old\_account* *new\_account* |
|
|
|
|
|
|
|
**amngrlist** \[**-s** *separator*\] |
|
|
|
|
|
|
|
**amngrrename** *old\_account new\_account* |
|
|
|
|
|
|
|
**amngrsearch** \[**-s** *separator*\] *pattern* |
|
|
|
**amngrsearch** \[**-h**\] \[**-D** *dbfile*\] \[**-s** *separator*\] |
|
|
|
\[*pattern*\] |
|
|
|
|
|
|
|
## DESCRIPTION |
|
|
|
|
|
|
|
@ -84,55 +78,58 @@ pair. |
|
|
|
|
|
|
|
Takes no arguments and connect a non blocking random source to stdout. |
|
|
|
|
|
|
|
**rand\_printable** \[*len*\] |
|
|
|
**rand\_printable** \[**-h**\] \[*len*\] |
|
|
|
|
|
|
|
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. |
|
|
|
communicate with the SQLite database. |
|
|
|
The optional *len* argument specifies the string length to be written |
|
|
|
and defaults to 512. |
|
|
|
|
|
|
|
**amngrdbinit** \[*dbfile*\] |
|
|
|
**amngrdbinit** \[**-h**\] \[*dbfile*\] |
|
|
|
|
|
|
|
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. |
|
|
|
|
|
|
|
**amngrdbdestroy** \[*dbfile*\] |
|
|
|
**amngrdbdestroy** \[**-h**\] \[*dbfile*\] |
|
|
|
|
|
|
|
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. |
|
|
|
|
|
|
|
**amngradd -u** *username* **-p** *password* \[**-d** *description*\] |
|
|
|
\[**-D** *dbfile*\] \[**-r** *recipient*\] *account* |
|
|
|
**amngradd** \[**-h**\] \[**-d** *description*\] \[**-D** *dbfile*\] |
|
|
|
\[**-r** *recipient*\] *account* \[*username* \[*password*\]\] |
|
|
|
|
|
|
|
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**). |
|
|
|
The necessary option **-u** specifies the username to be stored with |
|
|
|
this credential pair. |
|
|
|
The also necessary option **-p** specifies the password to be stored |
|
|
|
and the length of *password* is not limited at all. |
|
|
|
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. |
|
|
|
|
|
|
|
**amngrcreate -u** *username* \[**-d** *description*\] \[**-D** |
|
|
|
*dbfile*\] \[**-r** *recipient*\] *account* |
|
|
|
|
|
|
|
This will create a password with **amngrgen** and use that to add an |
|
|
|
credential via **amngradd**. (See there for options description) |
|
|
|
The added password will be copied to the X clipboard with |
|
|
|
**amngrgetpass** for further use. |
|
|
|
|
|
|
|
**amngrcrypt** \[**-r** *recipient*\] *password* |
|
|
|
this will be marked as inactive and thus becomes inaccessible with this |
|
|
|
tools (except for **amngrdelete**). |
|
|
|
|
|
|
|
The *username* and the *account* name must not be longer than 128 |
|
|
|
characters. The *password* is not limited in its length at all. If |
|
|
|
*password* is omitted one will be generated with **amngrgen**. |
|
|
|
|
|
|
|
The *username* may also be omitted if there was a previously added |
|
|
|
credentials pair for this account. In that case the previous username is |
|
|
|
taken. It is a failure to provide a *password* without a *username*. |
|
|
|
There is no way for the script to detect this condition and you will end |
|
|
|
up with a credential where the username is the password and the password |
|
|
|
was generated. |
|
|
|
|
|
|
|
Option **-d** adds a *description* to the account entry and option |
|
|
|
**-D** specifys the *dbfile* to use. If that option is not given the |
|
|
|
**$AMNGRDB** environment variable is used. |
|
|
|
|
|
|
|
If a password was generated with this call it will be stored in the X |
|
|
|
clipboard. |
|
|
|
|
|
|
|
**amngrcrypt** \[**-h**\] \[**-r** *recipient*\] *password* |
|
|
|
|
|
|
|
Crypt the given plain text *password* with GnuPG and write it to |
|
|
|
stdout. |
|
|
|
@ -140,58 +137,59 @@ 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. |
|
|
|
|
|
|
|
**amngrdelete** *account* |
|
|
|
**amngrdelete** \[**-h**\] \[**-D** *dbfile*\] *account* |
|
|
|
|
|
|
|
Remove the *account* and all credential associated to it. |
|
|
|
|
|
|
|
**amngrgen** \[**-r** *receipient*\] \[*len*\] |
|
|
|
**amngrgen** \[**-h**\] \[**-r** *receipient*\] \[*len*\] |
|
|
|
|
|
|
|
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. |
|
|
|
|
|
|
|
**amngrgetoldpass** *account* |
|
|
|
**amngrgetoldpass** \[**-h**\] \[**-D** *dbfile*\] *account* |
|
|
|
|
|
|
|
Read and decrypt the password associated with *account* that is flagged |
|
|
|
as old and store it into the X clipboard. |
|
|
|
|
|
|
|
**amngrgetolduser** *account* |
|
|
|
**amngrgetolduser** \[**-h**\] \[**-c**\] \[**-D** *dbfile*\] *account* |
|
|
|
|
|
|
|
Read and decrypt the username associated with *account* that is flagged |
|
|
|
as old and store it into the X clipboard. |
|
|
|
|
|
|
|
**amngrgetpass** *account* |
|
|
|
**amngrgetpass** \[**-h**\] \[**-D** *dbfile*\] *account* \[*state*\] |
|
|
|
|
|
|
|
Read and decrypt the password associated with *account* that is flagged |
|
|
|
as active and store it into the X clipboard. |
|
|
|
as active and store it into the X clipboard. The *state* argument might |
|
|
|
be either 1 or 2 where 1 means get the current credential and 2 means |
|
|
|
get the old credential. It defaults to 1. |
|
|
|
|
|
|
|
**amngrgetuser** *account* |
|
|
|
**amngrgetuser** \[**-h**\] \[**-c**\] \[**-D** *dbfile*\] *account* \[*state*\] |
|
|
|
|
|
|
|
Read and decrypt the username associated with *account* that is flagged |
|
|
|
as active and store it into the X clipboard. |
|
|
|
as active and store it into the X clipboard. The *state* argument might |
|
|
|
be either 1 or 2 where 1 means get the current credential and 2 means |
|
|
|
get the old credential. It defaults to 1. |
|
|
|
|
|
|
|
**amngrid** *account* |
|
|
|
**amngrid** \[**-h**\] \[**-D** *dbfile*\] *account* |
|
|
|
|
|
|
|
(This is primarily for internal use.) Get the database id associated to |
|
|
|
the given *account* argument. |
|
|
|
|
|
|
|
**amngrlist** \[**-s** *separator*\] |
|
|
|
|
|
|
|
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. |
|
|
|
|
|
|
|
**amngrrename** *old\_account new\_account* |
|
|
|
**amngrrename** \[**-h**\] \[**-D** *dbfile*\] *old\_account |
|
|
|
new\_account* |
|
|
|
|
|
|
|
Rename the account specified by *old\_account* to *new\_account*. |
|
|
|
|
|
|
|
**amngrsearch** \[**-s** *separator*\] *pattern* |
|
|
|
**amngrsearch** \[**-h**\] \[**-D** *dbfile*\] \[**-s** *separator*\] |
|
|
|
\[*pattern*\] |
|
|
|
|
|
|
|
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**. |
|
|
|
List all accounts where *pattern* exists in either the account name, the |
|
|
|
username or the account description. 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. |
|
|
|
If *pattern* is omitted all accounts will be listed. |
|
|
|
|
|
|
|
## OPTIONS |
|
|
|
|
|
|
|
@ -199,10 +197,17 @@ 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**) |
|
|
|
|
|
|
|
**-h** − Write a short usage information. |
|
|
|
|
|
|
|
**-u** − The login username of the credential for the account. |
|
|
|
|
|
|
|
**-p** − The plain text password of the credential for the account. |
|
|
|
|
|
|
|
**-c** − By default this scripts stores the username into the X clipboard |
|
|
|
whith **ambgrgetuser** and **amngrgetolduser**. When **-c** is given |
|
|
|
the username is written to stdout. The password is never written to |
|
|
|
stdout. |
|
|
|
|
|
|
|
**-d** − The description for the account. |
|
|
|
|
|
|
|
**-D** − Select the database file to use instead of the one defined in the |
|
|
|
@ -211,8 +216,8 @@ get per option. (See **DESCRIPTION**) |
|
|
|
**-r** − Select a recipient id for GnuPG encryption to use instead of the one |
|
|
|
defined in the **$AMNGRID** environment variable. |
|
|
|
|
|
|
|
**-s** − The column separator for the **amngrlist** and |
|
|
|
**amngrsearchcommands**. |
|
|
|
**-s** − The column separator for the **amngrlist** and **amngrsearch** |
|
|
|
commands. |
|
|
|
|
|
|
|
## ENVIRONMENT |
|
|
|
|
|
|
|
@ -231,7 +236,8 @@ option. |
|
|
|
|
|
|
|
**AMNGRPWLEN** |
|
|
|
|
|
|
|
The password length to be used when generating new passwords. |
|
|
|
The password length to be used when generating new passwords. If not |
|
|
|
specified this defaults to 10. |
|
|
|
|
|
|
|
## DEPENDENCIES |
|
|
|
|
|
|
|
@ -257,7 +263,7 @@ To store the data within the X clipboard the **xclip** is needed. |
|
|
|
- **awk** |
|
|
|
- **basename** |
|
|
|
- **cat** |
|
|
|
- **dnsdomainname** |
|
|
|
- **dirname** |
|
|
|
- **echo** |
|
|
|
- **getopts** |
|
|
|
- **gpg** |
|
|
|
|