-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The default behaviour of tangd is to reply correctly to all key recovery requests. In some deployments it may be needed to control when a key recovery should be allowed or not. This patch extends the tangd server with a very simple authorization method. When tangd is started with a second argument, this need to point at a directory to be used for authorizations. When a key recovery request occurs, the tangd server will check if this directory contains the filename of the client key fingerprint (thp/kid). If a file (which can be empty) exists with the name of a client fingerprint, the request is authorized and the decryption can be performed successfully. Signed-off-by: David Sommerseth <[email protected]>
- Loading branch information
Showing
2 changed files
with
118 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,6 +135,60 @@ of the database directory to all your servers. Make sure you don't forget the | |
unadvertised keys! Then set up DNS round-robin so that clients will be load | ||
balanced across your servers. | ||
|
||
== AUTHORIZATION CONTROL | ||
|
||
By default, tang will respond to any recovery requests. This can be | ||
controlled on a per client key by adding a second argument to the *tang* | ||
command line. This argument need to be a path to an existing directory. | ||
This directory should be empty on first setup; this directory is called | ||
the 'authorization directory'. | ||
|
||
The concept is that an empty file named by the fingerprint of the client | ||
key needs to be present in the authorization directory to allow a | ||
decryption operation to happen. If this file is missing, the request | ||
will be denied. | ||
|
||
An example: | ||
|
||
1. Configure tangd to use */var/db/tang/auth* as the authentication | ||
directory. | ||
|
||
ifdef::freebsd[] | ||
# TODO | ||
endif::[] | ||
ifndef::freebsd[] | ||
Edit the *ExecStart=* line in the *[email protected]* unit file by | ||
extending it with */var/db/tang/auth*. Like this: | ||
|
||
ExecStart=/usr/libexec/tangd /var/db/tang /var/db/tang/authorized | ||
endif::[] | ||
|
||
2. Encrypt some data: | ||
|
||
$ echo "One of my secrets" | clevis encrypt tang '{"url":"http://localhost"}' > enc.jwe | ||
|
||
3. Decrypting this will now fail: | ||
|
||
$ clevis decrypt < enc.jwe | ||
Error communicating with the server http://127.0.0.1 | ||
|
||
4. Extract the client fingerprint (*kid*) value from *enc.jwe*: | ||
|
||
$ cut -d. -f1 t2.jwe | jose b64 dec -i - | jose fmt -j- -Og kid -Su- | ||
EyIEfKd-_3UFMI5PSAp64UAAKeQ | ||
|
||
5. Authorize this client fingerprint to be used; on the tang server run this: | ||
|
||
# touch /var/db/tang/authorized/EyIEfKd-_3UFMI5PSAp64UAAKeQ | ||
|
||
6. Decrypting this will now works: | ||
|
||
$ clevis decrypt < enc.jwe | ||
One of my secrets | ||
|
||
If the client fingerprint file in the authorization directory is removed on the | ||
server, decryption is not possible. | ||
|
||
== COMMANDS | ||
|
||
The Tang server provides no public commands. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters