<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sebastian</title>
    <description>The latest articles on DEV Community by Sebastian (@admantium).</description>
    <link>https://dev.to/admantium</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F293754%2Fd729fdfe-66dd-4fe7-a2ed-9808c1fcb46d.png</url>
      <title>DEV Community: Sebastian</title>
      <link>https://dev.to/admantium</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/admantium"/>
    <language>en</language>
    <item>
      <title>Turning the Raspberry Pi Zero into a Hacking Gadget</title>
      <dc:creator>Sebastian</dc:creator>
      <pubDate>Thu, 16 Apr 2026 04:49:02 +0000</pubDate>
      <link>https://dev.to/admantium/turning-the-raspberry-pi-zero-into-a-hacking-gadget-2ekl</link>
      <guid>https://dev.to/admantium/turning-the-raspberry-pi-zero-into-a-hacking-gadget-2ekl</guid>
      <description>&lt;p&gt;Single Board Computers with the ability to run a full-fledged Linux distribution can be used as portable devices for a wide variety of use cases. To my surprise, one of them is computer hacking. I was astonished about the creativity and ease-of-use how a Raspberry Pi, Raspberry Pi Zero or Pico can be used for potentially nefarious activities. And after a long deliberation, I decided to start writing blog posts about this subject.&lt;/p&gt;

&lt;p&gt;The article completely covers the installation, setup, and configuration to convert a Raspberry Pi Zero into a portable hacking device. Once powered, the device will start a custom WiFi endpoint and can be connected to via SSH or HTTP. It offers a CLI and a full-fledged GUI to configure the device behavior when connected to USB. And it can run shell or a custom JavaScript compatible language to initiate keyboard stokes, move the mouse, and access files of the device it is connected too. You will also learn how to combine triggers, startup templates, and HID script for an entry level exploit: When connected via USB to a host system, a text editor will be opened and a message written into it.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article is for educational purposes only. Only use computers and devices that you own, and be mindful that they can be damaged.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The initial idea for this topic was sparked by an excellent article in the German computer magazine CT 2023/27 titled "Bad USB: Raspi Zero". The articles itself cannot be accessed, but only its &lt;a href="https://www.heise.de/select/ct/2023/27/softlinks/yhhf" rel="noopener noreferrer"&gt;link collection&lt;/a&gt; is available on the public internet.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article originally appeared at my blog &lt;a href="https://admantium.com/blog/micro23_rasperry_zero_hacking_device/" rel="noopener noreferrer"&gt;admantium.com&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Writing about Hacking?
&lt;/h2&gt;

&lt;p&gt;For a long time, I have been thinking about the aspect of writing about hacking. My specific concern is about how knowledge in this area, the concrete concepts and processes, can be used for nefarious activities. On the other hand, knowledge gathered by first-hand experience, and transparent communication about it, can raise the awareness about essential dangers. Ultimately, this is tied to the question of knowledge itself: For which purpose do you use it?&lt;/p&gt;

&lt;p&gt;Physical hacking is the process of connecting an external device to a target computer and starting an exploit. The goals of hacking are manifold, starting from recording interactions that happen at the computer, reading and copying computer files or the computer memory, running user interactions like keystrokes or mouse movements, executing scripts to modify the system or install new applications. An exploit is the concrete process to achieve a goal, and it can be a combination of intended computer behavior (e.g. registering a USB device) with known or new vulnerabilities in a computer system.&lt;/p&gt;

&lt;p&gt;I'm no security consultant, but working in IT, I'm exposed to security topics on a daily basis. Bridging the gap from theoretical knowledge to hands-on experiences while further exploring the amazing Raspberry Pi use cases provided the final nudge to start this blog series. And with this realization, I also feel the need to formulate a disclaimer: This blog content is presented as-is for educational purposes. Only use them on computer systems that you own, and be aware that you can damage the systems.&lt;/p&gt;

&lt;p&gt;Finally, bear in mind that explored concepts in this article are written from a beginner’s mind.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hardware Requirements and Assembly
&lt;/h2&gt;

&lt;p&gt;The required hardware for this article is as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Raspberry Pi Zero W (specifically not a Pi Zero W)&lt;/li&gt;
&lt;li&gt;USB Dongle (for example the &lt;a href="https://wiki.52pi.com/index.php?title=EP-0097" rel="noopener noreferrer"&gt;EP-0097&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The USB dongle needs to be assembled to turn the Zero into a USB hacking device. The particular dongle that I acquired did not include a construction manual, but its components seemed manageable.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fml89lpey5m03s356rxbz.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fml89lpey5m03s356rxbz.jpg" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However, trying to assemble it manually surfaced an embarrassing knowledge gap. Specifically, I thought that the connection pins of the USB dongle need to be connected to the Zeros GPI pins. But no, right next to the Zeros USB ports, external circuit "touchpoints" are exposed - the dongle pins merely need to touch them too.&lt;/p&gt;

&lt;p&gt;To assemble the USB dongle correctly, follow these steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Remove the protection layer from the acryl board&lt;/li&gt;
&lt;li&gt;Put the thinner acryl board to the bottom&lt;/li&gt;
&lt;li&gt;Put the dongle board on top so that the backside of the extruding pins aligns&lt;/li&gt;
&lt;li&gt;Put the thicker acryl board on top, aligning with the pins outward facing direction&lt;/li&gt;
&lt;li&gt;Put the RPI Zero with the bottom side down and align the connector pins with the touchpoints&lt;/li&gt;
&lt;li&gt;Carefully tighten the screws&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The resulting device should look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiodpglatu3sueb2unae3.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiodpglatu3sueb2unae3.jpg" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Software Installation &amp;amp; First Boot
&lt;/h2&gt;

&lt;p&gt;To turn the RPI Zero into a hacking device, the Linux Distribution &lt;a href="https://github.com/RoganDawes/P4wnP1_aloa" rel="noopener noreferrer"&gt;P4wnP1 ALOA&lt;/a&gt; - called PPA from here -  will be used. This is a custom Linux distribution, build on top of Kali Linux and specifically modified to run on the RPI Zero. As any other OS, the installation encompasses downloading the image, flashing it onto a SD Card, and booting the device.&lt;/p&gt;

&lt;p&gt;The specific steps in detail:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to the &lt;a href="https://github.com/RoganDawes/P4wnP1_aloa" rel="noopener noreferrer"&gt;P4wnP1 ALOA release page&lt;/a&gt; and download the latest version (Note: Don't be discouraged by the release date of February 2020 - the project works very well!)&lt;/li&gt;
&lt;li&gt;Open an image software of your choice, then flash the image (my recommendation is &lt;a href="https://www.balena.io/etcher/" rel="noopener noreferrer"&gt;Balena Etcher&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After this, put the SD Card into the device, and power it via the USB mini port.&lt;/p&gt;

&lt;p&gt;Shortly after booting, PPA creates a custom WiFi with an awkward, UTF8 icon encoded named: "💥 🖥️ 💥". Connect to it with the password &lt;code&gt;MaMe82-P4wnP1&lt;/code&gt;, and once the connection is established, you start exploring the many configuration options.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tool Overview
&lt;/h2&gt;

&lt;p&gt;PPA is a special Linux distribution with flexible and run-time configurable hardware features of the Raspberry Pi Zero. It provides access to this configuration both via the Web GUI and a CLI. After reading the projects extensive documentation and using the tool for some time, the Web GUI provides more features and will be used exclusively in the remainder of this article.&lt;/p&gt;

&lt;p&gt;With an active connection to the hotspot, open &lt;code&gt;http://172.24.0.1:8000&lt;/code&gt; in a browser to access the configuration screen:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7u3e1dt5mkpn2gp24bqc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7u3e1dt5mkpn2gp24bqc.png" width="800" height="550"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Each section in this GUI is a configurable building block of the complete functionality. By learning one section at a time, the overall number of available features becomes clearer.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hardware Settings
&lt;/h3&gt;

&lt;p&gt;Most sections in the tool menu directly modify the hardware features.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;USB: In this section, you define the USB properties when the Zero is connected to the targets. Available options start with the ID, serial number and vendor name, and continue with which USB functions the device offers. It can serve as an ethernet adapter, an HID device (keyboard, mouse, custom HID like pointer), as a serial interface, and as USB storage.&lt;/li&gt;
&lt;li&gt;WiFi: You can enable or disable the WiFi, change its SSID and PSK, and define its channel and visibility.&lt;/li&gt;
&lt;li&gt;Bluetooth: The Bluetooth stack provides several configuration options. The basic ones: availability, discoverability, and connectivity. Furthermore, you can configure if other devices are pairable with/without a key. BLE and Blue Toot High Speed are also supported. Lastly, different Bluetooth network encapsulation protocol services are provided: Network Access Point, Portable Area Network, and Group Ad-hoc network.&lt;/li&gt;
&lt;li&gt;Network: In this category, you can configure the concrete network interface settings for the &lt;code&gt;bteth&lt;/code&gt;, &lt;code&gt;usbeth&lt;/code&gt; and &lt;code&gt;wlan0&lt;/code&gt;. For an DHCP server, the IPv4 gateway address, client addresses and netmask, and static hosts. Alternatively, you can also configure interfaces with just static addresses or as clients.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Behavior Programming
&lt;/h3&gt;

&lt;p&gt;To create and manage scripts that are executed when the USB stick is connected to a host, you can use the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Trigger Actions: A combination of an event and a concrete action. For an event, several options exist: system checkpoints during startup (Wifi AP, core services), when an USB gadget connects or disconnects, when an external WiFi AP is joined, values on group channel, and even when a GPIO input is detection. The actions can be to write a log entry, send a value to a group channel, set an output to a GPIO, as well as starting a HID script or bash script. Each trigger action can be set to run only and exactly once, or continuously every time it occurs.&lt;/li&gt;
&lt;li&gt;HID Script: The heart of exploitation scripting. PPA provides a JavaScript compatible language to program complex behavior that runs on the target machines. As provided in the documentation, special attention was given to robust and OS-agnostic keyboard interactions, including keyboard layout, timing of keystrokes, and waiting for keyboard input. Also, the mouse cursor can be controlled, and combining it with the concrete physical dimensions of the target screen, pixel perfect controls can be achieved. Finally, all JavaScript concepts can be used, giving access to functions, loops, complex conditions and much more.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Log and Settings
&lt;/h3&gt;

&lt;p&gt;Two more sections complete the configurability of the PPA device.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Event Log: Shows all on-device stored log messages that PPA created during its usage. Messages are retained and persisted between boots, giving a complete picture how and when it was used.&lt;/li&gt;
&lt;li&gt;Generic Settings: The very last menu item appears a bit misleadingly named - it does not control the overall GUI, but the concrete run- and boot time behavior of PPA. Essentially, the Master Template Editor allows you to select and combine any defined USB, WiFi, Bluetooth, and Network setting, as well as the Trigger actions. With this, you specify the concrete behavior of the PPA, essentially arming the device for its intend purpose. The other options are to restart or shutdown the system, and to create or restore a backup of all user-define settings and modifications.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Writing and activating an HID Exploit
&lt;/h2&gt;

&lt;p&gt;The feature of PPA is extensive, and for a beginner exploring the device features, it might seem daunting to find a good start point. Following the project documentation closely, let’s start with a script that opens a text editor on the host and writes a message. The target OS is Linux Ubuntu.&lt;/p&gt;

&lt;p&gt;In the GUI, open the HID Script tab. The editor features syntax highlighting and remote execution for testing purposes. Paste the following code into the editor:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;layout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;de&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;   &lt;span class="c1"&gt;// US keyboard layout&lt;/span&gt;
&lt;span class="nf"&gt;typingSpeed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;150&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// Wait 100ms between key strokes + an additional random value between 0ms and 150ms (natural)&lt;/span&gt;

&lt;span class="c1"&gt;//waitLED(ANY_OR_NONE);  // Wait till NUM LED of target changes frequently multiple times (doesn't work on OSX)&lt;/span&gt;

&lt;span class="nf"&gt;delay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nf"&gt;press&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;CTRL ALT t&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nf"&gt;delay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nf"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;gedit&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;delay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nf"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello from Raspberry Pi Zero&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you see, the commands relate directly to executing keystrokes on the target machines, enriched by meta-arguments to influence the typing process. The function &lt;code&gt;layout&lt;/code&gt; sets the target keyboard, and the &lt;code&gt;delay&lt;/code&gt; function defines a random time range for each keystroke, making interactions more natural. With &lt;code&gt;waitForLed&lt;/code&gt;, a specific trigger can be added, deferring the script execution until keyboard interaction is detected. This prevents executing the script when e.g. the screen is still locked by the user.&lt;/p&gt;

&lt;p&gt;Now, to run this script, two options exist. If you connected the Raspberry Zero directly to a host system, you could click on "Run". The other option is to actually program this script to be executed when the Raspberry Zero is connected to a computer. For this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on "Store" and define a suitable name for the script.&lt;/li&gt;
&lt;li&gt;Select the tab "Trigger Action" and click on "Add one"&lt;/li&gt;
&lt;li&gt;In the dialog, activate the "Enabled" slider, then fill out the trigger "USB gadget connected to host", and in the action field the option "start a HID script" as well as the given script name file (also see the next picture)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvhvwx3zcjueoyufhpr7u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvhvwx3zcjueoyufhpr7u.png" width="800" height="443"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The final step is to store and activate this trigger definition:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Still on the "Trigger Action" tab, click on "Store" to save all active triggers as a configuration&lt;/li&gt;
&lt;li&gt;Go to on "Generic Settings", and in the "Master Template Editor", select the Trigger Action template that you just stored&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That’s it. Now you can connect the stick to a Linux host computer and see the script happening.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where to Continue
&lt;/h2&gt;

&lt;p&gt;Exploring the depth of HID script to write advanced exploits is not the focus of this article. However, I explored some ideas and give my summary here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/RoganDawes/P4wnP1" rel="noopener noreferrer"&gt;P4wnP1&lt;/a&gt;: The ancestor project. It includes links to videos and presentations showing particular exploits.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/whatotter/pwnhyve" rel="noopener noreferrer"&gt;pwnhyve&lt;/a&gt;: Naming itself as a sibling project, it focuses on bad USB capabilities and the injection of shellcode into target computers.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/lgeekjopt/P4wnP1_aloa/releases/tag/pi_zero2w" rel="noopener noreferrer"&gt;pi_zero2w&lt;/a&gt; Another developer forked the project and created a version that runs on a Raspberry Pi Zero 2 W, but it with fewer Kali Linux tools and no Bluetooth support&lt;/li&gt;
&lt;li&gt;Explore HID Script language: Unfortunately, there is no written document of the language, and digging into the project source code did not reveal an approachable form to me. Considering related rubber duck scripts, the general attack vector is to use HID commands to deploy a base64 decoded scripts for the shell language of the target system (PowerShell for Windows, Bash for Linux), which is then executed to install additional malware or a backdoor.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/V0lk3n/HIDScripts" rel="noopener noreferrer"&gt;HID Script collection&lt;/a&gt;: This repository is the only other source of examples. It contains script that target Windows Systems to steal credentials and password and provides examples both in HID and in Rubber Duck script.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Small form-size single board computer can be used as hacking gadgets. This article showed how to turn a Raspberry Pi Zero into a bad USB device, a specific form of physical hacking in which an inserted USB stick executes command on the host. You only need a Raspberry Pi Zero, an USB dongle to expose the Zeros USB ports, and the PPA Linux Image. Once the initial setup is completed, the Zero turns into a WiFi and SSH accessible device with complex configuration options for all hardware features. To write a bad USB exploit, the HID language, based on JavaScript, can be used to instruct a sequence of keystrokes. This article showed only a simple exploit: Opening the systems text editor to write a message. Yet the potential for serious exploits becomes visible: By executing shell scripts on the targets, access to the system can be achieved, stealing credentials or installing malware and backdoors.&lt;/p&gt;

</description>
      <category>raspberrypi</category>
      <category>raspberryzero</category>
    </item>
    <item>
      <title>Hashicorp Vault CLI Part 9: Managing Encryption Keys</title>
      <dc:creator>Sebastian</dc:creator>
      <pubDate>Mon, 06 Apr 2026 05:09:16 +0000</pubDate>
      <link>https://dev.to/admantium/hashicorp-vault-cli-part-9-managing-encryption-keys-fi9</link>
      <guid>https://dev.to/admantium/hashicorp-vault-cli-part-9-managing-encryption-keys-fi9</guid>
      <description>&lt;p&gt;Hashicorp Vault provides many features, and the secure storage of encrypted data and secrets is at its heart. Secrets engines are dedicated plugins that govern this storage. They can be grouped into builtin, application and services, cloud, and encryption keys. While all secret engines provide a REST API for interaction, some Vault builtin engines also have dedicated CLI commands.&lt;/p&gt;

&lt;p&gt;In this article, all CLI commands for managing or using keys are explored. These commands target the transform, transit, pki and ssh secrets engines. To further the understanding of applying these commands, examples in the context of a local, three server Vault cluster will be shown.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The technical context of this article is &lt;code&gt;hashicorp_vault_v1.21.1&lt;/code&gt;, released 2025-11-18. All provided information and command examples should be valid with newer versions too, baring an update of the CLI commands' syntax&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The background material for this article stems from the official Hashicorp Vault documentation about &lt;a href="https://developer.hashicorp.com/vault/docs/commands" rel="noopener noreferrer"&gt;Vault CLI&lt;/a&gt; and subsequent pages, as well as information from the binary itself&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article originally appeared at my blog &lt;a href="https://admantium.com/blog/vault18_cli_p9_secrets_management_encryption_keys/" rel="noopener noreferrer"&gt;admantium.com&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Vault CLI Overview
&lt;/h2&gt;

&lt;p&gt;The Vault CLI provides more than 30 commands. For systematically explaining and contextualizing each command, they can be structured as follows.&lt;/p&gt;

&lt;p&gt;Groups and commands marked with a checkmark were covered in an earlier article, and commands marked with an at sign are the focus for this article.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ Initialization

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;server&lt;/code&gt;: Starts a server process&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;agent&lt;/code&gt;: Starts an agent process, a utility to communicate with a vault server to gain access to tokens&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;proxy&lt;/code&gt;: Starts a vault proxy process&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;✅ Configuration

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;operator&lt;/code&gt;: Cluster management operations, including memberships, encryption and unseal keys&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;plugin&lt;/code&gt;: Manage and install additional plugins&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;read&lt;/code&gt; / &lt;code&gt;list&lt;/code&gt;: Access stored configuration and secrets&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;write&lt;/code&gt; / &lt;code&gt;patch&lt;/code&gt;: Modify or create any data&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;delete&lt;/code&gt;: Delete configuration data or secrets&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;✅ Introspection

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;status&lt;/code&gt;: Show status information of the vault server&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;version&lt;/code&gt;: Shows compact version information and build timestamp&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;version-history&lt;/code&gt;: Shows detailed version information about all previously used vault server instances&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;print&lt;/code&gt;: Detailed view of the vault’s server runtime configuration&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;path-help&lt;/code&gt;: Detailed documentation about API endpoints&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;events&lt;/code&gt;: Subscribe to the event stream of a running vault instance&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;monitor&lt;/code&gt;: Print vault log messages&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;debug&lt;/code&gt;: Shows debug information of the connected Vault server&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;audit&lt;/code&gt;: Interact with connected audit devices&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;✅ Vault Enterprise

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;hcp&lt;/code&gt;: Operate a managed Hashicorp Vault cluster&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;namespace&lt;/code&gt;: Interact with configured namespaces of the cluster&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;✅ Authorization

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;policy&lt;/code&gt;: Manage policy definitions that govern all vault operations&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;tokens&lt;/code&gt;: General token management&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;lease&lt;/code&gt;: Manage current token leases, including renewal, revocation and TTL modification&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Authentication

&lt;ul&gt;
&lt;li&gt;✅ &lt;code&gt;auth&lt;/code&gt;: Interact with configured authentication options&lt;/li&gt;
&lt;li&gt;✅ &lt;code&gt;login&lt;/code&gt;: Authenticates access to a Vault server&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Secrets Management

&lt;ul&gt;
&lt;li&gt;✅ &lt;code&gt;secrets&lt;/code&gt;: General configuration of secret engines&lt;/li&gt;
&lt;li&gt;✅ &lt;code&gt;kv&lt;/code&gt;: Access to the essential key-value store&lt;/li&gt;
&lt;li&gt;🌀 &lt;code&gt;transform&lt;/code&gt;: Interact with the transform secrets engine&lt;/li&gt;
&lt;li&gt;🌀 &lt;code&gt;transit&lt;/code&gt;: Interact with the Vaults transit secrets engine&lt;/li&gt;
&lt;li&gt;🌀 &lt;code&gt;unwrap&lt;/code&gt;: One-time access to arbitrary encrypted data&lt;/li&gt;
&lt;li&gt;🌀 &lt;code&gt;pki&lt;/code&gt;: Access the private key infrastructure secrets engine&lt;/li&gt;
&lt;li&gt;🌀 &lt;code&gt;ssh&lt;/code&gt;: Initiates SSH sessions via the SSH secrets engine&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  General Purpose Encryption Key Commands
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;transform&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;transform&lt;/code&gt; command allows to import a self-managed key for the purpose of defining a new generic or a special format preserving encryption tokenizer.&lt;/p&gt;

&lt;p&gt;Alas, the transform secret engine is a Vault enterprise feature. A try to mount the secret engine merely results in an error.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault secrets &lt;span class="nb"&gt;enable &lt;/span&gt;transform

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Error enabling: Error making API request.

URL: POST http://127.0.0.1:8210/v1/sys/mounts/transform
Code: 400. Errors:

&lt;span class="k"&gt;*&lt;/span&gt; plugin not found &lt;span class="k"&gt;in &lt;/span&gt;the catalog: transform

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Retrieving wrapping key.
failed to fetch wrapping key: no mount found at transform: &amp;lt;nil&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;transit&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Normally, secret data is stored in Vault, but the transit engine instead encrypts or decrypts provided data without keeping a record of it. Therefore, it can be considered encryption-as-a-service.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;transit&lt;/code&gt; command allows to import external, self-managed keys with the &lt;code&gt;import&lt;/code&gt; or &lt;code&gt;import-version&lt;/code&gt; subcommands. Here is a full example, starting with the secret engines’ activation, key generation, and key import.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Activate the transit secret engine&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault secrets &lt;span class="nb"&gt;enable &lt;/span&gt;transit

&lt;span class="c"&gt;# Generate the key in DER format, then encode in base64&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; openssl genpkey &lt;span class="nt"&gt;-algorithm&lt;/span&gt; ed25519 &lt;span class="nt"&gt;-outform&lt;/span&gt; DER &lt;span class="nt"&gt;-out&lt;/span&gt; ed25519.key.der 
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;cat &lt;/span&gt;ed25519.key.der| &lt;span class="nb"&gt;base64&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; ed25519.key.b64

&lt;span class="c"&gt;# Import the key&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault transit import transit/keys/ed25519 @ed25519.key.b64 &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"ed25519-2048"&lt;/span&gt; &lt;span class="nv"&gt;derived&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;true&lt;/span&gt;

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Retrieving wrapping key.
Wrapping &lt;span class="nb"&gt;source &lt;/span&gt;key with ephemeral key.
Encrypting ephemeral key with wrapping key.
Submitting wrapped key.
Success!

&lt;span class="c"&gt;# Check the key&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault &lt;span class="nb"&gt;read &lt;/span&gt;transit/keys/rsa

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Key                            Value
&lt;span class="nt"&gt;---&lt;/span&gt;                            &lt;span class="nt"&gt;-----&lt;/span&gt;
allow_plaintext_backup         &lt;span class="nb"&gt;false
&lt;/span&gt;auto_rotate_period             0s
convergent_encryption          &lt;span class="nb"&gt;false
&lt;/span&gt;deletion_allowed               &lt;span class="nb"&gt;false
&lt;/span&gt;derived                        &lt;span class="nb"&gt;true
&lt;/span&gt;exportable                     &lt;span class="nb"&gt;false
&lt;/span&gt;imported_key                   &lt;span class="nb"&gt;true
&lt;/span&gt;imported_key_allow_rotation    &lt;span class="nb"&gt;false
&lt;/span&gt;kdf                            hkdf_sha256
keys                           map[1:map[certificate_chain: creation_time:2025-12-23T08:18:13.700025+01:00 hybrid_public_key: name:ed25519 public_key:]]
latest_version                 1
min_available_version          0
min_decryption_version         1
min_encryption_version         0
name                           ed25519
supports_decryption            &lt;span class="nb"&gt;false
&lt;/span&gt;supports_derivation            &lt;span class="nb"&gt;true
&lt;/span&gt;supports_encryption            &lt;span class="nb"&gt;false
&lt;/span&gt;supports_signing               &lt;span class="nb"&gt;true
type                           &lt;/span&gt;ed25519
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;unwrap&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The conventional workflow to access secrets in Hashicorp Vault is that a user or system authorizes, retrieves a token, and accesses end points to which the policies associated with the issued token provide sufficient access rights. However, in some situations, it might not be desirable to allow access for a prolonged period of time, or it is required to access a stored secret only once. For these situations, Vault provides a feature called response wrapping. The original returned data is encrypted and stored in a cubbyhole secret, and a token to decrypt this secret is returned instead. To retrieve this secret, the unwrap function can be used.&lt;/p&gt;

&lt;p&gt;The following example shows how to create a secret in a KV store, then wrapping the secret access, and then to unwrap it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault secrets &lt;span class="nb"&gt;enable&lt;/span&gt; &lt;span class="nt"&gt;--version&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Success! Enabled the kv secrets engine at: kv/

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv put kv/data/config-db &lt;span class="nv"&gt;admin&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0ab84480a1efb802c1bd2 

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
&lt;span class="o"&gt;=====&lt;/span&gt; Secret Path &lt;span class="o"&gt;=====&lt;/span&gt;
kv/data/data/config-db

&lt;span class="o"&gt;=======&lt;/span&gt; Metadata &lt;span class="o"&gt;=======&lt;/span&gt;
Key                Value
&lt;span class="nt"&gt;---&lt;/span&gt;                &lt;span class="nt"&gt;-----&lt;/span&gt;
created_time       2025-12-15T08:48:25.820085Z
custom_metadata    &amp;lt;nil&amp;gt;
deletion_time      n/a
destroyed          &lt;span class="nb"&gt;false
&lt;/span&gt;version            1

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv get &lt;span class="nt"&gt;-wrap-ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1m kv/data/config-db

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Key                              Value
&lt;span class="nt"&gt;---&lt;/span&gt;                              &lt;span class="nt"&gt;-----&lt;/span&gt;
wrapping_token:                  hvs.CAESIKQIDe0zG0kMxKAMQVtk5n6dkt6FJ-1BOgkybvh1sddvGh4KHGh2cy43NTJGdG0xd1pqRkpMVnA2VExOS1ZWb00
wrapping_accessor:               B5rcG14qOl1y0SXUmpnr6J1n
wrapping_token_ttl:              1m
wrapping_token_creation_time:    2025-12-15 09:50:02.085264 +0100 CET
wrapping_token_creation_path:    kv/data/data/config-db

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault unwrap hvs.CAESIKQIDe0zG0kMxKAMQVtk5n6dkt6FJ-1BOgkybvh1sddvGh4KHGh2cy43NTJGdG0xd1pqRkpMVnA2VExOS1ZWb00

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Key         Value
&lt;span class="nt"&gt;---&lt;/span&gt;         &lt;span class="nt"&gt;-----&lt;/span&gt;
data        map[admin:0ab84480a1efb802c1bd2]
metadata    map[created_time:2025-12-15T08:48:25.820085Z custom_metadata:&amp;lt;nil&amp;gt; deletion_time: destroyed:false version:1]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Encryption Key Management
&lt;/h2&gt;

&lt;p&gt;The pki secrets engine allows Vault to become an automated certificate issuer. Covering the complete lifecycle, from CSR to CER and revocation, external systems can get certificates as required.&lt;/p&gt;

&lt;p&gt;With the &lt;code&gt;vault pki&lt;/code&gt; command, several subcommands for certificate issuing and revocation are offered. Internally, they will perform a sequence of CRUD operations, reading from and writing to several endpoints. To operate the engine with its full functionality, the general CRUD methods need to be used, which were covered in my earlier article &lt;a href="https://admantium.com/blog/vault12_cli_p3_plugin_and_general_crud_configuration" rel="noopener noreferrer"&gt;Plugin Management and General CRUD Operations&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To cover the certificate creation process from root to intermediate, the Vault documentation suggests to use multiple pki engines at different mount points. Following commands create the required example context:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault secrets &lt;span class="nb"&gt;enable &lt;/span&gt;pki

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault write &lt;span class="nt"&gt;-field&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;certificate pki/root/generate/internal &lt;span class="nv"&gt;common_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;admantium.com &lt;span class="nv"&gt;exported&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;internal &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; root_ca.cer

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault write pki/config/urls &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nv"&gt;issuing_certificates&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$VAULT_ADDR&lt;/span&gt;&lt;span class="s2"&gt;/v1/pki/ca"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nv"&gt;crl_distribution_points&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$VAULT_ADDR&lt;/span&gt;&lt;span class="s2"&gt;/v1/pki/crl"&lt;/span&gt;

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault secrets &lt;span class="nb"&gt;enable&lt;/span&gt; &lt;span class="nt"&gt;-path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;pki_intermediate pki
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;vault pki health-check&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;With this command, a complete introspection to all endpoints of the PKI engine is provided. Its output checks aspects such as certificate validity, configuration for the external ACME issuer service, and more.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault pki health-check pki/

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
ca_validity_period
&lt;span class="nt"&gt;------------------&lt;/span&gt;
status      endpoint                                            message
&lt;span class="nt"&gt;------&lt;/span&gt;      &lt;span class="nt"&gt;--------&lt;/span&gt;                                            &lt;span class="nt"&gt;-------&lt;/span&gt;
critical    /pki/issuer/1cc848d5-b781-d4d3-2ab7-893d5e31f3ce    Issuer&lt;span class="s1"&gt;'s validity is outside of the suggested rotation window: issuer is valid until 2026-01-25 but expires within 6mo (ending on 2026-06-22). It is suggested to start rotating this issuer to new key material to avoid future downtime caused by this current issuer expiring.


crl_validity_period
-------------------
status    endpoint                                                      message
------    --------                                                      -------
ok        /pki/issuer/1cc848d5-b781-d4d3-2ab7-893d5e31f3ce/crl          CRL'&lt;/span&gt;s validity &lt;span class="o"&gt;(&lt;/span&gt;2025-12-24 to 2025-12-27&lt;span class="o"&gt;)&lt;/span&gt; is OK.
ok        /pki/issuer/1cc848d5-b781-d4d3-2ab7-893d5e31f3ce/crl/delta    Delta CRL&lt;span class="s1"&gt;'s validity (2025-12-24 to 2025-12-27) is OK.


root_issued_leaves
------------------
status    endpoint      message
------    --------      -------
ok        /pki/certs    Root certificate(s) in this mount have not directly issued non-CA leaf certificates.


role_allows_localhost
---------------------
status    endpoint    message
------    --------    -------


role_allows_glob_wildcards
--------------------------
status    endpoint    message
------    --------    -------


role_no_store_false
-------------------
status    endpoint    message
------    --------    -------


audit_visibility
----------------
status           endpoint                message
------           --------                -------
informational    /sys/mounts/pki/tune    Mount currently HMACs csr because it is not in audit_non_hmac_request_keys; as this is not a sensitive security parameter, it is encouraged to disable HMACing to allow better auditing of the PKI engine.


allow_if_modified_since
-----------------------
status           endpoint                message
------           --------                -------
informational    /sys/mounts/pki/tune    Mount hasn'&lt;/span&gt;t enabled If-Modified-Since Request or Last-Modified Response headers&lt;span class="p"&gt;;&lt;/span&gt; consider enabling these headers to allow clients to fetch CAs and CRLs only when they&lt;span class="s1"&gt;'ve changed, reducing total bandwidth.


enable_auto_tidy
----------------
status           endpoint                 message
------           --------                 -------
informational    /pki/config/auto-tidy    Auto-tidy is currently disabled; consider enabling auto-tidy to execute tidy operations periodically. This helps the health and performance of a mount.


tidy_last_run
-------------
status      endpoint            message
------      --------            -------
critical    /pki/tidy-status    Tidy hasn'&lt;/span&gt;t run since this mount was created&lt;span class="p"&gt;;&lt;/span&gt; this can point to problems with the mount&lt;span class="s1"&gt;'s auto-tidy configuration or an external tidy executor; this can impact PKI'&lt;/span&gt;s and Vault&lt;span class="s1"&gt;'s performance if not run regularly. It is suggested to enable auto-tidy on this mount.


too_many_certs
--------------
status    endpoint      message
------    --------      -------
ok        /pki/certs    This mount has an OK number of stored certificates.


enable_acme_issuance
--------------------
status            endpoint            message
------            --------            -------
not_applicable    /pki/config/acme    Mount contains only root issuers, ACME is not required.


allow_acme_headers
------------------
status            endpoint            message
------            --------            -------
not_applicable    /pki/config/acme    ACME is not enabled, no additional response headers required.

vault write -field=certificate pki/root/generate/internal \
     common_name="example.com" \
     issuer_name="Admantium_Root_CA" &amp;gt; root_2023_ca.crt
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;vault pki issue&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;To create an intermediate certificate, the &lt;code&gt;issue&lt;/code&gt; subcommands requires the paths to the PKI engine that provides the root CA, the path to the PKI engine that creates the intermediate certificate, and flags for the issuer name and the common name of the new certificate.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault pki issue &lt;span class="nt"&gt;-issuer_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Admantium_Root_CA"&lt;/span&gt; /pki/issuer/default /pki_intermediate/ &lt;span class="nv"&gt;common_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"blog.adamantium.com"&lt;/span&gt;

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Key                               Value
&lt;span class="nt"&gt;---&lt;/span&gt;                               &lt;span class="nt"&gt;-----&lt;/span&gt;
ca_chain                          &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;-----BEGIN&lt;/span&gt; CERTIFICATE-----
MIIDRzCCAi+gAwIBAgIUX8qna7garPJWG7jWuW+Bp5MUPPAwDQYJKoZIhvcNAQEL
BQAwFjEUMBIGA1UEAxMLZXhhbXBsZS5jb20wHhcNMjUxMjI0MDk1NzMwWhcNMjYw
...
&lt;span class="nt"&gt;-----END&lt;/span&gt; CERTIFICATE-----

crl_distribution_points           &lt;span class="o"&gt;[]&lt;/span&gt;
delta_crl_distribution_points     &lt;span class="o"&gt;[]&lt;/span&gt;
enable_aia_url_templating         &lt;span class="nb"&gt;false
&lt;/span&gt;issuer_id                         9ea4aa8d-e69b-bb33-55cd-8a732dbe1d9d
issuer_name                       Admantium_Root_CA
issuing_certificates              &lt;span class="o"&gt;[]&lt;/span&gt;
key_id                            ce6a7bda-4a62-5f40-1d67-feff574e3629
leaf_not_after_behavior           err
manual_chain                      &amp;lt;nil&amp;gt;
ocsp_servers                      &lt;span class="o"&gt;[]&lt;/span&gt;
revocation_signature_algorithm    n/a
revoked                           &lt;span class="nb"&gt;false
&lt;/span&gt;usage                             crl-signing,issuing-certificates,ocsp-signing,read-only
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;vault pki reissue&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;A configured intermediate certificate issuer can be used as a template for another provider, where some attributes are modified. This is the goal of the &lt;code&gt;reissue&lt;/code&gt; command, and it requires the three PKI engine endpoints for the root CA, the intermediate the serves as the template, and the new issuer endpoint.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault pki reissue &lt;span class="nt"&gt;-issuer_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Admantium_Root_CA"&lt;/span&gt; /pki/issuer/default /pki_intermediate/issuer/Admantium_Root_CA /pki_intermediate_2/ &lt;span class="nv"&gt;common_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"blog2.admantium.com"&lt;/span&gt;

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Key                               Value
&lt;span class="nt"&gt;---&lt;/span&gt;                               &lt;span class="nt"&gt;-----&lt;/span&gt;
ca_chain                          &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;-----BEGIN&lt;/span&gt; CERTIFICATE-----
MIIDXDCCAkSgAwIBAgIUEHX6GOJK+GirdUbIhxupfimJhCswDQYJKoZIhvcNAQEL
BQAwFjEUMBIGA1UEAxMLZXhhbXBsZS5jb20wHhcNMjUxMjI0MTAxNzA2WhcNMjYw
...
&lt;span class="nt"&gt;-----END&lt;/span&gt; CERTIFICATE-----

crl_distribution_points           &lt;span class="o"&gt;[]&lt;/span&gt;
delta_crl_distribution_points     &lt;span class="o"&gt;[]&lt;/span&gt;
enable_aia_url_templating         &lt;span class="nb"&gt;false
&lt;/span&gt;issuer_id                         a4d92cfc-b71f-6492-47b2-5f0afb90bc8b
issuer_name                       Admantium_Root_CA
issuing_certificates              &lt;span class="o"&gt;[]&lt;/span&gt;
key_id                            9b629040-5903-cf8a-e0bd-9ade319b8099
leaf_not_after_behavior           err
manual_chain                      &amp;lt;nil&amp;gt;
ocsp_servers                      &lt;span class="o"&gt;[]&lt;/span&gt;
revocation_signature_algorithm    n/a
revoked                           &lt;span class="nb"&gt;false
&lt;/span&gt;usage                             crl-signing,issuing-certificates,ocsp-signing,read-only
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;vault pki list-intermediate&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;When the hierarchies of root to intermediate certificate becomes complex, this command can help to gain an overview. It requires the complete path to any certificate issuer, and lists all derived certificates.&lt;/p&gt;

&lt;p&gt;As an example, when called on the root CA, it lists all so-far created certificates:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault pki list-intermediates /pki/issuer/default

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
intermediate                                                      match?
&lt;span class="nt"&gt;------------&lt;/span&gt;                                                      &lt;span class="nt"&gt;------&lt;/span&gt;
pki_intermediate_2/issuer/b177e38f-8e3f-85c3-fed7-15e806d29010    &lt;span class="nb"&gt;true
&lt;/span&gt;pki_intermediate_2/issuer/d8873760-fe81-2062-8db8-9d03a0f16634    &lt;span class="nb"&gt;true
&lt;/span&gt;pki/issuer/0d365720-0d53-79a2-de95-f56fa434a0d5                   &lt;span class="nb"&gt;true
&lt;/span&gt;pki_intermediate/issuer/30bfd385-34d5-7d30-6400-82381469c21c      &lt;span class="nb"&gt;true
&lt;/span&gt;pki_intermediate/issuer/9ea4aa8d-e69b-bb33-55cd-8a732dbe1d9d      &lt;span class="nb"&gt;true
&lt;/span&gt;pki_intermediate_2/issuer/a4d92cfc-b71f-6492-47b2-5f0afb90bc8b    &lt;span class="nb"&gt;true

&lt;/span&gt;intermediate                                                    match?
&lt;span class="nt"&gt;------------&lt;/span&gt;                                                    &lt;span class="nt"&gt;------&lt;/span&gt;
pki_intermediate/issuer/30bfd385-34d5-7d30-6400-82381469c21c    &lt;span class="nb"&gt;true
&lt;/span&gt;pki_intermediate/issuer/9ea4aa8d-e69b-bb33-55cd-8a732dbe1d9d    &lt;span class="nb"&gt;true
&lt;/span&gt;pki/issuer/0d365720-0d53-79a2-de95-f56fa434a0d5                 &lt;span class="nb"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;vault pki verify-sign&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This command checks if the first given issuer was used to sign the second provided intermediate certificate.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault pki verify-sign pki/issuer/0d365720-0d53-79a2-de95-f56fa434a0d5 pki_intermediate/issuer/30bfd385-34d5-7d30-6400-82381469c21c

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
issuer:pki/issuer/0d365720-0d53-79a2-de95-f56fa434a0d5
issued:pki_intermediate/issuer/30bfd385-34d5-7d30-6400-82381469c21c

field              value
&lt;span class="nt"&gt;-----&lt;/span&gt;              &lt;span class="nt"&gt;-----&lt;/span&gt;
trust_match        &lt;span class="nb"&gt;true
&lt;/span&gt;key_id_match       &lt;span class="nb"&gt;true
&lt;/span&gt;signature_match    &lt;span class="nb"&gt;true
&lt;/span&gt;subject_match      &lt;span class="nb"&gt;true
&lt;/span&gt;path_match         &lt;span class="nb"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Encryption Key Usage
&lt;/h2&gt;

&lt;p&gt;The ssh secret engine allows connection to a remote machine based on signed SSH keys or one-time passwords. This allows users and systems to gain access to remote systems with ephemeral secrets, greatly improving security.&lt;/p&gt;

&lt;p&gt;To create the context for this section's example, run the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault &lt;span class="nb"&gt;enable &lt;/span&gt;secret ssh

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault write ssh/roles/otp &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nv"&gt;key_type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;otp &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nv"&gt;default_user&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;admin &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nv"&gt;cidr_list&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;192.168.1.0/26
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;vault ssh&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;vault ssh&lt;/code&gt; command establishes a connection to any remote host by one of these options. To establish a SSH connection to a remote host, the command needs to be called with a defined role, a mode, and a connection string:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault ssh &lt;span class="nt"&gt;-role&lt;/span&gt; otp &lt;span class="nt"&gt;-mode&lt;/span&gt; otp admin@192.168.1.42

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Vault could not locate &lt;span class="s2"&gt;"sshpass"&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt; The OTP code &lt;span class="k"&gt;for &lt;/span&gt;the session is displayed
below. Enter this code &lt;span class="k"&gt;in &lt;/span&gt;the SSH password prompt. If you &lt;span class="nb"&gt;install &lt;/span&gt;sshpass,
Vault can automatically perform this step &lt;span class="k"&gt;for &lt;/span&gt;you.
OTP &lt;span class="k"&gt;for &lt;/span&gt;the session is: 99a09001-cfb6-2b4a-b422-fb9adb306125
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The Vault CLI offers more than 30 subcommands. In a continuous blog article series, all commands were systematically explored and explained. In this final article, commands for handling encryption keys were covered. You learned how to a) import self-managed keys to the &lt;code&gt;transit&lt;/code&gt; engine, b) use &lt;code&gt;unwrap&lt;/code&gt; to decrypt data, c) utilize &lt;code&gt;pki&lt;/code&gt; to issue root and intermediate certificates on demand, and d) establish &lt;code&gt;ssh&lt;/code&gt; connections to remote hosts using ephemeral secrets.&lt;/p&gt;

</description>
      <category>hashicorp</category>
      <category>vault</category>
      <category>hashicorpvault</category>
    </item>
    <item>
      <title>Hashicorp Vault CLI Part 8: Secrets Management and Key-Value Engine</title>
      <dc:creator>Sebastian</dc:creator>
      <pubDate>Thu, 26 Mar 2026 06:08:55 +0000</pubDate>
      <link>https://dev.to/admantium/hashicorp-vault-cli-part-8-secrets-management-and-key-value-engine-153g</link>
      <guid>https://dev.to/admantium/hashicorp-vault-cli-part-8-secrets-management-and-key-value-engine-153g</guid>
      <description>&lt;p&gt;Hashicorp Vault is a tool for managing secrets and encrypted data. Upon successful authentication, a policy-based system authorizes access to Vault endpoints. All configuration aspects, as well as available functional featured, can be managed via its CLI.&lt;/p&gt;

&lt;p&gt;In an ongoing series, all CLI commands are explored systematically. The focus of this article are commands from the secret’s management group. Specifically, the management if secret engines themselves, and commands for working with encrypted data.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The technical context of this article is &lt;code&gt;hashicorp_vault_v1.21.1&lt;/code&gt;, released 2025-11-18. All provided information and command examples should be valid with newer versions too, baring an update of the CLI commands' syntax&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The background material for this article stems from the official Hashicorp Vault documentation about &lt;a href="https://developer.hashicorp.com/vault/docs/commands" rel="noopener noreferrer"&gt;Vault CLI&lt;/a&gt; and subsequent pages, as well as information from the binary itself&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article originally appeared at my blog &lt;a href="https://admantium.com/blog/vault17_cli_p8_secrets_management_encrypted_data.md/" rel="noopener noreferrer"&gt;admantium.com&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Vault CLI Overview
&lt;/h2&gt;

&lt;p&gt;The Vault CLI provides more than 30 commands. For systematically explaining and contextualizing each command, they can be structured as follows.&lt;/p&gt;

&lt;p&gt;Groups marked with a checkmark were covered in an earlier article, and the commands marked with an at sign are the focus for this article.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ Initialization

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;server&lt;/code&gt;: Starts a server process&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;agent&lt;/code&gt;: Starts an agent process, a utility to communicate with a vault server to gain access to tokens&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;proxy&lt;/code&gt;: Starts a vault proxy process&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;✅ Configuration

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;operator&lt;/code&gt;: Cluster management operations, including memberships, encryption and unseal keys&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;plugin&lt;/code&gt;: Manage and install additional plugins&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;read&lt;/code&gt; / &lt;code&gt;list&lt;/code&gt;: Access stored configuration and secrets&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;write&lt;/code&gt; / &lt;code&gt;patch&lt;/code&gt;: Modify or create any data&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;delete&lt;/code&gt;: Delete configuration data or secrets&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;✅ Introspection

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;status&lt;/code&gt;: Show status information of the vault server&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;version&lt;/code&gt;: Shows compact version information and build timestamp&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;version-history&lt;/code&gt;: Shows detailed version information about all previously used vault server instances&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;print&lt;/code&gt;: Detailed view of the vault’s server runtime configuration&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;path-help&lt;/code&gt;: Detailed documentation about API endpoints&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;events&lt;/code&gt;: Subscribe to the event stream of a running vault instance&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;monitor&lt;/code&gt;: Print vault log messages&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;debug&lt;/code&gt;: Shows debug information of the connected Vault server&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;audit&lt;/code&gt;: Interact with connected audit devices&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;✅ Vault Enterprise

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;hcp&lt;/code&gt;: Operate a managed Hashicorp Vault cluster&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;namespace&lt;/code&gt;: Interact with configured namespaces of the cluster&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;✅ Authorization

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;policy&lt;/code&gt;: Manage policy definitions that govern all vault operations&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;tokens&lt;/code&gt;: General token management&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;lease&lt;/code&gt;: Manage current token leases, including renewal, revocation and TTL modification&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;✅ Authentication

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;auth&lt;/code&gt;: Interact with configured authentication options&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;login&lt;/code&gt;: Authenticates access to a Vault server&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Secrets Management

&lt;ul&gt;
&lt;li&gt;🌀 &lt;code&gt;secrets&lt;/code&gt;: General configuration of secret engines&lt;/li&gt;
&lt;li&gt;🌀 &lt;code&gt;kv&lt;/code&gt;: Access to the essential key-value store&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;transform&lt;/code&gt;: Interact with the transform secrets engine&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;transit&lt;/code&gt;: Interact with the Vaults transit secrets engine&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;unwrap&lt;/code&gt;: One-time access to arbitrary encrypted data&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;pki&lt;/code&gt;: Access the private key infrastructure secrets engine&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ssh&lt;/code&gt;: Initiates SSH sessions via the SSH secrets engine&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Secret Engine Management
&lt;/h2&gt;

&lt;p&gt;Secrets engines manage different types of encrypted data. They can be grouped into native, applications and services, cloud provider, and encryption keys. For a detailed explanation, see my earlier article about &lt;a href="https://admantium.com/blog/vault05_secret_management_engines/" rel="noopener noreferrer"&gt;Secret Management Engines&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;secret&lt;/code&gt; command governs the complete life-cycle of an engine, from activation to re-configuration and dismantling. In the following sections, a kv-v2 engine will be regarded.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;kv secrets enable&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Every engine needs to be activated at first. A minimalist invocation of the &lt;code&gt;enable&lt;/code&gt; command&lt;br&gt;
 with just the secret engine name applies its default configuration including the mount path. Alternatively, all exposed configuration options can be passed as flags to customize the engine right from the start.&lt;/p&gt;

&lt;p&gt;To activate a kv-v2 engine with default properties:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault secrets &lt;span class="nb"&gt;enable &lt;/span&gt;kv-v2

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
2025-12-19T09:01:22.459+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core: successful mount: &lt;span class="nv"&gt;namespace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="nv"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;kv-v2/ &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;kv &lt;span class="nv"&gt;version&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"v0.25.0+builtin"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Custom configurations can be applied during setup. The list of options is long, and support varies by engine. Available are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;default-lease-ttl=&amp;lt;duration&amp;gt;&lt;/code&gt;: The TTL value for all leases issued by the engine&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;description=&amp;lt;string&amp;gt;&lt;/code&gt;: Additional documentation for this secret engine, intended for users&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;external-entropy-access=&amp;lt;bool&amp;gt;&lt;/code&gt;: Allow this engine to access external entropy sources&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;force-no-cache=&amp;lt;bool&amp;gt;&lt;/code&gt;: Configure the caching behavior of the engine&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;listing-visibility=&amp;lt;string&amp;gt;&lt;/code&gt;: Controls if the engine should be visible to authenticated unauthenticated users. Allowed values are &lt;code&gt;hidden&lt;/code&gt; and &lt;code&gt;unauth&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;local=&amp;lt;bool&amp;gt;&lt;/code&gt;: Secret engines configuration and values are normally replicated in the context of running Vault as a cluster. This option can disable this behavior.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;max-lease-ttl=&amp;lt;duration&amp;gt;&lt;/code&gt;: The maximum TTL of issues leases. If this time passes, the lease can not be renewed again.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;options=&amp;lt;key=value&amp;gt;&lt;/code&gt;: Additional generic options passed to the engine.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;path=&amp;lt;string&amp;gt;&lt;/code&gt;: The mount path of the engine. Needs to be unique.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;plugin-name=&amp;lt;string&amp;gt;&lt;/code&gt;: Vaults plugin nature allows developers to implement custom engine. This configuration option sets the correct plugin to use.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;plugin-version=&amp;lt;string&amp;gt;&lt;/code&gt;: Set the plugins version to use.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;seal-wrap&lt;/code&gt;: All secrets are encrypted with Vault-internal keys. This option allows to use additional keys for storing and reading secret data.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;version=&amp;lt;int&amp;gt;&lt;/code&gt;: The version of the secret engine.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is an example to create the kv-v2 engine with specific options.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault secrets &lt;span class="nb"&gt;enable&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"datacenter secrets"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-external-entropy-access&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;true&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-listing-visibility&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;hidden &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-force-no-cache&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;true&lt;/span&gt; &lt;span class="nt"&gt;-path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;kv2 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-default-lease-ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;5m &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-max-lease-ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1h &lt;span class="se"&gt;\&lt;/span&gt;
  kv-v2

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
2025-12-19T09:52:44.260+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core: successful mount: &lt;span class="nv"&gt;namespace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="nv"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;kv2/ &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;kv &lt;span class="nv"&gt;version&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"v0.25.0+builtin"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;kv secrets list&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This command shows all currently activated secret engines. The output can be formatted as table, JSON or YAML, and the &lt;code&gt;-detailed&lt;/code&gt; flags&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault secrets list &lt;span class="nt"&gt;-format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;json

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="s2"&gt;"cubbyhole/"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"uuid"&lt;/span&gt;: &lt;span class="s2"&gt;"2da6947a-8eb4-8bca-7405-8d056e87d997"&lt;/span&gt;,
    &lt;span class="s2"&gt;"type"&lt;/span&gt;: &lt;span class="s2"&gt;"cubbyhole"&lt;/span&gt;,
    &lt;span class="s2"&gt;"description"&lt;/span&gt;: &lt;span class="s2"&gt;"per-token private secret storage"&lt;/span&gt;,
    &lt;span class="s2"&gt;"accessor"&lt;/span&gt;: &lt;span class="s2"&gt;"cubbyhole_376f2732"&lt;/span&gt;,
    &lt;span class="s2"&gt;"config"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
      &lt;span class="s2"&gt;"default_lease_ttl"&lt;/span&gt;: 0,
      &lt;span class="s2"&gt;"max_lease_ttl"&lt;/span&gt;: 0,
      &lt;span class="s2"&gt;"force_no_cache"&lt;/span&gt;: &lt;span class="nb"&gt;false&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;,
    &lt;span class="s2"&gt;"options"&lt;/span&gt;: null,
    &lt;span class="s2"&gt;"local"&lt;/span&gt;: &lt;span class="nb"&gt;true&lt;/span&gt;,
    &lt;span class="s2"&gt;"seal_wrap"&lt;/span&gt;: &lt;span class="nb"&gt;false&lt;/span&gt;,
    &lt;span class="s2"&gt;"external_entropy_access"&lt;/span&gt;: &lt;span class="nb"&gt;false&lt;/span&gt;,
    &lt;span class="s2"&gt;"plugin_version"&lt;/span&gt;: &lt;span class="s2"&gt;""&lt;/span&gt;,
    &lt;span class="s2"&gt;"running_plugin_version"&lt;/span&gt;: &lt;span class="s2"&gt;"v1.21.1+builtin.vault"&lt;/span&gt;,
    &lt;span class="s2"&gt;"running_sha256"&lt;/span&gt;: &lt;span class="s2"&gt;""&lt;/span&gt;,
    &lt;span class="s2"&gt;"deprecation_status"&lt;/span&gt;: &lt;span class="s2"&gt;""&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;,
  &lt;span class="s2"&gt;"identity/"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"uuid"&lt;/span&gt;: &lt;span class="s2"&gt;"985d0186-a541-5905-fabb-70352eaf55b9"&lt;/span&gt;,
    &lt;span class="s2"&gt;"type"&lt;/span&gt;: &lt;span class="s2"&gt;"identity"&lt;/span&gt;,
    &lt;span class="s2"&gt;"description"&lt;/span&gt;: &lt;span class="s2"&gt;"identity store"&lt;/span&gt;,
    &lt;span class="s2"&gt;"accessor"&lt;/span&gt;: &lt;span class="s2"&gt;"identity_6676eb9f"&lt;/span&gt;,
    &lt;span class="s2"&gt;"config"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
      &lt;span class="s2"&gt;"default_lease_ttl"&lt;/span&gt;: 0,
      &lt;span class="s2"&gt;"max_lease_ttl"&lt;/span&gt;: 0,
      &lt;span class="s2"&gt;"force_no_cache"&lt;/span&gt;: &lt;span class="nb"&gt;false&lt;/span&gt;,
      &lt;span class="s2"&gt;"passthrough_request_headers"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
        &lt;span class="s2"&gt;"Authorization"&lt;/span&gt;
      &lt;span class="o"&gt;]&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;,
    &lt;span class="s2"&gt;"options"&lt;/span&gt;: null,
    &lt;span class="s2"&gt;"local"&lt;/span&gt;: &lt;span class="nb"&gt;false&lt;/span&gt;,
    &lt;span class="s2"&gt;"seal_wrap"&lt;/span&gt;: &lt;span class="nb"&gt;false&lt;/span&gt;,
    &lt;span class="s2"&gt;"external_entropy_access"&lt;/span&gt;: &lt;span class="nb"&gt;false&lt;/span&gt;,
    &lt;span class="s2"&gt;"plugin_version"&lt;/span&gt;: &lt;span class="s2"&gt;""&lt;/span&gt;,
    &lt;span class="s2"&gt;"running_plugin_version"&lt;/span&gt;: &lt;span class="s2"&gt;"v1.21.1+builtin.vault"&lt;/span&gt;,
    &lt;span class="s2"&gt;"running_sha256"&lt;/span&gt;: &lt;span class="s2"&gt;""&lt;/span&gt;,
    &lt;span class="s2"&gt;"deprecation_status"&lt;/span&gt;: &lt;span class="s2"&gt;""&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;,
  &lt;span class="s2"&gt;"kv2/"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"uuid"&lt;/span&gt;: &lt;span class="s2"&gt;"f7192663-902b-bc9f-da68-762c82c3738b"&lt;/span&gt;,
    &lt;span class="s2"&gt;"type"&lt;/span&gt;: &lt;span class="s2"&gt;"kv"&lt;/span&gt;,
    &lt;span class="s2"&gt;"description"&lt;/span&gt;: &lt;span class="s2"&gt;"datacenter secrets"&lt;/span&gt;,
    &lt;span class="s2"&gt;"accessor"&lt;/span&gt;: &lt;span class="s2"&gt;"kv_20ee0106"&lt;/span&gt;,
    &lt;span class="s2"&gt;"config"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
      &lt;span class="s2"&gt;"default_lease_ttl"&lt;/span&gt;: 300,
      &lt;span class="s2"&gt;"max_lease_ttl"&lt;/span&gt;: 3600,
      &lt;span class="s2"&gt;"force_no_cache"&lt;/span&gt;: &lt;span class="nb"&gt;true&lt;/span&gt;,
      &lt;span class="s2"&gt;"listing_visibility"&lt;/span&gt;: &lt;span class="s2"&gt;"hidden"&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;,
    &lt;span class="s2"&gt;"options"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
      &lt;span class="s2"&gt;"version"&lt;/span&gt;: &lt;span class="s2"&gt;"2"&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;,
    &lt;span class="s2"&gt;"local"&lt;/span&gt;: &lt;span class="nb"&gt;false&lt;/span&gt;,
    &lt;span class="s2"&gt;"seal_wrap"&lt;/span&gt;: &lt;span class="nb"&gt;false&lt;/span&gt;,
    &lt;span class="s2"&gt;"external_entropy_access"&lt;/span&gt;: &lt;span class="nb"&gt;true&lt;/span&gt;,
    &lt;span class="s2"&gt;"plugin_version"&lt;/span&gt;: &lt;span class="s2"&gt;""&lt;/span&gt;,
    &lt;span class="s2"&gt;"running_plugin_version"&lt;/span&gt;: &lt;span class="s2"&gt;"v0.25.0+builtin"&lt;/span&gt;,
    &lt;span class="s2"&gt;"running_sha256"&lt;/span&gt;: &lt;span class="s2"&gt;""&lt;/span&gt;,
    &lt;span class="s2"&gt;"deprecation_status"&lt;/span&gt;: &lt;span class="s2"&gt;"supported"&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;,
  &lt;span class="s2"&gt;"postgres/"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"uuid"&lt;/span&gt;: &lt;span class="s2"&gt;"50dae925-f07d-184c-a824-096e5719e213"&lt;/span&gt;,
    &lt;span class="s2"&gt;"type"&lt;/span&gt;: &lt;span class="s2"&gt;"database"&lt;/span&gt;,
    &lt;span class="s2"&gt;"description"&lt;/span&gt;: &lt;span class="s2"&gt;""&lt;/span&gt;,
    &lt;span class="s2"&gt;"accessor"&lt;/span&gt;: &lt;span class="s2"&gt;"database_53cdbc55"&lt;/span&gt;,
    &lt;span class="s2"&gt;"config"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
      &lt;span class="s2"&gt;"default_lease_ttl"&lt;/span&gt;: 0,
      &lt;span class="s2"&gt;"max_lease_ttl"&lt;/span&gt;: 0,
      &lt;span class="s2"&gt;"force_no_cache"&lt;/span&gt;: &lt;span class="nb"&gt;false&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;,
    &lt;span class="s2"&gt;"options"&lt;/span&gt;: null,
    &lt;span class="s2"&gt;"local"&lt;/span&gt;: &lt;span class="nb"&gt;false&lt;/span&gt;,
    &lt;span class="s2"&gt;"seal_wrap"&lt;/span&gt;: &lt;span class="nb"&gt;false&lt;/span&gt;,
    &lt;span class="s2"&gt;"external_entropy_access"&lt;/span&gt;: &lt;span class="nb"&gt;false&lt;/span&gt;,
    &lt;span class="s2"&gt;"plugin_version"&lt;/span&gt;: &lt;span class="s2"&gt;""&lt;/span&gt;,
    &lt;span class="s2"&gt;"running_plugin_version"&lt;/span&gt;: &lt;span class="s2"&gt;"v1.21.1+builtin.vault"&lt;/span&gt;,
    &lt;span class="s2"&gt;"running_sha256"&lt;/span&gt;: &lt;span class="s2"&gt;""&lt;/span&gt;,
    &lt;span class="s2"&gt;"deprecation_status"&lt;/span&gt;: &lt;span class="s2"&gt;""&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;,
  &lt;span class="s2"&gt;"sys/"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"uuid"&lt;/span&gt;: &lt;span class="s2"&gt;"9fc5f342-99e3-4d0a-b7c7-f3f015417a4e"&lt;/span&gt;,
    &lt;span class="s2"&gt;"type"&lt;/span&gt;: &lt;span class="s2"&gt;"system"&lt;/span&gt;,
    &lt;span class="s2"&gt;"description"&lt;/span&gt;: &lt;span class="s2"&gt;"system endpoints used for control, policy and debugging"&lt;/span&gt;,
    &lt;span class="s2"&gt;"accessor"&lt;/span&gt;: &lt;span class="s2"&gt;"system_5265b4ea"&lt;/span&gt;,
    &lt;span class="s2"&gt;"config"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
      &lt;span class="s2"&gt;"default_lease_ttl"&lt;/span&gt;: 0,
      &lt;span class="s2"&gt;"max_lease_ttl"&lt;/span&gt;: 0,
      &lt;span class="s2"&gt;"force_no_cache"&lt;/span&gt;: &lt;span class="nb"&gt;false&lt;/span&gt;,
      &lt;span class="s2"&gt;"passthrough_request_headers"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
        &lt;span class="s2"&gt;"Accept"&lt;/span&gt;
      &lt;span class="o"&gt;]&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;,
    &lt;span class="s2"&gt;"options"&lt;/span&gt;: null,
    &lt;span class="s2"&gt;"local"&lt;/span&gt;: &lt;span class="nb"&gt;false&lt;/span&gt;,
    &lt;span class="s2"&gt;"seal_wrap"&lt;/span&gt;: &lt;span class="nb"&gt;true&lt;/span&gt;,
    &lt;span class="s2"&gt;"external_entropy_access"&lt;/span&gt;: &lt;span class="nb"&gt;false&lt;/span&gt;,
    &lt;span class="s2"&gt;"plugin_version"&lt;/span&gt;: &lt;span class="s2"&gt;""&lt;/span&gt;,
    &lt;span class="s2"&gt;"running_plugin_version"&lt;/span&gt;: &lt;span class="s2"&gt;"v1.21.1+builtin.vault"&lt;/span&gt;,
    &lt;span class="s2"&gt;"running_sha256"&lt;/span&gt;: &lt;span class="s2"&gt;""&lt;/span&gt;,
    &lt;span class="s2"&gt;"deprecation_status"&lt;/span&gt;: &lt;span class="s2"&gt;""&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;,
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;kv secrets move&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;When a secrets engine mount path should be changed, this command can be used.&lt;/p&gt;

&lt;p&gt;Here is an example to move the kv-v2 engine to a more descriptive mount path reflecting its intended use-case:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault secrets move kv2 datacenter-secrets/

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
2025-12-19T10:06:07.937+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core.mounts.migration: Starting to update the mount table and revoke leases: &lt;span class="nv"&gt;from_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;kv2/ &lt;span class="nv"&gt;migration_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;d5c3b5d9-d0b8-4bd8-4b9a-c29e471fb0e1 &lt;span class="nv"&gt;namespace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="nv"&gt;to_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;datacenter-secrets/
2025-12-19T10:06:08.162+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core.mounts.migration: Removing the &lt;span class="nb"&gt;source &lt;/span&gt;mount from filtered paths on secondaries: &lt;span class="nv"&gt;from_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;kv2/ &lt;span class="nv"&gt;migration_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;d5c3b5d9-d0b8-4bd8-4b9a-c29e471fb0e1 &lt;span class="nv"&gt;namespace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="nv"&gt;to_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;datacenter-secrets/
2025-12-19T10:06:08.162+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core.mounts.migration: Updating quotas associated with the &lt;span class="nb"&gt;source &lt;/span&gt;mount: &lt;span class="nv"&gt;from_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;kv2/ &lt;span class="nv"&gt;migration_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;d5c3b5d9-d0b8-4bd8-4b9a-c29e471fb0e1 &lt;span class="nv"&gt;namespace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="nv"&gt;to_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;datacenter-secrets/
2025-12-19T10:06:08.162+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core.mounts.migration: Completed mount move operations: &lt;span class="nv"&gt;from_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;kv2/ &lt;span class="nv"&gt;migration_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;d5c3b5d9-d0b8-4bd8-4b9a-c29e471fb0e1 &lt;span class="nv"&gt;namespace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="nv"&gt;to_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;datacenter-secrets/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;kv secrets tune&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Once a secret engine became operational, its configuration might need a modification. The &lt;code&gt;tune&lt;/code&gt; command accepts most command from its activations, except those that govern the encryption itself, such as &lt;code&gt;external-entropy-access&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To modify the kv-v2 engine:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault secrets tune &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"stores datacenter secrets"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-listing-visibility&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;unauth &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-default-lease-ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;10m datacenter-secrets

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
2025-12-19T10:23:13.086+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core: mount tuning of listing_visibility successful: &lt;span class="nv"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;datacenter-secrets/
2025-12-19T10:23:43.231+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core: mount tuning of leases successful: &lt;span class="nv"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;datacenter-secrets/
2025-12-19T10:23:43.351+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core: mount tuning of description successful: &lt;span class="nv"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;datacenter-secrets/ &lt;span class="nv"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"stores datacenter secrets"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;kv secrets disable&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;When the secret engine is not required anymore, it can be turned off. All existing leases will be deleted, and all stored date is removed irreversible.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault secrets disable datacenter-secrets

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
2025-12-19T10:29:32.553+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core: successfully unmounted: &lt;span class="nv"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;datacenter-secrets/ &lt;span class="nv"&gt;namespace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Key-Value Secret Engine Data Commands
&lt;/h2&gt;

&lt;p&gt;Vault comes with several built-in secrets engines, and the key-value store is the most generic one. Once configured, secrets in the form of key-value pairs can be stored at any nested path, allowing to reflect organizational or logical structure.&lt;/p&gt;

&lt;p&gt;The key-value store is available in two different versions, a quick differentiation is this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The kv-v1 store is more runtime efficient and requires fewer storage space. Secrets are stored unversioned. When a command overwrites data at an existing path, its data is lost. Furthermore, deletion is also non-recoverable.&lt;/li&gt;
&lt;li&gt;The kv-v2 store adds versioning to all paths, with a default but tunable value of 10 versions. Storing data at an already defined path increments the version counter. Older versions can be read until the increments surpass the defined maximum value. Any version can be erased recoverable with the &lt;code&gt;delete&lt;/code&gt; command, or non-recoverable with the &lt;code&gt;destroy&lt;/code&gt; command. Finally, when using the vault CLI generic CRUD commands, the actual paths to access the secret need to differentiate between &lt;code&gt;&amp;lt;mount_path&amp;gt;/data/&amp;lt;name&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;mount_path&amp;gt;/metadata/&amp;lt;name&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Assuming a CRUD lifecycle, the &lt;code&gt;kv&lt;/code&gt; subcommands can be seperated as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creation

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;put&lt;/code&gt;: Adds a new secret or new version of the secret at a defined path&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Reading

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;list&lt;/code&gt;: Shows all secrets at a designated path, or at subsequent path parts&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;get&lt;/code&gt;: Access a specific secret and expose all its metadata&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Update

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;patch&lt;/code&gt;: Modify existing data without incrementing the version&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;rollback&lt;/code&gt;: Restores a previous version of a secret&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;undelete&lt;/code&gt;: Restores a secret, or versions of a secrets, that were marked for deletion&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;enable-versioning&lt;/code&gt;: Adds versioning capabilities to a secret if not present already&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Delete

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;delete&lt;/code&gt;: Removes a secret, or versions of a secret, but keeping an internal, recoverable record&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;destroy&lt;/code&gt;: Non-recoverable erasing of a secret or versions of secrets&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Only in an kv-v2 store are all CLI commands available, and will therfore be the context for this section. The store is created with the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault secrets &lt;span class="nb"&gt;enable&lt;/span&gt; &lt;span class="nt"&gt;-path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;kv2 kv-v2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;kv put&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;In its simplest form, a single key-value pair can be stored at an arbitrary path. The command can include the secret data directly, which will be stored in the Shell history and therefore exposed, or read from file.&lt;/p&gt;

&lt;p&gt;To pass secrets directly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv put kv2/api-creds &lt;span class="nv"&gt;aws&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;75ae33a4b907bc87796

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
&lt;span class="o"&gt;===&lt;/span&gt; Secret Path &lt;span class="o"&gt;===&lt;/span&gt;
kv2/data/api-creds

&lt;span class="o"&gt;=======&lt;/span&gt; Metadata &lt;span class="o"&gt;=======&lt;/span&gt;
Key                Value
&lt;span class="nt"&gt;---&lt;/span&gt;                &lt;span class="nt"&gt;-----&lt;/span&gt;
created_time       2025-12-20T08:13:57.536865Z
custom_metadata    &amp;lt;nil&amp;gt;
deletion_time      n/a
destroyed          &lt;span class="nb"&gt;false
&lt;/span&gt;version            1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Another option is to store the secret data in a file, and pass multiple key-value pairs to the command, where the &lt;code&gt;key&lt;/code&gt; is determined by the command, and its value by the content of the file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv put kv2/api-creds &lt;span class="nv"&gt;value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;@/tmp/aws.scr.txt

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
&lt;span class="o"&gt;===&lt;/span&gt; Secret Path &lt;span class="o"&gt;===&lt;/span&gt;
kv2/data/api-creds

&lt;span class="o"&gt;=======&lt;/span&gt; Metadata &lt;span class="o"&gt;=======&lt;/span&gt;
Key                Value
&lt;span class="nt"&gt;---&lt;/span&gt;                &lt;span class="nt"&gt;-----&lt;/span&gt;
created_time       2025-12-20T08:33:49.738235Z
custom_metadata    &amp;lt;nil&amp;gt;
deletion_time      n/a
destroyed          &lt;span class="nb"&gt;false
&lt;/span&gt;version            2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Interestingly, the file content can even be binary, as the following example shows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;dd &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/dev/urandom &lt;span class="nv"&gt;of&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/tmp/binary.scr.txt &lt;span class="nv"&gt;bs&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;30

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv put kv2/api-creds &lt;span class="nv"&gt;binary&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;@/tmp/binary.scr.txt

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
&lt;span class="o"&gt;===&lt;/span&gt; Secret Path &lt;span class="o"&gt;===&lt;/span&gt;
kv2/data/api-creds

&lt;span class="o"&gt;=======&lt;/span&gt; Metadata &lt;span class="o"&gt;=======&lt;/span&gt;
Key                binary
&lt;span class="nt"&gt;---&lt;/span&gt;                &lt;span class="nt"&gt;-----&lt;/span&gt;
created_time       2025-12-20T08:42:50.150485Z
custom_metadata    &amp;lt;nil&amp;gt;
deletion_time      n/a
destroyed          &lt;span class="nb"&gt;false
&lt;/span&gt;version            4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;kv list&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;To get an overview about all secrets, the &lt;code&gt;list&lt;/code&gt; command can be called with to secrets engines root-path.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv list kv2

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Keys
&lt;span class="nt"&gt;----&lt;/span&gt;
api-creds
databases
kubernetes
kubernetes/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As the output shows, it lists the top-level paths only. When structured paths are defined, they will be shown with a trailing &lt;code&gt;/&lt;/code&gt;. These paths need to be exposed additionally.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv list kv2/kubernetes/

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Keys
&lt;span class="nt"&gt;----&lt;/span&gt;
datacenter1
datacenter2
datacenter3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;kv get&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This command retrieves all data stored at a specific path. Unless scoped, the most recent version will be returned.&lt;/p&gt;

&lt;p&gt;Here is an example that returns the most-recent version, also showing that binary data was stored:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;  vault kv get kv2/api-creds

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
&lt;span class="o"&gt;===&lt;/span&gt; Secret Path &lt;span class="o"&gt;===&lt;/span&gt;
kv2/data/api-creds

&lt;span class="o"&gt;=======&lt;/span&gt; Metadata &lt;span class="o"&gt;=======&lt;/span&gt;
Key                Value
&lt;span class="nt"&gt;---&lt;/span&gt;                &lt;span class="nt"&gt;-----&lt;/span&gt;
created_time       2025-12-20T09:27:46.102492Z
custom_metadata    &amp;lt;nil&amp;gt;
deletion_time      n/a
destroyed          &lt;span class="nb"&gt;false
&lt;/span&gt;version            3

&lt;span class="o"&gt;====&lt;/span&gt; Data &lt;span class="o"&gt;====&lt;/span&gt;
Key      Value
&lt;span class="nt"&gt;---&lt;/span&gt;      &lt;span class="nt"&gt;-----&lt;/span&gt;
binary    7J&lt;span class="se"&gt;\Z&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;kMTtcyM/T
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To return a different version instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv get &lt;span class="nt"&gt;-version&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2 kv2/api-creds

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
&lt;span class="o"&gt;===&lt;/span&gt; Secret Path &lt;span class="o"&gt;===&lt;/span&gt;
kv2/data/api-creds

&lt;span class="o"&gt;=======&lt;/span&gt; Metadata &lt;span class="o"&gt;=======&lt;/span&gt;
Key                Value
&lt;span class="nt"&gt;---&lt;/span&gt;                &lt;span class="nt"&gt;-----&lt;/span&gt;
created_time       2025-12-20T09:26:19.01058Z
custom_metadata    &amp;lt;nil&amp;gt;
deletion_time      n/a
destroyed          &lt;span class="nb"&gt;false
&lt;/span&gt;version            2

&lt;span class="o"&gt;====&lt;/span&gt; Data &lt;span class="o"&gt;====&lt;/span&gt;
Key      Value
&lt;span class="nt"&gt;---&lt;/span&gt;      &lt;span class="nt"&gt;-----&lt;/span&gt;
value    &lt;span class="nv"&gt;aws&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;75ae33a4b907bc87796
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;kv patch&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;To amend additional data to an existing data record, two variants can be used. The &lt;code&gt;put&lt;/code&gt; command requires the complete original data and the new, additional data to be specified. The &lt;code&gt;patch&lt;/code&gt; command instead only requires to pass the additional data. In both cases, the version will be incremented.&lt;/p&gt;

&lt;p&gt;Here is an example that adds a comment to the stored binary data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv patch kv2/api-creds &lt;span class="nv"&gt;comment&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Binary executable for retrieving secrets"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The new version has to following structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv get kv2/api-creds

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
&lt;span class="o"&gt;===&lt;/span&gt; Secret Path &lt;span class="o"&gt;===&lt;/span&gt;
kv2/data/api-creds

&lt;span class="o"&gt;=======&lt;/span&gt; Metadata &lt;span class="o"&gt;=======&lt;/span&gt;
Key                Value
&lt;span class="nt"&gt;---&lt;/span&gt;                &lt;span class="nt"&gt;-----&lt;/span&gt;
created_time       2025-12-20T10:09:59.494854Z
custom_metadata    &amp;lt;nil&amp;gt;
deletion_time      n/a
destroyed          &lt;span class="nb"&gt;false
&lt;/span&gt;version            4

&lt;span class="o"&gt;=====&lt;/span&gt; Data &lt;span class="o"&gt;=====&lt;/span&gt;
Key        Value
&lt;span class="nt"&gt;---&lt;/span&gt;        &lt;span class="nt"&gt;-----&lt;/span&gt;
comment    Binary executable &lt;span class="k"&gt;for &lt;/span&gt;retrieving secrets
binary     7J&lt;span class="se"&gt;\Z&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;kMTtcyM/T
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;kv undelete&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;When a &lt;code&gt;kv delete&lt;/code&gt; command for a specific version was issued, attempts to read the data will only return the metadata section with the additional attribute &lt;code&gt;deletion_time&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Here is an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv delete &lt;span class="nt"&gt;-versions&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;4 kv2/api-creds
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv get kv2/api-creds

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
&lt;span class="o"&gt;===&lt;/span&gt; Secret Path &lt;span class="o"&gt;===&lt;/span&gt;
kv2/data/api-creds

&lt;span class="o"&gt;=======&lt;/span&gt; Metadata &lt;span class="o"&gt;=======&lt;/span&gt;
Key                Value
&lt;span class="nt"&gt;---&lt;/span&gt;                &lt;span class="nt"&gt;-----&lt;/span&gt;
created_time       2025-12-20T10:09:59.494854Z
custom_metadata    &amp;lt;nil&amp;gt;
deletion_time      2025-12-21T06:42:28.086713Z
destroyed          &lt;span class="nb"&gt;false
&lt;/span&gt;version            4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The data can be restored, and read attempts succeed once again.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv undelete &lt;span class="nt"&gt;-versions&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;4 kv2/api-creds

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Success! Data written to: kv2/undelete/api-creds

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv get kv2/api-creds

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
&lt;span class="o"&gt;===&lt;/span&gt; Secret Path &lt;span class="o"&gt;===&lt;/span&gt;
kv2/data/api-creds

&lt;span class="o"&gt;=======&lt;/span&gt; Metadata &lt;span class="o"&gt;=======&lt;/span&gt;
Key                Value
&lt;span class="nt"&gt;---&lt;/span&gt;                &lt;span class="nt"&gt;-----&lt;/span&gt;
created_time       2025-12-20T10:09:59.494854Z
custom_metadata    &amp;lt;nil&amp;gt;
deletion_time      n/a
destroyed          &lt;span class="nb"&gt;false
&lt;/span&gt;version            4

&lt;span class="o"&gt;=====&lt;/span&gt; Data &lt;span class="o"&gt;=====&lt;/span&gt;
Key        Value
&lt;span class="nt"&gt;---&lt;/span&gt;        &lt;span class="nt"&gt;-----&lt;/span&gt;
comment    Binary executable &lt;span class="k"&gt;for &lt;/span&gt;retrieving secrets
value      7J&lt;span class="se"&gt;\Z&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;kMTtcyM/T
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;kv rollback&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;rollback&lt;/code&gt; command accesses a previous version of a secret, and stores the secrets value at a new, incremented version.&lt;/p&gt;

&lt;p&gt;Here is an example of a rollback to version 2:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv rollback &lt;span class="nt"&gt;-versions&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2 kv2/api-creds

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Key                Value
&lt;span class="nt"&gt;---&lt;/span&gt;                &lt;span class="nt"&gt;-----&lt;/span&gt;
created_time       2025-12-21T06:49:06.178864Z
custom_metadata    &amp;lt;nil&amp;gt;
deletion_time      n/a
destroyed          &lt;span class="nb"&gt;false
&lt;/span&gt;version            5

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv get kv2/api-creds

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
&lt;span class="o"&gt;===&lt;/span&gt; Secret Path &lt;span class="o"&gt;===&lt;/span&gt;
kv2/data/api-creds

&lt;span class="o"&gt;=======&lt;/span&gt; Metadata &lt;span class="o"&gt;=======&lt;/span&gt;
Key                Value
&lt;span class="nt"&gt;---&lt;/span&gt;                &lt;span class="nt"&gt;-----&lt;/span&gt;
created_time       2025-12-21T06:49:06.178864Z
custom_metadata    &amp;lt;nil&amp;gt;
deletion_time      n/a
destroyed          &lt;span class="nb"&gt;false
&lt;/span&gt;version            5

&lt;span class="o"&gt;====&lt;/span&gt; Data &lt;span class="o"&gt;====&lt;/span&gt;
Key      Value
&lt;span class="nt"&gt;---&lt;/span&gt;      &lt;span class="nt"&gt;-----&lt;/span&gt;
value    &lt;span class="nv"&gt;aws&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;75ae33a4b907bc87796
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is not possible to perform a rollback for a previously deleted version.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv delete &lt;span class="nt"&gt;-versions&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;4 kv2/api-creds

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Success! Data deleted &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;if &lt;/span&gt;it existed&lt;span class="o"&gt;)&lt;/span&gt; at: kv2/data/api-creds

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv rollback &lt;span class="nt"&gt;-version&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;4 kv2/api-creds
Cannot roll back to a version that has been deleted
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;kv enable-versioning&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;As explained in the introductory paragraph, a kv-v1 store does not support versioned secrets. This command effectively turns the v1 to a v2 store.&lt;/p&gt;

&lt;p&gt;Here is an example in which a kv-v1 store is created. First, the store is enabled at path &lt;code&gt;kv&lt;/code&gt;, and two secrets stored.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault secrets &lt;span class="nb"&gt;enable&lt;/span&gt; &lt;span class="nt"&gt;-path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;kv kv-v1

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
2025-12-21T08:41:57.535+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core: successful mount: &lt;span class="nv"&gt;namespace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="nv"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;kv/ &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;kv &lt;span class="nv"&gt;version&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"v0.25.0+builtin"&lt;/span&gt;
Success! Enabled the kv-v1 secrets engine at: kv/

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv put kv/aws &lt;span class="nv"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;@/tmp/aws.scr.txt

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Success! Data written to: kv/aws

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv put kv/encryption_binary &lt;span class="nv"&gt;data&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;@/tmp/bin

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Success! Data written to: kv/encryption_binary

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv list kv

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Keys
&lt;span class="nt"&gt;----&lt;/span&gt;
aws
encryption_binary

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv get kv/aws

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
&lt;span class="o"&gt;=====&lt;/span&gt; Data &lt;span class="o"&gt;=====&lt;/span&gt;
Key        Value
&lt;span class="nt"&gt;---&lt;/span&gt;        &lt;span class="nt"&gt;-----&lt;/span&gt;
api_key    75ae33a4b907bc87796
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Second, &lt;code&gt;kv enable-versioning&lt;/code&gt; is applied, and a stored secret read. As shown, it now includes a metadata section, the sure sign that it is a kv-v2 secret.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv enable-versioning kv

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
2025-12-21T08:44:53.048+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core: mount tuning of options: &lt;span class="nv"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;kv/ &lt;span class="nv"&gt;options&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;map[version:2]
Success! Tuned the secrets engine at: kv/

2025-12-21T08:44:53.244+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  secrets.kv.kv_845130a3: collecting keys to upgrade
2025-12-21T08:44:53.244+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  secrets.kv.kv_845130a3: &lt;span class="k"&gt;done &lt;/span&gt;collecting keys: &lt;span class="nv"&gt;num_keys&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;3
2025-12-21T08:44:54.174+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  secrets.kv.kv_845130a3: upgrading keys finished

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv list kv

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Keys
&lt;span class="nt"&gt;----&lt;/span&gt;
aws
encryption_binary

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv get kv/aws

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
&lt;span class="o"&gt;==&lt;/span&gt; Secret Path &lt;span class="o"&gt;==&lt;/span&gt;
kv/data/aws

&lt;span class="o"&gt;=======&lt;/span&gt; Metadata &lt;span class="o"&gt;=======&lt;/span&gt;
Key                Value
&lt;span class="nt"&gt;---&lt;/span&gt;                &lt;span class="nt"&gt;-----&lt;/span&gt;
created_time       2025-12-21T07:44:53.342531Z
custom_metadata    &amp;lt;nil&amp;gt;
deletion_time      n/a
destroyed          &lt;span class="nb"&gt;false
&lt;/span&gt;version            1

&lt;span class="o"&gt;=====&lt;/span&gt; Data &lt;span class="o"&gt;=====&lt;/span&gt;
Key        Value
&lt;span class="nt"&gt;---&lt;/span&gt;        &lt;span class="nt"&gt;-----&lt;/span&gt;
api_key    75ae33a4b907bc87796
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;kv delete&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;In an kv-v2 store, the &lt;code&gt;delete&lt;/code&gt; command modifies the data-record of a versioned secret. From that moment on, its metadata obtains a timestamp in the &lt;code&gt;deletion_time&lt;/code&gt; attribute, and performing a &lt;code&gt;kv get&lt;/code&gt; does not show the stored data anymore. This commands results are reversible - issuing a &lt;code&gt;kv undelete&lt;/code&gt; restores the data, as shown above.&lt;/p&gt;

&lt;p&gt;Here is an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv delete &lt;span class="nt"&gt;-versions&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;4 kv2/api-creds

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Success! Data deleted &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;if &lt;/span&gt;it existed&lt;span class="o"&gt;)&lt;/span&gt; at: kv2/data/api-creds

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv get &lt;span class="nt"&gt;-version&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;4 kv2/api-creds

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
&lt;span class="o"&gt;===&lt;/span&gt; Secret Path &lt;span class="o"&gt;===&lt;/span&gt;
kv2/data/api-creds

&lt;span class="o"&gt;=======&lt;/span&gt; Metadata &lt;span class="o"&gt;=======&lt;/span&gt;
Key                Value
&lt;span class="nt"&gt;---&lt;/span&gt;                &lt;span class="nt"&gt;-----&lt;/span&gt;
created_time       2025-12-20T10:09:59.494854Z
custom_metadata    &amp;lt;nil&amp;gt;
deletion_time      2025-12-21T06:52:17.001191Z
destroyed          &lt;span class="nb"&gt;false
&lt;/span&gt;version            4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;kv destroy&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Similar to &lt;code&gt;kv delete&lt;/code&gt;, this command modifies the data record. Its metadata shows &lt;code&gt;destroyed true&lt;/code&gt;, and read attempts do not return the data anymore. This change is non-reversible - the data is removed permanently.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv destroy &lt;span class="nt"&gt;-versions&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;5 kv2/api-creds

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Success! Data written to: kv2/destroy/api-creds
midi :: work/development/vault » vault kv get kv2/api-creds
&lt;span class="o"&gt;===&lt;/span&gt; Secret Path &lt;span class="o"&gt;===&lt;/span&gt;
kv2/data/api-creds

&lt;span class="o"&gt;=======&lt;/span&gt; Metadata &lt;span class="o"&gt;=======&lt;/span&gt;
Key                Value
&lt;span class="nt"&gt;---&lt;/span&gt;                &lt;span class="nt"&gt;-----&lt;/span&gt;
created_time       2025-12-21T06:49:06.178864Z
custom_metadata    &amp;lt;nil&amp;gt;
deletion_time      n/a
destroyed          &lt;span class="nb"&gt;true
&lt;/span&gt;version            5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Key-Value Secret Engine Metadata Commands
&lt;/h2&gt;

&lt;p&gt;Each kv-v2 secret contains a data and a metadata section. The metadata section of a secret stored in a kv-v2 engine can be accessed and manipulated with the three subcommands &lt;code&gt;get&lt;/code&gt;, &lt;code&gt;put&lt;/code&gt;, and &lt;code&gt;delete&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;kv metadata get&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Issuing a &lt;code&gt;get&lt;/code&gt; returns the complete metadata history of a secret.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv metadata get kv2/api-creds

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
&lt;span class="o"&gt;====&lt;/span&gt; Metadata Path &lt;span class="o"&gt;====&lt;/span&gt;
kv2/metadata/api-creds

&lt;span class="o"&gt;==========&lt;/span&gt; Metadata &lt;span class="o"&gt;==========&lt;/span&gt;
Key                     Value
&lt;span class="nt"&gt;---&lt;/span&gt;                     &lt;span class="nt"&gt;-----&lt;/span&gt;
cas_required            &lt;span class="nb"&gt;false
&lt;/span&gt;created_time            2025-12-20T09:26:11.531797Z
current_version         5
custom_metadata         &amp;lt;nil&amp;gt;
delete_version_after    0s
last_updated_by         map[actor:root client_id:0DHqvq2D77kL2/JTPSZkTMJbkFVmUu0TzMi0jiXcFy8&lt;span class="o"&gt;=&lt;/span&gt; operation:update]
max_versions            0
oldest_version          0
updated_time            2025-12-21T06:49:06.178864Z

&lt;span class="o"&gt;======&lt;/span&gt; Version 1 &lt;span class="o"&gt;======&lt;/span&gt;
Key              Value
&lt;span class="nt"&gt;---&lt;/span&gt;              &lt;span class="nt"&gt;-----&lt;/span&gt;
created_by       map[actor:root client_id:0DHqvq2D77kL2/JTPSZkTMJbkFVmUu0TzMi0jiXcFy8&lt;span class="o"&gt;=&lt;/span&gt; operation:create]
created_time     2025-12-20T09:26:11.531797Z
deleted_by       &amp;lt;nil&amp;gt;
deletion_time    n/a
destroyed        &lt;span class="nb"&gt;false&lt;/span&gt;

&lt;span class="o"&gt;======&lt;/span&gt; Version 2 &lt;span class="o"&gt;======&lt;/span&gt;
Key              Value
&lt;span class="nt"&gt;---&lt;/span&gt;              &lt;span class="nt"&gt;-----&lt;/span&gt;
created_by       map[actor:root client_id:0DHqvq2D77kL2/JTPSZkTMJbkFVmUu0TzMi0jiXcFy8&lt;span class="o"&gt;=&lt;/span&gt; operation:update]
created_time     2025-12-20T09:26:19.01058Z
deleted_by       &amp;lt;nil&amp;gt;
deletion_time    n/a
destroyed        &lt;span class="nb"&gt;false&lt;/span&gt;

&lt;span class="o"&gt;======&lt;/span&gt; Version 3 &lt;span class="o"&gt;======&lt;/span&gt;
Key              Value
&lt;span class="nt"&gt;---&lt;/span&gt;              &lt;span class="nt"&gt;-----&lt;/span&gt;
created_by       map[actor:root client_id:0DHqvq2D77kL2/JTPSZkTMJbkFVmUu0TzMi0jiXcFy8&lt;span class="o"&gt;=&lt;/span&gt; operation:update]
created_time     2025-12-20T09:27:46.102492Z
deleted_by       &amp;lt;nil&amp;gt;
deletion_time    n/a
destroyed        &lt;span class="nb"&gt;false&lt;/span&gt;

&lt;span class="o"&gt;======&lt;/span&gt; Version 4 &lt;span class="o"&gt;======&lt;/span&gt;
Key              Value
&lt;span class="nt"&gt;---&lt;/span&gt;              &lt;span class="nt"&gt;-----&lt;/span&gt;
created_by       map[actor:root client_id:0DHqvq2D77kL2/JTPSZkTMJbkFVmUu0TzMi0jiXcFy8&lt;span class="o"&gt;=&lt;/span&gt; operation:patch]
created_time     2025-12-20T10:09:59.494854Z
deleted_by       map[actor:root client_id:0DHqvq2D77kL2/JTPSZkTMJbkFVmUu0TzMi0jiXcFy8&lt;span class="o"&gt;=&lt;/span&gt; operation:update]
deletion_time    2025-12-21T06:52:17.001191Z
destroyed        &lt;span class="nb"&gt;false&lt;/span&gt;

&lt;span class="o"&gt;======&lt;/span&gt; Version 5 &lt;span class="o"&gt;======&lt;/span&gt;
Key              Value
&lt;span class="nt"&gt;---&lt;/span&gt;              &lt;span class="nt"&gt;-----&lt;/span&gt;
created_by       map[actor:root client_id:0DHqvq2D77kL2/JTPSZkTMJbkFVmUu0TzMi0jiXcFy8&lt;span class="o"&gt;=&lt;/span&gt; operation:update]
created_time     2025-12-21T06:49:06.178864Z
deleted_by       &amp;lt;nil&amp;gt;
deletion_time    n/a
destroyed        &lt;span class="nb"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;kv metadata put&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Each secrets' metadata property inherits their configuration from the store itself. These properties can be changed on a per-record base, customizing especially sensitive secrets.&lt;/p&gt;

&lt;p&gt;Following properties are configurable:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;cas-required=&amp;lt;*bool&amp;gt;&lt;/code&gt;: CAS is an acronym for "check-and-set". When this property is enabled, all data-record updates need to include the cas attribute present, and its value needs to be that of the most recent version number. Therefore, this setting is an additional fail-safe to prevent accidental modifications of the secret&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;delete-version-after=&amp;lt;duration&amp;gt;&lt;/code&gt;: Secrets can be configured as self-destructing with this setting. When the duration passes, the most recent version of the secret will be deleted. If version increments happen before the duration expires, older records remain readable.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;max-versions=&amp;lt;int&amp;gt;&lt;/code&gt;: Per default, each secret path can be updated for 10 iterations before older data is purged. This flag modifies this property.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;custom-metadata=&amp;lt;key=value&amp;gt;&lt;/code&gt;: The metadata section of each secret can include arbitrary, custom fields to augment information for system or human user access.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is an example of extending the metadata record with custom fields:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv metadata put &lt;span class="nt"&gt;-custom-metadata&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"comment=API credentials for AWS"&lt;/span&gt; &lt;span class="nt"&gt;-custom-metadata&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"public-key=ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHwxMpyeMvv1THOjNfBubFwtifqWO6nSZj2AS6n0fFoT"&lt;/span&gt; kv2/api-creds

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Success! Data written to: kv2/metadata/api-creds

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv get &lt;span class="nt"&gt;-format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;JSON kv2/api-creds

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="s2"&gt;"request_id"&lt;/span&gt;: &lt;span class="s2"&gt;"18da20a1-b67b-f781-ae10-a699675f3b80"&lt;/span&gt;,
  &lt;span class="s2"&gt;"lease_id"&lt;/span&gt;: &lt;span class="s2"&gt;""&lt;/span&gt;,
  &lt;span class="s2"&gt;"lease_duration"&lt;/span&gt;: 0,
  &lt;span class="s2"&gt;"renewable"&lt;/span&gt;: &lt;span class="nb"&gt;false&lt;/span&gt;,
  &lt;span class="s2"&gt;"data"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"data"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
      &lt;span class="s2"&gt;"api_key"&lt;/span&gt;: &lt;span class="s2"&gt;"75ae33a4b907bc87796&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;,
    &lt;span class="s2"&gt;"metadata"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
      &lt;span class="s2"&gt;"created_time"&lt;/span&gt;: &lt;span class="s2"&gt;"2025-12-21T09:36:44.286357Z"&lt;/span&gt;,
      &lt;span class="s2"&gt;"custom_metadata"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"comment"&lt;/span&gt;: &lt;span class="s2"&gt;"API credentials for AWS"&lt;/span&gt;,
        &lt;span class="s2"&gt;"public-key"&lt;/span&gt;: &lt;span class="s2"&gt;"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHwxMpyeMvv1THOjNfBubFwtifqWO6nSZj2AS6n0fFoT"&lt;/span&gt;
      &lt;span class="o"&gt;}&lt;/span&gt;,
      &lt;span class="s2"&gt;"deletion_time"&lt;/span&gt;: &lt;span class="s2"&gt;""&lt;/span&gt;,
      &lt;span class="s2"&gt;"destroyed"&lt;/span&gt;: &lt;span class="nb"&gt;false&lt;/span&gt;,
      &lt;span class="s2"&gt;"version"&lt;/span&gt;: 4
    &lt;span class="o"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;,
  &lt;span class="s2"&gt;"warnings"&lt;/span&gt;: null,
  &lt;span class="s2"&gt;"mount_type"&lt;/span&gt;: &lt;span class="s2"&gt;"kv"&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The following experiment shows how the duration setting auto-deletes secrets. First, the duration is set to 1min. Second, a new version is created, and the return value shows a deletion timestamp in the future.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv metadata put &lt;span class="nt"&gt;-delete-version-after&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1m kv2/api-creds

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Success! Data written to: kv2/metadata/api-creds

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv put kv2/api-creds &lt;span class="nv"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;@/tmp/aws.scr.txt

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
&lt;span class="o"&gt;===&lt;/span&gt; Secret Path &lt;span class="o"&gt;===&lt;/span&gt;
kv2/data/api-creds

&lt;span class="o"&gt;=======&lt;/span&gt; Metadata &lt;span class="o"&gt;=======&lt;/span&gt;
Key                Value
&lt;span class="nt"&gt;---&lt;/span&gt;                &lt;span class="nt"&gt;-----&lt;/span&gt;
created_time       2025-12-21T09:43:58.324523Z
custom_metadata    map[comment:API credentials &lt;span class="k"&gt;for &lt;/span&gt;AWS public-key:ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHwxMpyeMvv1THOjNfBubFwtifqWO6nSZj2AS6n0fFoT]
deletion_time      2025-12-21T09:44:58.324523Z
destroyed          &lt;span class="nb"&gt;false
&lt;/span&gt;version            6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the time passed, the record is deleted. Executing a &lt;code&gt;undelete&lt;/code&gt; command makes the secret available again.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vault kv get kv2/api-creds

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
&lt;span class="o"&gt;===&lt;/span&gt; Secret Path &lt;span class="o"&gt;===&lt;/span&gt;
kv2/data/api-creds

&lt;span class="o"&gt;=======&lt;/span&gt; Metadata &lt;span class="o"&gt;=======&lt;/span&gt;
Key                Value
&lt;span class="nt"&gt;---&lt;/span&gt;                &lt;span class="nt"&gt;-----&lt;/span&gt;
created_time       2025-12-21T09:43:58.324523Z
custom_metadata    map[comment:API credentials &lt;span class="k"&gt;for &lt;/span&gt;AWS public-key:ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHwxMpyeMvv1THOjNfBubFwtifqWO6nSZj2AS6n0fFoT]
deletion_time      2025-12-21T09:44:58.324523Z
destroyed          &lt;span class="nb"&gt;false
&lt;/span&gt;version            6

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv undelete &lt;span class="nt"&gt;-versions&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;7 kv2/api-creds

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Success! Data written to: kv2/undelete/api-creds

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv get kv2/api-creds

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
&lt;span class="o"&gt;===&lt;/span&gt; Secret Path &lt;span class="o"&gt;===&lt;/span&gt;
kv2/data/api-creds

&lt;span class="o"&gt;=======&lt;/span&gt; Metadata &lt;span class="o"&gt;=======&lt;/span&gt;
Key                Value
&lt;span class="nt"&gt;---&lt;/span&gt;                &lt;span class="nt"&gt;-----&lt;/span&gt;
created_time       2025-12-21T09:43:58.324523Z
custom_metadata    map[comment:API credentials &lt;span class="k"&gt;for &lt;/span&gt;AWS public-key:ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHwxMpyeMvv1THOjNfBubFwtifqWO6nSZj2AS6n0fFoT]
deletion_time      2025-12-21T09:48:18.574148Z
destroyed          &lt;span class="nb"&gt;false
&lt;/span&gt;version            6

&lt;span class="o"&gt;=====&lt;/span&gt; Data &lt;span class="o"&gt;=====&lt;/span&gt;
Key        Value
&lt;span class="nt"&gt;---&lt;/span&gt;        &lt;span class="nt"&gt;-----&lt;/span&gt;
api_key    &lt;span class="nv"&gt;aws&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;75ae33a4b907bc87796
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;kv metadata delete&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This command results in the immediate, non-recoverable destruction of all versions of a secret's data and metadata.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv metadata delete kv2/api-creds

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Success! Data deleted &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;if &lt;/span&gt;it existed&lt;span class="o"&gt;)&lt;/span&gt; at: kv2/metadata/api-creds
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All following read attempts result in an error.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault kv metadata get kv2/api-creds

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
No value found at kv2/metadata/api-creds
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The Hashicorp Vault CLI is a powerful tool for setup, configuration and maintenance of a Vault server or cluster. In an ongoing article series, all CLI commands are systematically explored. The focus for this article is two commands from the secret management group. With &lt;code&gt;secrets&lt;/code&gt;, the available engines can be activated, their configuration read and modified, and finally disabled. Similarly, for the built-in key-value store engine, the &lt;code&gt;kv&lt;/code&gt; subcommands cover all lifecycles. Here, you learned about the differences of kv-v1 and kv-v2 stores, and saw the intricacies of secret lifecycles with recoverable and non-recoverable deletion. Finally, you also saw how a secrets metadata can be accessed and manipulated, setting e.g. a property that automatically deletes secrets after a defined duration passed. Overall, this coverage should help you to use the key-value store with its full functionality.&lt;/p&gt;

</description>
      <category>hashicorp</category>
      <category>vault</category>
      <category>hashicorpvault</category>
    </item>
    <item>
      <title>Hashicorp Vault CLI Part 7: Authentication</title>
      <dc:creator>Sebastian</dc:creator>
      <pubDate>Mon, 16 Mar 2026 05:58:06 +0000</pubDate>
      <link>https://dev.to/admantium/hashicorp-vault-cli-part-7-authentication-2k33</link>
      <guid>https://dev.to/admantium/hashicorp-vault-cli-part-7-authentication-2k33</guid>
      <description>&lt;p&gt;Hashicorp Vault is a secrets management tool. For setup, configuration, and management, the Vault CLI can be used. It offers more than 30 subcommands, and in this blog series, they are explored systematically.&lt;/p&gt;

&lt;p&gt;This article focuses on Authentication. It covers the setup and management of authentication engines, and it shows how to perform logins for the engines.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The technical context of this article is &lt;code&gt;hashicorp_vault_v1.21.1&lt;/code&gt;, released 2025-11-18. All provided information and command examples should be valid with newer versions too, baring an update of the CLI commands' syntax&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The background material for this article stems from the official Hashicorp Vault documentation about &lt;a href="https://developer.hashicorp.com/vault/docs/commands" rel="noopener noreferrer"&gt;Vault CLI&lt;/a&gt; and subsequent pages, as well as information from the binary itself&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article originally appeared at my blog &lt;a href="https://admantium.com/blog/vault16_cli_p7_authentication/" rel="noopener noreferrer"&gt;admantium.com&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Vault CLI Overview
&lt;/h2&gt;

&lt;p&gt;The Vault CLI provides more than 30 commands. For systematically explaining and contextualizing each command, they can be structured as follows.&lt;/p&gt;

&lt;p&gt;Groups marked with a checkmark were covered in an earlier article, and the section marked with an at sign is the focus for this article.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ Initialization

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;server&lt;/code&gt;: Starts a server process&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;agent&lt;/code&gt;: Starts an agent process, a utility to communicate with a vault server to gain access to tokens&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;proxy&lt;/code&gt;: Starts a vault proxy process&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;✅ Configuration

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;operator&lt;/code&gt;: Cluster management operations, including memberships, encryption and unseal keys&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;plugin&lt;/code&gt;: Manage and install additional plugins&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;read&lt;/code&gt; / &lt;code&gt;list&lt;/code&gt;: Access stored configuration and secrets&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;write&lt;/code&gt; / &lt;code&gt;patch&lt;/code&gt;: Modify or create any data&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;delete&lt;/code&gt;: Delete configuration data or secrets&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;✅ Introspection

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;status&lt;/code&gt;: Show status information of the vault server&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;version&lt;/code&gt;: Shows compact version information and build timestamp&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;version-history&lt;/code&gt;: Shows detailed version information about all previously used vault server instances&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;print&lt;/code&gt;: Detailed view of the vault’s server runtime configuration&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;path-help&lt;/code&gt;: Detailed documentation about API endpoints&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;events&lt;/code&gt;: Subscribe to the event stream of a running vault instance&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;monitor&lt;/code&gt;: Print vault log messages&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;debug&lt;/code&gt;: Shows debug information of the connected Vault server&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;audit&lt;/code&gt;: Interact with connected audit devices&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;✅ Vault Enterprise

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;hcp&lt;/code&gt;: Operate a managed Hashicorp Vault cluster&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;namespace&lt;/code&gt;: Interact with configured namespaces of the cluster&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;✅ Authorization

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;policy&lt;/code&gt;: Manage policy definitions that govern all vault operations&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;tokens&lt;/code&gt;: General token management&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;lease&lt;/code&gt;: Manage current token leases, including renewal, revocation and TTL modification&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;🌀 Authentication

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;auth&lt;/code&gt;: Interact with configured authentication options&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;login&lt;/code&gt;: Authenticates access to a Vault server&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Secrets Management

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;secrets&lt;/code&gt;: General configuration of secret engines&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;kv&lt;/code&gt;: Access to the essential key-value store&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;transform&lt;/code&gt;: Interact with the transform secrets engine&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;transit&lt;/code&gt;: Interact with the Vaults transit secrets engine&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;unwrap&lt;/code&gt;: One-time access to arbitrary encrypted data&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;pki&lt;/code&gt;: Access the private key infrastructure secrets engine&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ssh&lt;/code&gt;: Initiates SSH sessions via the SSH secrets engine&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Authentication Commands
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;auth&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;A new vault instance supports exactly one, not disableable authentication method: token. Using either the initially defined root token, or other created tokens with the required policies, access to the Vault server can be given.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;vault auth&lt;/code&gt; command provides several subcommands with which the available authentication methods can be managed.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;enable&lt;/code&gt;: Activate a new authentication method&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;move&lt;/code&gt;: Change the mount path of an auth method&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;tune&lt;/code&gt;: Modify the configuration of an auth method&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;list&lt;/code&gt;: Show all configured auth methods&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;help&lt;/code&gt;: Show supporting information about how to use an authentication method&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;disable&lt;/code&gt;: Deactivate an authentication method&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As explored in more detail in my article &lt;a href="https://admantium.com/blog/vault08_authenthication_provider" rel="noopener noreferrer"&gt;Authentication Provider Almanac&lt;/a&gt;, authentication methods can be divided into builtin, user, system, and cloud. While the subcommands structure stays the same for each method, parameters may vary.&lt;/p&gt;

&lt;p&gt;To get an overview to all available authentication methods, one option is to access the Vault GUI at path &lt;code&gt;/ui/vault/settings/auth/enable&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd2chsyidxjkg6ikb2leg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd2chsyidxjkg6ikb2leg.png" width="800" height="488"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The other option is to access the plugin management and list authentication plugins.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault plugin list auth

Name          Version
&lt;span class="nt"&gt;----&lt;/span&gt;          &lt;span class="nt"&gt;-------&lt;/span&gt;
alicloud      v0.22.0+builtin
approle       v1.21.1+builtin.vault
aws           v1.21.1+builtin.vault
azure         v0.22.0+builtin
cert          v1.21.1+builtin.vault
cf            v0.22.0+builtin
gcp           v0.22.0+builtin
github        v1.21.1+builtin.vault
jwt           v0.25.0+builtin
kerberos      v0.16.0+builtin
kubernetes    v0.23.1+builtin
ldap          v1.21.1+builtin.vault
oci           v0.20.0+builtin
oidc          v1.21.1+builtin.vault
okta          v1.21.1+builtin.vault
pcf           v1.21.1+builtin.vault
radius        v1.21.1+builtin.vault
userpass      v1.21.1+builtin.vault
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The following two sections contrast examples for builtin and user authentication methods.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Managing Builtin Authentication Method: Userpass&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A new authentication method can be enabled by just passing its name. Several options can be passed already at initialization time, including the TTL of leases and plugin-specific options, or technical options like access to Vault-external entropy sources.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault auth &lt;span class="nb"&gt;enable &lt;/span&gt;userpass

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Success! Enabled userpass auth method at: userpass/
core: enabled credential backend: &lt;span class="nv"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;userpass/ &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;userpass &lt;span class="nv"&gt;version&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"v1.21.1+builtin.vault"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The default mount path can be changed, with the immediate effect that all existing tokens will be invalidated immediately. Internally, the authentication methods endpoints configuration will be copied, then unmounted, and mounted at the new path - a background operation that can take some time.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault auth move auth/userpass auth/login

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Started moving auth method auth/userpass/ to auth/login/, with migration ID b332d7d5-719d-631c-e15c-a85d09c81fd6
Waiting &lt;span class="k"&gt;for &lt;/span&gt;terminal status &lt;span class="k"&gt;in &lt;/span&gt;migration of auth method auth/userpass/ to auth/login/, with migration ID b332d7d5-719d-631c-e15c-a85d09c81fd6
Success! Finished moving auth method auth/userpass/ to auth/login/, with migration ID b332d7d5-719d-631c-e15c-a85d09c81fd6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the authentication method is mounted, its configuration can be changed with the &lt;code&gt;tune&lt;/code&gt; command. All options available during initialization can be accessed and modified. The following command shows how to change the default lease time.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault auth tune &lt;span class="nt"&gt;-default-lease-ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1h login/

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
2025-12-11T20:07:33.703+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core: mount tuning of leases successful: &lt;span class="nv"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;auth/login/
Success! Tuned the auth method at: login/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To get an overview to all defined authentication methods, run the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault auth list

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Path      Type        Accessor                  Description                Version
&lt;span class="nt"&gt;----&lt;/span&gt;      &lt;span class="nt"&gt;----&lt;/span&gt;        &lt;span class="nt"&gt;--------&lt;/span&gt;                  &lt;span class="nt"&gt;-----------&lt;/span&gt;                &lt;span class="nt"&gt;-------&lt;/span&gt;
login/    userpass    auth_userpass_208f6abe    n/a                        n/a
token/    token       auth_token_a5a09180       token based credentials    n/a
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each authentication methods can be used with the Vault CLI via &lt;code&gt;vault login&lt;/code&gt;. A helpful shortcut to see when parameters an authentication method requires can be obtained as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault auth &lt;span class="nb"&gt;help &lt;/span&gt;login/

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Usage: vault login &lt;span class="nt"&gt;-method&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;userpass &lt;span class="o"&gt;[&lt;/span&gt;CONFIG &lt;span class="nv"&gt;K&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;V...]

  The userpass auth method allows &lt;span class="nb"&gt;users &lt;/span&gt;to authenticate using Vault&lt;span class="s1"&gt;'s
  internal user database.

  Authenticate as "sally":

      $ vault login -method=userpass username=sally
      Password (will be hidden):

  Authenticate as "bob":

      $ vault login -method=userpass username=bob password=password

Configuration:

  password=&amp;lt;string&amp;gt;
      Password to use for authentication. If not provided, the CLI will prompt
      for this on stdin.

  username=&amp;lt;string&amp;gt;
      Username to use for authentication.
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, a configured auth method can be disabled, immediately revoking all existing leases.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault auth disable login/

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
2025-12-11T20:14:25.462+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core: disabled credential backend: &lt;span class="nv"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;auth/login/
Success! Disabled the auth method &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;if &lt;/span&gt;it existed&lt;span class="o"&gt;)&lt;/span&gt; at: login/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Managing User Authentication Method: OIDC&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The OIDC method is activated and mounted at a predefined path.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault auth oidc

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
2025-12-13T11:20:44.946+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core: enabled credential backend: &lt;span class="nv"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;oidc/ &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;oidc &lt;span class="nv"&gt;version&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"v1.21.1+builtin.vault"&lt;/span&gt;
Success! Enabled oidc auth method at: oidc/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, it should be available at the path &lt;code&gt;/openid-login&lt;/code&gt;. Let’s move it there.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault auth move auth/oidc auth/openid-login

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
2025-12-13T11:21:23.440+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core.mounts.migration: Starting to update the mount table and revoke leases: &lt;span class="nv"&gt;from_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;auth/oidc/ &lt;span class="nv"&gt;migration_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;64a573e0-b9f5-1a92-bf63-68578a90ee13 &lt;span class="nv"&gt;namespace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="nv"&gt;to_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;auth/openid-login/
Started moving auth method auth/oidc/ to auth/openid-login/, with migration ID 64a573e0-b9f5-1a92-bf63-68578a90ee13
Waiting &lt;span class="k"&gt;for &lt;/span&gt;terminal status &lt;span class="k"&gt;in &lt;/span&gt;migration of auth method auth/oidc/ to auth/openid-login/, with migration ID 64a573e0-b9f5-1a92-bf63-68578a90ee13
2025-12-13T11:21:23.734+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core.mounts.migration: Removing the &lt;span class="nb"&gt;source &lt;/span&gt;mount from filtered paths on secondaries: &lt;span class="nv"&gt;from_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;auth/oidc/ &lt;span class="nv"&gt;migration_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;64a573e0-b9f5-1a92-bf63-68578a90ee13 &lt;span class="nv"&gt;namespace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="nv"&gt;to_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;auth/openid-login/
2025-12-13T11:21:23.734+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core.mounts.migration: Updating quotas associated with the &lt;span class="nb"&gt;source &lt;/span&gt;mount: &lt;span class="nv"&gt;from_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;auth/oidc/ &lt;span class="nv"&gt;migration_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;64a573e0-b9f5-1a92-bf63-68578a90ee13 &lt;span class="nv"&gt;namespace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="nv"&gt;to_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;auth/openid-login/
2025-12-13T11:21:23.735+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core.mounts.migration: Completed mount move operations: &lt;span class="nv"&gt;from_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;auth/oidc/ &lt;span class="nv"&gt;migration_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;64a573e0-b9f5-1a92-bf63-68578a90ee13 &lt;span class="nv"&gt;namespace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="nv"&gt;to_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;auth/openid-login/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The OIDC authentication can be used in conjunction with an external system. To see tunable properties, run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault &lt;span class="nb"&gt;read &lt;/span&gt;sys/auth/openid-login/tune

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Key                  Value
&lt;span class="nt"&gt;---&lt;/span&gt;                  &lt;span class="nt"&gt;-----&lt;/span&gt;
default_lease_ttl    768h
description          n/a
force_no_cache       &lt;span class="nb"&gt;false
&lt;/span&gt;max_lease_ttl        768h
token_type           default-service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let’s limit the TTL, and ensure unauthenticated users can access the method as well.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault auth tune &lt;span class="nt"&gt;-max-lease-ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1m &lt;span class="nt"&gt;-listing-visibility&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;unauth openid-login

2025-12-13T11:37:08.199+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core: mount tuning of leases successful: &lt;span class="nv"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;auth/openid-login/
2025-12-13T11:37:08.456+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core: mount tuning of listing_visibility successful: &lt;span class="nv"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;auth/openid-login/
Success! Tuned the auth method at: openid-login/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To see how to perform a login with this method, run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault auth &lt;span class="nb"&gt;help &lt;/span&gt;openid-login/

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Usage: vault login &lt;span class="nt"&gt;-method&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;oidc &lt;span class="o"&gt;[&lt;/span&gt;CONFIG &lt;span class="nv"&gt;K&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;V...]

  The OIDC auth method allows &lt;span class="nb"&gt;users &lt;/span&gt;to authenticate using an OIDC provider.
  The provider must be configured as part of a role by the operator.

  Authenticate using role &lt;span class="s2"&gt;"engineering"&lt;/span&gt;:

      &lt;span class="nv"&gt;$ &lt;/span&gt;vault login &lt;span class="nt"&gt;-method&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;oidc &lt;span class="nv"&gt;role&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;engineering
      Complete the login via your OIDC provider. Launching browser to:

          https://accounts.google.com/o/oauth2/v2/...

  The default browser will be opened &lt;span class="k"&gt;for &lt;/span&gt;the user to &lt;span class="nb"&gt;complete &lt;/span&gt;the login. Alternatively,
  the user may visit the provided URL directly.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, the authentication method will be disabled again.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault auth disable openid-login

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
2025-12-13T11:44:33.916+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core: disabled credential backend: &lt;span class="nv"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;auth/openid-login/
Success! Disabled the auth method &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;if &lt;/span&gt;it existed&lt;span class="o"&gt;)&lt;/span&gt; at: openid-login/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;login&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;To login to a configured authentication method, both the GUI and the CLI can be used. An invocation via the CLI requires the following command flags to be present:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;method&lt;/code&gt;: The authentication method type&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;path&lt;/code&gt;: In case of a non-default mount path, it needs to be configured specifically.&lt;/li&gt;
&lt;li&gt;parameters: Additional parameters as required by the authentication method&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Continuing with the examples from the last two sections, to perform the login for the userpass method, run the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault login &lt;span class="nt"&gt;-method&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;userpass &lt;span class="nt"&gt;-path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;login &lt;span class="nv"&gt;username&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;user

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Password &lt;span class="o"&gt;(&lt;/span&gt;will be hidden&lt;span class="o"&gt;)&lt;/span&gt;:
Success! You are now authenticated. The token information displayed below
is already stored &lt;span class="k"&gt;in &lt;/span&gt;the token helper. You &lt;span class="k"&gt;do &lt;/span&gt;NOT need to run &lt;span class="s2"&gt;"vault login"&lt;/span&gt;
again. Future Vault requests will automatically use this token.

Key                    Value
&lt;span class="nt"&gt;---&lt;/span&gt;                    &lt;span class="nt"&gt;-----&lt;/span&gt;
token                  hvs.CAESICzlbzAXoGcIvdAgGQ1NToqs5jARRfP4oFJAS_37Mw-HGh4KHGh2cy5ORGMzYmYyQWlGbFk5em92cHVuNXFBbkU
token_accessor         EjZQYdMEMCAsN7VvVCR1ef1r
token_duration         768h
token_renewable        &lt;span class="nb"&gt;true
&lt;/span&gt;token_policies         &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"default"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
identity_policies      &lt;span class="o"&gt;[]&lt;/span&gt;
policies               &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"default"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
token_meta_username    user
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To properly setup the OIDC authentication method, additional steps are required: Registration with an OIDC provider, configuring the discovery URL and secrets in vaults, and the setup of policies and roles. Assuming these steps were done, the login works as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault login &lt;span class="nt"&gt;-method&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;oidc &lt;span class="nt"&gt;-path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;openid-login &lt;span class="nv"&gt;role&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;user

&lt;span class="c"&gt;#logMessages&lt;/span&gt;
Complete the login via your OIDC provider. Launching browser to:

...

Waiting &lt;span class="k"&gt;for &lt;/span&gt;OIDC authentication to complete...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The Hashicorp Vault CLI offers more then 30 commands. In this article, you learned all about authentication. First, authentication methods are enabled at a specific mountpoints. Their properties can be modified, their mount path changed, and a list of all active methods obtained. Not required authentication methods can be disabled, immediately revoking all token leases. Second, users and systems alike can use the CLI also to login. Providing the authentication methods name, its mount path, and other required parameters. When successful, a new token is created, access policies attached, and the token owner can interact with the Vault server.&lt;/p&gt;

</description>
      <category>hashicorp</category>
      <category>vault</category>
      <category>hashicorpvault</category>
    </item>
    <item>
      <title>Hashicorp Vault CLI Part 6: Authorization</title>
      <dc:creator>Sebastian</dc:creator>
      <pubDate>Thu, 05 Mar 2026 06:32:24 +0000</pubDate>
      <link>https://dev.to/admantium/hashicorp-vault-cli-part-6-authorization-41hb</link>
      <guid>https://dev.to/admantium/hashicorp-vault-cli-part-6-authorization-41hb</guid>
      <description>&lt;p&gt;With Hashicorp Vault, the secure management of secrets and encrypted data becomes a manageable task. Thanks to its plugin architecture, functional extensions that target authentication, secrete creation, and short-lived access to system can be implemented and adapted to meet changing requirements.&lt;/p&gt;

&lt;p&gt;In an ongoing blog series, all Vault CLI commands are explored systematically. This article explains three commands from the authorization group, showing how to define policies, and managing tokens and leases that embody the policies for providing access to a Vault server.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The technical context of this article is &lt;code&gt;hashicorp_vault_v1.21.1&lt;/code&gt;, released 2025-11-18. All provided information and command examples should be valid with newer versions too, baring an update of the CLI commands' syntax&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The background material for this article stems from the official Hashicorp Vault documentation about &lt;a href="https://developer.hashicorp.com/vault/docs/commands" rel="noopener noreferrer"&gt;Vault CLI&lt;/a&gt; and subsequent pages, as well as information from the binary itself&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article originally appeared at my blog &lt;a href="https://admantium.com/blog/vault14_cli_p5_vault_enterprise/vault15_cli_p6_authorization/" rel="noopener noreferrer"&gt;admantium.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Vault CLI Overview
&lt;/h2&gt;

&lt;p&gt;The Vault CLI provides more than 30 commands. For systematically explaining and contextualizing each command, they can be structured as follows.&lt;/p&gt;

&lt;p&gt;Groups marked with a checkmark were covered in an earlier article, and the section marked with an at sign is the focus for this article. From the authorization group, the commands &lt;code&gt;policy&lt;/code&gt; and &lt;code&gt;lease&lt;/code&gt; will be covered here. The &lt;code&gt;token&lt;/code&gt; command is extensively covered in my earlier article about &lt;a href="https://admantium.com/blog/vault07_token_management/" rel="noopener noreferrer"&gt;token management&lt;/a&gt;_.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ Initialization

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;server&lt;/code&gt;: Starts a server process&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;agent&lt;/code&gt;: Starts an agent process, a utility to communicate with a vault server to gain access to tokens&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;proxy&lt;/code&gt;: Starts a vault proxy process&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;✅ Configuration

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;operator&lt;/code&gt;: Cluster management operations, including memberships, encryption and unseal keys&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;plugin&lt;/code&gt;: Manage and install additional plugins&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;read&lt;/code&gt; / &lt;code&gt;list&lt;/code&gt;: Access stored configuration and secrets&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;write&lt;/code&gt; / &lt;code&gt;patch&lt;/code&gt;: Modify or create any data&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;delete&lt;/code&gt;: Delete configuration data or secrets&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;✅ Introspection

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;status&lt;/code&gt;: Show status information of the vault server&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;version&lt;/code&gt;: Shows compact version information and build timestamp&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;version-history&lt;/code&gt;: Shows detailed version information about all previously used vault server instances&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;print&lt;/code&gt;: Detailed view of the vault’s server runtime configuration&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;path-help&lt;/code&gt;: Detailed documentation about API endpoints&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;events&lt;/code&gt;: Subscribe to the event stream of a running vault instance&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;monitor&lt;/code&gt;: Print vault log messages&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;debug&lt;/code&gt;: Shows debug information of the connected Vault server&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;audit&lt;/code&gt;: Interact with connected audit devices&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;✅ Vault Enterprise

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;hcp&lt;/code&gt;: Operate a managed Hashicorp Vault cluster&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;namespace&lt;/code&gt;: Interact with configured namespaces of the cluster&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;🌀 Authorization

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;policy&lt;/code&gt;: Manage policy definitions that govern all vault operations&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;tokens&lt;/code&gt;: General token management&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;lease&lt;/code&gt;: Manage current token leases, including renewal, revocation and TTL modification&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Authentication

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;auth&lt;/code&gt;: Interact with configured authentication options&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;login&lt;/code&gt;: Authenticates access to a Vault server&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Secrets Management

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;secrets&lt;/code&gt;: General configuration of secret engines&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;kv&lt;/code&gt;: Access to the essential key-value store&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;transform&lt;/code&gt;: Interact with the transform secrets engine&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;transit&lt;/code&gt;: Interact with the Vaults transit secrets engine&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;unwrap&lt;/code&gt;: One-time access to arbitrary encrypted data&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;pki&lt;/code&gt;: Access the private key infrastructure secrets engine&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ssh&lt;/code&gt;: Initiates SSH sessions via the SSH secrets engine&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Policy Management Commands
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Note: For a detailed guide to policies, see my earlier article &lt;a href="https://admantium.com/blog/vault09_policies.md" rel="noopener noreferrer"&gt;Fine-Grained Access Control with Policies&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Policies are rules that detail which operations are available on which endpoints. Written in the Hashicorp Configuration Language, they are blocks of code consisting of a path declaration, which supports wildcard path segments, and a declaration of capabilities and other restrictions.&lt;/p&gt;

&lt;p&gt;Here is an example that limits access to a kv-v2 secrets store.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;path &lt;span class="s2"&gt;"kv2/*"&lt;/span&gt;
&lt;span class="o"&gt;{&lt;/span&gt;
  capabilities &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"create"&lt;/span&gt;, &lt;span class="s2"&gt;"update"&lt;/span&gt;, &lt;span class="s2"&gt;"delete"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;policy&lt;/code&gt; command provides high-level CRUD operations on policy definitions. All commands are explained in the following sections.  To provide the example context for all commands, a kv-v2 secret store is assumed. It can be created with the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vault secrets &lt;span class="nb"&gt;enable&lt;/span&gt; &lt;span class="nt"&gt;-max-lease-ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1h &lt;span class="nt"&gt;-path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;kv2 kv-v2

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
2025-12-17T11:32:07.670+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core: successful mount: &lt;span class="nv"&gt;namespace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="nv"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;kv2/ &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;kv &lt;span class="nv"&gt;version&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"v0.25.0+builtin"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;policy fmt&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Documents written in Hashicorp Vault Configuration language should confirm with syntactic rules. This command processes a file and prints a formatted version of it.&lt;/p&gt;

&lt;p&gt;Assuming a syntactic-valid, but ill-formatted document is created ...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'
path "kv2/config-db/datacenter1" { capabilities = ["read"] }


path "kv2/config-db/datacenter1"{
  capabilities = ["create"]
  required_parameters = ["server_id"]}'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; datacenter1.policy.hcl
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;... running &lt;code&gt;fmt&lt;/code&gt; changes the file content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault policy &lt;span class="nb"&gt;fmt &lt;/span&gt;datacenter1.policy.hcl

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Success! Formatted policy: datacenter1.policy.hcl

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;cat &lt;/span&gt;datacenter1.policy.hcl

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
path &lt;span class="s2"&gt;"kv2/config-db/datacenter1"&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  capabilities &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"read"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

path &lt;span class="s2"&gt;"kv2/config-db/datacenter1"&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  capabilities        &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"create"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
  required_parameters &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"server_id"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;policy write&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Policy declarations need to be saved in Vault to become effective. The command requires two parameters: The name of the policy object that is to be stored, and either a filename or the dash symbol so that the policy declaration is read from STDIN.&lt;/p&gt;

&lt;p&gt;Here is the invocation that reads the content from the defined file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault policy write datacenter1 ./datacenter1.policy.hcl

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Success! Uploaded policy: datacenter1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And the invocation via STDIN:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'
path "kv2/config-db/datacenter1" { capabilities = ["read"] }


path "kv2/config-db/datacenter1"{
  capabilities = ["create"]
  required_parameters = ["server_id"]}'&lt;/span&gt; | vault policy write datacenter1_v2 -
Success! Uploaded policy: datacenter1_v2

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Success! Uploaded policy: datacenter1_v2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;policy list&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This command prints the name of all currently defined policies in a Vault server. The output can be formatted in a text table, as JSON or as YAML.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault policy list &lt;span class="nt"&gt;-format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;table

&lt;span class="c"&gt;#Log messages&lt;/span&gt;
datacenter1
datacenter1_v2
default
acl/kv-secrets
root
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;policy read&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;With the help of the &lt;code&gt;read&lt;/code&gt; command, the full content of a policy can be shown. The command requires a concrete policy name, and the output can be formatted as a table, JSON or YAML.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault policy &lt;span class="nb"&gt;read&lt;/span&gt; &lt;span class="s2"&gt;"datacenter1"&lt;/span&gt;

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
path &lt;span class="s2"&gt;"kv2/config-db/datacenter1"&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  capabilities &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"read"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

path &lt;span class="s2"&gt;"kv2/config-db/datacenter1"&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  capabilities        &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"create"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
  required_parameters &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"server_id"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Interestingly, when querying about the policy &lt;code&gt;datacenter1_v2&lt;/code&gt;, the same ill-for mated input is returned.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault policy &lt;span class="nb"&gt;read&lt;/span&gt; &lt;span class="nt"&gt;-format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;YAML &lt;span class="s2"&gt;"datacenter1_v2"&lt;/span&gt;

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
policy: |2

  path &lt;span class="s2"&gt;"kv2/config-db/datacenter1"&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; capabilities &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"read"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;

  path &lt;span class="s2"&gt;"kv2/config-db/datacenter1"&lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
    capabilities &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"create"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
    required_parameters &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"server_id"&lt;/span&gt;&lt;span class="o"&gt;]}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;policy delete&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;When the policy lifecycle ends, it should be removed with this command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault policy delete datacenter1

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Success! Deleted policy: datacenter1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Lease Management
&lt;/h2&gt;

&lt;p&gt;Leases are special data structures in Vault, used to reference data in external systems. One type is the association of a token issued by an authentication provider with a data record at the providers system. Another type are dynamic secrets, ephemeral data that is stored at an external system, such as a database or a cloud provider.&lt;/p&gt;

&lt;p&gt;Leases can be accessed and manipulated with the Vault CLI.&lt;/p&gt;

&lt;p&gt;To provide a context for the following examples, a dynamic secret at a Postgres DB is assumed. Create a local Postgres DB, setup the user, then execute the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault secrets &lt;span class="nb"&gt;enable&lt;/span&gt; &lt;span class="nt"&gt;-path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;postgres database

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault write postgres/config/vault &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nv"&gt;plugin_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"postgresql-database-plugin"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nv"&gt;connection_url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"postgresql://&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;POSTGRES_USER&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;POSTGRES_PASSWORD&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;@localhost:5432/vault"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nv"&gt;allowed_roles&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"vault"&lt;/span&gt;

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;ROLE_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;vault&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;ROLE_PASSWORD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;SECRET&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  vault write postgres/roles/vault &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nv"&gt;db_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"vault"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nv"&gt;creation_statements&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"CREATE ROLE &lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;ROLE_NAME&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; WITH LOGIN PASSWORD '&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;ROLE_PASSWORD&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;'; &lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;&lt;span class="s2"&gt;
    GRANT SELECT ON ALL TABLES IN SCHEMA public TO &lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;ROLE_NAME&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nv"&gt;default_ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"1h"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nv"&gt;max_ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"24h"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, the dynamic secret is created:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault &lt;span class="nb"&gt;read &lt;/span&gt;postgres/creds/vault

&lt;span class="c"&gt;# Log message&lt;/span&gt;
Key                Value
&lt;span class="nt"&gt;---&lt;/span&gt;                &lt;span class="nt"&gt;-----&lt;/span&gt;
lease_id           postgres/creds/vault/St5gVIx3wlUE7YQhj4yxESsl
lease_duration     1h
lease_renewable    &lt;span class="nb"&gt;true
&lt;/span&gt;password           &lt;span class="nt"&gt;-EEvuNgFotraoUpBxgY4&lt;/span&gt;
username           v-root-vault-tkTtmMfzNdnkVHwgJ4Pq-1766045698
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;lease lookup&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This command introspects an existing lease.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault lease lookup postgres/creds/vault/St5gVIx3wlUE7YQhj4yxESsl

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Key             Value
&lt;span class="nt"&gt;---&lt;/span&gt;             &lt;span class="nt"&gt;-----&lt;/span&gt;
expire_time     2025-12-18T10:14:58.165563+01:00
&lt;span class="nb"&gt;id              &lt;/span&gt;postgres/creds/vault/St5gVIx3wlUE7YQhj4yxESsl
issue_time      2025-12-18T09:14:58.165563+01:00
last_renewal    &amp;lt;nil&amp;gt;
renewable       &lt;span class="nb"&gt;true
&lt;/span&gt;ttl             52m18s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;lease renew&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Leases have a configured TTL. When the TTL expires, so does the data record at the external system. A renewal refreshes the lease TTL.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault lease renew postgres/creds/vault/St5gVIx3wlUE7YQhj4yxESsl

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Key                Value
&lt;span class="nt"&gt;---&lt;/span&gt;                &lt;span class="nt"&gt;-----&lt;/span&gt;
lease_id           postgres/creds/vault/St5gVIx3wlUE7YQhj4yxESsl
lease_duration     1h
lease_renewable    &lt;span class="nb"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;lease revoke&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;An existing lease can be immediately revoked. The data record at the external system will be deleted as well.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault lease revoke postgres/creds/vault/St5gVIx3wlUE7YQhj4yxESsl

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
2025-12-18T09:40:07.289+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  expiration: revoked lease: &lt;span class="nv"&gt;lease_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;postgres/creds/vault/St5gVIx3wlUE7YQhj4yxESsl
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Hashicorp Vault uses policy definitions, tokens, and leases to provide authorization for accessing Vault API endpoints or interact with external systems. This article about the Vault CLI explored authorization commands. You learned that &lt;code&gt;policy&lt;/code&gt; can be used to introspected, create, and delete any system-defined policies. And you learned the application of &lt;code&gt;lease&lt;/code&gt; for introspecting, renewing and revoking data records at external systems.&lt;/p&gt;

</description>
      <category>hashicorp</category>
      <category>vault</category>
      <category>hashicorpvault</category>
    </item>
    <item>
      <title>Hashicorp Vault CLI Part 5: Vault Enterprise</title>
      <dc:creator>Sebastian</dc:creator>
      <pubDate>Mon, 23 Feb 2026 06:02:43 +0000</pubDate>
      <link>https://dev.to/admantium/hashicorp-vault-cli-part-5-vault-enterprise-3mi2</link>
      <guid>https://dev.to/admantium/hashicorp-vault-cli-part-5-vault-enterprise-3mi2</guid>
      <description>&lt;p&gt;The Hashicorp Vault CLI binary is a multi-purpose tool offering several commands for all configurational and operational aspects. This article investigates two commands available in Hashicorp Vault enterprise: Connecting with managed cloud platform instances, and using namespaces.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The technical context of this article is &lt;code&gt;hashicorp_vault_v1.21.1&lt;/code&gt;, released 2025-11-18. All provided information and command examples should be valid with newer versions too, baring an update of the CLI commands' syntax&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The background material for this article stems from the official Hashicorp Vault documentation about &lt;a href="https://developer.hashicorp.com/vault/docs/commands" rel="noopener noreferrer"&gt;Vault CLI&lt;/a&gt; and subsequent pages, as well as information from the binary itself&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article originally appeared at my blog &lt;a href="https://admantium.com/blog/vault14_cli_p5_vault_enterprise/" rel="noopener noreferrer"&gt;admantium.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Vault CLI Overview
&lt;/h2&gt;

&lt;p&gt;The Vault CLI provides more than 30 commands. For systematically explaining and contextualizing each command, they can be structured as follows.&lt;/p&gt;

&lt;p&gt;Groups marked with a checkmark were covered in an earlier article, and the section marked with an at sign is the focus for this article.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ Initialization

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;server&lt;/code&gt;: Starts a server process&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;agent&lt;/code&gt;: Starts an agent process, a utility to communicate with a vault server to gain access to tokens&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;proxy&lt;/code&gt;: Starts a vault proxy process&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;✅ Configuration

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;operator&lt;/code&gt;: Cluster management operations, including memberships, encryption and unseal keys&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;plugin&lt;/code&gt;: Manage and install additional plugins&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;read&lt;/code&gt; / &lt;code&gt;list&lt;/code&gt;: Access stored configuration and secrets&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;write&lt;/code&gt; / &lt;code&gt;patch&lt;/code&gt;: Modify or create any data&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;delete&lt;/code&gt;: Delete configuration data or secrets&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;✅ Introspection

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;status&lt;/code&gt;: Show status information of the vault server&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;version&lt;/code&gt;: Shows compact version information and build timestamp&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;version-history&lt;/code&gt;: Shows detailed version information about all previously used vault server instances&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;print&lt;/code&gt;: Detailed view of the vault’s server runtime configuration&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;path-help&lt;/code&gt;: Detailed documentation about API endpoints&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;events&lt;/code&gt;: Subscribe to the event stream of a running vault instance&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;monitor&lt;/code&gt;: Print vault log messages&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;debug&lt;/code&gt;: Shows debug information of the connected Vault server&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;audit&lt;/code&gt;: Interact with connected audit devices&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;🌀 Vault Enterprise

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;hcp&lt;/code&gt;: Operate a managed Hashicorp Vault cluster&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;namespace&lt;/code&gt;: Interact with configured namespaces of the cluster&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Authorization

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;policy&lt;/code&gt;: Manage policy definitions that govern all vault operations&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;tokens&lt;/code&gt;: General token management&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;lease&lt;/code&gt;: Manage current token leases, including renewal, revocation and TTL modification&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Authentication

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;auth&lt;/code&gt;: Interact with configured authentication options&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;login&lt;/code&gt;: Authenticates access to a Vault server&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Secrets Management

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;secrets&lt;/code&gt;: General configuration of secret engines&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;kv&lt;/code&gt;: Access to the essential key-value store&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;transform&lt;/code&gt;: Interact with the transform secrets engine&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;transit&lt;/code&gt;: Interact with the Vaults transit secrets engine&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;unwrap&lt;/code&gt;: One-time access to arbitrary encrypted data&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;pki&lt;/code&gt;: Access the private key infrastructure secrets engine&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ssh&lt;/code&gt;: Initiates SSH sessions via the SSH secrets engine&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Vault Enterprise Commands
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;hcp&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Hashicorp offers cloud-based managed installations of Vault, called Hashicorp Cloud Plattform (HCP). With the same-named command, a connection between HCP and any computer that runs the same version of the Vault CLI can be established.&lt;/p&gt;

&lt;p&gt;In the absence of a HCP installation, the connection establashing can only be hinted at:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault hcp connect

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
The default web browser has been opened at https://auth.idp.hashicorp.com/oauth2/auth?access_type&lt;span class="o"&gt;=&lt;/span&gt;offline&amp;amp;audience&lt;span class="o"&gt;=&lt;/span&gt;https%3A%2F%2Fapi.hashicorp.cloud&amp;amp;client_id&lt;span class="o"&gt;=&lt;/span&gt;4edd6521-6eb9-4d78-9039-7ce8569d667c&amp;amp;redirect_uri&lt;span class="o"&gt;=&lt;/span&gt;http%3A%2F%2Flocalhost%3A8443%2Foidc%2Fcallback&amp;amp;response_type&lt;span class="o"&gt;=&lt;/span&gt;code&amp;amp;scope&lt;span class="o"&gt;=&lt;/span&gt;openid+offline_access&amp;amp;state&lt;span class="o"&gt;=&lt;/span&gt;A45XFyg3naoKuyc2LASrFV1RvzNQpFzlbn2rXFlFZMU. Please &lt;span class="k"&gt;continue &lt;/span&gt;the login &lt;span class="k"&gt;in &lt;/span&gt;the web browser.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;namespace&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;In Vault, all interactions ultimately send data to a mount point. And when managing an extensive suite of multiple version of the same secrets or authentication methods, the route paths can become cobbled. Namespaces add a path-segment to the mount point, helping to structure Vault e.g. into company sections.&lt;/p&gt;

&lt;p&gt;A full set of CRUD methods is available:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;create&lt;/code&gt;: adds a new namespace&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;lookup&lt;/code&gt;: checks if the given namespace exists&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;list&lt;/code&gt;: reads all child namespaces&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;patch&lt;/code&gt;: update the parameters of a given namespace&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;delete&lt;/code&gt;: removes the namespaces&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;lock&lt;/code&gt;: prevents access to any endpoints mounted under a target namespace&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;unlock&lt;/code&gt;: removes the lock for a namespace&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, namespaces are a feature for enterprise hashicorp vault only. Calling any methods with the community edition results merely in an error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault namespace create data-center-1

&lt;span class="c"&gt;# log messages&lt;/span&gt;
Error creating namespace: Error making API request.

URL: PUT http://127.0.0.1:8210/v1/sys/namespaces/data-center-1
Code: 404. Errors:

&lt;span class="k"&gt;*&lt;/span&gt; enterprise-only feature
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The Vault CLI binary offers more than 30 subcommands. This blog post covered 2 miscellaneous commands. With &lt;code&gt;hcp&lt;/code&gt;, a connection to a managed Hashicorp Vault Cloud Platform instance can be created. The &lt;code&gt;namespace&lt;/code&gt; commands enables supplementing API endpoints with additional path segments to reflect organizational structure. Both commands require a Vault Enterprise server, they cannot be used in the Vault community version.&lt;/p&gt;

</description>
      <category>hashicorp</category>
      <category>vault</category>
      <category>hashicorpvault</category>
    </item>
    <item>
      <title>Hashicorp Vault CLI Part 4: Introspection</title>
      <dc:creator>Sebastian</dc:creator>
      <pubDate>Thu, 12 Feb 2026 06:26:40 +0000</pubDate>
      <link>https://dev.to/admantium/hashicorp-vault-cli-part-4-introspection-250f</link>
      <guid>https://dev.to/admantium/hashicorp-vault-cli-part-4-introspection-250f</guid>
      <description>&lt;p&gt;Hashicorp Vault is a secrets management tool. Its CLI is a powerful companion, supporting all tasks from setup to configuration and troubleshooting. Continuing the series about all CLI commands, this article focuses the introspection group. All available commands will be listed, explained, and applied in the context of a locally running cluster with three servers.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The technical context of this article is &lt;code&gt;hashicorp_vault_v1.21.1&lt;/code&gt;, released 2025-11-18. All provided information and command examples should be valid with newer versions too, baring an update of the CLI commands' syntax&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The background material for this article stems from the official Hashicorp Vault documentation about &lt;a href="https://developer.hashicorp.com/vault/docs/commands" rel="noopener noreferrer"&gt;Vault CLI&lt;/a&gt; and subsequent pages, as well as information from the binary itself&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article originally appeared at my blog &lt;a href="https://admantium.com/blog/vault13_cli_p4_introspection/" rel="noopener noreferrer"&gt;admantium.com&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Vault CLI Overview
&lt;/h2&gt;

&lt;p&gt;The Vault CLI provides more than 30 commands. For systematically explaining and contextualizing each command, they can be structured as follows.&lt;/p&gt;

&lt;p&gt;Groups marked with a checkmark were covered in an earlier article, and the section marked with an at sign is the focus for this article.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ Initialization

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;server&lt;/code&gt;: Starts a server process&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;agent&lt;/code&gt;: Starts an agent process, a utility to communicate with a vault server to gain access to tokens&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;proxy&lt;/code&gt;: Starts a vault proxy process&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;✅ Configuration

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;operator&lt;/code&gt;: Cluster management operations, including memberships, encryption and unseal keys&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;plugin&lt;/code&gt;: Manage and install additional plugins&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;read&lt;/code&gt; / &lt;code&gt;list&lt;/code&gt;: Access stored configuration and secrets&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;write&lt;/code&gt; / &lt;code&gt;patch&lt;/code&gt;: Modify or create any data&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;delete&lt;/code&gt;: Delete configuration data or secrets&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;🌀 Introspection

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;status&lt;/code&gt;: Show status information of the vault server&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;version&lt;/code&gt;: Shows compact version information and build timestamp&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;version-history&lt;/code&gt;: Shows detailed version information about all previously used vault server instances&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;print&lt;/code&gt;: Detailed view of the vault’s server runtime configuration&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;path-help&lt;/code&gt;: Detailed documentation about API endpoints&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;events&lt;/code&gt;: Subscribe to the event stream of a running vault instance&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;monitor&lt;/code&gt;: Print vault log messages&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;debug&lt;/code&gt;: Shows debug information of the connected Vault server&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;audit&lt;/code&gt;: Interact with connected audit devices&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Vault Enterprise

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;hcp&lt;/code&gt;: Operate a managed Hashicorp Vault cluster&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;namespace&lt;/code&gt;: Interact with configured namespaces of the cluster&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Authorization

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;policy&lt;/code&gt;: Manage policy definitions that govern all vault operations&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;tokens&lt;/code&gt;: General token management&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;lease&lt;/code&gt;: Manage current token leases, including renewal, revocation and TTL modification&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Authentication

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;auth&lt;/code&gt;: Interact with configured authentication options&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;login&lt;/code&gt;: Authenticates access to a Vault server&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Secrets Management

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;secrets&lt;/code&gt;: General configuration of secret engines&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;kv&lt;/code&gt;: Access to the essential key-value store&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;transform&lt;/code&gt;: Interact with the transform secrets engine&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;transit&lt;/code&gt;: Interact with the Vaults transit secrets engine&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;unwrap&lt;/code&gt;: One-time access to arbitrary encrypted data&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;pki&lt;/code&gt;: Access the private key infrastructure secrets engine&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ssh&lt;/code&gt;: Initiates SSH sessions via the SSH secrets engine&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Introspection Commands
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;status&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This convenient method shows the current status of the vault server.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault status

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Key                     Value
&lt;span class="nt"&gt;---&lt;/span&gt;                     &lt;span class="nt"&gt;-----&lt;/span&gt;
Seal Type               shamir
Initialized             &lt;span class="nb"&gt;true
&lt;/span&gt;Sealed                  &lt;span class="nb"&gt;false
&lt;/span&gt;Total Shares            5
Threshold               2
Version                 1.21.1
Build Date              2025-11-18T13:04:32Z
Storage Type            raft
Cluster Name            vault
Cluster ID              dfbcadb4-8f92-3c29-2369-10a53a8a72b4
Removed From Cluster    &lt;span class="nb"&gt;false
&lt;/span&gt;HA Enabled              &lt;span class="nb"&gt;true
&lt;/span&gt;HA Cluster              https://127.0.0.1:8211
HA Mode                 active
Active Since            2025-12-03T20:09:40.417402+01:00
Raft Committed Index    60
Raft Applied Index      60
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;version&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Prints the version of the vault server, complete with a verifiable hast value and timestamp.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault version

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Vault v1.21.1 &lt;span class="o"&gt;(&lt;/span&gt;2453aac2638a6ae243341b4e0657fd8aea1cbf18&lt;span class="o"&gt;)&lt;/span&gt;, built 2025-11-18T13:04:32Z
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;version-history&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;When upgrading the Vault binary, information about its installation date is gathered. This command lists all update information.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault version-history

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Note:
Use of this &lt;span class="nb"&gt;command &lt;/span&gt;requires a server running Vault 1.10.0 or greater.
Version tracking was added &lt;span class="k"&gt;in &lt;/span&gt;1.9.0. Earlier versions have not been tracked.

Version  Installation Time     Build Date
&lt;span class="nt"&gt;-------&lt;/span&gt;  &lt;span class="nt"&gt;-----------------&lt;/span&gt;     &lt;span class="nt"&gt;----------&lt;/span&gt;
1.20.0   2025-06-29T1142:02Z   2025-06-23T10:21:30Z
1.21.1   2025-12-02T18:57:15Z  2025-11-18T13:04:32Z
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;print&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This command shows the currently used vault token. It either reflects the environment variable &lt;code&gt;VAULT_TOKEN&lt;/code&gt;, or the content of the currents user &lt;code&gt;~/.vault-token&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;Here is an example of a successful invocation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault print

&lt;span class="c"&gt;# log messages&lt;/span&gt;
hvs.HTMdJOhLMnJ0l3mHYB242Swv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When no token is defined, the command merely prints an empty line and exits with status code &lt;code&gt;0&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;path-help&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This handy command prints compact information about any configured mount point of Vault. This helps to quickly find out which parameters can be used on which endpoint.&lt;/p&gt;

&lt;p&gt;Here are some examples, showing the responses for endpoints accessible to the admin only, as well as generic endpoints for secrets.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault path-help sys

&lt;span class="c"&gt;# log messages&lt;/span&gt;
&lt;span class="c"&gt;## DESCRIPTION&lt;/span&gt;

The system backend is built-in to Vault and cannot be remounted or
unmounted. It contains the paths that are used to configure Vault itself
as well as perform core operations.

&lt;span class="c"&gt;## PATHS&lt;/span&gt;

The following paths are supported by this backend. To view &lt;span class="nb"&gt;help &lt;/span&gt;&lt;span class="k"&gt;for
&lt;/span&gt;any of the paths below, use the &lt;span class="nb"&gt;help command &lt;/span&gt;with any route matching
the path pattern. Note that depending on the policy of your auth token,
you may or may not be able to access certain paths.

    ^&lt;span class="o"&gt;(&lt;/span&gt;leases/&lt;span class="o"&gt;)&lt;/span&gt;?renew&lt;span class="o"&gt;(&lt;/span&gt;/&lt;span class="o"&gt;(&lt;/span&gt;?P&amp;lt;url_lease_id&amp;gt;.+&lt;span class="o"&gt;))&lt;/span&gt;?&lt;span class="err"&gt;$&lt;/span&gt;
        Renew a lease on a secret

    ^&lt;span class="o"&gt;(&lt;/span&gt;leases/&lt;span class="o"&gt;)&lt;/span&gt;?revoke&lt;span class="o"&gt;(&lt;/span&gt;/&lt;span class="o"&gt;(&lt;/span&gt;?P&amp;lt;url_lease_id&amp;gt;.+&lt;span class="o"&gt;))&lt;/span&gt;?&lt;span class="err"&gt;$&lt;/span&gt;
        Revoke a leased secret immediately

    ^&lt;span class="o"&gt;(&lt;/span&gt;leases/&lt;span class="o"&gt;)&lt;/span&gt;?revoke-force/&lt;span class="o"&gt;(&lt;/span&gt;?P&amp;lt;prefix&amp;gt;.+&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt;
        Revoke all secrets generated &lt;span class="k"&gt;in &lt;/span&gt;a given prefix, ignoring errors.

    ^&lt;span class="o"&gt;(&lt;/span&gt;leases/&lt;span class="o"&gt;)&lt;/span&gt;?revoke-prefix/&lt;span class="o"&gt;(&lt;/span&gt;?P&amp;lt;prefix&amp;gt;.+&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt;
        Revoke all secrets generated &lt;span class="k"&gt;in &lt;/span&gt;a given prefix
    ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault path-help auth/token

&lt;span class="c"&gt;# log messages&lt;/span&gt;
&lt;span class="c"&gt;## DESCRIPTION&lt;/span&gt;

&lt;span class="c"&gt;## PATHS&lt;/span&gt;

The following paths are supported by this backend. To view &lt;span class="nb"&gt;help &lt;/span&gt;&lt;span class="k"&gt;for
&lt;/span&gt;any of the paths below, use the &lt;span class="nb"&gt;help command &lt;/span&gt;with any route matching
the path pattern. Note that depending on the policy of your auth token,
you may or may not be able to access certain paths.

    ^accessors/?&lt;span class="err"&gt;$&lt;/span&gt;
        List token accessors, which can &lt;span class="k"&gt;then &lt;/span&gt;be
        be used to iterate and discover their properties
        or revoke them. Because this can be used to
        cause a denial of service, this endpoint
        requires &lt;span class="s1"&gt;'sudo'&lt;/span&gt; capability &lt;span class="k"&gt;in &lt;/span&gt;addition to
        &lt;span class="s1"&gt;'list'&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;

    ^create&lt;span class="err"&gt;$&lt;/span&gt;
        The token create path is used to create new tokens.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;events&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Vault usage logs data to an internal event system, and with the same named command, a live trail of events from a specific topic can be obtained. Alas, in the vault community edition, events are not implemented yet. Checking the official documentation about the &lt;a href="https://developer.hashicorp.com/vault/api-docs/system/experiments" rel="noopener noreferrer"&gt;/sys/experiments endpoint&lt;/a&gt; does not reveal information how to get events operational.&lt;/p&gt;

&lt;p&gt;Calling the command returns an error only.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault events subscribe &lt;span class="s1"&gt;'*'&lt;/span&gt;

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
events endpoint not found&lt;span class="p"&gt;;&lt;/span&gt; check &lt;span class="sb"&gt;`&lt;/span&gt;vault &lt;span class="nb"&gt;read &lt;/span&gt;sys/experiments&lt;span class="sb"&gt;`&lt;/span&gt; to see &lt;span class="k"&gt;if &lt;/span&gt;an events experiment is available but disabled
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;monitor&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This command continuously streams live log files. It gives an immediate insight into a Vault server.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault monitor

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
2025-12-07T10:20:26.602+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core: successful mount: &lt;span class="nv"&gt;namespace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="nv"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;ldap/ &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;ldap &lt;span class="nv"&gt;version&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"v1.21.1+builtin.vault"&lt;/span&gt;
2025-12-07T10:20:26.608+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  secrets.ldap.ldap_e03497d2: initializing database rotation queue
2025-12-07T10:20:26.608+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  secrets.ldap.ldap_e03497d2: populating role rotation queue
2025-12-07T10:20:26.617+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  secrets.ldap.ldap_e03497d2: starting periodic ticker
2025-12-07T10:20:42.356+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core: successful mount: &lt;span class="nv"&gt;namespace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="nv"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;totp/ &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;totp &lt;span class="nv"&gt;version&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"v1.21.1+builtin.vault"&lt;/span&gt;
2025-12-07T10:21:00.354+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core: successfully unmounted: &lt;span class="nv"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;totp/ &lt;span class="nv"&gt;namespace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;debug&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;While Vault's configuration can be determined statically, its runtime behavior needs to be actively observed and measured.&lt;/p&gt;

&lt;p&gt;When executed, the &lt;code&gt;debug&lt;/code&gt; command start a process that connects to the Vault server instance, captures data for a specific time, and creates an archive file with all individual results. The command uses the configured vault token and attached policies - to ensure complete coverage of all required endpoints, elevated access rights are required.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault debug

&lt;span class="o"&gt;==&amp;gt;&lt;/span&gt; Starting debug capture...
         Vault Address: http://127.0.0.1:8210
        Client Version: 1.21.1
        Server Version: 1.21.1
              Duration: 2m0s
              Interval: 30s
      Metrics Interval: 10s
               Targets: config, host, requests, metrics, pprof, replication-status, server-status, log
                Output: vault-debug-2025-12-05T15-58-58Z.tar.gz

&lt;span class="o"&gt;==&amp;gt;&lt;/span&gt; Capturing static information...
2025-12-05T17:58:58.830+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing configuration state

&lt;span class="o"&gt;==&amp;gt;&lt;/span&gt; Capturing dynamic information...
2025-12-05T17:58:58.834+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing pprof data: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0
2025-12-05T17:58:58.835+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing &lt;span class="k"&gt;in&lt;/span&gt;&lt;span class="nt"&gt;-flight&lt;/span&gt; request status: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0
2025-12-05T17:58:58.835+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing server status: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0
2025-12-05T17:58:58.835+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing host information: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0
2025-12-05T17:58:58.835+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing metrics: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0
2025-12-05T17:58:58.835+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing replication status: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0
2025-12-05T17:59:08.834+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing metrics: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1
2025-12-05T17:59:18.834+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing metrics: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2
2025-12-05T17:59:28.833+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing replication status: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1
2025-12-05T17:59:28.833+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing server status: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1
2025-12-05T17:59:28.833+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing &lt;span class="k"&gt;in&lt;/span&gt;&lt;span class="nt"&gt;-flight&lt;/span&gt; request status: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1
2025-12-05T17:59:28.833+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing metrics: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;3
2025-12-05T17:59:28.833+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing host information: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1
2025-12-05T17:59:38.833+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing metrics: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;4
2025-12-05T17:59:48.832+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing metrics: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;5
2025-12-05T17:59:58.831+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing replication status: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2
2025-12-05T17:59:58.831+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing metrics: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;6
2025-12-05T17:59:58.831+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing host information: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2
2025-12-05T17:59:58.831+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing &lt;span class="k"&gt;in&lt;/span&gt;&lt;span class="nt"&gt;-flight&lt;/span&gt; request status: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2
2025-12-05T17:59:58.831+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing server status: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2
2025-12-05T17:59:58.833+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing pprof data: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1
2025-12-05T18:00:08.831+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing metrics: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;7
2025-12-05T18:00:18.830+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing metrics: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;8
2025-12-05T18:00:28.829+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing metrics: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;9
2025-12-05T18:00:28.830+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing &lt;span class="k"&gt;in&lt;/span&gt;&lt;span class="nt"&gt;-flight&lt;/span&gt; request status: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;3
2025-12-05T18:00:28.830+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing host information: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;3
2025-12-05T18:00:28.830+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing replication status: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;3
2025-12-05T18:00:28.830+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing server status: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;3
2025-12-05T18:00:38.829+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing metrics: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;10
2025-12-05T18:00:48.828+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing metrics: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;11
2025-12-05T18:00:58.828+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing metrics: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;12
2025-12-05T18:00:58.828+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing host information: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;4
2025-12-05T18:00:58.828+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing &lt;span class="k"&gt;in&lt;/span&gt;&lt;span class="nt"&gt;-flight&lt;/span&gt; request status: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;4
2025-12-05T18:00:58.828+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing replication status: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;4
2025-12-05T18:00:58.828+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing server status: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;4
2025-12-05T18:00:58.830+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  capturing pprof data: &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2
Finished capturing information, bundling files...
Success! Bundle written to: vault-debug-2025-12-05T17-58-58Z.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The created archive file contains the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;config.json&lt;/code&gt;: Lists the derived, complete configuration of the Vault server, including TCP listeners, plugins, storage and listeners&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;host_info.json&lt;/code&gt;: Detailed hardware metrics of the host, including CPU, memory and storage&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;index.json&lt;/code&gt;: Meta information about the debug process, like timestamps and endpoint targets, and about the archive itself, listing all individual files&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;metrics.json&lt;/code&gt;: fine-grained measurements of the Vault process, such as read-write statistics of the storage and memory, health of replication, and other&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;replication_status.json&lt;/code&gt;: time-base probes about the status of replication&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;requests.json&lt;/code&gt;: A logfile detailing which Vault-internal endpoints were queried to obtain data&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;server_status.json&lt;/code&gt;: Reports the health and seal status monitored over the debug command duration&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;vault.log&lt;/code&gt;: An export of log statements printed by vault for the duration of the debug command&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;audit&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Audit devices are files, syslog servers, or any sockets that can process a text stream. When configured, all API calls and responses to the Vault server are logged in these audit devices. In the logs, all string-encoded content is hashed in order to prevent the clear-text recording of sensitive data. If other value types are considered sensitive, they should be output as string values too.&lt;/p&gt;

&lt;p&gt;Once configured, audit devices are strictly required: Vault logs first to an audit device, and then returns responses to the client. If all configured audit devices are non-responsive, the Vault server effectively stops functioning.&lt;/p&gt;

&lt;p&gt;Finally, not all API endpoints are stored to an audit device - see the documentation about &lt;a href="https://developer.hashicorp.com/vault/docs/audit#exempted-api-endpoints" rel="noopener noreferrer"&gt;exempted API endpoints&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The audit command distinguishes three subcommands:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;enable&lt;/code&gt;: Activate and configure an audit text file or stream&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;list&lt;/code&gt;: Shows all configured audit devices and their status&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;disable&lt;/code&gt;: Disables a device&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The first step is to define an audit device. The following example activates a log file and the syslog stream.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault audit &lt;span class="nb"&gt;enable &lt;/span&gt;file &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nv"&gt;file_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/var/log/vault/audit.log

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Success! Enabled the file audit device at: file/
2025-12-08T20:34:08.865+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core: enabled audit backend: &lt;span class="nv"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;file/ &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;file
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault audit &lt;span class="nb"&gt;enable &lt;/span&gt;syslog

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Success! Enabled the syslog audit device at: syslog/
2025-12-08T20:34:21.429+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core: enabled audit backend: &lt;span class="nv"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;syslog/ &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;syslog
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, any interactions with Vault are logged to the audit devices. Here is an example during interacting with Vault via the GUI. A read request to &lt;code&gt;sys/internal/ui/mounts&lt;/code&gt; creates the following record:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"auth"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"accessor"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"hmac-sha256:8b11128ad2c588dfb8266c831fca6967ffb2248bb880c62ca7d5a997ea3df2f4"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"client_token"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"hmac-sha256:9b4208cf75a780083842745f54a4fa3827b2120af50c560aa74a03f83009d320"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"display_name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"root"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"policies"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"root"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"policy_results"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"allowed"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"token_policies"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"root"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"token_issue_time"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2025-12-02T19:57:16+01:00"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"token_type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"service"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"request"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"client_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"0DHqvq2D77kL2/JTPSZkTMJbkFVmUu0TzMi0jiXcFy8="&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"client_token"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"hmac-sha256:9b4208cf75a780083842745f54a4fa3827b2120af50c560aa74a03f83009d320"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"client_token_accessor"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"hmac-sha256:8b11128ad2c588dfb8266c831fca6967ffb2248bb880c62ca7d5a997ea3df2f4"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"headers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"user-agent"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"Mozilla/5.0 (Macintosh; Intel Mac OS X 15_7_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Safari/605.1.15"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"d0fff50b-0448-15cb-afd3-5dc9a394e717"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"mount_class"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"secret"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"mount_point"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"sys/"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"mount_running_version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"v1.21.1+builtin.vault"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"mount_type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"system"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"namespace"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"root"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"operation"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"read"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"path"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"sys/internal/ui/mounts"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"remote_address"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"127.0.0.1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"remote_port"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;61961&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"time"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2025-12-09T19:26:00.392476Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"request"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All currently configured devices can be show by running the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault audit list

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Path       Type      Description
&lt;span class="nt"&gt;----&lt;/span&gt;       &lt;span class="nt"&gt;----&lt;/span&gt;      &lt;span class="nt"&gt;-----------&lt;/span&gt;
file/      file      n/a
syslog/    syslog    n/a
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And to disable audit devices, following command can be used:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault audit disable file/
Success! Disabled audit device &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;if &lt;/span&gt;it was enabled&lt;span class="o"&gt;)&lt;/span&gt; at: file/
2025-12-09T20:33:23.538+0100 &lt;span class="o"&gt;[&lt;/span&gt;INFO]  core: disabled audit backend: &lt;span class="nv"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;file/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The Hashicorp vault CLI is the essential tool to setup, configure, maintain and troubleshoot a Vault server. This article explored commands from the introspection group. You learned how to a) see the status of the Vault server, b) access version information, c) get documentation about available endpoints, d) collect detailed metrics and access log message live stream, and e) configure and manage audit devices. Commands in this group should help you to diagnose and expediate the resolution of operational errors.&lt;/p&gt;

</description>
      <category>hashicorp</category>
      <category>vault</category>
      <category>hashicorpvault</category>
    </item>
    <item>
      <title>Hashicorp Vault CLI Part 3: Plugin Management and General CRUD Operations</title>
      <dc:creator>Sebastian</dc:creator>
      <pubDate>Mon, 02 Feb 2026 06:31:41 +0000</pubDate>
      <link>https://dev.to/admantium/hashicorp-vault-cli-part-3-plugin-management-and-general-crud-operations-1np0</link>
      <guid>https://dev.to/admantium/hashicorp-vault-cli-part-3-plugin-management-and-general-crud-operations-1np0</guid>
      <description>&lt;p&gt;The management of encrypted data and secrets in on-premise or cloud environments is a crucial task. Hashicorp Vault is a flexible tool, supporting a wide range of secret types and helping to provide short-lived access tokens to various systems.&lt;/p&gt;

&lt;p&gt;All Vault operation and configuration tasks can be implemented with the Vault CLI tool. In an ongoing article series, all commands are explored systematically. This article continues commands from the configuration group. You will learn how to manage plugins, and how to perform general create-read-update-delete operations on any configuration or data.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The technical context of this article is &lt;code&gt;hashicorp_vault_v1.21.1&lt;/code&gt;, released 2025-11-18. All provided information and command examples should be valid with newer versions too, baring an update of the CLI commands' syntax&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The background material for this article stems from the official Hashicorp Vault documentation about &lt;a href="https://developer.hashicorp.com/vault/docs/commands" rel="noopener noreferrer"&gt;Vault CLI&lt;/a&gt; and subsequent pages, as well as information from the binary itself&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article originally appeared at my blog &lt;a href="https://admantium.com/blog/vault12_cli_p3_plugin_and_general_crud_configuration/" rel="noopener noreferrer"&gt;admantium.com&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Vault CLI Overview
&lt;/h2&gt;

&lt;p&gt;The Vault CLI provides more than 30 commands. For systematically explaining and contextualizing each command, they can be structured as follows.&lt;/p&gt;

&lt;p&gt;Groups and commands marked with a checkmark were covered in an earlier article, and the commands marked with an at sign are the focus for this article. In particular, this article covers all commands from the configuration group, except &lt;code&gt;vault operator&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ Initialization

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;server&lt;/code&gt;: Starts a server process&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;agent&lt;/code&gt;: Starts an agent process, a utility to communicate with a vault server to gain access to tokens&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;proxy&lt;/code&gt;: Starts a vault proxy process&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Configuration

&lt;ul&gt;
&lt;li&gt;✅ &lt;code&gt;operator&lt;/code&gt;: Cluster management operations, including memberships, encryption and unseal keys&lt;/li&gt;
&lt;li&gt;🌀 &lt;code&gt;plugin&lt;/code&gt;: Manage and install additional plugins&lt;/li&gt;
&lt;li&gt;🌀 &lt;code&gt;read&lt;/code&gt; / &lt;code&gt;list&lt;/code&gt;: Access stored configuration and secrets&lt;/li&gt;
&lt;li&gt;🌀 &lt;code&gt;write&lt;/code&gt; / &lt;code&gt;patch&lt;/code&gt;: Modify or create any data&lt;/li&gt;
&lt;li&gt;🌀 &lt;code&gt;delete&lt;/code&gt;: Delete configuration data or secrets&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Introspection

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;status&lt;/code&gt;: Show status information of the vault server&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;version&lt;/code&gt;: Shows compact version information and build timestamp&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;version-history&lt;/code&gt;: Shows detailed version information about all previously used vault server instances&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;print&lt;/code&gt;: Detailed view of the vault’s server runtime configuration&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;path-help&lt;/code&gt;: Detailed documentation about API endpoints&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;events&lt;/code&gt;: Subscribe to the event stream of a running vault instance&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;monitor&lt;/code&gt;: Print vault log messages&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;debug&lt;/code&gt;: Shows debug information of the connected Vault server&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;audit&lt;/code&gt;: Interact with connected audit devices&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Vault Enterprise

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;hcp&lt;/code&gt;: Operate a managed Hashicorp Vault cluster&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;namespace&lt;/code&gt;: Interact with configured namespaces of the cluster&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Authorization

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;policy&lt;/code&gt;: Manage policy definitions that govern all vault operations&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;tokens&lt;/code&gt;: General token management&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;lease&lt;/code&gt;: Manage current token leases, including renewal, revocation and TTL modification&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Authentication

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;auth&lt;/code&gt;: Interact with configured authentication options&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;login&lt;/code&gt;: Authenticates access to a Vault server&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Secrets Management

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;secrets&lt;/code&gt;: General configuration of secret engines&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;kv&lt;/code&gt;: Access to the essential key-value store&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;transform&lt;/code&gt;: Interact with the transform secrets engine&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;transit&lt;/code&gt;: Interact with the Vaults transit secrets engine&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;unwrap&lt;/code&gt;: One-time access to arbitrary encrypted data&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;pki&lt;/code&gt;: Access the private key infrastructure secrets engine&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ssh&lt;/code&gt;: Initiates SSH sessions via the SSH secrets engine&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Plugin Management Commands
&lt;/h2&gt;

&lt;p&gt;Plugin is the technical name and architectural implementation of extended Vault functionality. They are separated into three groups: auth, database, and secrets. Each plugin exposes common functionality hooked with, and accessible by, the Vault CLI.&lt;/p&gt;

&lt;p&gt;To manage plugins themselves, the same named command &lt;code&gt;plugin&lt;/code&gt; can be used. Its subcommands either interact with the plugin catalog, a database that stores information about available plugins, or modify loaded plugins of a Vault instance.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;plugin list&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Show all available plugins that are configured in a Vaults instance plugin catalog. Naturally, on a fresh installation, these plugins reflect the complete list of built-in variants.&lt;/p&gt;

&lt;p&gt;The following code blocks show which auth, database, and secret plugins are available in &lt;code&gt;hashicorp_vault_v1.21.1&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault plugin list auth

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Name          Version
&lt;span class="nt"&gt;----&lt;/span&gt;          &lt;span class="nt"&gt;-------&lt;/span&gt;
alicloud      v0.22.0+builtin
approle       v1.21.1+builtin.vault
aws           v1.21.1+builtin.vault
azure         v0.22.0+builtin
cert          v1.21.1+builtin.vault
cf            v0.22.0+builtin
gcp           v0.22.0+builtin
github        v1.21.1+builtin.vault
jwt           v0.25.0+builtin
kerberos      v0.16.0+builtin
kubernetes    v0.23.1+builtin
ldap          v1.21.1+builtin.vault
oci           v0.20.0+builtin
oidc          v1.21.1+builtin.vault
okta          v1.21.1+builtin.vault
pcf           v1.21.1+builtin.vault
radius        v1.21.1+builtin.vault
userpass      v1.21.1+builtin.vault
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault plugin list database

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Name                                 Version
&lt;span class="nt"&gt;----&lt;/span&gt;                                 &lt;span class="nt"&gt;-------&lt;/span&gt;
cassandra-database-plugin            v1.21.1+builtin.vault
couchbase-database-plugin            v0.15.0+builtin
elasticsearch-database-plugin        v0.19.0+builtin
hana-database-plugin                 v1.21.1+builtin.vault
influxdb-database-plugin             v1.21.1+builtin.vault
mongodb-database-plugin              v1.21.1+builtin.vault
mongodbatlas-database-plugin         v0.16.0+builtin
mssql-database-plugin                v1.21.1+builtin.vault
mysql-aurora-database-plugin         v1.21.1+builtin.vault
mysql-database-plugin                v1.21.1+builtin.vault
mysql-legacy-database-plugin         v1.21.1+builtin.vault
mysql-rds-database-plugin            v1.21.1+builtin.vault
postgresql-database-plugin           v1.21.1+builtin.vault
redis-database-plugin                v0.7.0+builtin
redis-elasticache-database-plugin    v0.8.0+builtin
redshift-database-plugin             v1.21.1+builtin.vault
snowflake-database-plugin            v0.15.0+builtin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault plugin list secret

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Name            Version
&lt;span class="nt"&gt;----&lt;/span&gt;            &lt;span class="nt"&gt;-------&lt;/span&gt;
ad              v0.21.0+builtin
alicloud        v0.21.0+builtin
aws             v1.21.1+builtin.vault
azure           v0.23.0+builtin
consul          v1.21.1+builtin.vault
gcp             v0.23.0+builtin
gcpkms          v0.22.0+builtin
kubernetes      v0.12.0+builtin
kv              v0.25.0+builtin
ldap            v1.21.1+builtin.vault
mongodbatlas    v0.16.0+builtin
nomad           v1.21.1+builtin.vault
openldap        v0.17.0+builtin
pki             v1.21.1+builtin.vault
rabbitmq        v1.21.1+builtin.vault
ssh             v1.21.1+builtin.vault
terraform       v0.13.0+builtin
totp            v1.21.1+builtin.vault
transit         v1.21.1+builtin.vault
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;plugin info&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Prints detailed information about a plugin.&lt;/p&gt;

&lt;p&gt;For example, the built-in &lt;code&gt;kv&lt;/code&gt; secret plugin is shown as this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault plugin info secret kv

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Key                   Value
&lt;span class="nt"&gt;---&lt;/span&gt;                   &lt;span class="nt"&gt;-----&lt;/span&gt;
args                  &lt;span class="o"&gt;[]&lt;/span&gt;
&lt;span class="nb"&gt;builtin               true
command               &lt;/span&gt;n/a
deprecation_status    supported
name                  kv
oci_image             n/a
runtime               n/a
sha256                n/a
version               v0.25.0+builtin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;plugin register&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;In addition to the built-in plugins provided with the vault binary itself, several external and community plugins can be added too. This command assumes that the plugin is provided as a binary, executable file stored in the plugin directory path. Additional flags to this command control metainformations like the version, plugin parameters, and a sh256 sum of the binary file.&lt;/p&gt;

&lt;p&gt;The documentation about &lt;a href="https://developer.hashicorp.com/vault/docs/plugins" rel="noopener noreferrer"&gt;Vault plugin ecosystem&lt;/a&gt; provides additional information and sources for different plugin types.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;plugin deregister&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Removes a manually added plugin from the local catalog, either completely, or a dedicated version by passing the same named flag to the command.&lt;/p&gt;

&lt;p&gt;It is not possible to remove a built-in plugin - an attempt is shown in the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault plugin deregister secret aws

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Plugin &lt;span class="s2"&gt;"aws"&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;type&lt;/span&gt;: &lt;span class="s2"&gt;"secret"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; is a built-in plugin and cannot be deregistered
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;plugin reload&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Re-initializes a configured plugin with the default options. This method is helpful when a newer version of a plugin is installed, and should be loaded without a shutdown of the complete Vault instance. All type of plugins can be reloaded as shown by the following example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault plugin reload &lt;span class="nt"&gt;-type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;secret &lt;span class="nt"&gt;-plugin&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;kv

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Success! Reloaded plugin: kv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;plugin reload-status&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Shows metainformation about a concrete reload action, requiring the reload ID.&lt;/p&gt;

&lt;p&gt;However, I could not find information about where to obtain a reload ID. And when running the command with an example ID from its documentation, the following error message is returned.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault plugin reload-status d60a3e83-a598-4f3a-879d-0ddd95f11d4e

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Error retrieving plugin reload status: Error making API request.

URL: GET http://127.0.0.1:8210/v1/sys/plugins/reload/backend/status?reload_id&lt;span class="o"&gt;=&lt;/span&gt;d60a3e83-a598-4f3a-879d-0ddd95f11d4e
Code: 404. Errors:

&lt;span class="k"&gt;*&lt;/span&gt; enterprise-only feature

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;plugin runtime&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This subcommand interacts directly with the running Vault instance plugins, and supports the sub-subcommands &lt;code&gt;info&lt;/code&gt;, &lt;code&gt;list&lt;/code&gt;, &lt;code&gt;register&lt;/code&gt; and &lt;code&gt;deregister&lt;/code&gt; which work similarly as their plugin catalog counterparts.&lt;/p&gt;

&lt;p&gt;At the time of writing, the &lt;code&gt;runtime&lt;/code&gt; command only supports custom plugins of type container as the following explanation from the CLI itself exposes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault plugin runtime &lt;span class="nt"&gt;--help&lt;/span&gt;

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Usage: vault plugin runtime &amp;lt;subcommand&amp;gt; &lt;span class="o"&gt;[&lt;/span&gt;options] &lt;span class="o"&gt;[&lt;/span&gt;args]

  This &lt;span class="nb"&gt;command groups &lt;/span&gt;subcommands &lt;span class="k"&gt;for &lt;/span&gt;interacting with Vaults plugin runtimes and the
  plugin runtime catalog. The plugin runtime catalog is divided into types. Currently,
  Vault only supports &lt;span class="s2"&gt;"container"&lt;/span&gt; plugin runtimes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  CRUD Operations
&lt;/h2&gt;

&lt;p&gt;Hashicorp Vault exposes its complete functionality via API endpoints. And these endpoints can be operated via CRUD operations directly via the CLI. Internally, the CLI will transform the commands to confirm with the REST-API design of its endpoint, issuing HTTP requests.&lt;/p&gt;

&lt;p&gt;To see the CRUD operations in action, two different types of data are covered in the following examples: A kv-v2 secret engine, and their appropriate access policies.&lt;/p&gt;

&lt;p&gt;The kv-v2 secret engine will be mounted at &lt;code&gt;/kv-secrets&lt;/code&gt; with the following command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault secrets &lt;span class="nb"&gt;enable&lt;/span&gt; &lt;span class="nt"&gt;-max-lease-ttl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1h &lt;span class="nt"&gt;-path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;kv-secrets kv-v2

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Success! Enabled the kv-v2 secrets engine at: kv-secrets/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;write&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The write operation creates a new dataset.&lt;/p&gt;

&lt;p&gt;To add a new kv-v2 secret, the path structure &lt;code&gt;&amp;lt;mount_path&amp;gt;/data/&amp;lt;secret_name&amp;gt;&lt;/code&gt; must be used. Furthermore, the data needs to be stored in a file, and provide via the &lt;code&gt;@&lt;/code&gt; sign.&lt;/p&gt;

&lt;p&gt;First, create a file with the following content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"data"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"admin"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"CjE3OjAwIEtvY2hlbiwg"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"options"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"cas"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Second, write the secret &lt;code&gt;config-db-credentials&lt;/code&gt; with the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault write kv-secrets/data/config-db-credentials @secret.json

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Key                Value
&lt;span class="nt"&gt;---&lt;/span&gt;                &lt;span class="nt"&gt;-----&lt;/span&gt;
created_time       2025-12-16T11:03:52.838769Z
custom_metadata    &amp;lt;nil&amp;gt;
deletion_time      n/a
destroyed          &lt;span class="nb"&gt;false
&lt;/span&gt;version            1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, create a read-only policy for non-admin users:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vault write sys/policy/kv-secrets &lt;span class="nv"&gt;policy&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'path "kv-secrets/*" {
  capabilities = ["read"]
}'&lt;/span&gt;

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Success! Data written to: sys/policy/kv-secrets
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;read&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The read operation prints stored data.&lt;/p&gt;

&lt;p&gt;To access the secret, the path &lt;code&gt;kv-secrets/metadata&lt;/code&gt; must be used in the request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault &lt;span class="nb"&gt;read &lt;/span&gt;kv-secrets/metadata/config-db-credentials

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Key                     Value
&lt;span class="nt"&gt;---&lt;/span&gt;                     &lt;span class="nt"&gt;-----&lt;/span&gt;
cas_required            &lt;span class="nb"&gt;false
&lt;/span&gt;created_time            2025-12-16T11:03:52.838769Z
current_version         1
custom_metadata         &amp;lt;nil&amp;gt;
delete_version_after    0s
last_updated_by         map[actor:root client_id:0DHqvq2D77kL2/JTPSZkTMJbkFVmUu0TzMi0jiXcFy8&lt;span class="o"&gt;=&lt;/span&gt; operation:create]
max_versions            0
oldest_version          0
updated_time            2025-12-16T11:03:52.838769Z
versions                map[1:map[created_by:map[actor:root client_id:0DHqvq2D77kL2/JTPSZkTMJbkFVmUu0TzMi0jiXcFy8&lt;span class="o"&gt;=&lt;/span&gt; operation:create] created_time:2025-12-16T11:03:52.838769Z deleted_by:&amp;lt;nil&amp;gt; deletion_time: destroyed:false]]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault &lt;span class="nb"&gt;read &lt;/span&gt;sys/policy/kv-secrets

&lt;span class="c"&gt;# Log message&lt;/span&gt;
Key      Value
&lt;span class="nt"&gt;---&lt;/span&gt;      &lt;span class="nt"&gt;-----&lt;/span&gt;
name     kv-secrets
rules    path &lt;span class="s2"&gt;"kv-secrets/*"&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  capabilities &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"read"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;list&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;While the &lt;code&gt;read&lt;/code&gt; operation returns a single entry with complete details, calling &lt;code&gt;list&lt;/code&gt; shows all defined entries with their names.&lt;/p&gt;

&lt;p&gt;Assuming additional secrets were added to the kv-v2 secret store:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault list kv-secrets/metadata

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Keys
&lt;span class="nt"&gt;----&lt;/span&gt;
app-credentials
config-db-credentials
config-portal-credentials
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same operation applied to the policies returns the complete set of all system and user defined objects.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault list sys/policy/

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Keys
&lt;span class="nt"&gt;----&lt;/span&gt;
default
kv-secrets
root
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;patch&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;To update configuration parts of an existing entry, the &lt;code&gt;patch&lt;/code&gt; command can be used.&lt;/p&gt;

&lt;p&gt;To update a kv-v2 entry, the payload file needs to be changed as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;change&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;cas&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;value&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;current&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;version&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;of&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;secret&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"data"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"admin"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"CjE3OjAwIEtvY2hlbiwg"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"options"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"cas"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then perform the update:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault patch kv-secrets/data/config-db-credentials @secret.json

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Key                Value
&lt;span class="nt"&gt;---&lt;/span&gt;                &lt;span class="nt"&gt;-----&lt;/span&gt;
created_time       2025-12-16T13:29:38.764223Z
custom_metadata    &amp;lt;nil&amp;gt;
deletion_time      n/a
destroyed          &lt;span class="nb"&gt;false
&lt;/span&gt;version            2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And for the policy, the access rights shall be expanded.&lt;/p&gt;

&lt;p&gt;However, executing the &lt;code&gt;patch&lt;/code&gt; command returns an error - policies cannot be changed, merely redefined.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault patch sys/policy/kv-secrets &lt;span class="nv"&gt;policy&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'path "kv-secrets/*" {
  capabilities = ["read", "create"]
}'&lt;/span&gt;

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Error writing data to sys/policy/kv-secrets: Error making API request.

URL: PATCH http://127.0.0.1:8210/v1/sys/policy/kv-secrets
Code: 405. Errors:

&lt;span class="k"&gt;*&lt;/span&gt; 1 error occurred:
 &lt;span class="k"&gt;*&lt;/span&gt; unsupported operation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The redefinition takes the form of another &lt;code&gt;write&lt;/code&gt; command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault write sys/policy/kv-secrets &lt;span class="nv"&gt;policy&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'path "kv-secrets/*" {
  capabilities = ["read", "create"]
}'&lt;/span&gt;

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Success! Data written to: sys/policy/kv-secrets
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;delete&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;When data is not required anymore, a &lt;code&gt;delete&lt;/code&gt; command safely erases it.&lt;/p&gt;

&lt;p&gt;To delete a stored secret in the kv-v2 store:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault delete kv-secrets/metadata/config-db-credentials

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Success! Data deleted &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;if &lt;/span&gt;it existed&lt;span class="o"&gt;)&lt;/span&gt; at: kv-secrets/metadata/config-db-credentials
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And to delete the policy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault delete sys/policy/kv-secrets

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Success! Data deleted &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;if &lt;/span&gt;it existed&lt;span class="o"&gt;)&lt;/span&gt; at: sys/policy/kv-secrets
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;All operational and configurational Vault tasks can be implemented with the &lt;code&gt;vault&lt;/code&gt; binary. In this article, CLI commands from the configuration group were explored. First, you learned about the &lt;code&gt;plugin&lt;/code&gt; command, which gives either access to a static database, or reflects respectively modifies the runtime status of plugins. Second, you learned about the generic CRUD commands &lt;code&gt;write&lt;/code&gt;, &lt;code&gt;read&lt;/code&gt;, &lt;code&gt;list&lt;/code&gt;, &lt;code&gt;patch&lt;/code&gt; and &lt;code&gt;delete&lt;/code&gt;, which can modify core Vault configuration data as well as data stored in its activated plugins.&lt;/p&gt;

</description>
      <category>hashicorp</category>
      <category>vault</category>
      <category>hashicorpvault</category>
    </item>
    <item>
      <title>Hashicorp Vault: TOTP Secrets Engine</title>
      <dc:creator>Sebastian</dc:creator>
      <pubDate>Thu, 22 Jan 2026 05:57:30 +0000</pubDate>
      <link>https://dev.to/admantium/hashicorp-vault-totp-secrets-engine-1lp3</link>
      <guid>https://dev.to/admantium/hashicorp-vault-totp-secrets-engine-1lp3</guid>
      <description>&lt;p&gt;In Hashicorp Vault, secrets are distinguished into static and dynamic. Static secrets are more long-term, stored encrypted in Vault, and given access to by tokens. Dynamic Secrets are created on demand at the target application when a token is issued, and removed when the token expires or is explicitly revoked. All secrets engines fall into one or the other category.&lt;/p&gt;

&lt;p&gt;The TOTP secret engine is an exception. It creates one-time-password (OTP) tokens that are secrets themselves. In terms of password strength, they are rather weak with only 6-8 digits, but their lifetime is limited to typically 30 seconds. The primary use case is to show token ownership in this short lifespan, typically as a second factor when authenticating with a third party system.&lt;/p&gt;

&lt;p&gt;This blog article is a complete coverage of the TOTP secrets engine. It shows the setup, groups and explains all API methods, and finally shows an application example.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The technical context of this article is &lt;code&gt;hashicorp_vault_v1.21.1&lt;/code&gt;, released 2025-11-18. All provided information and command examples should be valid with newer versions too, baring an update of the CLI commands' syntax&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The background material for this article stems from the official Hashicorp Vault documentation about &lt;a href="https://developer.hashicorp.com/vault/docs/secrets/totp" rel="noopener noreferrer"&gt;TOTP secrets engine&lt;/a&gt; and &lt;a href="https://developer.hashicorp.com/vault/api-docs/secret/totp" rel="noopener noreferrer"&gt;TOTP secrets engine (API)&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This blog article originally appeared at my blog &lt;a href="https://admantium.com/blog/vault11_totp_secrets_engine/" rel="noopener noreferrer"&gt;admantium.com&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  TOTP Secrets Engine
&lt;/h2&gt;

&lt;p&gt;In Hashicorp Vault, secrets engines issue tokens that provide access to stored secrets. The default mechanism to implement this function is that a system or user authenticates with Vault, receives a token to which a policy is attached, and then uses this token to access other mount paths in the Vault instance. With the TOTP secrets engine, the secrets themselves are tokens - cryptographically rather weak with only 6-8 digits, but a very short time span and only one valid token at a time&lt;/p&gt;

&lt;p&gt;The TOTP secrets engine can be used in two different roles. One role is the OTP generator. External applications that support second factor authentication expose a configuration URL. When this URL is registered as a Vault TOTP engine key, OTPs can be generated from it that are valid for the external application. The second role is as an OTP provider. Vault itself exposes API endpoints for generating short-lived OTPs, and provides an additional endpoint that validates these tokens.&lt;/p&gt;

&lt;p&gt;In essence, the TOTP secrets engine issues one-time usable, short-lived secrets that are used as second factor when authenticating with external systems.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup
&lt;/h2&gt;

&lt;p&gt;The TOTP engine must be enabled via GUI or CLI - the later will be used as it is in all other articles of this blog series.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault secrets &lt;span class="nb"&gt;enable&lt;/span&gt; &lt;span class="nt"&gt;-path&lt;/span&gt; /totp totp

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
&lt;span class="o"&gt;[&lt;/span&gt;INFO]  core: successful mount: &lt;span class="nv"&gt;namespace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="nv"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;totp/ &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;totp &lt;span class="nv"&gt;version&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"v1.21.1+builtin.vault"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It offers a slim set of 6 API methods which are covered in the following sections.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create Keys
&lt;/h2&gt;

&lt;p&gt;Encryption keys are required for the TOTP engine to create its secrets. Either external keys are imported to Vault, or the keys are generated with Vault. Dependent on these, the API method features slightly different parameters.&lt;/p&gt;

&lt;p&gt;To create a new key, the &lt;code&gt;generate&lt;/code&gt; option must be passed. This option allows to configure the key size, the issuer and account name. To import a key, its remote URL and root key need to be defined.&lt;/p&gt;

&lt;p&gt;Other options include to print the resulting URL for accessing the Vault key server, the hashing algorithm, the number of digits of the generated code (6 to 8), and the period time with which new TOTP codes will be generated.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;POST /totp/keys/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Manage Keys
&lt;/h2&gt;

&lt;p&gt;To see the managed keys, a list can be created that contains only identification key.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;GET /totp/keys/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All details of a specific key can be printed with a specific endpoint.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;GET /totp/keys/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Identified keys can be revoked. All currently issued TOTP tokens will also loose their viability immediately.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;DELETE /totp/keys/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Create or Validate Tokens
&lt;/h2&gt;

&lt;p&gt;For a configured key, short-lived secrets can be created. Vault uses the key to generate a 6-8 digit value that is returned to the caller.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;GET /totp/code/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To validate a TOTP secret, it can be sent to the following endpoint, using the &lt;code&gt;name&lt;/code&gt; of the key as an URL parameter, and a JSON structured request body containing the secret.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;POST /totp/code/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  TOTP Secrets Engine Example: OTP Provider
&lt;/h2&gt;

&lt;p&gt;In this example, Vault will be used as a provider for one-time passwords.&lt;/p&gt;

&lt;p&gt;Once the OTP engine is mounted, a new key can be generated. Required parameters include the sub-path at the mount path, and meta data about the key issuer and his account name.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault write totp/keys/vault-otp &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nv"&gt;generate&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;true&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nv"&gt;issuer&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Hashicorp Vault"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nv"&gt;account_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;vault-otp@example.org

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Key        Value
&lt;span class="nt"&gt;---&lt;/span&gt;        &lt;span class="nt"&gt;-----&lt;/span&gt;
barcode    iVBORw0KGgoA...
url        otpauth://totp/Hashicorp%20Vault:vault-otp@example.org?algorithm&lt;span class="o"&gt;=&lt;/span&gt;SHA1&amp;amp;digits&lt;span class="o"&gt;=&lt;/span&gt;6&amp;amp;issuer&lt;span class="o"&gt;=&lt;/span&gt;Hashicorp+Vault&amp;amp;period&lt;span class="o"&gt;=&lt;/span&gt;30&amp;amp;secret&lt;span class="o"&gt;=&lt;/span&gt;E64DAQLJ35PEXAPFT4TYODI4KJZQGTZ4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For creating an OTP, two options exist.&lt;/p&gt;

&lt;p&gt;One option is to use the Vault GUI. Navigating to the secrets engines section, selecting the key-name, and then the following dialog appears:&lt;/p&gt;

&lt;p&gt;&lt;a href="/images/blog/vault11_otp_generation.png" class="article-body-image-wrapper"&gt;&lt;img src="/images/blog/vault11_otp_generation.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The second option is the use the HTTP API.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; curl &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--header&lt;/span&gt; &lt;span class="s2"&gt;"X-Vault-Token: &lt;/span&gt;&lt;span class="nv"&gt;$VAULT_TOKEN&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--request&lt;/span&gt; GET &lt;span class="se"&gt;\&lt;/span&gt;
  http://127.0.0.1:8210/v1/totp/code/vault-otp

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="s2"&gt;"request_id"&lt;/span&gt;: &lt;span class="s2"&gt;"a912546e-9454-3354-ad5d-52731f09225f"&lt;/span&gt;,
  &lt;span class="s2"&gt;"lease_id"&lt;/span&gt;: &lt;span class="s2"&gt;""&lt;/span&gt;,
  &lt;span class="s2"&gt;"renewable"&lt;/span&gt;: &lt;span class="nb"&gt;false&lt;/span&gt;,
  &lt;span class="s2"&gt;"lease_duration"&lt;/span&gt;: 0,
  &lt;span class="s2"&gt;"data"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"code"&lt;/span&gt;: &lt;span class="s2"&gt;"306037"&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;,
  &lt;span class="s2"&gt;"wrap_info"&lt;/span&gt;: null,
  &lt;span class="s2"&gt;"warnings"&lt;/span&gt;: null,
  &lt;span class="s2"&gt;"auth"&lt;/span&gt;: null,
  &lt;span class="s2"&gt;"mount_type"&lt;/span&gt;: &lt;span class="s2"&gt;"totp"&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The generated code can be validated via the Vault CLI and the API. The API access can be used universally from other applications too, and is shown here.&lt;/p&gt;

&lt;p&gt;Here is an example for the latter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; curl &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--header&lt;/span&gt; &lt;span class="s2"&gt;"X-Vault-Token: &lt;/span&gt;&lt;span class="nv"&gt;$VAULT_TOKEN&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--request&lt;/span&gt; POST &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--data&lt;/span&gt; &lt;span class="s1"&gt;'{"code" : "306037"}'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  http://127.0.0.1:8210/v1/totp/code/vault-otp

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="s2"&gt;"request_id"&lt;/span&gt;: &lt;span class="s2"&gt;"cfa70339-189c-bd4a-bda0-13feaf6ccf51"&lt;/span&gt;,
  &lt;span class="s2"&gt;"lease_id"&lt;/span&gt;: &lt;span class="s2"&gt;""&lt;/span&gt;,
  &lt;span class="s2"&gt;"renewable"&lt;/span&gt;: &lt;span class="nb"&gt;false&lt;/span&gt;,
  &lt;span class="s2"&gt;"lease_duration"&lt;/span&gt;: 0,
  &lt;span class="s2"&gt;"data"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"valid"&lt;/span&gt;: &lt;span class="nb"&gt;true&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;,
  &lt;span class="s2"&gt;"wrap_info"&lt;/span&gt;: null,
  &lt;span class="s2"&gt;"warnings"&lt;/span&gt;: null,
  &lt;span class="s2"&gt;"auth"&lt;/span&gt;: null,
  &lt;span class="s2"&gt;"mount_type"&lt;/span&gt;: &lt;span class="s2"&gt;"totp"&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Secrets engines govern access to and the creation of confidential data for various purposes. The TOTP secrets engine issues short-lived secrets, typically used as one-time-passwords. This compact blog article provided a complete coverage. It showed how to setup the engine at a defined path, explored the API methods to setup keys that create token, and the method for creating and validating secrets. An example showed how to uses these API methods. Overall, this engine fully complements Hashicorp Vault functionality as a tool for second-factor authentication.&lt;/p&gt;

</description>
      <category>hashicorp</category>
      <category>vault</category>
      <category>hashicorpvault</category>
    </item>
    <item>
      <title>Hashicorp Vault: Transit Secrets Engine</title>
      <dc:creator>Sebastian</dc:creator>
      <pubDate>Mon, 12 Jan 2026 06:22:00 +0000</pubDate>
      <link>https://dev.to/admantium/hashicorp-vault-transit-secrets-engine-2kam</link>
      <guid>https://dev.to/admantium/hashicorp-vault-transit-secrets-engine-2kam</guid>
      <description>&lt;p&gt;In Hashicorp Vault, secrets engines provide a uniform way to store and manage credentials, encryption keys, certificates and other sensitive information. To gain access to a secret, a typically time restricted token is generated. With this token, the secret can be read by any client application.&lt;/p&gt;

&lt;p&gt;Secrets themselves can be static or dynamic. A static secret is stored as-is, and has a typical lifetime of several weeks or even months. Dynamic secrets are created on-demand with a limited lifetime of several hours or days, and are revoked at the end of their lifetime.&lt;/p&gt;

&lt;p&gt;The transit secrets engine manages dynamic secrets to facilitate exchange between several applications. It stores generated or externally keys imported into Vault, and uses these keys to encrypt/decrypt data. This discusses the principal usage, covers all API endpoints, and shows a practical example.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The technical context of this article is &lt;code&gt;hashicorp_vault_v1.21.1&lt;/code&gt;, released 2025-11-18. All provided information and command examples should be valid with newer versions too, baring an update of the CLI commands' syntax&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The background material for this article stems from the official Hashicorp Vault documentation about &lt;a href="https://developer.hashicorp.com/vault/docs/secrets/transit" rel="noopener noreferrer"&gt;Transit secrets engine&lt;/a&gt; and &lt;a href="https://developer.hashicorp.com/vault/api-docs/secret/transit" rel="noopener noreferrer"&gt;Transit secrets engine (API)&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article originally appeared at my blog &lt;a href="https://admantium.com/blog/vault10_transit_secrets_engine/" rel="noopener noreferrer"&gt;admantium.com&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Transit Secrets Engine
&lt;/h2&gt;

&lt;p&gt;In Hashicorp Vault, secrets engine can be accessed with a proper token, and provide different endpoints for their functionality. With the Transit Secrets engine, the stored secrets are key themselves, in different formats such as AES or RSA.&lt;/p&gt;

&lt;p&gt;Based on these keys, different functions are offered. The main use-case is the encryption and decryption of plaintext data, where the data itself is not stored in Vault. Other functions are to sign and verify data, to create hash values for data as a means to validate data integrity, as well as to generate random bytes as entropy input to external encryption processes.&lt;/p&gt;

&lt;p&gt;In essence, the transit secrets engine provides encryption-as-a-service. Applications do not need to implement encryption functions themselves, but can access a Hashicorp Vault server instance instead.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup
&lt;/h2&gt;

&lt;p&gt;To initialize the transit secrets engine, it needs to be enabled via the CLI or the GUI. Continuing the focus in this blog series, CLI commands will be shown.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault secrets &lt;span class="nb"&gt;enable&lt;/span&gt; &lt;span class="nt"&gt;-path&lt;/span&gt; /transit transit

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
&lt;span class="o"&gt;[&lt;/span&gt;INFO]  core: successful mount: &lt;span class="nv"&gt;namespace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="nv"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;transit/ &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;transit &lt;span class="nv"&gt;version&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"v1.21.1+builtin.vault"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No other configuration steps are necessary. The mounted transit secrets engine provides 39 different API methods for its core functionality, key management, and general operation. Following subsections explore them in detail.&lt;/p&gt;

&lt;h2&gt;
  
  
  Encryption Keys
&lt;/h2&gt;

&lt;p&gt;The transit engine stores encryption keys with which data is decrypted and encrypted. It is possible to import keys and to generate new ones.&lt;/p&gt;

&lt;p&gt;The key generation API method creates an RSA key with specified bit length and padding scheme. Additionally, key derivation context data and a nonce can be used. The endpoint either returns the key in plaintext or in cipher form.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;POST  /transit/datakey/&lt;span class="o"&gt;{&lt;/span&gt;plaintext&lt;span class="o"&gt;}&lt;/span&gt;/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A new key can also be generated with a CSR. The endpoint generates the key and stores it internally.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;POST  /transit/keys/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;/csr
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is also an option to import an external key, which can be  variants of &lt;code&gt;aes&lt;/code&gt; and &lt;code&gt;rsa&lt;/code&gt;, as well as &lt;code&gt;ed25519&lt;/code&gt; and &lt;code&gt;hmac&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;First of all, the engines public key needs to be generated with the following endpoint.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;GET /transit/wrapping_key
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Second, following the instructions about &lt;a href="https://developer.hashicorp.com/vault/docs/secrets/transit#bring-your-own-key-byok" rel="noopener noreferrer"&gt;bring your own key&lt;/a&gt;, a ciphertext needs to be created, which is an Vault-internal data format for the key. The ciphertext, key-type, and additional key-specific parameters are then passed to the following endpoints.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;POST  /transit/keys/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;/import
POST  /transit/keys/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;/import_version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Encrypt and Decrypt Data
&lt;/h2&gt;

&lt;p&gt;The data encryption endpoints require in its most essential form only the key name and the base64 encoded plaintext. When the used key is configured with key derivation, then also its context and associated data must be provided. For older versions of Vault, the nonce value could be provided - it is still an endpoint parameter, but not required. Finally, it is also possible to encrypt several plaintexts as well, requiring a structured JSON List with items that include the &lt;code&gt;plaintext&lt;/code&gt; parameters, and others required for the targeted key.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;POST  /transit/encrypt/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The complementing decryption endpoint requires the key name and the ciphertext. Additional parameters are the same as of the encryption endpoint.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;POST  /transit/decrypt/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Sign and Verify Data
&lt;/h2&gt;

&lt;p&gt;Encryption keys stored in the transit engine can be used to sign data. Several parameters can be provided to configure the signing process: key version, hash algorithm, signature and marshaling algorithm, and the used salt. Input data can be single, base64 encoded text, or a structured JSON format with a list of strings. The signing process returns a Vault-specific signature string.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;POST  /transit/sign/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;
POST  /transit/sign/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;/&lt;span class="o"&gt;{&lt;/span&gt;algorithm&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To verify data, the complementary endpoint can be used. It requires the original input (single text or structured JSON), and the signature string. Additional parameters used during signing, such as the key version and hash algorithm, can be provided too. Furthermore, this endpoint can also be used for verifying HMAC data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;POST  /transit/verify/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;
POST  /transit/verify/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;/&lt;span class="o"&gt;{&lt;/span&gt;algorithm&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Creating HMAC Values
&lt;/h2&gt;

&lt;p&gt;In cryptography, the message authentication code (MAC) is a unique signature for an arbitrary payload data and key. When two parties share the key, they can authenticate and check the integrity of exchanged messages.&lt;/p&gt;

&lt;p&gt;Hashicorp Vault provides and endpoint to sign data using a hash function. The key name must be provided, optionally the hash algorithm, and mandatory the single or structured plaintext data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;POST  /transit/hmac/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;
POST  /transit/hmac/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;/&lt;span class="o"&gt;{&lt;/span&gt;algorithm&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The returned HMAC data can be verified with the above explained &lt;code&gt;/transit/verify&lt;/code&gt; endpoint.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating Hash Values
&lt;/h2&gt;

&lt;p&gt;Hash values of data are unique identifiers that can be used to ensure data integrity. Hash values can be created for any base64 encoded input data, and returned as either base64 or hex value. Also, different &lt;code&gt;sha2&lt;/code&gt; and &lt;code&gt;sha3&lt;/code&gt; algorithms are supported.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;POST  /transit/hash
POST  /transit/hash/&lt;span class="o"&gt;{&lt;/span&gt;algorithm&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Creating Random Bytes
&lt;/h2&gt;

&lt;p&gt;Random data can be used as a nonce for encrypting data. The available API endpoints return base64 or hex encoded values of defined byte length. Additionally, the entropy source from which the bytes are generated can be configured: either the virtual or physical server itself, or with the entropy augmentation feature from an enterprise vault.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;POST  transit/random
POST  transit/random/&lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;source&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;
POST  transit/random/&lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;source&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;/&lt;span class="o"&gt;{&lt;/span&gt;bytes&lt;span class="o"&gt;}&lt;/span&gt;
POST  transit/random/&lt;span class="o"&gt;{&lt;/span&gt;bytes&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Manage Encryption Keys
&lt;/h2&gt;

&lt;p&gt;All configured keys can be read-accessed, returning type information and optionally the ciphertext, a Vault internal data form representing the key. For some keys, their internal configuration can be retrieved too.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;GET /transit/keys/
GET /transit/keys/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;
GET /transit/config/keys
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Existing keys can be updated or deleted.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;POST  /transit/keys/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;
DELETE  /transit/keys/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Some aspects of managed keys can be reconfigured without creating new keys.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;POST  /transit/config/keys&lt;span class="sb"&gt;`&lt;/span&gt;
POST  /transit/keys/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;/config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Key rotation is a security best practice, and implemented in Vault by a dedicated API method. Stored key versions are kept indefinitely, but limits can be set via key configuration, or explicitly trimmed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;POST  /transit/keys/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;/rotate
POST  /transit/keys/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;/trim
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When keys are versioned, older ciphertexts are not valid anymore. They can be rewrapped to the newest version of a key.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;POST  /transit/rewrap/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For stored keys, the corresponding certificate chain can be configured. Please note: The documentation does not detail if this method is only applicable to keys created with the CSR endpoint, data keys, or imported keys.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;POST  /transit/keys/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;/set-certificate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the keys need to be migrated to an external system, they can be explicitly exported. The API methods are differentiated into keys created with the transit engine itself or externally created keys. The export itself targets either the most recent version of a key, or a very specific version identified by a time string.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;GET /transit/export/&lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;
GET /transit/export/&lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;/&lt;span class="o"&gt;{&lt;/span&gt;version&lt;span class="o"&gt;}&lt;/span&gt;
GET /transit/byok-export/&lt;span class="o"&gt;{&lt;/span&gt;destination&lt;span class="o"&gt;}&lt;/span&gt;/&lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;source&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;
GET /transit/byok-export/&lt;span class="o"&gt;{&lt;/span&gt;destination&lt;span class="o"&gt;}&lt;/span&gt;/&lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;source&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;/&lt;span class="o"&gt;{&lt;/span&gt;version&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Backup and Restore
&lt;/h2&gt;

&lt;p&gt;For any managed key, a complete plaintext backup can be generated. This contains the keys ciphertext, its HMAC, and its version information. A corresponding endpoint can be used to restore keys from their backup data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;GET transit/backup/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;
POST  transit/restore
POST  transit/restore/&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Cache Management
&lt;/h2&gt;

&lt;p&gt;The transit secrets engine internally caches its responses. The current number of items in the cache can be read, and the maximum allowed number of cached items can be seat (but requires a reload of the plugin to become effective).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;GET transit/cache-config
POST  transit/cache-config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Transit Secrets Engine Example: Date Encryption and Decryption
&lt;/h2&gt;

&lt;p&gt;In this example, a transit secrets engine with an internally managed key will be setup.&lt;/p&gt;

&lt;p&gt;First of all, the engine itself needs to be created.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault secrets &lt;span class="nb"&gt;enable&lt;/span&gt; &lt;span class="nt"&gt;-path&lt;/span&gt; /transit transit

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
&lt;span class="o"&gt;[&lt;/span&gt;INFO]  core: successful mount: &lt;span class="nv"&gt;namespace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="nv"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;transit/ &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;transit &lt;span class="nv"&gt;version&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"v1.20.0+builtin.vault"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, a key will be generated.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault write transit/keys/cha &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;chacha20-poly1305

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Key                       Value
&lt;span class="nt"&gt;---&lt;/span&gt;                       &lt;span class="nt"&gt;-----&lt;/span&gt;
allow_plaintext_backup    &lt;span class="nb"&gt;false
&lt;/span&gt;auto_rotate_period        0s
deletion_allowed          &lt;span class="nb"&gt;false
&lt;/span&gt;derived                   &lt;span class="nb"&gt;false
&lt;/span&gt;exportable                &lt;span class="nb"&gt;false
&lt;/span&gt;imported_key              &lt;span class="nb"&gt;false
&lt;/span&gt;keys                      map[1:1760175423]
latest_version            1
min_available_version     0
min_decryption_version    1
min_encryption_version    0
name                      cha
supports_decryption       &lt;span class="nb"&gt;true
&lt;/span&gt;supports_derivation       &lt;span class="nb"&gt;true
&lt;/span&gt;supports_encryption       &lt;span class="nb"&gt;true
&lt;/span&gt;supports_signing          &lt;span class="nb"&gt;false
type                      &lt;/span&gt;chacha20-poly1305
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With the key in place, let’s explore the decryption and encryption of data.&lt;/p&gt;

&lt;p&gt;First, the plaintext data needs to be base64 encoded:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Lorem ipsum dolor sit amet"&lt;/span&gt;|base64

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQK
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This encoded text needs to be sent to the key endpoint.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault write transit/encrypt/cha &lt;span class="nv"&gt;plaintext&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQK"&lt;/span&gt;

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Key            Value
&lt;span class="nt"&gt;---&lt;/span&gt;            &lt;span class="nt"&gt;-----&lt;/span&gt;
ciphertext     vault:v1:KihZ/vP/a/4Jk7N0533I1bj+TGWE526HrMyr1V6+RJYCPNsGv1XQxDGxQoUBRDuYE8qyNRk7bQ&lt;span class="o"&gt;==&lt;/span&gt;
key_version    1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The ciphertext starts with the metainformation &lt;code&gt;vault:v1:&lt;/code&gt;, followed by the decrypted text. Decryption is straightforward:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault write transit/decrypt/cha &lt;span class="nv"&gt;ciphertext&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"vault:v1:KihZ/vP/a/4Jk7N0533I1bj+TGWE526HrMyr1V6+RJYCPNsGv1XQxDGxQoUBRDuYE8qyNRk7bQ=="&lt;/span&gt;

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Key          Value
&lt;span class="nt"&gt;---&lt;/span&gt;          &lt;span class="nt"&gt;-----&lt;/span&gt;
plaintext    TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQK
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Vault supports key rotation, and therefore decryption requires to specify the key version too. Once a newer key is in use, old ciphertext versions need to be rewrapped.&lt;/p&gt;

&lt;p&gt;Let’s rotate the key twice.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault write &lt;span class="nt"&gt;-force&lt;/span&gt; transit/keys/cha/rotate
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault write &lt;span class="nt"&gt;-force&lt;/span&gt; transit/keys/cha/rotate

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Key                       Value
&lt;span class="nt"&gt;---&lt;/span&gt;                       &lt;span class="nt"&gt;-----&lt;/span&gt;
allow_plaintext_backup    &lt;span class="nb"&gt;false
&lt;/span&gt;auto_rotate_period        0s
deletion_allowed          &lt;span class="nb"&gt;false
&lt;/span&gt;derived                   &lt;span class="nb"&gt;false
&lt;/span&gt;exportable                &lt;span class="nb"&gt;false
&lt;/span&gt;imported_key              &lt;span class="nb"&gt;false
&lt;/span&gt;keys                      map[1:1760175423 2:1760177345 3:1760177350]
latest_version            3
min_available_version     0
min_decryption_version    1
min_encryption_version    0
name                      cha
supports_decryption       &lt;span class="nb"&gt;true
&lt;/span&gt;supports_derivation       &lt;span class="nb"&gt;true
&lt;/span&gt;supports_encryption       &lt;span class="nb"&gt;true
&lt;/span&gt;supports_signing          &lt;span class="nb"&gt;false
type                      &lt;/span&gt;chacha20-poly1305
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, try to decrypt the ciphertext, but alter its metainformation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault write transit/decrypt/cha &lt;span class="nv"&gt;ciphertext&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"vault:v2:KihZ/vP/a/4Jk7N0533I1bj+TGWE526HrMyr1V6+RJYCPNsGv1XQxDGxQoUBRDuYE8qyNRk7bQ=="&lt;/span&gt;

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Error writing data to transit/decrypt/cha: Error making API request.

URL: PUT http://127.0.0.1:8210/v1/transit/decrypt/cha
Code: 400. Errors:

&lt;span class="k"&gt;*&lt;/span&gt; chacha20poly1305: message authentication failed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let’s rewrap the ciphertext ...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault write transit/rewrap/cha &lt;span class="nv"&gt;ciphertext&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"vault:v1:KihZ/vP/a/4Jk7N0533I1bj+TGWE526HrMyr1V6+RJYCPNsGv1XQxDGxQoUBRDuYE8qyNRk7bQ=="&lt;/span&gt;

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Key            Value
&lt;span class="nt"&gt;---&lt;/span&gt;            &lt;span class="nt"&gt;-----&lt;/span&gt;
ciphertext     vault:v3:W1lRpdvej7N5IEWuxqOqLSiYCibD0/cu9lLNXt1fhInGxTrLkvuXUyf3I4AqdQj8VbCALvjZrA&lt;span class="o"&gt;==&lt;/span&gt;
key_version    3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.. and then decrypt it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault write transit/decrypt/cha &lt;span class="nv"&gt;ciphertext&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"vault:v3:W1lRpdvej7N5IEWuxqOqLSiYCibD0/cu9lLNXt1fhInGxTrLkvuXUyf3I4AqdQj8VbCALvjZrA=="&lt;/span&gt;

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Key          Value
&lt;span class="nt"&gt;---&lt;/span&gt;          &lt;span class="nt"&gt;-----&lt;/span&gt;
plaintext    TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQK
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Old versions of a key can be removed intentionally, but any non-rewrapped ciphertext is then irrevocably lost. To remove old versions, the values &lt;code&gt;min_decryption_version&lt;/code&gt; and &lt;code&gt;min_encryption_version&lt;/code&gt; should be set to the desired version, and a background job in the Vault instance deletes non-required versions eventually.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vault write transit/keys/cha/config &lt;span class="nv"&gt;min_decryption_version&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;3 &lt;span class="nv"&gt;min_encryption_version&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;3

&lt;span class="c"&gt;# Log messages&lt;/span&gt;
Key                       Value
&lt;span class="nt"&gt;---&lt;/span&gt;                       &lt;span class="nt"&gt;-----&lt;/span&gt;
allow_plaintext_backup    &lt;span class="nb"&gt;false
&lt;/span&gt;auto_rotate_period        0s
deletion_allowed          &lt;span class="nb"&gt;false
&lt;/span&gt;derived                   &lt;span class="nb"&gt;false
&lt;/span&gt;exportable                &lt;span class="nb"&gt;false
&lt;/span&gt;imported_key              &lt;span class="nb"&gt;false
&lt;/span&gt;keys                      map[3:1760177350]
latest_version            3
min_available_version     0
min_decryption_version    3
min_encryption_version    3
name                      cha
supports_decryption       &lt;span class="nb"&gt;true
&lt;/span&gt;supports_derivation       &lt;span class="nb"&gt;true
&lt;/span&gt;supports_encryption       &lt;span class="nb"&gt;true
&lt;/span&gt;supports_signing          &lt;span class="nb"&gt;false
type                      &lt;/span&gt;chacha20-poly1305
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In Hashicorp Vault, secrets engines manage setup and access to confidential data. The transit secrets engine provides a special use case: Encryption and decryption of plaintext data without actually storing it. This blog post introduced and showed how to setup and use this engine. The first step is the generation or import of a key, supporting different variants of AES, RSA, and ED25519. Once stored, several endpoints for various use cases become available. The encryption endpoint accepts base64 encoded plaintext, and returns a ciphertext. Likewise, the decryption endpoint expects to be passed the full ciphertext, and will return the base64 decoded base text. These texts are not stored at all in Vault - client applications are expected to handle them. Additional endpoints support signing and verifying data, creating HMAC values or hash values, and random bytes. Overall, the transit secrets' engine features complement the Vault functionality with a secrets-as-a-service component.&lt;/p&gt;

</description>
      <category>hashicorp</category>
      <category>hashicorpvault</category>
      <category>vault</category>
    </item>
    <item>
      <title>Hashicorp Vault: Fine-Grained Access Control with Policies</title>
      <dc:creator>Sebastian</dc:creator>
      <pubDate>Thu, 01 Jan 2026 06:39:46 +0000</pubDate>
      <link>https://dev.to/admantium/hashicorp-vault-fine-grained-access-control-with-policies-53h2</link>
      <guid>https://dev.to/admantium/hashicorp-vault-fine-grained-access-control-with-policies-53h2</guid>
      <description>&lt;p&gt;Hashicorp Vault is a flexible secret management engine. It provides several authentication and authorization mechanisms, and stores secrets that represent credentials, ciphers, or certificates. To access Vaults functionality, successful authentication is required, resulting in an access token and associated policies. These policies determine which actions on which mount paths are allowed.&lt;/p&gt;

&lt;p&gt;This blog article details Hashicorp Vault policies. It shows how to write policies in HCL, explains the action words and paths patterns, and shows several practical examples.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The technical context of this article is &lt;code&gt;hashicorp_vault_v1.21.1&lt;/code&gt;, released 2025-11-18. All provided information and command examples should be valid with newer versions too, baring an update of the CLI commands' syntax&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The background material for this article stems from the official Hashicorp Vault documentation about &lt;a href="https://developer.hashicorp.com/vault/docs/concepts/policies" rel="noopener noreferrer"&gt;Policies&lt;/a&gt; and the tutorial &lt;a href="https://developer.hashicorp.com/vault/tutorials/policies/policies?variants=vault-deploy%3Aselfhosted" rel="noopener noreferrer"&gt;Access controls with Vault policies&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article originally appeared on my blog &lt;a href="https://admantium.com/blog/vault09_policies" rel="noopener noreferrer"&gt;admantium.com&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Access Control Essential
&lt;/h2&gt;

&lt;p&gt;Policies encode which actions, such as writing, reading or deleting, are allowed at specific mount paths of a Vault instance. Essentially, in a Vault instance, all functionality is accessible by mount paths. Both CLI commands and explicit HTTP API requests targets these paths. Policies underlie every interaction: For example, in order to create a token, the &lt;code&gt;write&lt;/code&gt; action to path &lt;code&gt;/auth/token/create&lt;/code&gt; is required. Any path and any action that is not part of a policy is denied.&lt;/p&gt;

&lt;p&gt;Two built-in policies exist. The &lt;code&gt;root&lt;/code&gt; policy provides complete access to all paths, and allows all actions. It is attached to the root token so that an administrator can setup a Vault instance initially. A complementing policy is named &lt;code&gt;default&lt;/code&gt;. It is attached to all tokens (unless explicitly removed), and governs essential self-referential lookup and data access for the token itself.&lt;/p&gt;

&lt;p&gt;Policies consists of a path declaration, which can be a fixed absolute path or include wildcard segments, and a list of actions. Should a token have multiple policies with overlapping path declarations, all applicable policies are resolved following the &lt;a href="https://developer.hashicorp.com/vault/docs/concepts/policies#priority-matching" rel="noopener noreferrer"&gt;priority matching&lt;/a&gt; ruleset. Then, path access and targeted actions are checked, so that the access is either granted or denied.&lt;/p&gt;

&lt;p&gt;Finally, some paths are only accessible by the &lt;code&gt;root&lt;/code&gt; policy itself, or when the &lt;code&gt;sudo&lt;/code&gt; action is allowed for a specific path - see the documentation about &lt;a href="https://developer.hashicorp.com/vault/docs/concepts/policies#root-protected-api-endpoints" rel="noopener noreferrer"&gt;root protected API endpoints&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hashicorp Vault Policies
&lt;/h2&gt;

&lt;p&gt;Hashicorp Vault policies are written in the Hashicorp Configuration Language.&lt;/p&gt;

&lt;h3&gt;
  
  
  Policy Declaration
&lt;/h3&gt;

&lt;p&gt;In its most simple form, they consist of only two mandatory declarations: &lt;code&gt;path&lt;/code&gt; and &lt;code&gt;capabilities&lt;/code&gt;. Here is an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;PATH&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;capabilities&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;cap&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Additionally, parameters passed to the HTTP API endpoints can be set to be explicitly allowed, denied, or required.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;PATH&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;capabilities&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;cap&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="nx"&gt;allowed_parameters&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;key&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;values&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;denied_parameters&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;key&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;values&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;required_parameters&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;key&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;values&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, some HTTP API endpoints can be used for response wrapping to e.g. protect a sensible secret. When the endpoint is accessed, the data will not be returned as is, but a one-time access token to a cubbyhole secret is returned. For this API endpoint, the response wrapping validity TTLs can be specified as shown:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;PATH&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;capabilities&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;cap&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

  &lt;span class="nx"&gt;min_wrapping_ttl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;time&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

  &lt;span class="nx"&gt;max_wrapping_ttl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;time&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Path Declaration
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;path&lt;/code&gt; declaration can be a fixed, absolute path with multiple segments, or encompass two different wildcard symbols that match segments.&lt;/p&gt;

&lt;p&gt;With the symbol &lt;code&gt;+&lt;/code&gt;, one segment is covered. For example, the declaration &lt;code&gt;path /auth/token/+&lt;/code&gt; would allow access to &lt;code&gt;/auth/token/create&lt;/code&gt; but not to &lt;code&gt;/auth/token/create/{role_name}&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;With the &lt;code&gt;*&lt;/code&gt; symbol, any number of path segments are matched. The declaration &lt;code&gt;path /auth/token/*&lt;/code&gt; includes any paths that have a prefix of &lt;code&gt;/auth/token&lt;/code&gt;, and therefore access to &lt;code&gt;/auth/token/create/{role_name}&lt;/code&gt; and &lt;code&gt;auth/token/roles/{role_name}&lt;/code&gt; is covered.&lt;/p&gt;

&lt;h3&gt;
  
  
  Policy Actions
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;capabilities&lt;/code&gt; property is a list of action verbs. Following values can be used:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;create&lt;/code&gt;: Add a new entity definition.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;read&lt;/code&gt;: Provide read access to an entity definition.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;update&lt;/code&gt; and &lt;code&gt;patch&lt;/code&gt;: Rewrite an existing entity definition (there is no clear distinction about their scope in the official documentation, but the CLI command &lt;code&gt;vault patch&lt;/code&gt; maps to the same named action)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;delete&lt;/code&gt;: Remove an entity definition&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;list&lt;/code&gt;: Enumerate all entity definitions by their name or ID (to obtain the full details of an individual resource, the &lt;code&gt;read&lt;/code&gt; access right is required)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sudo&lt;/code&gt;: Provide full access to the entity, as well access to the mentioned &lt;a href="https://developer.hashicorp.com/vault/docs/concepts/policies#root-protected-api-endpoints" rel="noopener noreferrer"&gt;root protected API endpoints&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;deny&lt;/code&gt;: Bar any access to the resource.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Except &lt;code&gt;sudo&lt;/code&gt; and &lt;code&gt;deny&lt;/code&gt;, all other actions directly translate to HTTP verbs or CLI commands when performing an operation at the desired path.&lt;/p&gt;

&lt;h2&gt;
  
  
  Policy Examples
&lt;/h2&gt;

&lt;p&gt;This section shows three policies for managing authentication methods, managing a secrets engine, and creating orphaned tokens.&lt;/p&gt;

&lt;h3&gt;
  
  
  CRUD access to a custom kv v2 engine
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;kv2/*&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;capabilities&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;create&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;read&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;update&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;delete&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Complete management access to AUTH methods
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;sys/auth&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;capabilities&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;create&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;read&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;update&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;delete&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;sudo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;sys/auth/+/tune&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;capabilities&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;create&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;read&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;update&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;delete&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;sudo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Create Orphaned Tokens
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;auth/token/create&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;capabilities&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;create&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;sudo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The secrets management tool Hashicorp Vault implements fine-grained access control with the help of policies. This blog article showed how to declare policies in the compact Hashicorp Configuration Language syntax. Essentially, they consist of two parts. First, a path declaration, which can be fixed and absolute, or flexible by including wildcard segments. Second, actions in the form of verbs such as &lt;code&gt;create&lt;/code&gt;, &lt;code&gt;delete&lt;/code&gt;, &lt;code&gt;list&lt;/code&gt;, &lt;code&gt;deny&lt;/code&gt; and &lt;code&gt;sudo&lt;/code&gt;. Declared policies are attached to tokens, and when using a token to access a path, applicable policies are resolved and processed in priority order. Finally, this article showed three example policies for managing auth methods, configuring a defined kv v2 secrets engine, and for issuing orphaned tokens.&lt;/p&gt;

</description>
      <category>hashicorp</category>
      <category>vault</category>
    </item>
    <item>
      <title>Hashicorp Vault: Fine-Grained Access Control with Policies</title>
      <dc:creator>Sebastian</dc:creator>
      <pubDate>Wed, 31 Dec 2025 13:54:21 +0000</pubDate>
      <link>https://dev.to/admantium/hashicorp-vault-fine-grained-access-control-with-policies-2oan</link>
      <guid>https://dev.to/admantium/hashicorp-vault-fine-grained-access-control-with-policies-2oan</guid>
      <description>&lt;p&gt;Hashicorp Vault is a flexible secret management engine. It provides several authentication and authorization mechanisms, and stores secrets that represent credentials, ciphers, or certificates. To access Vaults functionality, successful authentication is required, resulting in an access token and associated policies. These policies determine which actions on which mount paths are allowed.&lt;/p&gt;

&lt;p&gt;This blog article details Hashicorp Vault policies. It shows how to write policies in HCL, explains the action words and paths patterns, and shows several practical examples.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The technical context of this article is &lt;code&gt;hashicorp_vault_v1.21.1&lt;/code&gt;, released 2025-11-18. All provided information and command examples should be valid with newer versions too, baring an update of the CLI commands' syntax&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The background material for this article stems from the official Hashicorp Vault documentation about &lt;a href="https://developer.hashicorp.com/vault/docs/concepts/policies" rel="noopener noreferrer"&gt;Policies&lt;/a&gt; and the tutorial &lt;a href="https://developer.hashicorp.com/vault/tutorials/policies/policies?variants=vault-deploy%3Aselfhosted" rel="noopener noreferrer"&gt;Access controls with Vault policies&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article originally appeared on my blog &lt;a href="https://admantium.com/blog/vault09_policies" rel="noopener noreferrer"&gt;admantium.com&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Access Control Essential
&lt;/h2&gt;

&lt;p&gt;Policies encode which actions, such as writing, reading or deleting, are allowed at specific mount paths of a Vault instance. Essentially, in a Vault instance, all functionality is accessible by mount paths. Both CLI commands and explicit HTTP API requests targets these paths. Policies underlie every interaction: For example, in order to create a token, the &lt;code&gt;write&lt;/code&gt; action to path &lt;code&gt;/auth/token/create&lt;/code&gt; is required. Any path and any action that is not part of a policy is denied.&lt;/p&gt;

&lt;p&gt;Two built-in policies exist. The &lt;code&gt;root&lt;/code&gt; policy provides complete access to all paths, and allows all actions. It is attached to the root token so that an administrator can setup a Vault instance initially. A complementing policy is named &lt;code&gt;default&lt;/code&gt;. It is attached to all tokens (unless explicitly removed), and governs essential self-referential lookup and data access for the token itself.&lt;/p&gt;

&lt;p&gt;Policies consists of a path declaration, which can be a fixed absolute path or include wildcard segments, and a list of actions. Should a token have multiple policies with overlapping path declarations, all applicable policies are resolved following the &lt;a href="https://developer.hashicorp.com/vault/docs/concepts/policies#priority-matching" rel="noopener noreferrer"&gt;priority matching&lt;/a&gt; ruleset. Then, path access and targeted actions are checked, so that the access is either granted or denied.&lt;/p&gt;

&lt;p&gt;Finally, some paths are only accessible by the &lt;code&gt;root&lt;/code&gt; policy itself, or when the &lt;code&gt;sudo&lt;/code&gt; action is allowed for a specific path - see the documentation about &lt;a href="https://developer.hashicorp.com/vault/docs/concepts/policies#root-protected-api-endpoints" rel="noopener noreferrer"&gt;root protected API endpoints&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hashicorp Vault Policies
&lt;/h2&gt;

&lt;p&gt;Hashicorp Vault policies are written in the Hashicorp Configuration Language.&lt;/p&gt;

&lt;h3&gt;
  
  
  Policy Declaration
&lt;/h3&gt;

&lt;p&gt;In its most simple form, they consist of only two mandatory declarations: &lt;code&gt;path&lt;/code&gt; and &lt;code&gt;capabilities&lt;/code&gt;. Here is an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;PATH&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;capabilities&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;cap&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Additionally, parameters passed to the HTTP API endpoints can be set to be explicitly allowed, denied, or required.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;PATH&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;capabilities&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;cap&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="nx"&gt;allowed_parameters&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;key&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;values&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;denied_parameters&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;key&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;values&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;required_parameters&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;key&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;values&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, some HTTP API endpoints can be used for response wrapping to e.g. protect a sensible secret. When the endpoint is accessed, the data will not be returned as is, but a one-time access token to a cubbyhole secret is returned. For this API endpoint, the response wrapping validity TTLs can be specified as shown:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;PATH&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;capabilities&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;cap&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

  &lt;span class="nx"&gt;min_wrapping_ttl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;time&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

  &lt;span class="nx"&gt;max_wrapping_ttl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;time&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Path Declaration
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;path&lt;/code&gt; declaration can be a fixed, absolute path with multiple segments, or encompass two different wildcard symbols that match segments.&lt;/p&gt;

&lt;p&gt;With the symbol &lt;code&gt;+&lt;/code&gt;, one segment is covered. For example, the declaration &lt;code&gt;path /auth/token/+&lt;/code&gt; would allow access to &lt;code&gt;/auth/token/create&lt;/code&gt; but not to &lt;code&gt;/auth/token/create/{role_name}&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;With the &lt;code&gt;*&lt;/code&gt; symbol, any number of path segments are matched. The declaration &lt;code&gt;path /auth/token/*&lt;/code&gt; includes any paths that have a prefix of &lt;code&gt;/auth/token&lt;/code&gt;, and therefore access to &lt;code&gt;/auth/token/create/{role_name}&lt;/code&gt; and &lt;code&gt;auth/token/roles/{role_name}&lt;/code&gt; is covered.&lt;/p&gt;

&lt;h3&gt;
  
  
  Policy Actions
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;capabilities&lt;/code&gt; property is a list of action verbs. Following values can be used:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;create&lt;/code&gt;: Add a new entity definition.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;read&lt;/code&gt;: Provide read access to an entity definition.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;update&lt;/code&gt; and &lt;code&gt;patch&lt;/code&gt;: Rewrite an existing entity definition (there is no clear distinction about their scope in the official documentation, but the CLI command &lt;code&gt;vault patch&lt;/code&gt; maps to the same named action)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;delete&lt;/code&gt;: Remove an entity definition&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;list&lt;/code&gt;: Enumerate all entity definitions by their name or ID (to obtain the full details of an individual resource, the &lt;code&gt;read&lt;/code&gt; access right is required)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sudo&lt;/code&gt;: Provide full access to the entity, as well access to the mentioned &lt;a href="https://developer.hashicorp.com/vault/docs/concepts/policies#root-protected-api-endpoints" rel="noopener noreferrer"&gt;root protected API endpoints&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;deny&lt;/code&gt;: Bar any access to the resource.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Except &lt;code&gt;sudo&lt;/code&gt; and &lt;code&gt;deny&lt;/code&gt;, all other actions directly translate to HTTP verbs or CLI commands when performing an operation at the desired path.&lt;/p&gt;

&lt;h2&gt;
  
  
  Policy Examples
&lt;/h2&gt;

&lt;p&gt;This section shows three policies for managing authentication methods, managing a secrets engine, and creating orphaned tokens.&lt;/p&gt;

&lt;h3&gt;
  
  
  CRUD access to a custom kv v2 engine
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;kv2/*&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;capabilities&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;create&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;read&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;update&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;delete&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Complete management access to AUTH methods
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;sys/auth&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;capabilities&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;create&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;read&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;update&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;delete&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;sudo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;sys/auth/+/tune&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;capabilities&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;create&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;read&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;update&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;delete&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;sudo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Create Orphaned Tokens
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;auth/token/create&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;capabilities&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;create&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;sudo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The secrets management tool Hashicorp Vault implements fine-grained access control with the help of policies. This blog article showed how to declare policies in the compact Hashicorp Configuration Language syntax. Essentially, they consist of two parts. First, a path declaration, which can be fixed and absolute, or flexible by including wildcard segments. Second, actions in the form of verbs such as &lt;code&gt;create&lt;/code&gt;, &lt;code&gt;delete&lt;/code&gt;, &lt;code&gt;list&lt;/code&gt;, &lt;code&gt;deny&lt;/code&gt; and &lt;code&gt;sudo&lt;/code&gt;. Declared policies are attached to tokens, and when using a token to access a path, applicable policies are resolved and processed in priority order. Finally, this article showed three example policies for managing auth methods, configuring a defined kv v2 secrets engine, and for issuing orphaned tokens.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>security</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
