This commit is contained in:
tlimoncelli@stackexchange.com
2015-04-01 11:41:06 -04:00
2 changed files with 28 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
BlackBox BlackBox
======== ========
Safely store secrets in a VCS repo (i.e. Git, Mercurial, or Subversion). These Safely store secrets in a VCS repo (i.e. Git, Mercurial, Subversion or Perforce). These
commands make it easy commands make it easy
for you to Gnu Privacy Guard (GPG) encrypt specific files in a repo so they are for you to Gnu Privacy Guard (GPG) encrypt specific files in a repo so they are
"encrypted at rest" in your repository. However, the scripts "encrypted at rest" in your repository. However, the scripts
@@ -42,8 +42,8 @@ files. Simply set up a GPG key for the Puppet master (or the role
account that pushes new files to the Puppet master) and have that account that pushes new files to the Puppet master) and have that
user run `blackbox_postdeploy` after any files are updated. user run `blackbox_postdeploy` after any files are updated.
Getting started is easy. Just `cd` into a Git, Mercurial or Subversion Getting started is easy. Just `cd` into a Git, Mercurial, Subversion or
repository and run `blackbox_initialize`. After that, if a file is to Perforce repository and run `blackbox_initialize`. After that, if a file is to
be encrypted, run `blackbox_register_new_file` and you are done. Add be encrypted, run `blackbox_register_new_file` and you are done. Add
and remove keys with `blackbox_addadmin` and `blackbox_removeadmin`. and remove keys with `blackbox_addadmin` and `blackbox_removeadmin`.
To view and/or edit a file, run `blackbox_edit`; this will decrypt the To view and/or edit a file, run `blackbox_edit`; this will decrypt the
@@ -117,6 +117,7 @@ It has been tested to work with many operating systems.
* `git` -- The Git * `git` -- The Git
* `hg` -- Mercurial * `hg` -- Mercurial
* `svn` -- SubVersion (Thanks, Ben Drasin!) * `svn` -- SubVersion (Thanks, Ben Drasin!)
* `p4` -- Perforce
* Operating system * Operating system
* CentOS / RedHat * CentOS / RedHat
* MacOS X * MacOS X
@@ -133,7 +134,7 @@ Note: Cywin support requires the following packages:
* Normal operation: * Normal operation:
* gnupg * gnupg
* git or mercurial or subversion (as appropriate) * git or mercurial or subversion or perforce (as appropriate)
* Development (if you will be adding code and want to run the confidence test) * Development (if you will be adding code and want to run the confidence test)
* procps * procps
* make * make

View File

@@ -349,6 +349,17 @@ function is_in_svn() {
echo false echo false
fi fi
} }
# Perforce
function is_in_p4() {
local filename
filename="$1"
if p4 list "$filename" ; then
echo true
else
echo false
fi
}
# Add a file to the repo (but don't commit it). # Add a file to the repo (but don't commit it).
@@ -367,6 +378,10 @@ function vcs_add_git() {
function vcs_add_svn() { function vcs_add_svn() {
svn add --parents """$@""" svn add --parents """$@"""
} }
# Perfoce
function vcs_add_p4() {
p4 add """$@"""
}
# Commit a file to the repo # Commit a file to the repo
@@ -385,6 +400,10 @@ function vcs_commit_git() {
function vcs_commit_svn() { function vcs_commit_svn() {
svn commit -m"""$@""" svn commit -m"""$@"""
} }
# Perforce
function vcs_commit_p4() {
p4 submit -d """$@"""
}
# Remove file from repo, even if it was deleted locally already. # Remove file from repo, even if it was deleted locally already.
@@ -404,3 +423,7 @@ function vcs_remove_git() {
function vcs_remove_svn() { function vcs_remove_svn() {
svn delete """$@""" svn delete """$@"""
} }
# Perforce
function vcs_remove_svn() {
p4 delete """$@"""
}