2020-04-24 08:55:38 +02:00
|
|
|
# secret
|
|
|
|
|
2020-05-02 18:41:29 +02:00
|
|
|
Keep your little secrets.
|
|
|
|
|
|
|
|
## Compatibility
|
|
|
|
|
|
|
|
`secret` should work on a wide variety of architectures and POSIX systems.
|
|
|
|
It was successfully tested on Linux, OpenBSD, FreeBSD and MacOS.
|
2020-04-24 08:55:38 +02:00
|
|
|
|
|
|
|
## Features
|
|
|
|
|
2020-04-25 13:40:13 +02:00
|
|
|
`secret` is the simplest secret store you can think of:
|
|
|
|
|
|
|
|
- Requires only one file `~/.secret` that you can share publicly without fear.
|
|
|
|
- No configuration. Get back your file and you're done.
|
2020-05-02 18:41:29 +02:00
|
|
|
- Secret names (usually hostname, mail, login, etc.) are also encrypted.
|
|
|
|
- A secret agent that only trusts subprocesses. Not all the processes of the same user!
|
|
|
|
- Secret names completion (on bash only) once the agent is activated.
|
|
|
|
- Supports unstored secrets. Derived from some simple keys and a passphrase.
|
2020-04-25 13:40:13 +02:00
|
|
|
- Supports multiple passphrases. Not super user-friendly but nice to have.
|
2020-04-24 08:55:38 +02:00
|
|
|
- Depends only on the [libhydrogen](https://libhydrogen.org/) library.
|
2020-04-25 13:40:13 +02:00
|
|
|
- Small, simple and non obfuscated C code. Well, I hope so :)
|
2020-04-24 08:55:38 +02:00
|
|
|
|
|
|
|
## Build and install
|
|
|
|
|
2020-04-26 00:19:08 +02:00
|
|
|
Clone the repository recursively:
|
|
|
|
|
2020-04-25 13:40:13 +02:00
|
|
|
$ git clone https://github.com/angt/secret --recursive
|
|
|
|
$ cd secret
|
|
|
|
|
2020-04-26 00:19:08 +02:00
|
|
|
Then, run as `root`:
|
|
|
|
|
|
|
|
# make install
|
2020-04-25 13:40:13 +02:00
|
|
|
|
2020-04-26 00:19:08 +02:00
|
|
|
As usual, you can customize the destination with `DESTDIR` and `prefix`.
|
2020-04-24 08:55:38 +02:00
|
|
|
|
2020-04-25 13:40:13 +02:00
|
|
|
Currently, bash completion is not installed.
|
|
|
|
Download the file [argz.sh](argz/argz.sh) then:
|
2020-04-24 09:05:00 +02:00
|
|
|
|
2020-04-25 13:40:13 +02:00
|
|
|
$ . argz.sh
|
2020-04-24 09:05:00 +02:00
|
|
|
$ complete -F _argz secret
|
|
|
|
|
2020-04-25 13:40:13 +02:00
|
|
|
Completion for secrets is only available in a trusted shell. See below.
|
|
|
|
|
2020-04-24 08:55:38 +02:00
|
|
|
## Commands
|
|
|
|
|
2020-04-27 22:58:13 +02:00
|
|
|
Available commands:
|
2020-04-24 08:55:38 +02:00
|
|
|
|
2020-04-28 13:41:17 +02:00
|
|
|
init Initialize secret for the current user
|
2020-04-27 22:58:13 +02:00
|
|
|
list List all secrets for a given passphrase
|
|
|
|
show Print a secret
|
|
|
|
new Generate a new secret
|
|
|
|
set Set a new secret
|
|
|
|
renew Regenerate an existing secret
|
|
|
|
reset Update an existing secret
|
2020-04-29 13:18:55 +02:00
|
|
|
pass Derivate a new secret
|
2020-04-27 22:58:13 +02:00
|
|
|
agent Run a process in a trusted zone
|
|
|
|
version Show version
|
|
|
|
|
|
|
|
All secrets are encrypted in the file `~/.secret`.
|
|
|
|
You can use a different file with the `SECRET_STORE` environment variable:
|
2020-04-26 10:30:22 +02:00
|
|
|
|
|
|
|
$ env SECRET_STORE=<FILE> secret ...
|
|
|
|
|
2020-04-24 08:55:38 +02:00
|
|
|
## Examples
|
|
|
|
|
2020-04-25 13:40:13 +02:00
|
|
|
Initialize secret for the current user:
|
2020-04-24 08:55:38 +02:00
|
|
|
|
|
|
|
$ secret init
|
|
|
|
|
2020-04-26 10:30:22 +02:00
|
|
|
Add a new randomly generated secret:
|
2020-04-24 08:55:38 +02:00
|
|
|
|
2020-04-27 22:58:13 +02:00
|
|
|
$ secret new test
|
2020-04-26 22:44:54 +02:00
|
|
|
Passphrase:
|
2020-04-29 13:18:55 +02:00
|
|
|
^>f.8%]_zoN^jSi0CO_{(yYY5
|
2020-04-24 08:55:38 +02:00
|
|
|
|
2020-04-25 13:40:13 +02:00
|
|
|
Show the secret:
|
2020-04-24 08:55:38 +02:00
|
|
|
|
|
|
|
$ secret show test
|
2020-04-26 22:44:54 +02:00
|
|
|
Passphrase:
|
2020-04-29 13:18:55 +02:00
|
|
|
^>f.8%]_zoN^jSi0CO_{(yYY5
|
|
|
|
|
|
|
|
Derive a deterministic (a.k.a. unstored) secret:
|
|
|
|
|
|
|
|
$ secret pass me@domain.com
|
|
|
|
Passphrase:
|
|
|
|
a`4$B2mJ=|"HD?b4:/y"?wOaQ
|
2020-04-24 08:55:38 +02:00
|
|
|
|
2020-04-29 14:50:59 +02:00
|
|
|
Subkeys are also supported, this allows to update your secret in a clean way:
|
|
|
|
|
|
|
|
$ secret pass me@domain.com 2020
|
|
|
|
Passphrase:
|
|
|
|
F"1j;-X]t.Pi>.xf5hG,]dUMz
|
|
|
|
|
2020-04-28 18:18:33 +02:00
|
|
|
Storing binary secrets is supported:
|
|
|
|
|
|
|
|
$ dd if=/dev/urandom bs=1 count=32 bs=1 2>/dev/null | secret set mykey
|
|
|
|
Passphrase:
|
|
|
|
|
|
|
|
Then, use a pipe to get it:
|
|
|
|
|
|
|
|
$ secret show mykey | xxd
|
|
|
|
Passphrase:
|
|
|
|
00000000: 0ee9 cdb3 de0a 3e71 b623 726d 5d7e eb23 ......>q.#rm]~.#
|
|
|
|
00000010: 5b43 a458 3fb7 3b96 ea9b 6e47 d302 cae7 [C.X?.;...nG....
|
|
|
|
|
2020-04-27 11:48:50 +02:00
|
|
|
Start a trusted zone:
|
2020-04-24 08:55:38 +02:00
|
|
|
|
2020-04-27 11:48:50 +02:00
|
|
|
$ secret agent
|
2020-04-26 22:44:54 +02:00
|
|
|
Passphrase:
|
2020-04-24 08:55:38 +02:00
|
|
|
|
2020-04-26 10:30:22 +02:00
|
|
|
Now, the passphrase is not requested and completion fully works!
|
2020-04-25 13:40:13 +02:00
|
|
|
|
2020-04-27 11:48:50 +02:00
|
|
|
If you don't use `bash` but still want completion,
|
|
|
|
run `secret agent bash` or (much better) send a PR to add support for your shiny shell :)
|
|
|
|
|
2020-04-25 13:40:13 +02:00
|
|
|
---
|
|
|
|
For feature requests and bug reports,
|
|
|
|
please create an [issue](https://github.com/angt/secret/issues).
|