/bash-check-vault-encryption

"Pre hook" for git commit. Checks if every file that matches a configurable naming pattern is encrypted before performing a git commit.

Primary LanguageShellGNU General Public License v3.0GPL-3.0

Check vault encryption

This script checks if every file matching the configured naming pattern is encrypted and gives you helpful output before committing your changes to a git repository.

Configuration

Naming convention filters:
Edit the check_vault.sh file and add/remove naming patterns to/from the TYPES array.
All array entries will be used to find files matching these pattern.
Found files will be checked for ansible-vault header.
Note: Empty files are ignored.

Usage

Manual invocation:
Navigate to the git repository where you want to commit changes and exec the script.

Automated invocation:
Suitable if you want to perform this check every time you want to commit new code to a git repository.
Set an alias in your .bashrc to call this script.

# git safe commit
alias gitsc='<path to the script>check_vault.sh'

All arguments passed to the script are taken and used for the actual git commit command.
Emaples:

# With arguments
gitsc -m "added awesome new code"

Make the new alias available in your current shell: source ~/.bashrc

Sample output:
Image

Current matching pattern

  • *vault*
  • *.keytab
  • *.pem
  • *.jks