Keys Master is fully usable from command-line, thanks to WP-CLI. You can set Keys Master options and much more, without using a web browser.
- Obtaining statistics about application passwords -
wp apwd analytics
- Managing passwords -
wp apwd paswword
- Getting Keys Master status -
wp apwd status
- Modifying operation mode -
wp apwd mode
- Managing main settings -
wp apwd settings
- Misc flags
You can get application passwords analytics for today (compared with yesterday). To do that, use the wp apwd analytics
command.
By default, the outputted format is a simple table. If you want to customize the format, just use --format=<format>
. Note if you choose json
or yaml
as format, the output will contain full data and metadata for the current day.
To display application passwords statistics, type the following command:
pierre@dev:~$ wp apwd analytics
+---------------+-----------------------------------------------------+-------+-------+-----------+
| kpi | description | value | ratio | variation |
+---------------+-----------------------------------------------------+-------+-------+-----------+
| Auth. Success | Successful authentications. | 1 | 100% | 0% |
| Passwords | Application passwords. | 10 | - | 0% |
| Created | Created application passwords. | 0 | - | 0% |
| Revoked | Revoked application passwords. | 2 | - | 0% |
| Adoption | Users having set at least one application password. | 2 | 100% | +100% |
| Usage | Application passwords usage. | 2 | - | -78.82% |
+---------------+-----------------------------------------------------+-------+-------+-----------+
To manage WordPress application passwords, use the wp apwd password <list|create|revoke> [<uuid|user_id>] [--settings=<settings>]
command.
To list application passwords of your site/network, use the wp apwd password list [<uuid|user_id>]
command.
You can filter the listed passwords as follow:
uuid
: show only the password with this UUIDuser_id
: show only passwords for a specific user
To display all the passwords for the user ID 1, type the following command:
pierre@dev:~$ wp apwd password list 1
+--------------------------------------+---------------------------+---------------+------------+
| uuid | user | name | last-used |
+--------------------------------------+---------------------------+---------------+------------+
| 21c98ff6-c903-4b44-aa9e-f60d4e35a7b5 | Pierre Lannoy (user ID 1) | Dev mod | 2020-11-23 |
| ed0f775f-2271-4570-a28b-0bc11f122b27 | Pierre Lannoy (user ID 1) | Application 1 | never |
| 0d7087aa-a080-41b2-b34e-f89831441609 | Pierre Lannoy (user ID 1) | Application 2 | 2020-11-22 |
| 2e025fcd-c7e6-4efb-b0c9-7d8cb50edf14 | Pierre Lannoy (user ID 1) | Another one | 2020-11-19 |
| b89374be-56ed-495c-935f-213252d91c6c | Pierre Lannoy (user ID 1) | Test pwd | 2020-11-23 |
+--------------------------------------+---------------------------+---------------+------------+
To display details about password 23b40ccc-f27c-4c21-a383-9ca7ad53983b
, type the following command:
pierre@dev:~$ wp apwd password list 23b40ccc-f27c-4c21-a383-9ca7ad53983b
+--------------------------------------+--------------------------------+---------------+------------+
| uuid | user | name | last-used |
+--------------------------------------+--------------------------------+---------------+------------+
| 23b40ccc-f27c-4c21-a383-9ca7ad53983b | Christophe Trente (user ID 23) | App test | 2020-11-23 |
+--------------------------------------+--------------------------------+---------------+------------+
To create a WordPress application password, use the wp apwd password create <user_id> [--settings=<settings>]
command where:
<user_id>
is a valid WordPress user ID.<settings>
a json string containing "parameter":value pairs. The only available parameter isname
; if you omit it, Keys Master will name the new password automatically.
To create an application password for user ID 1, type the following command:
pierre@dev:~$ wp apwd password create 1 --settings='{"name": "Application Test"}'
Success: the new password is tvu9q3LUv0jgEMdTbIsWlGQM. Be sure to save this in a safe location, you will not be able to retrieve it.
To revoke a WordPress application password, use the wp apwd password revoke <uuid>
command where:
<uuid>
is a valid application password UUID.
To revoke an application password with UUID 23b40ccc-f27c-4c21-a383-9ca7ad53983b
, type the following command:
pierre@dev:~$ wp apwd password revoke 23b40ccc-f27c-4c21-a383-9ca7ad53983b --yes
Success: password ed0f775f-2271-4570-a28b-0bc11fba2b27 revoked.
To get detailed status and operation mode, use the wp apwd status
command.
To set Keys Master main operation mode, use wp apwd mode <set> <none|cumulative|least>
.
If you try to set none
as mode, wp-cli will ask you to confirm. To force answer to yes without prompting, just use --yes
.
none
: disable application passwords usage by roles (standard WordPress mode)cumulative
: enable application passwords usage by roles with cumulative privilegesleast
: enable application passwords usage by roles with least privileges
To disable application passwords usage by roles without confirmation prompt, type the following command:
pierre@dev:~$ wp apwd mode set none --yes
Success: operation mode is now "no role limitation".
To toggle on/off main settings, use wp apwd settings <enable|disable> <analytics|metrics>
.
If you try to disable a setting, wp-cli will ask you to confirm. To force answer to yes without prompting, just use --yes
.
analytics
: analytics featuremetrics
: metrics collation feature
To disable analytics without confirmation prompt, type the following command:
pierre@dev:~$ wp apwd settings disable analytics --yes
Success: analytics are now deactivated.
For most commands, Keys Master lets you use the following flags:
--yes
: automatically answer "yes" when a question is prompted during the command execution.--stdout
: outputs a clean STDOUT string so you can pipe or store result of command execution.
It's not mandatory to use
--stdout
when using--format=count
or--format=ids
: in such cases--stdout
is assumed.
Note Keys Master sets exit code so you can use
$?
to write scripts. To know the meaning of Keys Master exit codes, just use the commandwp apwd exitcode list
.