You can leverage the /sys/version-history endpoint to extract the currently running version of Vault.
Expected Outcome
End users will be able to determine the version of Vault running on a host.
Prerequisites (if applicable)
- Vault Version 1.9
Use Case
When running multiple Vault clusters it's important to be able to monitor the versions of Vault running across clusters to make planning easier, and to ensure Vault stays up to date.
Procedure
-
Simply send a LIST query to the `/sys/version-history` api endpoint.
curl \
-X LIST --header "X-Vault-Token: ..." \
http://127.0.0.1:8200/v1/sys/version-history
A response will include:
-
keys
: a list of installed versions in chronological order based on the time installed -
key_info
: a map indexed by the versions found in thekeys
list containing the following subkeys:-
build_date
: the time (in UTC) at which the Vault binary used to run the Vault server was built.Note: Only tracked from version 1.11.0 or greater -
previous_version
: the version installed prior to this version ornull
if no prior version exists -
timestamp_installed
: the time (in UTC) at which the version was installed
-
Sample Response:
{
"keys": ["1.9.0", "1.9.1", "1.9.2", "1.11.0"],
"key_info": {
"1.9.0": {
"build_date": null,
"previous_version": null,
"timestamp_installed": "2021-11-18T10:23:16Z"
},
"1.9.1": {
"build_date": null,
"previous_version": "1.9.0",
"timestamp_installed": "2021-12-13T11:09:52Z"
},
"1.9.2": {
"build_date": null,
"previous_version": "1.9.1",
"timestamp_installed": "2021-12-23T10:56:37Z"
},
"1.11.0": {
"build_date": "2022-05-03T08:34:11Z",
"previous_version": null,
"timestamp_installed": "2022-05-03T13:16:04Z"
}
}
}