README
¶
gfbank
This tool manages on-disk "vaults" of secrets that require n
of m
SSH RSA
keys for decryption. This technique uses Shamir secret sharing via libgfshare.
When a vault is created, a secret file is encrypted with a new key, and then the key is n of m Shamir secret shared to keys that are themselves encrypted to the public ends of SSH RSA keys, and then all of this vault information is stored on disk.
To decrypt the vault, gfbank will start a network server which the other n-1
key holders can use their SSH private keys to connect to. Once n
users are
connected (including the server starter), the vault will be decrypted and the
secret restored.
Key generation
Note that this tool requires RSA SSH keys. You can generate a usable key in the format this tool will understand by running:
ssh-keygen -t rsa -m pem -f output-key
Requirements
libgfshare-bin (for gfcombine/gfsplit)
Usage
Usage: gfbank [OPTIONS] COMMAND [arg...]
The Grand French Bank
Options:
--dir bank directory (default "./")
--debug debug logging
--identity private key identity (default "default")
Commands:
pubkey public key commands
vault vault commands
Run 'gfbank COMMAND --help' for more information on a command.
Usage: gfbank pubkey COMMAND [arg...]
public key commands
Commands:
list list all public keys
revoke revoke public key
unrevoke unrevoke public key
import import a public key
Run 'gfbank pubkey COMMAND --help' for more information on a command.
Usage: gfbank vault COMMAND [arg...]
vault commands
Commands:
list list vaults
create create vault
open open vault
collude collude to open vault
audit audit vaults
Run 'gfbank vault COMMAND --help' for more information on a command.
LICENSE
See LICENSE file for details.
Documentation
¶
Index ¶
- Constants
- Variables
- func CheckDeps() error
- func CombineBytes(shares []Share) (data []byte, err error)
- func CombineString(shares []Share) (data string, err error)
- func DecryptBytes(in, key, nonce []byte) (out []byte, err error)
- func EncryptBytes(in []byte) (out, key, nonce []byte, err error)
- func HostVaultOpen(identity *Identity, vault *Vault, proxy ListenProxy, status OpenStatus) (data []byte, err error)
- func JoinVaultOpen(identity *Identity, vault *Vault, host, host_keyid string, proxy DialProxy) (err error)
- type AuditStatus
- type Bank
- func (b *Bank) AuditAllVaults() ([]VaultAudit, error)
- func (b *Bank) AuditVaults(names []string) (audits []VaultAudit, err error)
- func (b *Bank) AuditVaultsWithKeyId(keyid string) (audits []VaultAudit, err error)
- func (b *Bank) CreateVault(src string, pubkeys []string, n, m int) (vault *Vault, err error)
- func (b *Bank) HostVaultOpen(name string, out string, status OpenStatus) (err error)
- func (b *Bank) ImportPublicKey(path string) (*PublicKey, error)
- func (b *Bank) JoinVaultOpen(name, host, host_keyid string) (err error)
- func (b *Bank) ListVaults() (names []string, err error)
- func (b *Bank) LoadPublicKeys() (keys []PublicKey, err error)
- func (b *Bank) RevokePublicKey(name string) (*PublicKey, error)
- func (b *Bank) UnrevokePublicKey(name string) (*PublicKey, error)
- type DialProxy
- type EncryptedShare
- type Identities
- type Identity
- type KeyIds
- type ListenProxy
- type OpenStatus
- type PassphraseFunc
- type Proxy
- type PublicKey
- type PublicKeys
- func (ks *PublicKeys) Import(path string) (key *PublicKey, err error)
- func (ks *PublicKeys) Load(name string) (key *PublicKey, err error)
- func (ks *PublicKeys) LoadAll() (out []PublicKey, err error)
- func (ks *PublicKeys) LoadN(names []string) (out []PublicKey, err error)
- func (ks *PublicKeys) Revoke(name string) (*PublicKey, error)
- func (ks *PublicKeys) Unrevoke(name string) (*PublicKey, error)
- type Share
- type ShareAudit
- type Vault
- type VaultAudit
- type Vaults
Constants ¶
const DefaultIdentityName = "default"
Variables ¶
var (
Error = errors.NewClass("error")
)
Functions ¶
func CombineBytes ¶
func CombineString ¶
func DecryptBytes ¶
func EncryptBytes ¶
func HostVaultOpen ¶
func HostVaultOpen(identity *Identity, vault *Vault, proxy ListenProxy, status OpenStatus) (data []byte, err error)
Types ¶
type Bank ¶
type Bank struct {
// contains filtered or unexported fields
}
func NewBank ¶
func NewBank(dir, identity string, proxy Proxy, fn PassphraseFunc) ( b *Bank, err error)
func (*Bank) AuditAllVaults ¶
func (b *Bank) AuditAllVaults() ([]VaultAudit, error)
func (*Bank) AuditVaults ¶
func (b *Bank) AuditVaults(names []string) (audits []VaultAudit, err error)
func (*Bank) AuditVaultsWithKeyId ¶
func (b *Bank) AuditVaultsWithKeyId(keyid string) (audits []VaultAudit, err error)
func (*Bank) CreateVault ¶
func (*Bank) HostVaultOpen ¶
func (b *Bank) HostVaultOpen(name string, out string, status OpenStatus) ( err error)
func (*Bank) JoinVaultOpen ¶
func (*Bank) ListVaults ¶
func (*Bank) LoadPublicKeys ¶
type EncryptedShare ¶
type EncryptedShare struct {}
type Identities ¶
type Identities struct {
// contains filtered or unexported fields
}
func NewIdentities ¶
func NewIdentities(dir string, fn PassphraseFunc) (*Identities, error)
type Identity ¶
type Identity struct { Name string Id string Key *rsa.PrivateKey }
func LoadIdentity ¶
func LoadIdentity(path string, fn PassphraseFunc) (key *Identity, err error)
func (*Identity) DecryptShare ¶
func (id *Identity) DecryptShare(encrypted_share *EncryptedShare) ( *Share, error)
type ListenProxy ¶
type OpenStatus ¶
type PassphraseFunc ¶
type Proxy ¶
type Proxy interface { ListenProxy DialProxy }
type PublicKey ¶
func LoadPublicKey ¶
func (*PublicKey) EncryptShare ¶
func (k *PublicKey) EncryptShare(share Share) (*EncryptedShare, error)
type PublicKeys ¶
type PublicKeys struct {
// contains filtered or unexported fields
}
func NewPublicKeys ¶
func NewPublicKeys(dir string) (*PublicKeys, error)
func (*PublicKeys) LoadAll ¶
func (ks *PublicKeys) LoadAll() (out []PublicKey, err error)
type ShareAudit ¶
type ShareAudit struct {}
type Vault ¶
type Vault struct { Name string `json:"-"` Nonce string `json:"nonce"` Needed int `json:"needed"` Data string `json:"data"` }
func CreateVault ¶
func (*Vault) Audit ¶
func (v *Vault) Audit(keyids *KeyIds) VaultAudit
func (*Vault) Identities ¶
func (*Vault) LookupKeyId ¶
func (v *Vault) LookupKeyId(keyid string) *EncryptedShare
type VaultAudit ¶
func (*VaultAudit) Safe ¶
func (va *VaultAudit) Safe() (n int)
func (*VaultAudit) Status ¶
func (va *VaultAudit) Status() AuditStatus