Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to run HashiCorp Vault as a Windows Service?

I currently have vault server set up on my machine. However, I would like it to have an Automatic Startup after my machine is restarted. Essentially, I would want it to automatically run the vault server start up script e.g.:

     vault server -config C:\vault_0.6.2\config.hcl

and to unseal the vault using 3 keys. I have previously used Windows Service Wrapper (winsv) to install Spring Boot Applications as windows services. Would it be possible to use winsv to run vault? or if winsv could be used to execute 2 bat files (one containing vault server and another for vault unseal)? I am using Windows 10.
I appreciate the help, thanks!

like image 741
Hanaa Avatar asked Aug 31 '25 16:08

Hanaa


1 Answers

In case someone attempts this in the future. The solution was to have a service start up the vault server. The service uses ProcessBuilder to run a bat script that contains this:

start /b vault server -config "C:\vault_0.6.2\config.hcl"

Then it uses another ProcessBuilder that runs a second bat script containing: vault unseal %1

,where %1 is a paramter that the service passes.

like image 151
Hanaa Avatar answered Sep 02 '25 11:09

Hanaa