17 Commits

Author SHA1 Message Date
tlimoncelli@stackexchange.com
ee3b6612ff - Add blackbox_list_files to RPM and MacPorts packages.
- Makefile should not require DESTDIR variable.
2015-02-16 16:17:30 +00:00
tlimoncelli@stackexchange.com
7cfb47c09b blackbox_list_files: Only list files. No extra text. (Makes it easier to work with grep and other utilities) 2015-02-16 16:16:40 +00:00
tlimoncelli@stackexchange.com
f18a6a0a8a README.md: Add list of commands. 2015-02-16 11:09:58 -05:00
tlimoncelli@stackexchange.com
503b26d354 blackbox_update_all_files: Clarify comment. 2015-02-16 11:09:58 -05:00
Tom Limoncelli
27df8eadf0 Merge pull request #42 from jrodriguezjr/master
List files that BlackBox is tracking
2015-02-16 10:59:28 -05:00
Tom Limoncelli
79ae5d33ab Merge pull request #43 from cyberbob25/master
Added EDITOR default to _blackbox_common.sh
2015-02-16 10:56:39 -05:00
Bryan Roberts
63b5dc9de4 Fixed parameter expansion in _blackbox_common.sh for EDITOR 2015-02-15 11:52:34 -05:00
Bryan Roberts
d4fd6cf8ed Removed check for EDITOR from blackbox_edit 2015-02-15 11:40:00 -05:00
Bryan Roberts
e5028b0fdb Removed blackbox_view since blackbox_cat already exists 2015-02-15 02:36:11 -05:00
Bryan Roberts
9b5af9f85c Added EDITOR default to _blackbox_common.sh 2015-02-15 02:35:03 -05:00
Bryan Roberts
a95a5ef629 Fixed argument for deletion 2015-02-15 02:22:41 -05:00
Bryan Roberts
0e5fdf6fa3 Added EDITOR default to blackbox_edit; Created blackbox_view 2015-02-14 20:00:34 -05:00
Joe Rodriguez Jr
1c69a11cdf Changing default umask. 2015-02-11 13:47:00 -06:00
Joe Rodriguez Jr
28b8c413c0 Make file executable. 2015-02-11 08:40:16 -06:00
tlimoncelli@stackexchange.com
86fe5ae352 More securely quote $BB_FILES 2015-02-10 18:54:47 -05:00
Joe Rodriguez Jr
bb6e7e3451 List files that BlackBox is tracking 2015-02-10 16:08:19 -06:00
tlimoncelli@stackexchange.com
de3ec22655 mk_rpm_fpmdir: Many improvements: configurable epoch, description, vendor 2015-02-04 20:19:09 +00:00
10 changed files with 54 additions and 13 deletions

View File

@@ -25,9 +25,9 @@ tools/mk_macports.vcs_blackbox.txt: tools/mk_rpm_fpmdir.stack_blackbox.txt
sed -e 's@/usr/blackbox/bin/@bin/@g' -e '/profile.d-usrblackbox.sh/d' <tools/mk_rpm_fpmdir.stack_blackbox.txt >$@ sed -e 's@/usr/blackbox/bin/@bin/@g' -e '/profile.d-usrblackbox.sh/d' <tools/mk_rpm_fpmdir.stack_blackbox.txt >$@
check-destdir: check-destdir:
ifndef DESTDIR ifndef DESTDIR
$(error DESTDIR is undefined) $(error DESTDIR is undefined)
endif endif
# MacPorts expects to run: make packages-macports DESTDIR=${destroot} # MacPorts expects to run: make packages-macports DESTDIR=${destroot}
packages-macports: tools/mk_macports.vcs_blackbox.txt check-destdir packages-macports: tools/mk_macports.vcs_blackbox.txt check-destdir

View File

@@ -74,6 +74,24 @@ exception of a few specific files, is key to the kind of
collaboration that DevOps and modern IT practitioniers collaboration that DevOps and modern IT practitioniers
need to do. need to do.
Commands:
============================
| Name: | Description: |
| --- | --- |
| `blackbox_addadmin` | Add someone to the list of people that can encrypt/decrypt secrets |
| `blackbox_cat` | Decrypt and view the contents of a file |
| `blackbox_edit` | Decrypt, run $EDITOR, re-encrypt a file |
| `blackbox_edit_start` | Decrypt a file so it can be updated |
| `blackbox_edit_end` | Encrypt a file after blackbox_edit_start was used |
| `blackbox_initialize` | Enable blackbox for a GIT or HG repo |
| `blackbox_postdeploy` | Decrypt all managed files |
| `blackbox_register_new_file` | Encrypt a file for the first time |
| `blackbox_removeadmin` | Remove someone from the list of people that can encrypt/decrypt secrets |
| `blackbox_shred_all_files` | Safely delete any decrypted files |
| `blackbox_update_all_file` | Decrypt then re-encrypt all files. Useful after keys are changed |
Compatibility: Compatibility:
============================ ============================
@@ -87,7 +105,7 @@ It has been tested to work with many operating systems.
* `hg` -- Mercurial * `hg` -- Mercurial
* `svn` -- SubVersion (Thanks, Ben Drasin!) * `svn` -- SubVersion (Thanks, Ben Drasin!)
* Operating system * Operating system
* CentOS * CentOS / RedHat
* MacOS X * MacOS X
* Cygwin (Thanks, Ben Drasin!) * Cygwin (Thanks, Ben Drasin!)

View File

@@ -11,6 +11,11 @@
# Where in the VCS repo should the blackbox data be found? # Where in the VCS repo should the blackbox data be found?
: ${BLACKBOXDATA:=keyrings/live} ; # If BLACKBOXDATA not set, set it. : ${BLACKBOXDATA:=keyrings/live} ; # If BLACKBOXDATA not set, set it.
# If $EDITOR is not set, set it to "vi":
: ${EDITOR:=vi} ;
# Outputs a string that is the base directory of this VCS repo. # Outputs a string that is the base directory of this VCS repo.
# By side-effect, sets the variable VCS_TYPE to either 'git', 'hg', # By side-effect, sets the variable VCS_TYPE to either 'git', 'hg',
@@ -56,7 +61,8 @@ BB_FILES_FILE="blackbox-files.txt"
BB_FILES="${KEYRINGDIR}/${BB_FILES_FILE}" BB_FILES="${KEYRINGDIR}/${BB_FILES_FILE}"
SECRING="${KEYRINGDIR}/secring.gpg" SECRING="${KEYRINGDIR}/secring.gpg"
PUBRING="${KEYRINGDIR}/pubring.gpg" PUBRING="${KEYRINGDIR}/pubring.gpg"
: ${DECRYPT_UMASK:=o=} ; : ${DECRYPT_UMASK:=0022} ;
# : ${DECRYPT_UMASK:=o=} ;
# Return error if not on cryptlist. # Return error if not on cryptlist.
function is_on_cryptlist() { function is_on_cryptlist() {

9
bin/blackbox_list_files Executable file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
#
# blackbox_list_files.sh -- List files that black box is tracking
#
set -e
blackbox_home=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source ${blackbox_home}/_blackbox_common.sh
cat "$BB_FILES"

View File

@@ -46,6 +46,8 @@ if $SECRETSEXPOSED ; then
COMMIT_FILES="$BB_FILES $encrypted_file $unencrypted_file" COMMIT_FILES="$BB_FILES $encrypted_file $unencrypted_file"
else else
COMMIT_FILES="$BB_FILES $encrypted_file" COMMIT_FILES="$BB_FILES $encrypted_file"
# FIXME(tal): This should be an array so that filenames with
# spaces aren't a problem.
fi fi
# TODO(tlim): This should be moved to _blackbox_common.sh in a # TODO(tlim): This should be moved to _blackbox_common.sh in a
@@ -61,7 +63,7 @@ if [[ $VCS_TYPE = 'git' ]]; then
fi fi
echo 'NOTE: "already tracked!" messages are safe to ignore.' echo 'NOTE: "already tracked!" messages are safe to ignore.'
vcs_add $BB_FILES $encrypted_file vcs_add "$BB_FILES" $encrypted_file
vcs_commit "registered in blackbox: ${unencrypted_file}" $COMMIT_FILES vcs_commit "registered in blackbox: ${unencrypted_file}" $COMMIT_FILES
echo "========== UPDATING VCS: DONE" echo "========== UPDATING VCS: DONE"
echo "Local repo updated. Please push when ready." echo "Local repo updated. Please push when ready."

View File

@@ -22,7 +22,7 @@ source ${blackbox_home}/_blackbox_common.sh
change_to_root change_to_root
echo '========== FILES BEING SHREDDED:' echo '========== FILES BEING SHREDDED:'
for i in $(<$BB_FILES) ; do for i in $(<"$BB_FILES") ; do
unencrypted_file=$(get_unencrypted_filename "$i") unencrypted_file=$(get_unencrypted_filename "$i")
encrypted_file=$(get_encrypted_filename "$i") encrypted_file=$(get_encrypted_filename "$i")
if [[ -f "$unencrypted_file" ]]; then if [[ -f "$unencrypted_file" ]]; then

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# #
# blackbox_update_all_files -- Re-encrypt file after edits. # blackbox_update_all_files -- Decrypt then re-encrypt all files. Useful after keys are changed.
# #
set -e set -e
@@ -23,7 +23,7 @@ awk <"$BB_FILES" '{ print " " $1 ".gpg" }'
echo '========== FILES IN THE WAY:' echo '========== FILES IN THE WAY:'
need_warning=false need_warning=false
for i in $(<$BB_FILES) ; do for i in $(<"$BB_FILES") ; do
unencrypted_file=$(get_unencrypted_filename "$i") unencrypted_file=$(get_unencrypted_filename "$i")
encrypted_file=$(get_encrypted_filename "$i") encrypted_file=$(get_encrypted_filename "$i")
if [[ -f "$unencrypted_file" ]]; then if [[ -f "$unencrypted_file" ]]; then
@@ -40,7 +40,7 @@ else
fi fi
echo '========== RE-ENCRYPTING FILES:' echo '========== RE-ENCRYPTING FILES:'
for i in $(<$BB_FILES) ; do for i in $(<"$BB_FILES") ; do
unencrypted_file=$(get_unencrypted_filename "$i") unencrypted_file=$(get_unencrypted_filename "$i")
encrypted_file=$(get_encrypted_filename "$i") encrypted_file=$(get_encrypted_filename "$i")
echo ========== PROCESSING "$unencrypted_file" echo ========== PROCESSING "$unencrypted_file"
@@ -53,7 +53,7 @@ done
fail_if_keychain_has_secrets fail_if_keychain_has_secrets
echo '========== COMMITING TO VCS:' echo '========== COMMITING TO VCS:'
vcs_commit 'Re-encrypted keys' $(awk <$BB_FILES '{ print $1 ".gpg" }' ) vcs_commit 'Re-encrypted keys' $(awk <"$BB_FILES" '{ print $1 ".gpg" }' )
VCSCMD=$(which_vcs) VCSCMD=$(which_vcs)
echo '========== DONE.' echo '========== DONE.'

View File

@@ -11,3 +11,4 @@ exec bin/blackbox_register_new_file ../bin/blackbox_register_new_file
exec bin/blackbox_removeadmin ../bin/blackbox_removeadmin exec bin/blackbox_removeadmin ../bin/blackbox_removeadmin
exec bin/blackbox_shred_all_files ../bin/blackbox_shred_all_files exec bin/blackbox_shred_all_files ../bin/blackbox_shred_all_files
exec bin/blackbox_update_all_files ../bin/blackbox_update_all_files exec bin/blackbox_update_all_files ../bin/blackbox_update_all_files
exec bin/blackbox_list_files ../bin/blackbox_list_files

View File

@@ -24,6 +24,8 @@ shift
: ${PKGVERSION:=1.0} ; : ${PKGVERSION:=1.0} ;
# If there is no iteration setting, assume "1": # If there is no iteration setting, assume "1":
: ${PKGRELEASE:=1} : ${PKGRELEASE:=1}
# If there is no epoch, assume 0
: ${PKGEPOCH:=0}
# The RPM is output here: (should be a place that can be wiped) # The RPM is output here: (should be a place that can be wiped)
OUTPUTDIR="${HOME}/rpmbuild-$PACKAGENAME" OUTPUTDIR="${HOME}/rpmbuild-$PACKAGENAME"
@@ -37,6 +39,7 @@ rm -rf "$OUTPUTDIR"
mkdir -p "$OUTPUTDIR/installroot" mkdir -p "$OUTPUTDIR/installroot"
# Copy the files into place: # Copy the files into place:
set -o pipefail # Error out if any manifest is not found.
cat """$@""" | while read -a arr ; do cat """$@""" | while read -a arr ; do
PERM="${arr[0]}" PERM="${arr[0]}"
case $PERM in case $PERM in
@@ -56,12 +59,13 @@ done
# Build the RPM: # Build the RPM:
cd "$OUTPUTDIR" && fpm -s dir -t rpm \ cd "$OUTPUTDIR" && fpm -s dir -t rpm \
-a x86_64 \ -a x86_64 \
--epoch '0' \
-n "${PACKAGENAME}" \ -n "${PACKAGENAME}" \
--epoch "${PKGEPOCH}" \
--version "${PKGVERSION}" \ --version "${PKGVERSION}" \
--iteration "${PKGRELEASE}" \ --iteration "${PKGRELEASE}" \
${PKGDESCRIPTION:+ --description="${PKGDESCRIPTION}"} \
${PKGVENDOR:+ --vendor="${PKGVENDOR}"} \
-C "$OUTPUTDIR/installroot" \ -C "$OUTPUTDIR/installroot" \
--description="$PKGDESCRIPTION" \
. .
# TeamCity templates for RPMS expect to find # TeamCity templates for RPMS expect to find

View File

@@ -12,3 +12,4 @@ exec /usr/blackbox/bin/blackbox_register_new_file ../bin/blackbox_register_new_f
exec /usr/blackbox/bin/blackbox_removeadmin ../bin/blackbox_removeadmin exec /usr/blackbox/bin/blackbox_removeadmin ../bin/blackbox_removeadmin
exec /usr/blackbox/bin/blackbox_shred_all_files ../bin/blackbox_shred_all_files exec /usr/blackbox/bin/blackbox_shred_all_files ../bin/blackbox_shred_all_files
exec /usr/blackbox/bin/blackbox_update_all_files ../bin/blackbox_update_all_files exec /usr/blackbox/bin/blackbox_update_all_files ../bin/blackbox_update_all_files
exec /usr/blackbox/bin/blackbox_list_files ../bin/blackbox_list_files