Giter Club home page Giter Club logo

hashicorp-vault's Introduction

PSVault

PowerShell module for using HashiCorp Vault on windows

This PowerShell module can be used for installing, configuring and managing HashiCorp Vault. It works at the moment through the vault.exe and with the vault api.

This Module contains cmdlets for install, configure and managing Hashicorp vault via PowerShell See the Folder Examples.

import-module "C:\Program Files\WindowsPowerShell\Modules\PSVault\1.0.1\PSVault.psm1" -Verbose get-command -Module PSVault

Functions for downloading and unziping software from HashiCorp

  • Get-Unzip
  • Get-DownloadAndUnzip
  • Get-FileFromInternet
  • Add-Path
  • Remove-StringSpecialCharacter

Functions for password and encryption

  • Convertfrom-SecureHashAES
  • Convert-PlainpasswordtoSecurestring
  • Convertto-SecureHashAES
  • Get-AESHash
  • New-AESHASH
  • New-AESKey

Functions for Vault

  • Connect-Vault
  • Start-VaultWeb
  • Start-VaultTask
  • Start-VaultInit
  • start-VaultautoUnseal
  • Start-Vault
  • set-VaultUnseal
  • set-VaultSecret
  • set-VaultSeal
  • Set-VaultPowershellProfile
  • set-VaultLDAP
  • Stop-VaultTask
  • set-vaultconfig
  • Remove-vaultauto
  • Remove-Vault
  • new-VaultSecretEngine
  • New-VaultPolicy
  • Install-Vault
  • get-VaultStatuscode
  • Get-VaultStatus
  • get-VaultSecretEngine
  • get-VaultSecret
  • get-Vaultobject
  • remove-VaultSecretEngine
  • Update-Vault

Test function

  • Import-PSVaultModule

Unblock ps1 files in psvault module after download

$Path  = "C:\Program Files\WindowsPowerShell\Modules\psvault" ;
$files =  get-childitem -path $Path -recurse | where {$_.Attributes -eq "Archive" } ;
foreach($file in $files){ 
 write-host " - Unblock $($file.FullName)" ; 
 Unblock-File -Path  $file.FullName 
}#EndForeach

hashicorp-vault's People

Contributors

d2cit avatar stefancvetanovski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

hashicorp-vault's Issues

Error: Get-Vault not found

Hi
I have a problem with cmdlet get-VaultSecret and others that try to use Get-Vault function:

PS❯ get-VaultSecret

Get-Vault: C:\Program Files\WindowsPowerShell\Modules\PSVault\1.0.1\PSVault.psm1:2240
Line |
2240 |          $VaultObject  = $(Get-Vault -Address $APIAddress -Token $env: …
     |                            ~~~~~~~~~
     | The term 'Get-Vault' is not recognized as a name of a cmdlet, function, script file, or
     | executable program. Check the spelling of the name, or if a path was included, verify
     | that the path is correct and try again.

As think as I understand it necessary to use function get-Vaultobject

Get-VaultObject assumes port 8200

In this code:

begin{
        if($Address -notlike "http://*.*.*.*:8200"){$Address = "http://127.0.0.1:8200" }
    }

 process{
        $vaultobject = [PSCustomObject]@{'uri'= $Address + $prefix
                            'auth_header' = @{'X-Vault-Token'=$Token}
                            } 
    }
    end{
        return  $vaultobject
    }

You are assuming that the Vault is on port 8200. If anyone installs Hashicorp Vault on another port, this module will never work.
Ours is installed at a URL like this: https://hashivault.dev.local.

When doing this:
get-Vaultobject -Address https://hashivault.dev.local -Token <token>
It returns this:

uri                   auth_header    
---                   -----------    
http://127.0.0.1:8200 {X-Vault-Token}

Parsing Vault Initialization is still hardcoded at 5 keys instead of dynamic size

First, HUGE thank you for putting this together... I just came across it while working through a tutorial on another site.

At line 1552, you parse the secrets for initializing the vault.

For our org, we wanted to do 7 shares with a threshold of 2.

The script itself does great at actually pushing that, but when it builds the object for the $VaultINITKeys, it makes an assumption that it will have 5 keys.

I did a down-and-dirty cut and paste to expand it for my 7 keys, but a better approach would probably be a foreach loop based on the incoming $initialize variable.

Another possibility, is that the web interface, by default downloads this as a .json file. Possibly just parsing the data a little more "raw" using ConvertFrom-Json would be easier?

I haven't dug in on diagnostics to look at the raw stuff yet, but hopefully this can point this in a direction to make this wonderful toolset a little more generic.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.