]> git.wincent.com - git-cipher.git/log
git-cipher.git
10 months agochore: prepare for 1.1 release main master 1.1
Greg Hurrell [Tue, 2 Aug 2022 14:51:05 +0000 (16:51 +0200)] 
chore: prepare for 1.1 release

10 months agofeat: make some improvements to logging
Greg Hurrell [Mon, 1 Aug 2022 11:53:07 +0000 (13:53 +0200)] 
feat: make some improvements to logging

- Interleave output (topological ordering) instead of showing _all_ the
  changes for one file before moving on to the next.
- When you don't pass any limiting paths, grab the history for _all_
  files across the entire history of the repo (including past renames).
- Don't reprint commit messages for every file in a commit (no longer
  necessary now that output is interleaved).

22 months agofeat: improve `git-cipher status -h` output
Greg Hurrell [Fri, 9 Jul 2021 11:54:12 +0000 (13:54 +0200)] 
feat: improve `git-cipher status -h` output

I often forget the difference between "STALE" and "MODIFIED" — they
should probably be replaced with better terms but I am not sure what —
but I can at least make it easy to look up what each one means.

23 months agodocs: update "master" references to say "main"
Greg Hurrell [Tue, 8 Jun 2021 07:52:27 +0000 (09:52 +0200)] 
docs: update "master" references to say "main"

23 months agofix: ignore Git-ignored encrypted files
Greg Hurrell [Tue, 8 Jun 2021 07:40:40 +0000 (09:40 +0200)] 
fix: ignore Git-ignored encrypted files

This is primarily to avoid junk like this from creeping into `status`
listings:

    aspects/vim/files/.config/nvim/undo/%Users%glh%code%wincent%aspects%ssh%templates%.ssh%.config.erb.encrypted: [MISSING]

and potentially getting pulled into `encrypt`/`decrypt` operations.

I hadn't seen this until now, but I just caused such a file to be
created while preparing the last commit because I edited a ciphertext by
hand to modify it (of course, I should have just used `touch` and I
later did, but anyway...)

23 months agofeat: teach `status` to report staleness
Greg Hurrell [Tue, 8 Jun 2021 07:32:40 +0000 (09:32 +0200)] 
feat: teach `status` to report staleness

Previously we only had checks to report when plain-text was newer than
ciphertext. In this case, `status` would show `[MODIFIED]` for that
file. In practice, I never see these messages because I have a Vim
autocmd that re-encrypts such files whenever I edit them.

But we did not have a check for the inverse case; ie. when a ciphertext
is newer than a plain-text. This can happen when you are editing on
multiple machines and syncing via Git. So, now we report that case as
`[STALE]`. The terminology may be confusing, but without printing out a
huge blurb explaining it, I think we have to rely on the `git-cipher
status -h/--help` output.

We do this somewhat fuzzily, requiring a difference of at least 5
seconds, because we already rely on plain-text being "older" than
ciphertext to avoid unnecessary churn. That is, when we decrypt a file,
we force the plain-text timestamp to be 1 second older than the
ciphertext. I am a bit fuzzy on why we did this and I am too lazy to
look it up in the Git history, but I am assuming it is because setting
the timestamps to be _equal_ was not enough (ie. `FileUtils.uptodate?`
probably didn't do the right thing in that case, possibly due to
timestamp resolution issues).

[Ok, I lied about being too lazy. I looked in the source repo where this
originally came from and it says nothing about `uptodate?`, so my guess
above is the best I can do.]

Related: https://github.com/wincent/wincent/issues/103

23 months agorefactor: remove dead get_passphrase() code
Greg Hurrell [Tue, 8 Jun 2021 06:44:23 +0000 (08:44 +0200)] 
refactor: remove dead get_passphrase() code

Dead since fd4c78aeb9d11d44c.

2 years agofeat: support encryption with multiple keys
Greg Hurrell [Sat, 5 Jun 2021 12:38:26 +0000 (14:38 +0200)] 
feat: support encryption with multiple keys

The motivation, as explained here[0], is to have these keys and subkeys:

1.  Personal (signing) key: alice@home.example.net, not used by
    git-cipher
    -   Subkey for encryption (added by GPG): used for encryption
    -   Any other subkeys (optionally) added by user: not used by
        git-cipher
2.  Work (signing) key: alice@work.example.com, not used by git-cipher
    -   Subkey for encryption (added by GPG): used for encryption
    -   Any other subkeys (optionally) added by user: not used by
        git-cipher

The primary keys can have expiry dates or not (I recommend that they
have them, but that you extend them periodically, for reasons that are
too long to go into here).

The subkeys should have expiry dates. When they expire, rotate to new
keys (ie. re-encrypt the files). To make life easy, the expiry dates
should be synchronized.

Having personal and work keys makes it possible to revoke keys,
rotate them independently if desired, or stop using a key upon leaving a
job.

[0]: https://wincent.com/wiki/GPG_key_rotation_notes

2 years agodoc: add notes about usage on Arch Linux
Greg Hurrell [Thu, 20 May 2021 10:00:37 +0000 (12:00 +0200)] 
doc: add notes about usage on Arch Linux

2 years agodoc: update CHANGELOG
Greg Hurrell [Thu, 20 May 2021 07:56:26 +0000 (09:56 +0200)] 
doc: update CHANGELOG

2 years agofix: allow `command` built-in to work on Linux
Greg Hurrell [Thu, 20 May 2021 07:49:34 +0000 (09:49 +0200)] 
fix: allow `command` built-in to work on Linux

On macOS `command` works because there is an actual `command` executable
at `/usr/bin/command`; it's actually a shell script:

    #!/bin/sh
    # $FreeBSD: src/usr.bin/alias/generic.sh,v 1.2 2005/10/24 22:32:19 cperciva Exp $
    # This file is in the public domain.
    builtin `echo ${0##*/} | tr \[:upper:] \[:lower:]` ${1+"$@"}

On Linux, we have to explicitly fork a shell in order for to use the
`command` built-in directly.

4 years agodoc: s/OS X/macOS/
Greg Hurrell [Wed, 16 Jan 2019 22:18:56 +0000 (23:18 +0100)] 
doc: s/OS X/macOS/

Keep up with Apple's ever-changing self-denominations.

4 years agodoc: switch to soft-wrapping in Markdown
Greg Hurrell [Wed, 16 Jan 2019 22:18:12 +0000 (23:18 +0100)] 
doc: switch to soft-wrapping in Markdown

For consistency with what I am doing in other repos.

4 years agodoc: link to dotfiles as an example usage
Greg Hurrell [Wed, 16 Jan 2019 22:16:50 +0000 (23:16 +0100)] 
doc: link to dotfiles as an example usage

4 years agodoc: expand usage section in docs
Greg Hurrell [Wed, 16 Jan 2019 22:12:34 +0000 (23:12 +0100)] 
doc: expand usage section in docs

4 years agoCut 1.0 release 1.0
Greg Hurrell [Wed, 16 Jan 2019 22:08:15 +0000 (23:08 +0100)] 
Cut 1.0 release

4 years agoAdd "status" subcommand
Greg Hurrell [Wed, 16 Jan 2019 22:03:49 +0000 (23:03 +0100)] 
Add "status" subcommand

6 years agoCut 0.3 release 0.3
Greg Hurrell [Mon, 24 Apr 2017 16:40:34 +0000 (09:40 -0700)] 
Cut 0.3 release

6 years agoMarkdownify license file
Greg Hurrell [Mon, 24 Apr 2017 16:39:57 +0000 (09:39 -0700)] 
Markdownify license file

6 years agoPrepare for 0.3 release
Greg Hurrell [Mon, 24 Apr 2017 16:38:30 +0000 (09:38 -0700)] 
Prepare for 0.3 release

6 years agoSet executable bit on common scripting language files
Greg Hurrell [Mon, 24 Apr 2017 16:33:32 +0000 (09:33 -0700)] 
Set executable bit on common scripting language files

If you encrypt (or decrypt) a file with a common scripting extension
(eg. `.js`, `.sh`) then `git-cipher` will set its executable bit
automatically. We didn't used to do this, but that meant that if you
went back and manually set the permissions then you would bump the
modification time of the file, causing it to be needlessly reencrypted
on the next run of `git-cipher encrypt`.

Other approaches that were considered and discarded were:

1. Make the behavior optional, via a switch or configuration option
   (discarded due to needless complexity).
2. Encode the need to set the bit in the encrypted file's own
   permissions (discarded because that means setting the bit on a file
   that is not executable, which is misleading).
3. Encode the need to set the bit in the encrypted file's internal
   structure: effectively, instead of storing the GPG output, we'd store
   a YAML file containing metadata and the output (discarded because of
   compatibility concerns and complexity; would make many subcommands in
   the app more complicated).
4. Encode the need to set the bit in the encrypted file's name
   (discarded because it's ugly and would still add a fair bit of
   complexity).

So in the end have taken what I think is the pragmatic approach.

6 years agoAdd `ls` subcommand
Greg Hurrell [Mon, 24 Apr 2017 16:17:51 +0000 (09:17 -0700)] 
Add `ls` subcommand

Simply lists the encrypted files in the repo.

6 years agoMove to gnupg2
Greg Hurrell [Wed, 5 Apr 2017 02:01:27 +0000 (19:01 -0700)] 
Move to gnupg2

No need for `preset` or `forget` any more as gnupg2 mostly handles
launching the agent, connecting to it, and storing passphrases.

6 years agodoc: update CHANGELOG
Greg Hurrell [Wed, 18 Jan 2017 03:41:01 +0000 (19:41 -0800)] 
doc: update CHANGELOG

6 years agoAdd original basename to `log` tempfile
Greg Hurrell [Wed, 18 Jan 2017 03:38:19 +0000 (19:38 -0800)] 
Add original basename to `log` tempfile

Makes the log slightly more intelligible, although it is still darn
ugly. On macOS:

  Before:

    --- a/var/folders/wf/h41r9yss4_x42p080xqn5xtsjt0h71/T/git-cipher-20170117-86549-1arr3p9
    +++ b/var/folders/wf/h41r9yss4_x42p080xqn5xtsjt0h71/T/git-cipher-20170117-86549-h3j6j9

  After:

    --- a/var/folders/wf/h41r9yss4_x42p080xqn5xtsjt0h71/T/git-cipher-20170117-86549-1arr3p9-.command-t.private.vim.encrypted
    +++ b/var/folders/wf/h41r9yss4_x42p080xqn5xtsjt0h71/T/git-cipher-20170117-86549-h3j6j9-.command-t.private.vim.encrypted

6 years agoRemove unnecessary `chmod` call
Greg Hurrell [Wed, 18 Jan 2017 03:27:36 +0000 (19:27 -0800)] 
Remove unnecessary `chmod` call

The library does this for us, according to the docs:

http://ruby-doc.org/stdlib-1.9.3/libdoc/tempfile/rdoc/Tempfile.html#method-c-new

6 years agoAdd logo to README
Greg Hurrell [Wed, 8 Jun 2016 06:55:31 +0000 (23:55 -0700)] 
Add logo to README

7 years agoRecursively explore dot directories when searching for matching files
Greg Hurrell [Mon, 7 Mar 2016 16:27:58 +0000 (16:27 +0000)] 
Recursively explore dot directories when searching for matching files

The old pattern would catch "foo/bar/.baz" but not "foo/.bar/baz". Now
we catch everything.

7 years agodoc: Mention the `log` subcommand in two other places
Greg Hurrell [Mon, 8 Feb 2016 09:32:45 +0000 (01:32 -0800)] 
doc: Mention the `log` subcommand in two other places

7 years agoUpdate CHANGELOG.md
Greg Hurrell [Mon, 8 Feb 2016 09:27:22 +0000 (01:27 -0800)] 
Update CHANGELOG.md

7 years agoBump version number for 0.2 release 0.2
Greg Hurrell [Mon, 8 Feb 2016 09:22:28 +0000 (01:22 -0800)] 
Bump version number for 0.2 release

7 years agoFuture-proof year ranges
Greg Hurrell [Mon, 8 Feb 2016 09:22:16 +0000 (01:22 -0800)] 
Future-proof year ranges

7 years agoAdd `log` subcommand
Greg Hurrell [Mon, 8 Feb 2016 09:09:31 +0000 (01:09 -0800)] 
Add `log` subcommand

This is a rough cut, but it works. Incredibly fork-heavy and generates a
lot of temporary files. Could probably benefit from some better (or
any?) error handling. I might follow up with that later and tidy it up.

In the meantime though...

Closes: https://github.com/wincent/git-cipher/issues/1
8 years agodoc: explain why git-cipher is structured as a single file
Greg Hurrell [Wed, 1 Apr 2015 01:03:33 +0000 (18:03 -0700)] 
doc: explain why git-cipher is structured as a single file

8 years agoAdd "Development" section to README
Greg Hurrell [Wed, 1 Apr 2015 00:54:03 +0000 (17:54 -0700)] 
Add "Development" section to README

8 years agoAdd Gem version badge to README
Greg Hurrell [Wed, 1 Apr 2015 00:51:34 +0000 (17:51 -0700)] 
Add Gem version badge to README

8 years agoAdd gemspec 0.1
Greg Hurrell [Wed, 1 Apr 2015 00:41:51 +0000 (17:41 -0700)] 
Add gemspec

8 years agoAdd CHANGELOG
Greg Hurrell [Wed, 1 Apr 2015 00:41:34 +0000 (17:41 -0700)] 
Add CHANGELOG

8 years agoUpdate README
Greg Hurrell [Tue, 31 Mar 2015 17:19:36 +0000 (10:19 -0700)] 
Update README

Getting this as close to polished up for release as I can.

8 years agoAdd more configurability for GPG user and preset command
Greg Hurrell [Tue, 31 Mar 2015 15:21:22 +0000 (08:21 -0700)] 
Add more configurability for GPG user and preset command

You can now provide `GPG_USER` and `GPG_PRESET_COMMAND` environment
variables to override the defaults, or more permanently, you can (ab)use
`git config` via the keys `cipher.gpguser` and `cipher.presetcommand`.

Otherwise, the existing default values with be used.

8 years agoWork around gpg quirks
Greg Hurrell [Sat, 28 Mar 2015 00:21:19 +0000 (17:21 -0700)] 
Work around gpg quirks

Somehow, gpg will hang if given multiline input, so replace it.

8 years agoFix broken --force option for decrypt subcommand
Greg Hurrell [Sat, 28 Mar 2015 00:11:36 +0000 (17:11 -0700)] 
Fix broken --force option for decrypt subcommand

8 years agoMostly alphabetize methods
Greg Hurrell [Sat, 28 Mar 2015 00:08:18 +0000 (17:08 -0700)] 
Mostly alphabetize methods

I want this to be a single file, so decomposing it into
classes/modules/files isn't going to happen. In order to keep thing
manageable, let's just alphabetize everything except for the
`#initialize` method which stays at the top by convention.

8 years agoFix whitespace
Greg Hurrell [Sat, 28 Mar 2015 00:04:04 +0000 (17:04 -0700)] 
Fix whitespace

8 years agoMake external process calls more robust
Greg Hurrell [Fri, 27 Mar 2015 23:50:12 +0000 (16:50 -0700)] 
Make external process calls more robust

Try to insulate us against crazy environments by shell-escaping
everything, and print a helpful message when a dependency isn't
available on the system.

8 years agoRemove a redundant comment
Greg Hurrell [Fri, 27 Mar 2015 23:18:42 +0000 (16:18 -0700)] 
Remove a redundant comment

8 years agoRemove now-unused bin_utils.rb file
Greg Hurrell [Fri, 27 Mar 2015 23:18:18 +0000 (16:18 -0700)] 
Remove now-unused bin_utils.rb file

8 years agoExtract inline documentation into separate README
Greg Hurrell [Fri, 27 Mar 2015 23:14:49 +0000 (16:14 -0700)] 
Extract inline documentation into separate README

The docs still need to be revised, but let's do that in the README.

8 years agoAdd LICENSE
Greg Hurrell [Fri, 27 Mar 2015 23:13:39 +0000 (16:13 -0700)] 
Add LICENSE

8 years agoMerge `decrypt` into `git-cipher`
Greg Hurrell [Fri, 27 Mar 2015 23:05:36 +0000 (16:05 -0700)] 
Merge `decrypt` into `git-cipher`

It started to get complicated to do this in a piecemeal way, so here it
all is at once. Will follow-up with subsequent cleanups.

8 years agoTeach command_name to be context aware
Greg Hurrell [Fri, 27 Mar 2015 16:34:49 +0000 (09:34 -0700)] 
Teach command_name to be context aware

Identify self as `git cipher` when run as a Git subcommand, or
`git-cipher` otherwise. Maybe a bit flakey and platform-dependent, based
on the use of `ps`, which is why I'm using `rescue` here.

8 years agoUpdate internal references from `encrypt` to `git cipher encrypt`
Greg Hurrell [Fri, 27 Mar 2015 16:09:22 +0000 (09:09 -0700)] 
Update internal references from `encrypt` to `git cipher encrypt`

8 years agoInline the contents of `bin_utils.rb` in `git-cipher`
Greg Hurrell [Fri, 27 Mar 2015 16:01:36 +0000 (09:01 -0700)] 
Inline the contents of `bin_utils.rb` in `git-cipher`

8 years agoRename `encrypt` to `git-cipher`
Greg Hurrell [Fri, 27 Mar 2015 15:59:59 +0000 (08:59 -0700)] 
Rename `encrypt` to `git-cipher`

This is the first step in the process of merging `encrypt` and `decrypt`
into a single command with subcommands. The docs and pretty much
everything else will need to be updated, but I'm going to do this in
small steps to make the changes legible in the commit history

8 years agoInitial import from ansible-configs repo
Greg Hurrell [Fri, 27 Mar 2015 15:54:21 +0000 (08:54 -0700)] 
Initial import from ansible-configs repo