updates for #813 (#814)

* updates for #813

* update man pages

* Update utils/tests.sh

Co-authored-by: joshr <joshr>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
pull/819/head
Josh Rabinowitz 2 years ago committed by GitHub
parent a97dd7ffa8
commit c798e89539
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "GIT\-SECRET\-ADD" "1" "June 2021" "sobolevn" "git-secret 0.5.0-alpha1"
.TH "GIT\-SECRET\-ADD" "1" "February 2022" "sobolevn" "git-secret 0.5.0-alpha1"
.
.SH "NAME"
\fBgit\-secret\-add\fR \- starts to track added files\.

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "GIT\-SECRET\-CAT" "1" "June 2021" "sobolevn" "git-secret 0.5.0-alpha1"
.TH "GIT\-SECRET\-CAT" "1" "February 2022" "sobolevn" "git-secret 0.5.0-alpha1"
.
.SH "NAME"
\fBgit\-secret\-cat\fR \- decrypts files passed on command line to stdout

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "GIT\-SECRET\-CHANGES" "1" "June 2021" "sobolevn" "git-secret 0.5.0-alpha1"
.TH "GIT\-SECRET\-CHANGES" "1" "February 2022" "sobolevn" "git-secret 0.5.0-alpha1"
.
.SH "NAME"
\fBgit\-secret\-changes\fR \- view diff of the hidden files\.

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "GIT\-SECRET\-CLEAN" "1" "June 2021" "sobolevn" "git-secret 0.5.0-alpha1"
.TH "GIT\-SECRET\-CLEAN" "1" "February 2022" "sobolevn" "git-secret 0.5.0-alpha1"
.
.SH "NAME"
\fBgit\-secret\-clean\fR \- removes all the hidden files\.

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "GIT\-SECRET\-HIDE" "1" "June 2021" "sobolevn" "git-secret 0.5.0-alpha1"
.TH "GIT\-SECRET\-HIDE" "1" "February 2022" "sobolevn" "git-secret 0.5.0-alpha1"
.
.SH "NAME"
\fBgit\-secret\-hide\fR \- encrypts all added files with the inner keyring\.

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "GIT\-SECRET\-INIT" "1" "June 2021" "sobolevn" "git-secret 0.5.0-alpha1"
.TH "GIT\-SECRET\-INIT" "1" "April 2022" "sobolevn" "git-secret 0.5.0-alpha1"
.
.SH "NAME"
\fBgit\-secret\-init\fR \- initializes git\-secret repository\.
@ -18,7 +18,18 @@ git secret init
\fBgit\-secret\-init\fR should be run inside a \fBgit\fR repo to set up the \.gitsecret directory and initialize the repo for git\-secret\. Until repository is initialized with \fBgit secret init\fR, all other \fBgit\-secret\fR commands are unavailable\.
.
.P
If a \fB\.gitsecret\fR directory already exists, \fBgit\-secret\-init\fR exits without making any changes\. Otherwise, a \.gitsecret directory is created with appropriate sub\-directories, and patterns to ignore \fBgit\-secret\fR\'s \fBrandom_seed_file\fR and not ignore \fB\.secret\fR files are added to \fB\.gitignore\fR\.
If a \fB\.gitsecret\fR directory already exists, \fBgit\-secret\-init\fR exits without making any changes\. Otherwise,
.
.IP "\(bu" 4
\fB\.gitignore\fR is modified to ignore \fBgit\-secret\fR\'s \fBrandom_seed_file\fR, and to not ignore \fB\.secret\fR files,
.
.IP "\(bu" 4
a \.gitsecret directory is created with the sub\-directories /keys and /paths,
.
.IP "\(bu" 4
The \fB\.gitsecret/keys\fR subdirectory permissions are set to 700 to make gnupg happy\.
.
.IP "" 0
.
.P
(See git\-secret(7) \fIhttps://git\-secret\.io/git\-secret\fR for information about renaming the \.gitsecret folder with the \fBSECRETS_DIR\fR environment variable, and changing the extension \fBgit\-secret\fR uses for secret files with the \fBSECRETS_EXTENSION\fR environment variable\.

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "GIT\-SECRET\-LIST" "1" "June 2021" "sobolevn" "git-secret 0.5.0-alpha1"
.TH "GIT\-SECRET\-LIST" "1" "February 2022" "sobolevn" "git-secret 0.5.0-alpha1"
.
.SH "NAME"
\fBgit\-secret\-list\fR \- prints all the added files\.

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "GIT\-SECRET\-REMOVE" "1" "June 2021" "sobolevn" "git-secret 0.5.0-alpha1"
.TH "GIT\-SECRET\-REMOVE" "1" "February 2022" "sobolevn" "git-secret 0.5.0-alpha1"
.
.SH "NAME"
\fBgit\-secret\-remove\fR \- removes files from index\.

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "GIT\-SECRET\-REMOVEPERSON" "1" "June 2021" "sobolevn" "git-secret 0.5.0-alpha1"
.TH "GIT\-SECRET\-REMOVEPERSON" "1" "February 2022" "sobolevn" "git-secret 0.5.0-alpha1"
.
.SH "NAME"
\fBgit\-secret\-removeperson\fR \- deletes key identified by an email from the inner keyring\.

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "GIT\-SECRET\-REVEAL" "1" "June 2021" "sobolevn" "git-secret 0.5.0-alpha1"
.TH "GIT\-SECRET\-REVEAL" "1" "February 2022" "sobolevn" "git-secret 0.5.0-alpha1"
.
.SH "NAME"
\fBgit\-secret\-reveal\fR \- decrypts all added files\.

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "GIT\-SECRET\-TELL" "1" "June 2021" "sobolevn" "git-secret 0.5.0-alpha1"
.TH "GIT\-SECRET\-TELL" "1" "February 2022" "sobolevn" "git-secret 0.5.0-alpha1"
.
.SH "NAME"
\fBgit\-secret\-tell\fR \- adds a person, who can access private data\.

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "GIT\-SECRET\-USAGE" "1" "June 2021" "sobolevn" "git-secret 0.5.0-alpha1"
.TH "GIT\-SECRET\-USAGE" "1" "February 2022" "sobolevn" "git-secret 0.5.0-alpha1"
.
.SH "NAME"
\fBgit\-secret\-usage\fR \- prints all the available commands\.

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "GIT\-SECRET\-WHOKNOWS" "1" "June 2021" "sobolevn" "git-secret 0.5.0-alpha1"
.TH "GIT\-SECRET\-WHOKNOWS" "1" "February 2022" "sobolevn" "git-secret 0.5.0-alpha1"
.
.SH "NAME"
\fBgit\-secret\-whoknows\fR \- prints email\-labels for each key in the keyring\.

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "GIT\-SECRET" "7" "June 2021" "sobolevn" "git-secret 0.5.0-alpha1"
.TH "GIT\-SECRET" "7" "April 2022" "sobolevn" "git-secret 0.5.0-alpha1"
.
.SH "NAME"
\fBgit\-secret\fR \- bash tool to store private data inside a git repo\.
@ -41,15 +41,18 @@ Later you can decrypt files with the \fBgit secret reveal\fR command, or just pr
Import this key into your \fBgpg\fR keyring (in \fB~/\.gnupg\fR or similar) by running \fBgpg \-\-import KEY_NAME\.txt\fR
.
.IP "3." 4
Now add this person to your secrets repo by running \fBgit secret tell persons@email\.id\fR (this will be the email address associated with the public key)
Now add this person to your secrets repo by running \fBgit secret tell persons@email\.id\fR (this will be the email address associated with their public key)
.
.IP "4." 4
Now remove the other user\'s public key from your personal keychain with \fBgpg \-\-delete\-keys persons@email\.id\fR
.
.IP "5." 4
The newly added user cannot yet read the encrypted files\. Now, re\-encrypt the files using \fBgit secret reveal; git secret hide \-d\fR, and then commit and push the newly encrypted files\. (The \-d options deletes the unencrypted file after re\-encrypting it)\. Now the newly added user will be able to decrypt the files in the repo using \fBgit\-secret reveal\fR\.
.
.IP "" 0
.
.P
Note that it is possible to add yourself to the git\-secret repo without decrypting existing files\. It will be possible to decrypt them after re\-encrypting them with the new keyring\. So, if you don\'t want unexpected keys added, you can configure some server\-side security policy with the \fBpre\-receive\fR hook\.
Note that it is possible to add yourself to the git\-secret repo without being able decrypting existing files\. It will be possible to decrypt them after re\-encrypting them with the new keyring\. If you do not want unexpected keys added, you can configure some server\-side security policy with the \fBpre\-receive\fR hook\.
.
.SS "Using gpg"
You can follow a quick \fBgpg\fR tutorial at devdungeon \fIhttps://www\.devdungeon\.com/content/gpg\-tutorial\fR\. Here are the most useful commands to get started:
@ -103,13 +106,13 @@ When using \fBgit\-secret\fR for CI/CD, you get the benefit that any deployment
One way of doing it is the following:
.
.IP "1." 4
\fIcreate a gpg key\fR for your CI/CD environment\. You can chose any name and email address you want: for instance \fBMyApp CodeShip <myapp@codeship\.com>\fR if your app is called MyApp and your CI/CD provider is CodeShip\. It is easier not to define a password for that key\.
\fIcreate a gpg key\fR for your CI/CD environment\. You can chose any name and email address you want: for instance \fBMyApp CodeShip <myapp@codeship\.com>\fR if your app is called MyApp and your CI/CD provider is CodeShip\. It is easier not to define a passphrase for that key\. However, if defining a passphrase is unavoidable, use a unique passphrase for the private key\.
.
.IP "2." 4
run \fBgpg \-\-armor \-\-export\-secret\-key myapp@codeship\.com\fR to get your private key value
.
.IP "3." 4
Create an env var on your CI/CD server \fBGPG_PRIVATE_KEY\fR and assign it the private key value\.
Create an env var on your CI/CD server \fBGPG_PRIVATE_KEY\fR and assign it the private key value\. If a passphrase has been setup for the private key, create another env var on the CI/CD server \fBGPG_PASSPHRASE\fR and assign it the passphrase of the private key\.
.
.IP "4." 4
Then write your Continuous Deployment build script\. For instance:
@ -124,11 +127,12 @@ Then write your Continuous Deployment build script\. For instance:
# see: https://git\-secret\.io/installation
# Create private key file
echo $GPG_PRIVATE_KEY > \./private_key\.gpg
# Import private key
gpg \-\-import \./private_key\.gpg
# Reveal secrets
git secret reveal
echo "$GPG_PRIVATE_KEY" > \./private_key\.gpg
# Import private key and avoid the "Inappropriate ioctl for device" error
gpg \-\-batch \-\-yes \-\-pinentry\-mode loopback \-\-import private_key\.gpg
# Reveal secrets without user interaction and with passphrase\. If no passphrase
# is created for the key, remove `\-p $GPG_PASSPHRASE`
git secret reveal \-p "$GPG_PASSPHRASE"
# carry on with your build script, secret files are available \.\.\.
.
.fi
@ -155,12 +159,15 @@ You can then create your private key file with:
.
.nf
echo $GPG_PRIVATE_KEY | tr \',\' \'\en\' > \./private_key\.gpg
echo "$GPG_PRIVATE_KEY" | tr \',\' \'\en\' > \./private_key\.gpg
.
.fi
.
.IP "" 0
.
.P
Also note: the \fBgpg\fR version on the CI/CD server \fBMUST INTEROPERATE\fR with the one used locally\. Otherwise, \fBgpg\fR decryption can fail, which leads to \fBgit secret reveal\fR reporting \fBcannot find decrypted version of file\fR error\. The best way to ensure this is to use the same version of gnupg on different systems\.
.
.SH "Environment Variables and Configuration"
You can configure the version of \fBgpg\fR used, or the extension your encrypted files use, to suit your workflow better\. To do so, just set the required variable to the value you need\. This can be done in your shell environment file or with each \fBgit\-secret\fR command\. See below, or the man page of \fBgit\-secret\fR for an explanation of the environment variables \fBgit\-secret\fR uses\.
.

@ -37,15 +37,17 @@ And you're done!
2. Import this key into your `gpg` keyring (in `~/.gnupg` or similar) by running `gpg --import KEY_NAME.txt`
3. Now add this person to your secrets repo by running `git secret tell persons@email.id`
(this will be the email address associated with the public key)
(this will be the email address associated with their public key)
4. The newly added user cannot yet read the encrypted files. Now, re-encrypt the files using
4. Now remove the other user's public key from your personal keychain with `gpg --delete-keys persons@email.id`
5. The newly added user cannot yet read the encrypted files. Now, re-encrypt the files using
`git secret reveal; git secret hide -d`, and then commit and push the newly encrypted files.
(The -d options deletes the unencrypted file after re-encrypting it).
Now the newly added user will be able to decrypt the files in the repo using `git-secret reveal`.
Note that it is possible to add yourself to the git-secret repo without decrypting existing files.
It will be possible to decrypt them after re-encrypting them with the new keyring. So, if you don't
Note that it is possible to add yourself to the git-secret repo without being able decrypting existing files.
It will be possible to decrypt them after re-encrypting them with the new keyring. If you do not
want unexpected keys added, you can configure some server-side security policy with the `pre-receive` hook.
### Using gpg

@ -26,6 +26,7 @@ chmod 0700 "${TEST_DIR}"
# (IE, like: `echo '# message here' >&3`).
# bats ... 3>&1 shows diagnostic output
bats "${SECRETS_PROJECT_ROOT}/tests" 3>&1
# bats "${SECRETS_PROJECT_ROOT}/tests/test_tell.bats" 3>&1
)
rm -rf "${TEST_DIR}"

Loading…
Cancel
Save