46 Commits

Author SHA1 Message Date
Mahrud Sayrafi
e6481c0513 Fixing rebase of andrewbuss/decrypt_sign
Also switched testdata/ssh_key with an ssh-ed25519 key
2018-03-12 12:39:32 -07:00
Andrew Buss
9a49b3a39e Rebasing fixups 2018-03-12 12:39:32 -07:00
Andrew Buss
186092a44e Renamed DecryptSign -> SSHSignWith, added tests for SSHSignWith and Usages 2018-03-12 12:39:32 -07:00
Andrew Buss
4571399c6f Include Usages field when computing HMAC 2018-03-12 12:39:32 -07:00
Andrew Buss
9035eed8fd Add SSH wrapper to RO client
Add Usages field to EncryptedData to allow creation of a file which
can only be used to create signatures and cannot be directly decrypted
2018-03-12 12:39:32 -07:00
Zi Lin
43ffe45e72 GetOwners returns labels on the encryption too 2017-01-04 12:24:58 -08:00
Kyle Isom
29dd3b2411 Fix the concurrent map write error. (#177)
+ Add a lock to the keycache.
+ Ensure that all instantiations of keycaches use New, rather
  than the old keycache.Cache{make()} construct. This no longer
  works with the lock in place.
+ Update travis to run the race detector on a few specific packages
  that should help identify this type of problem in the future.
2016-12-06 15:41:18 -08:00
Gábor Lipták
6b9fad5e9d Cleanup Go Report Card warnings 2016-11-09 17:21:39 -05:00
Zi Lin
78e9720635 Zi/disable dead loop retry (#175)
* disable endless retry logic

- we should do the retry logic at application cmd/ro, cmd/ro will need to
  deal with keyboard interrupts as well

* update test self-signed certificate with a expiry of 100 years

* ro tool supports retries after getting delegation errors
2016-10-17 15:19:30 -07:00
Brendan McMillion
7050c7c6aa Fix typo. 2016-09-18 20:01:13 -07:00
Kyle Isom
9f39413adb Properly restore delegations.
This change addresses several points:

1. The integration tests didn't verify that delegations could be used
   for decryption following a restore. The integration tests now
   verify this.

2. There was no functionality for clearing persisted delegations if
   needed. The vault admin can now do this via the command line tool.

3. Restoring active delegations wasn't storing the key with the
   delegation. Keys are now serialised properly.

4. [Minor] The MSP package now reports the name of the offending user
   when it can't find a user name in the database.
2016-08-24 13:22:13 -07:00
Kyle Isom
4da501264a Add CLI support for restore endpoint.
+ Add the relevant parts to the command line tool and the client
  package.
+ Small improvements to cryptor's restore function:
  + Don't try to restore if the store is already active.
  + Flush the persistence key cache once the restoration occurs.
+ The redoctober program now explicitly mentions that a config file is
  invalid when that's the case.
2016-08-16 15:12:14 -07:00
Kyle Isom
5a8e70047a Add a restore endpoint to Red October core. (#167)
This takes the work done in 7c95007cda and
provides an interface via the server's API.
2016-08-12 09:09:56 -07:00
Kyle Isom
5396cdc899 Address @jkroll-cf's feedback on keycache interface.
+ persistLabels moved from cryptor to persist package global.
+ Restore now explicitly checks for the case where there aren't enough
  shares to return `ErrRestoreDelegations`.
+ The users responsible for restoring the cache are now logged.
2016-08-05 15:23:10 -07:00
Kyle Isom
510b7ba9f6 Implementation of a file-backed persistence store. (#160)
This is a rather large change. It consists of the following changes:

+ Direct access to the keycache has been removed from the core
  package. This forces all interaction with the cache to go
  through the Cryptor, which is required for persistence. The
  Cryptor needs to know when the cache has changed, and the only
  way to do this effectively is to make the Cryptor responsible
  for managing the keycache.

+ A new persist package has been added. This provides a Store
  interface, for which two implementations are provided. The
  first is a null persister: this is used when no persistence
  is configured. The second is a file-backed persistence store.

+ The Cryptor now persists the cache every time it changes.

Additionally, a number of missing returns in a function in the core
package have been added.
2016-08-04 17:12:08 -07:00
Zi Lin
7a806308d3 Access structure should be invalide when Minimum == 0 with non-nil Names 2016-02-19 10:17:45 -08:00
Nick Sullivan
cac6da28c4 Merge pull request #106 from ejcx/ordermsp
Add hipchat and ordering support to redoctober
2016-01-29 15:57:16 -08:00
e
95940ed3fa Add hipchat and ordering support to redoctober. Also fix XSS in RO
Supports MSP and requires several arguments to add hipchat integration to
red october. RedOctober will then alert on creation of an order, any new
delegation, or several other states.
2016-01-12 11:21:47 -08:00
Brendan Mc
e8f30ae4a1 Don't cast to cryptor.UserDatabase to msp.UserDatabase. 2015-12-13 20:16:06 -08:00
Andrew Buss
24fc3bb7d8 Fix "invalid key size 0" when decrypting after a delegation expires
The keycache does not remove active delegations when uses drops to zero;
rather it only removes these when Refresh is called.

So Valid returns true even if the user's delegation has expired,
so fullMatch is not set to false in unwrapKey,
so DecryptKey fails since the keycache refreshes and finds the delegation has expired,
so tmpKeyValue is left empty and decryptErr is set.

Since decryptErr is only used to break out of the inner loop, and
fullMatch wasn't set to false, no error is returned from unwrapKey.
So aesKey in DecryptKey is an empty string, causing an error when
passed to aes.NewCipher.

This commit actively removes a delegation from the keycache when it
is used for the last time, and properly handles errors thrown by
DecryptKey in unwrapKey.
2015-12-04 02:15:53 -08:00
Andrew Buss
13f6616e60 Allow encryption with a single owner
The "minimum" parameter was ignored, so when a single user
was provided as an owner, the encrypted data had no KeySet value
and could not be decrypted.

This change fixes the API and cryptor to pay attention to the Minimum
parameter and handle the case where Minimum is 1
2015-11-30 03:07:07 -08:00
Brendan McMillion
7e56983fa6 Move field and matrix logic into their own files and abstractions.
- Instead of using GF(2^127-1) as one of many options, move to GF(2^128) exclusively.
- Don't clear the first two bits of every secret key.
2015-11-21 09:23:55 -08:00
Brendan McMillion
07b99b15f3 Update comments. 2015-11-20 10:22:59 -08:00
Brendan McMillion
61540eca4e Bug fixes from code audit.
- Catch ignored error.
- Make sure that key data exists in the EncryptedData object as well as in the key cache.
2015-11-13 16:21:30 -08:00
Brendan McMillion
2422b2920d Update owners API and README with predicates. 2015-11-11 15:23:14 -08:00
Brendan McMillion
d93709973e Track delegates when decrypting with shares. 2015-11-11 15:22:33 -08:00
Brendan McMillion
9e514e902a Shorten key by 2 bits. 2015-11-11 15:21:49 -08:00
Brendan McMillion
e652300f43 Vendored in Bren2010/MSP 2015-11-11 15:20:46 -08:00
Brendan Mc
becabb40e9 Integration with Bren2010/MSP 2015-11-11 15:20:17 -08:00
ejcx
c9a381d5c2 Multiple delegations to redoctober
The idea is to create a new type (to avoid ugly string parsing) and
then, instead of iterating through delegations with the username, iterate
through the delegations and look for your username and matching slot. Also
in cases we don't have the slot (everything but delegation), find the slot
when we match a user.
2015-11-11 08:26:26 -08:00
Alessandro Ghedini
4183569465 Add support for listing required delegations for an encrypted secret
This patch adds the /owners API endpoint that returns the list of users
that "own" the given secret. These are the users that can delegate their
passwords for decrypting the secret.

It also adds the "Get Owners" form in the web UI that uses the new API.

Fixes #62
2015-06-17 11:07:26 +02:00
Brendan Mc
fcf9b125d0 Fixed left & right owner logic. Closes issue #63. 2015-06-11 21:19:04 -07:00
Nick Sullivan
244288a4d3 Check for full set of keys before using delegation. 2015-05-19 17:20:26 -07:00
Brendan Mc
ef80162f14 Style changes 2015-05-07 13:51:00 -07:00
Brendan Mc
935b929dd5 Return to idiomatic style & Backwards compatible left&right owners 2015-05-04 19:05:19 -07:00
Brendan Mc
7e08548caf Patched HMAC vulnerability. 2015-05-01 16:46:57 -07:00
Brendan Mc
e61103147c Minimized global state and made user type an option. 2015-05-01 16:10:55 -07:00
Brendan Mc
c3c0e2182b Removed AES user type and reformatted more code. 2015-04-28 16:24:58 -07:00
Nick Sullivan
8e910c2035 Changes to delegation model
- decryption can happen by non-admins
- encrypted files can be given labels
- delegation can limit decryption to specific users and labels
2015-04-09 17:15:44 -07:00
Nick Sullivan
8c21db7ba4 Add support for left/right groups
LeftOwners and RightOwners can now be used as either disjoint
or overlapping sets of users for encrypting a message. Default
behavior is to set them to Owners given a non-empty Owners set.

One member from each group are required to decrypt the message.
2015-02-09 18:51:33 -08:00
Kyle Isom
91cd67f267 Decrypt returns the list of users used for delegation
When decrypting a chunk of data, red october will now report the users
whose keys were used in the decryption.
2014-09-14 19:13:37 -07:00
Kyle
1916f385ed Move {En,De}cryptCBC and MakeRandom to symcrypt.
The symcrypt package now contains common secret-key code that is
redefined in a number of packages.
2014-01-10 03:58:43 -07:00
Kyle
db0b10e671 Add ECC support to cryptor.
There are a few changes made here:
  * Comments have been updated to reflect the presence of ECC records.
  * Variables named rsa* have been renamed pub* to reflect the general
    use of public key cryptography, instead of RSA specifically.
  * An if statement for RSA keys now handles both RSA and ECC keys.
2014-01-09 19:20:06 -07:00
Nick Sullivan
8cc69edefe Fix passvault on 32-bit systems
The passvault's id is created with math.rand as a native int.
If the vault is created on a 64-bit system, it breaks compatibility
with 32-bit systems.

- Generate vaults with 32-bit ids.
- Update testcode
2013-11-27 10:55:24 -08:00
Nick Sullivan
669d7279c2 Make testcode play nice with go vet 2013-11-26 12:15:37 -08:00
Albert Strasheim
9c5d08f665 Make repository work with go get 2013-11-21 12:01:25 -08:00