Commit Graph

175 Commits

Author SHA1 Message Date
Stephan Renatus 2b7df1c402 plugins/logs: allow for using service AND custom plugin (#4039)
Now any subset of service, plugin, console logger should be usable.

Fixes #4013.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2021-11-19 10:22:57 +01:00
David Lu 41fe76862b Add Azure HTTP auth plugin
This commit adds an HTTP auth plugin that fetches bearer access tokens using managed identities for Azure resources. This plugin will complement the existing AWS and GCP auth plugins.

Signed-off-by: David Lu <david.scowluga@gmail.com>
2021-11-08 19:14:02 +01:00
Ashutosh Narkar 4a48b65d7b Add an adaptive limit for the upload chunk size
This commit adds a chunk adaptive limit that acts as a
measure for encoding as many decisions into each chunk as possible.
This change should help fill-up the chunks close to their allowed
limit and thereby help reduce netwrok and memory resources.

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2021-11-03 09:54:59 -07:00
Torin Sandall 679c3de78b runtime: Enable print calls
This commit enables print() calls inside of the server for INFO and
DEBUG log levels. The print hook is plumbed through to the server via
the manager so that other server implementations (e.g., the Envoy
plugin) can be updated similarly.

The server will compile print() calls for the /v1/query API but not
others since (i) print() calls inside the policies will already have
been compiled and (ii) the queries are limited to fetching `data`
paths and therefore cannot contain print() calls themselves. The
bundle plugin has been updated to compile print() calls as well--this
way the bundle plugin/server will respect incoming bundles and not
attempt to override them.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2021-10-14 09:31:16 -07:00
Torin Sandall e9d04fc1f5 runtime: Refactor logger usage
This commit does not change any functionality except it provides
callers with a way to provide a logger when instantiating the
runtime. Previously, the runtime had hardcoded dependencies on the
global logrus logger which made it problematic to test logging
behaviour. With this change, the logger can be supplied as a
parameter (which allows the caller to mock out the logger in tests...)

As part of this change, the dependencies on logrus have been moved out
of the runtime package entirely.

This commit includes a breaking change to the
runtime.NewLoggingHandler function: the function now requires a logger
to be supplied.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2021-10-14 09:31:16 -07:00
Ashutosh Narkar ea96db6de6 plugins: Fix default trigger mode in the non-discovery path
When individual plugins (except discovery) were configured, the
default trigger mode was set as periodic. So if the plugin specified
a different mode (eg. manual), the configuration check would incorrectly
fail on account of a mode mismatch. This commit fixes the issue by
updating the trigger mode check to not specify a default mode in
scenarios when only plugins (except discovery) are configured.

Fixes: #3797

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2021-09-23 09:10:17 -07:00
Torin Sandall 0b7a2c38af Add support for manual plugin triggers
This commit introduces the idea of manual triggers to trigger
plugins. Currently plugins such as discovery, bundle, decision log etc.
perform their functions in a timer-based loop. For example, the bundle
plugin periodically checks for new bundles by polling a remote server.

This change adds the ability to trigger a plugin thereby allowing callers
to control when a bundle download happens, when a decision log is
uploaded etc. The periodic mode is still the default for the plugins.

This feature allows callers to trigger individual plugins. Plugins perform
their functions and then report back to the caller when done.

Co-authored-by: Torin Sandall <torinsandall@gmail.com>
Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2021-08-26 09:35:02 -07:00
Rafael Fernández López 581ba9c456 documentation: fix uid and message returned to the Kubernetes apiserver (#3730)
* documentation: always return the `uid` to the Kubernetes apiserver

The Kubernetes API server will reject the answer from any webhook that
does not contain the `uid` present in the request [1]. Failing to do
so will not only result in a warning, but in the answer from the
webhook being ignored, and the request rejected [2].

[1] https://github.com/kubernetes/apiserver/blob/464eee4062a8f21f785e657b32b83f19d693af8d/pkg/admission/plugin/webhook/request/admissionreview.go#L52-L55
[2] https://github.com/kubernetes/apiserver/blob/464eee4062a8f21f785e657b32b83f19d693af8d/pkg/admission/plugin/webhook/validating/dispatcher.go#L236-L239

* documentation: rename `reason` to `message` on certain objects

When the object refers to an `AdmissionReview` from Kubernetes, what
OPA calls the `reason` is the `message` field.

* documentation: create `opa-server` secret in the `opa` namspace

Signed-off-by: Rafael Fernández López <rfernandezlopez@suse.com>
2021-08-20 09:51:19 +02:00
Stephan Renatus e732b0b482 topdown/buitins: io.jwt.encode_sign uses BuiltinContext random source (#3738)
It didn't before, so we had not much control over the entropy that is getting into the signature for ecdsa.

This is useful if you want reproducible outcomes over multiple policy evaluations, such as in testing.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2021-08-19 07:43:16 +02:00
Grant Shively 6369788d31 plugins, runtime: Add visibility for server init
- Plugins can now access a channel which receives a message when the OPA
  server is fully initialized and ready to receive traffic.
- Added ServerInitialized() and ServerInitializedChannel() to plugin
  manager.
- Runtime now calls ServerInitialized() when server listeners are
  initialized.

Fixes #3701

Signed-off-by: Grant Shively <gshively@godaddy.com>
2021-08-12 14:31:56 -07:00
Torin Sandall 8b40acea0a logging: Fix console logger instantiation
This commit fixes the console loggers so that messages are emitted
regardless of the debug log level. The problem was that in 3fcc875 we
updated the plugins to use a console logger obtained from the plugin
manager as opposed to a global logger instantiated in the plugins
package--the console logger obtained from the plugin manager was
instantiated in the runtime package by calling
logging.NewStandardLogger. Unfortunately, logging.NewStandardLogger
does not create a new logger--it returns the global logrus
logger.

This commit fixes the issue by deprecating logging.NewStandardLogger
and introducing two new functions in the logging package:

* logging.Get() - this replaces the old logging.NewStandardLogger
  function--this function should be called to obtain the debug logger
  used throughout OPA.

* logging.New() - this actually returns a new logger that can be
  configured independently from the debug logger used throughout
  OPA.

The runtime and sdk packages have been updated to call logging.New()
to obtain console loggers and the rest of the codebase has been
updated to call logging.Get() in place of logging.NewStandardLogger().

Fixes #3654

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2021-07-27 09:39:01 -07:00
Casey Buto 452bc8310c plugins: Add new Resource configuration for decision logs (#3657)
As described in #3618, when using a service with a specific path for receiving logs (like a SaaS SIEM) its often the case that the path to the endpoint is static and cannot be changed.
This change allows setting the entire path to be used when sending decision logs via the decision_logs.resource field, unlike the partition name configuration which appends the path as /log/<partition>. Partition name has been deprecated and its recommended to use resource instead but if partition name is set, it will take precendence over resource.

Fixes #3618

Signed-off-by: Casey Buto <cbuto22@gmail.com>
2021-07-21 20:40:26 +02:00
Liam Nattrass 00a29c47f2 Use POST for AWS STS tokens to prevent leak
This will prevent the token from being leaked in
logs when the request fails.

Signed-off-by: Liam Nattrass <lnattrass@squareup.com>
2021-07-12 13:50:16 -07:00
Ashutosh Narkar 5528361c69 plugins/rest: Add option to specify CA for remote services
This change allows users to specify a certificate for the services
that implement the bundle, status etc. APIs. This cert will be
used to create the root CA pool.

Fixes: #1954

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2021-06-23 08:36:16 -07:00
Ashutosh Narkar 2a6b8a74ca Update downloader's Etag to last successful act value
Earlier the client would reset the etag on the downloader
in case of downloader errors and bundle activation failures.
The drawback of this approach is that OPA could potentially download
the same version of a bundle multiple times thereby unnecessarily
adding to network traffic.

This change resolves the issue by allowing the client to set
the etag on the downloader to the last successful activation
etag value in case of failures.

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2021-06-04 09:40:14 -07:00
Ashutosh Narkar a2a4b5d4bd Persist downloaded bundle bytes to disk
Earlier with bundle persistence enabled, the bundle
plugin would save the bundle object to disk. In
scenarios where the downloaded bundle has multiple
data files, OPA would first read the bundle and merge
data in the bundle under the bundle.Bundle struct's
Data field. Then before persisting the bundle to disk,
the bundle plugin would use the bundle writer to write
the bundle to the provided output stream. The result
of this is that all the data files in the original
bundle are consolidated into one data.json file.

Now if signature verification is enabled, it will fail
since the files includes in the bundle's signature will not
match the ones in the persisted bundle.

This commit resolves this issue by persiting the bytes
of downloaded bundle to disk which then loaded
from disk maintain the same structure as the original.

Fixes: #3472

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2021-05-26 13:00:20 -07:00
Andrew Banchich f455066cb0 Change log level
Signed-off-by: Andrew Banchich <andrewbanchich@protonmail.ch>

Reword log message

Signed-off-by: Andrew Banchich <andrewbanchich@protonmail.ch>
2021-05-26 18:47:40 +02:00
Ashutosh Narkar b7078b2e19 Fix OPA deadlock while stopping bundle plugin
This commit fixes couple of issues that could result
in blocking OPA:

1) When the bundle plugin attempts to stop the bundle
downloader, it first grabs the lock on the plugin and then
stops the downloader. The downloader in-turn calls the plugin’s
callback function which now waits for the lock to be released
by the plugin's stop function. This results in a deadlock.

This commit fixes this issue by making sure the plugin's stop
function releases the lock before stopping the downloader.

2) Another issue that could block OPA is when the stop function
on the same downloader gets called multiple times.

Fixes: #3363

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2021-05-21 11:29:46 -07:00
Will Beason 3be1d08b87 Change check-lint to use golangci-lint (#3465)
golint is deprecated. The author of the code no longer supports the
codebase. golangci-lint is faster than golint, and is in use by other
opa repositories (e.g. Gatekeeper).

This commit changes tools.go to reference golangci (so it ends up in
vendor) and modifies check-lint to use golangci instead.

Breaking API Changes:

- plugins/rest/rest.go: Fix typo "AllowInsureTLS" -> "AllowInsecureTLS"
- storage/errors.go: Removed unused IndexingNotSupportedErr

Signed-off-by: Will Beason <willbeason@google.com>
2021-05-19 07:52:02 +02:00
Stephan Renatus a6698f7840 plugins/discovery: fix race in test (#3467)
This one wasn't detected reliably, it sometimes appeared and
sometimes did not. Running the test in a loop in a low-resource
docker container make it come out.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2021-05-17 11:33:46 +02:00
viovanov 4a8f57c23f Add a manifest key for bundle metadata
Signed-off-by: viovanov <vlad@aserto.com>
2021-05-13 12:33:28 -04:00
Stephan Renatus 1a4227b7dc nightly checks: fix races, bump logrus version (#3439)
* runtime_test: avoid race condition

This had been flagged by our nightly race deteector run. Now, we'll
wait for the server to have stopped before checking its log output.

* plugins: avoid races, bump github.com/sirupsen/logrus

To fix that other one, I've first tried updating logrus (there was a
mention of fixed races in the changelog), but to no avail. Setting up
the hook before any plugin would log from that test resolved the issue.

No harm in updating logrus, though, let's keep that: 1.6.0 -> 1.8.1

* plugins/bundle: fix race

Golang for-range loops need special care when using a reference to the
second variable (v in `for k, v := range m`). We had been copying the
value of m[k], which is a pointer to Status, we had not been -- as was
intended -- copying the values of the struct that the pointer had been
pointing to.

Tests needed to be adapted for this, the s4 update will NOT contain
any bundle-activation-related metrics, as no bundle was activated, and
its status is a fresh copy.

* workflow: add race detector to PR checks

When run from nightly, we use ubuntu-latest; whereas the other checks
in the pull-request workflow use ubuntu-18.04.

I don't think it matters at all for the race detector, since that one
runs only from another docker container, using the golang image.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2021-05-12 11:06:40 +02:00
Torin Sandall 1d79ea97e3 plugins/bundle: Add support for file:// urls
This is useful for test purposes. Users can test OPA integrations
using local files without having to introduce special code paths.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2021-05-10 11:34:14 -04:00
Torin Sandall c23aca50ac plugins: Add String() for plugin status
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2021-05-10 11:34:14 -04:00
Torin Sandall c7ea2bbf48 plugins/discovery: Treat discovery.resource as canonical
This commit updates the discovery plugin so that discovery.resource
can be supplied without discovery.name. This change is a long time
coming and makes the discovery configuration consistent w/ bundle
configuration.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2021-05-10 11:34:14 -04:00
Torin Sandall a75318270b plugins: Initialize plugin status to NotReady instead of nil
Listeners should not have to check for nil status objects. Just
initialize the status to NotReady.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2021-05-10 11:34:14 -04:00
Torin Sandall 3fcc875a55 logging: Move logging infrastructure into separate package
This commit moves the logging interface and implementations out of the
sdk package into the logging package.

This commit also updates the status and decision log plugins to use a
logger obtained from the plugin manager instead of going to the global
console logger in the plugins package. The latter change will be
important for SDK consumers. This change is backwards incompatible but
it's unlikely that anyone is relying on that export. The test for
console logger independence has also been moved into the plugins
package (from the status package.)

Fixes #3275

Co-authored-by: Torin Sandall <torinsandall@gmail.com>
Co-authored-by: Anders Eknert <anders@eknert.com>

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
Signed-off-by: Anders Eknert <anders@eknert.com>
2021-05-10 11:34:14 -04:00
Ashutosh Narkar 0be08fd04a download: Add support for http long polling
Earlier the downloader package only supported the http
short polling technique where the client sends periodic
requests to the server to fetch bundles. A drawback of this
method is that a low polling frequency could add unnecessary
burden on the server and network.

This commit adds support for http long polling which helps
to minimize server/network resource usage and also reduces
the delay in delivery of updates to the client.

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2021-05-06 09:11:57 -07:00
Grant Shively dd35d6ce8d plugins/status: add plugin support
Added support for plugins in status plugin, similar to the pattern
employed in the decision logs plugin. By setting `status.plugin`
in configuration, you can override how the status plugin sends status
updates.

Related to #3047

Signed-off-by: Grant Shively <gshively@godaddy.com>
2021-04-16 09:31:23 -04:00
Anders Eknert 7bf53f82d7 Add thumbprint config option for x5t JWT header
This is required by the Azure Identity OAuth2 implementation
when the client credentials JWT flow is used.

Fixes #3372

Signed-off-by: Anders Eknert <anders@eknert.com>
2021-04-13 14:12:00 +02:00
Arshad Saquib 2764c67094 Add TLS option to specify CA file (#3359)
this option allows CA file to be used in TLS configuration for bundle downloads

Fixes: #1968
Signed-off-by: Arshad Saquib <arshad.saquib@styra.com>
2021-04-13 09:47:12 +02:00
Ashutosh Narkar 11181a7cb6 plugins/discovery: Fix log drop flaky test (#3373)
The log drop check test does not setup a remote
decision logging endpoint to upload logs. Hence when the
decision log plugin tries to upload a log, it fails. Now when
the plugin tries to requeue the log it causes the log
drop count to increase as the rate limit has already exceeded.

This change updates the test to take into account the drop count
increase caused due to such a scenario.

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2021-04-13 09:23:37 +02:00
Ashutosh Narkar 9cbe2e1433 plugins/logs: Add test to check upload size limit on reconfig
This change adds a test to check the upload limit is updated
when the log plugin is reconfigured.

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2021-04-10 18:05:18 -07:00
Ashutosh Narkar 64e91ff678 plugins/discovery: Fix log drop checking flaky test (#3360)
The test that checks for log drops was utilizing the
test server and would fail sporadically from an unmarshalling
error in the test server.

This change updates the test to not use the test server as
it's not required to meet the goal of the test.

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2021-04-09 07:58:08 +02:00
Ashutosh Narkar 489c581433 plugins: Include log drop count in the status plugin's metrics
This change adds the count of the decision log events that
were dropped when the rate limit was exceeded to the status
plugin's metrics provider. These metrics are part of the periodic
status update and hence should allow control planes to monitor the
number of dropped log events.

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2021-04-02 13:44:13 -07:00
Stephan Renatus 683aed99ba wasm_sdk: redo interrupt handling, pass server ctx (#3317)
Now, when an interrupt happens, we'll clean up after ourselves: we keep calling
a cheap function to ensure that the trap has been trapped on.

To get there, we'll move the "defer-recover" further down the call stack.

Also, this changes the cancellation error returned by the topdown builtin. It no
longer is a builtinError with a message indicating that the context was cancelled
(or its deadline reached), but return a CancelErr, the same thing that happens via
the other cancellation mechanisms involved topdown's Cancel (like in cidr.expand).

Compared with master, this isn't worse:

    name                       old time/op    new time/op    delta
    RESTAuthzForbidAuthn-16       542µs ±15%     525µs ±12%    ~     (p=0.841 n=5+5)
    RESTAuthzForbidPath-16        818µs ± 2%     827µs ± 2%    ~     (p=0.556 n=4+5)
    RESTAuthzForbidMethod-16      864µs ± 2%     851µs ± 4%    ~     (p=0.310 n=5+5)
    RESTAuthzAllow10Paths-16      896µs ±20%     855µs ± 5%    ~     (p=1.000 n=5+5)
    RESTAuthzAllow100Paths-16    4.28ms ± 3%    4.07ms ± 3%  -4.97%  (p=0.008 n=5+5)

    name                       old alloc/op   new alloc/op   delta
    RESTAuthzForbidAuthn-16      68.8kB ± 1%    67.2kB ± 1%  -2.28%  (p=0.008 n=5+5)
    RESTAuthzForbidPath-16       68.5kB ± 0%    66.9kB ± 0%  -2.33%  (p=0.008 n=5+5)
    RESTAuthzForbidMethod-16     68.5kB ± 0%    66.9kB ± 0%  -2.33%  (p=0.008 n=5+5)
    RESTAuthzAllow10Paths-16     68.5kB ± 0%    66.9kB ± 0%  -2.33%  (p=0.008 n=5+5)
    RESTAuthzAllow100Paths-16    69.1kB ± 0%    67.5kB ± 0%  -2.31%  (p=0.008 n=5+5)

    name                       old allocs/op  new allocs/op  delta
    RESTAuthzForbidAuthn-16       1.73k ± 1%     1.64k ± 1%  -5.17%  (p=0.008 n=5+5)
    RESTAuthzForbidPath-16        1.72k ± 0%     1.63k ± 0%    ~     (p=0.079 n=4+5)
    RESTAuthzForbidMethod-16      1.72k ± 0%     1.63k ± 0%  -5.13%  (p=0.008 n=5+5)
    RESTAuthzAllow10Paths-16      1.72k ± 0%     1.63k ± 0%  -5.13%  (p=0.008 n=5+5)
    RESTAuthzAllow100Paths-16     1.72k ± 0%     1.63k ± 0%  -5.16%  (p=0.008 n=5+5)

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2021-03-30 13:48:45 +02:00
Ashutosh Narkar 959de3dac1 plugins/log: Add rate limit control for encoding decision log events
This change allows users to configure the rate at which decision
logs can be written into the encoder. A token bucket based rate
limiter is used to decide if a log event should be written into
the encoder. The encoded events are then added to the
buffer. If the rate limit is exceeded the event is dropped.

This change provides added control to users over buufering log events
on top of the existing behavior of specifying a buffer size limit.

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2021-03-29 14:04:51 -07:00
Ashutosh Narkar cb104e318b config: Add API to expose OPA's active config
This commit adds a new API endpoint to fetch OPA's
active configuration. When the discovery feature is enabled,
this API can be used to fetch the discovered configuration
in the last evaluated discovery bundle.

Fixes: #2020

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2021-03-19 11:23:59 -07:00
Magnus Jungsbluth bdb3d0f658 Allow configuring logger + its fields in library usage
Signed-off-by: Magnus Jungsbluth <magnus.jungsbluth@zalando.de>
2021-03-16 09:22:31 -04:00
Anders Eknert 83a7079483 Fix crash in v0.27.0 when s3_signing is configured (#3256)
This was caused by new logger not getting properly initialized in NewClient
call.

Fixes #3255

Signed-off-by: Anders Eknert <anders@eknert.com>
2021-03-12 09:14:07 +01:00
Jack Stevenson 5406cb3811 plugins/rest: SigV4 Signing for any AWS service (#3210)
This adds a new `service` option to the `s3_signing` config, allowing for other AWS services (such
as API Gateway endpoints) to be used for bundles, decision logs etc.

For example:

```
services:
  decision-log-service:
    url: https://myrestapi.execute-api.ap-southeast-2.amazonaws.com/prod/
    credentials:
      s3_signing:
        service: execute-api
        environment_credentials: {}

decision_logs:
  service: decision-log-service
  reporting:
    min_delay_seconds: 300
    max_delay_seconds: 600
```

If no service is specified, we default to `s3` to maintain backwards compatibility.

This updates the sigv4 signer to include the specified service in the signature, and to sign all
request headers for better compatibility with other AWS services, except an explicit ignore list,
as per https://github.com/aws/aws-sdk-go/blob/master/aws/signer/v4/v4.go#L92

Additionally, this fixes a bug in the signer where the body ReadCloser was consumed and not reset,
meaning requests that were signed were always sent with an empty body!

Fixes #3193

Signed-off-by: Jack Stevenson <jacsteve@amazon.com>
2021-03-10 13:30:50 +01:00
Anders Eknert 968d49de3d Injectable logging implementation
Refactor logging to allow providing custom logging implementations to plugin
manager. This should allow us to keep logging as it is when running OPA as a
server, while injecting noop-loggers or custom, provided loggers for SDK client
implementations.

Fixes #3180

Signed-off-by: Anders Eknert <anders@eknert.com>
2021-03-05 14:42:39 +01:00
Stan Lagun 9063587794 logs: do not block Stop if there are no logs to publish
Addresses #3197

Signed-off-by: Stan Lagun <stan@styra.com>
2021-02-25 23:23:21 +01:00
Bojan Poprzen 79be94f509 plugins/bundle: properly unregister a listener
- fixed a bug to unregister a listener and not a bulk listener
- added assertions on existing tests

Fixes #3190

Signed-off-by: Bojan Poprzen <bojan.poprzen@sap.com>
2021-02-25 14:16:34 +01:00
Anders Eknert fe97f335fc Allow PKCS8 encoded private keys (#3117)
Fixes #3116

Signed-off-by: Anders Eknert <anders@eknert.com>
2021-02-03 20:16:14 +01:00
Anders Eknert 635d8a52d8 Configurable persistence_directory
This allows configuring the persistence_directory OPA should use for persisting
bundles to disk. While this currently only covers bundles I didn't want to close
the door for persisting other type of objects later, so the
persistence_directory option is kept at the top level of the configuration,
defaulting to $PWD/.opa if not provided.

Bundles will be persisted to ${persistence_directory}/bundles.

Closes #3085

Signed-off-by: Anders Eknert <anders@eknert.com>
2021-02-02 10:14:03 +01:00
Anders Eknert 36ba4454e8 OAuth2 JWT bearer grant type and JWT client auth
Allow OPA to issue JWT's which it uses to authenticate a configured
OAuth2 client, as described in RFC7523. This replaces the client_secret
as the actual credential and allows for either using an entirely new
grant type called "JWT bearer", or using the previously supported
client_credentials grant type, only with the client_secret replaced
by a signed JWT. This change covers both scenarios described in
RFC7523.

Other changes made to accomodate this feature:

- Add `private_key` attribute to keys struct to allow for both public and
private keys to be stored there.
- Refactored the keys configuration struct and logic to its
own package no longer coupled to bundles.

Closes #3055

Signed-off-by: Anders Eknert <anders@eknert.com>
2021-01-20 13:36:15 +01:00
Grant Shively a1d8381fc8 plugins: inter-query cache config discovery
InterQueryBuiltinCacheConfig now responds to the plugin manager's reconfigure event, which allows cache config to exist in discovery config. Previously, cache config would be ignored if it was only declared in discovery config.

Related to #2978.

Signed-off-by: Grant Shively <gshively@godaddy.com>
2021-01-05 16:09:58 -08:00
Torin Sandall 57ccd83c68 bundle: Add deprecation warning for old 'bundle' configuration
Fixes #1598

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2020-12-14 14:28:57 -05:00
Grant Shively 7a28f26ae7 plugins/plugins: WARN state and optional message
The WARN state can be used to signal admins that a plugin is in a
potentially dangerous or degraded state. The optional message may be
used to provide context about the warning.

Fixes #2932

Signed-off-by: Grant Shively <gshively@godaddy.com>
2020-12-10 13:54:55 -05:00