Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for API keys #328

Merged
merged 1 commit into from
Feb 11, 2023
Merged

add support for API keys #328

merged 1 commit into from
Feb 11, 2023

Conversation

aead
Copy link
Member

@aead aead commented Feb 9, 2023

This commit adds API keys as secret-based
authentication mechanism.

An API key has the following format:

kes:v1:base64-encode(<key-type> | <key-bytes>)

key-type:  1 byte key algorithm identifier
key-bytes: value of the secret key

An example API key looks like this:

kes:v1:ACQpoGqx3rHHjT938Hfu5hVVQJHZWSqVI2Xp1KlYxFVw

Like TLS certificates, an API has a corresponding
identity. The identity of the example API key
above is:

0426fa9a04bc2756b92fbe8a97e1a1e07b53ecf04ed33da22c33e5c9faeb8cbb

Now, the kes identity new and kes identity of, by default, generate an API key resp. compute the identity from an API key.


Under the hood, an API key deterministically generates a private/public key pair - from which a CA-signed / self-signed certificate can be generated.

However, with API keys it is possible to generate
a TLS certificate, e.g. for mTLS authentication, on the fly from a single secret value.

Hence, API keys still boil down to private/public
key / TLS-based authentication. However, the simply key management when certificates don't need to be
signed by a publicly trusted CA but instead are used for internal machine-to-machine communication.

In particular, a client requires just the API key
while the server just requires the corresponding identity. Furthermore, the server does not hold any secret
(identities aren't secret information). So, we don't have to worry about compromise of API keys from the server-side.

@aead aead added the release-notes This PR or issue should be mentioned in the next release notes label Feb 9, 2023
@aead aead force-pushed the api-key branch 2 times, most recently from 13cf5fd to d9c7633 Compare February 9, 2023 11:12
@aead
Copy link
Member Author

aead commented Feb 10, 2023

The API key of the current root.key and root.cert files is:

kes:v1:AD9E7FSYWrMD+VjhI6q545cYT9YOyFxZb7UnjEepYDRc

Verify:

kes identity of kes:v1:AD9E7FSYWrMD+VjhI6q545cYT9YOyFxZb7UnjEepYDRc

kes identity of root.cert

@aead aead force-pushed the api-key branch 3 times, most recently from 63c175a to 61b3a43 Compare February 10, 2023 11:39
Copy link
Contributor

@klauspost klauspost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Just some minor stuff.

This commit adds API keys as secret-based
authentication mechanism.

An API key has the following format:
```
kes:v1:base64-encode(<key-type> | <key-bytes>)

key-type:  1 byte key algorithm identifier
key-bytes: value of the secret key
```

An example API key looks like this:
```
kes:v1:ACQpoGqx3rHHjT938Hfu5hVVQJHZWSqVI2Xp1KlYxFVw
```

Like TLS certificates, an API has a corresponding
identity. The identity of the example API key
above is:
```
0426fa9a04bc2756b92fbe8a97e1a1e07b53ecf04ed33da22c33e5c9faeb8cbb
```

Now, the `kes identity new` and `kes identity of`, by default,
generate an API key resp. compute the identity from an API key.

***

Under the hood, an API key deterministically generates
a private/public key pair - from which a CA-signed / self-signed
certificate can be generated.

However, with API keys it is possible to generate
a TLS certificate, e.g. for mTLS authentication, on
the fly from a single secret value.

Hence, API keys still boil down to private/public
key / TLS-based authentication. However, the simply
key management when certificates don't need to be
signed by a publicly trusted CA but instead are used
for internal machine-to-machine communication.

In particular, a client requires just the API key
while the server just requires the corresponding identity.
Furthermore, the server does not hold any secret
(identities aren't secret information). So, we don't
have to worry about compromise of API keys from the
server-side.

Signed-off-by: Andreas Auernhammer <[email protected]>
Co-authored-by: Klaus Post <[email protected]>
Signed-off-by: Andreas Auernhammer <[email protected]>
Copy link
Contributor

@klauspost klauspost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aead aead merged commit 9bd31a4 into master Feb 11, 2023
@aead aead deleted the api-key branch February 11, 2023 12:20
aead added a commit to minio/minio that referenced this pull request Feb 14, 2023
This commit adds support for KES API keys.
A detailed explanation of API keys can be
found here:
minio/kes#328

This commit introduces a new env. var.
```
MINIO_KMS_KES_API_KEY
```
Either an explicit client certificate or an
API key can be set.

Further, this commit replaces the `github.com/minio/kes`
dependency with `github.com/minio/kes-go` containing
the new offical KES SDK for Go.

Signed-off-by: Andreas Auernhammer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes This PR or issue should be mentioned in the next release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants