Commit graph

439 commits

Author SHA1 Message Date
Caleb Doxsey
7eb7861f2c
core: fix graceful stop (#4865)
* core/grpc: fix graceful stop

* core/http: add graceful stop serve
2023-12-29 10:18:08 -07:00
Denis Mishin
faa2a8652b
zero/telemetry: add reporter (#4855) 2023-12-20 14:53:06 -05:00
Caleb Doxsey
d6221c07ce
core/config: remove debug option, always use json logs (#4857)
* core/config: remove debug option, always use json logs

* go mod tidy
2023-12-15 11:29:05 -07:00
Caleb Doxsey
a2fd95aae6
core/ci: update linting (#4844)
* core/ci: update linting

* re-add exportloopref

* re-add gocheckcompilerdirectives

* re-add stylecheck

* re-add usestdlibvars

* upgrade lint

---------

Co-authored-by: Denis Mishin <dmishin@pomerium.com>
2023-12-14 09:07:54 -08:00
Denis Mishin
b66634d1e6
zero: only leave public packages in pkg/zero (#4854) 2023-12-12 14:24:37 -05:00
Kenneth Jenkins
a6ae9d3f2d
integration: check for profile cookies (#4847)
Update the authentication flow integration test to verify that the
pomerium_identity_profile cookies are not present for the stateful
authentication flow.
2023-12-12 10:07:13 -08:00
Kenneth Jenkins
fe46ed33f4
config: no longer stub out HPKE public key fetch (#4853)
This partially reverts commit a1388592d8.

Fetching the authenticate service HPKE public key is required only for 
the stateless authentication flow. Now that Pomerium will instead use 
the older (stateful) authentication flow when configured for a
self-hosted authenticate service, this logic shouldn't be needed at all.

Removing this logic should also make it easier to test against a local
instance of the hosted authenticate service.
2023-12-12 09:57:58 -08:00
Denis Mishin
c5f7519c06
zero/openapi: pin v1.0.0 of a runtime (#4851) 2023-12-11 18:24:44 -05:00
Denis Mishin
ea64902a73
zero: merge pomerium/zero-sdk (#4848) 2023-12-11 17:31:39 -05:00
Denis Mishin
c4dd965f2d
zero/telemetry: calculate DAU and MAU (#4810) 2023-12-11 13:37:01 -05:00
Kenneth Jenkins
a771b82a72
storage/inmemory: fix Patch() error handling (#4838)
The Patch() method was intended to skip any records that do not
currently exist. However, currently inmemory.Backend.Patch() will return
ErrNotFound if the last record in the records slice is not found (it
will ignore any other previous records that are not found).

Update the error handling logic here to be consistent with the postgres
backend, and add a unit test to exercise this case.
2023-12-07 12:21:10 -08:00
Caleb Doxsey
ce8abde236
core/go: use max procs (#4766)
* core/go: use max procs

* update test

* logging
2023-12-07 09:14:57 -07:00
Caleb Doxsey
1780fefa72
core/storage: hijack connections for notification listeners (#4806) 2023-12-04 09:29:10 -07:00
Denis Mishin
4559320463
metrics: add linear probabilistic counter (#4776)
* metrics: add linear probabilistic counter

* add pkg
2023-12-04 08:51:41 -05:00
Denis Mishin
7e2532f644
zero/bundle-reconciler: better code reuse (#4758) 2023-11-21 14:32:52 -05:00
Caleb Doxsey
d7ed62c350
core/storage: fix nil data unmarshal (#4734) 2023-11-10 13:16:22 -07:00
Denis Mishin
15ca641b9c
databroker: changeset: prevent nil data in the deleted records (#4736) 2023-11-10 13:04:22 -07:00
Caleb Doxsey
6de9f12ac1
core/session: fix flaky test (#4730) 2023-11-09 12:36:08 -07:00
Denis Mishin
cc6592b6fd
reconciler: allow custom comparison function (#4726) 2023-11-08 20:11:49 -05:00
Kenneth Jenkins
0238a39f23
session: add unit tests for gRPC wrapper methods (#4713) 2023-11-08 15:22:47 -08:00
Caleb Doxsey
3bdbd56222
core/config: add pass_identity_headers option (#4720)
* core/config: add pass_identity_headers option

* add to proto

* remove deprecated field
2023-11-08 13:07:37 -07:00
Denis Mishin
bfcc970839
databroker: build config concurrently, option to bypass validation (#4655)
* validation: option to bypass

* concurrently build config

* add regex_priority_order and route sorting

* rm mutex
2023-11-06 13:21:29 -05:00
Kenneth Jenkins
ab104a643a
rework session updates to use new patch method (#4705)
Update the AccessTracker, WebAuthn handlers, and identity manager
refresh loop to perform their session record updates using the
databroker Patch() method.

This should prevent any of these updates from conflicting.
2023-11-06 09:43:07 -08:00
Caleb Doxsey
2771a5ae87
core/config: refactor file watcher (#4702)
* core/config: refactor file watcher

* add comments

* updates

* only use the polling watcher

* fix test

* fix test

* try to fix test again

* remove batching

* dont rely on file modification timestamp

* remove benchmark

* try fix again
2023-11-03 15:53:20 -06:00
Denis Mishin
77bb203276
databroker: add reconciler (#4709) 2023-11-03 15:40:57 -04:00
Denis Mishin
6d5558cb97
databroker: add utility recordset and changeset (#4701) 2023-11-03 11:26:59 -04:00
Denis Mishin
45b72bc9b5
proto: add id to certificate (#4706) 2023-11-02 21:26:30 -04:00
Kenneth Jenkins
d5da872157
databroker: add patch method (#4704)
Add a Patch() method to the databroker gRPC service.

Update the storage.Backend interface to include the Patch() method now
that all the storage.Backend implementations include it.

Add a test to exercise the patch method under concurrent usage.
2023-11-02 15:07:37 -07:00
Kenneth Jenkins
4842002ed7
storage/postgres: implement patch operation (#4656)
Implement the new Patch() method for the Postgres storage backend.
2023-11-02 12:07:36 -07:00
Kenneth Jenkins
4f648e9ac1
databroker: remove redis storage backend (#4699)
Remove the Redis databroker backend. According to
https://www.pomerium.com/docs/internals/data-storage#redis it has been
discouraged since Pomerium v0.18.

Update the config options validation to return an error if "redis" is 
set as the databroker storage backend type.
2023-11-02 11:53:25 -07:00
Kenneth Jenkins
47890e9ee1
storage/inmemory: implement patch operation (#4654)
Add a new Patch() method that updates specific fields of an existing
record's data, based on a field mask.

Extract some logic from the existing Get() and Put() methods so it can
be shared with the new Patch() method.
2023-11-02 11:03:00 -07:00
Caleb Doxsey
53573dc046
core/config: remove version (#4653)
* core/config: remove version

* lint

* fix
2023-11-01 10:19:55 -06:00
Caleb Doxsey
a29476f61e
core/hpke: reduce memory usage from zstd (#4650)
* core/hpke: reduce memory usage from zstd

* use default compression, use default concurrency
2023-10-31 10:24:56 -06:00
Kenneth Jenkins
2cc82ed706
protoutil: add OverwriteMasked method (#4651)
Add a method to copy selected fields from one proto message to another
(of the same type), using a FieldMask. This is intended for use in a new
databroker Patch method.
2023-10-31 09:16:54 -07:00
Caleb Doxsey
ae420f01c6
core/config: add config version, additional telemetry (#4645)
* core/config: add config version, additional telemetry

* typo
2023-10-27 15:16:40 -06:00
Caleb Doxsey
818f3926bf
core/grpc: fix deprecated protobuf package, remove tools (#4643) 2023-10-26 11:38:54 -06:00
Caleb Doxsey
23ea48815f
core/authorize: check for expired tokens (#4543)
* core/authorize: check for expired tokens

* Update pkg/grpc/session/session.go

Co-authored-by: Denis Mishin <dmishin@pomerium.com>

* lint

* fix zero timestamps

* fix

---------

Co-authored-by: Denis Mishin <dmishin@pomerium.com>
2023-09-15 16:06:13 -06:00
Kenneth Jenkins
01672528cb
cryptutil: remove unused functions (#4541)
Remove the unused functions Sign() and Verify().
2023-09-14 11:25:19 -07:00
Kenneth Jenkins
fd84075af1
config: remove set_authorization_header option (#4489)
Remove the deprecated set_authorization_header option entirely. Add an
entry to the removedConfigFields map with a link to the relevant
Upgrading page section.
2023-08-29 09:02:08 -07:00
Caleb Doxsey
3e330bb76a
storage: add indexes for postgres (#4479)
* storage: add indexes for postgres

* add type, version index
2023-08-21 15:13:48 -06:00
Kenneth Jenkins
cc1ef1ae18
cryptutil: update CRL parsing (#4454)
Move the parseCRLs() method from package 'authorize/evaluator' to
'pkg/cryptutil', replacing the existing DecodeCRL() method. This method
will parse all CRLs found in the PEM input, rather than just the first.

(This removes our usage of the deprecated method x509.ParseDERCRL.)

Update this method to return an error if there is non-PEM data found in
the input, to satisfy the existing test that raw DER-encoded CRLs are
not permitted.

Delete the CRLFromBase64() and CRLFromFile() methods, as these are no
longer used.
2023-08-11 08:33:22 -07:00
Kenneth Jenkins
ac475f4c5d
ppl: add new client certificate criterion (#4448)
Add a new client_certificate criterion that accepts a "Certificate
Matcher" object. Start with two certificate match conditions:
fingerprint and SPKI hash, each of which can accept either a single
string or an array of strings.

Add new "client-certificate-ok" and "client-certificate-unauthorized"
reason strings.
2023-08-09 09:47:23 -07:00
Kenneth Jenkins
de68e37bc3
config: add new mTLS enforcement setting (#4443)
Add an "enforcement" option to the new downstream mTLS configuration
settings group.

When not set, or when set to "policy_default_deny", keep the current
behavior of adding an invalid_client_certificate rule to all policies.

When the enforcement mode is set to just "policy", remove the default
invalid_client_certificate rule that would be normally added.

When the enforcement mode is set to "reject_connection", configure the
Envoy listener with the require_client_certificate setting and remove
the ACCEPT_UNTRUSTED option.

Add a corresponding field to the Settings proto.
2023-08-09 07:53:11 -07:00
Kenneth Jenkins
24b09186a4
config: move mTLS settings to new struct (#4442)
Move downstream mTLS settings to a nested config file object, under the
key 'downstream_mtls', and add a new DownstreamMTLSSettings struct for
these settings.

Deprecate the existing ClientCA and ClientCAFile fields in the Options
struct, but continue to honor them for now (log a warning if either is
populated).

Delete the ClientCRL and ClientCRLFile fields entirely (in current
releases these cannot be set without causing an Envoy error, so this
should not be a breaking change).

Update the Settings proto to mirror this nested structure.
2023-08-08 10:22:48 -07:00
Kenneth Jenkins
8401170443
authorize: add "client-certificate-required" reason (#4389)
Add a new reason "client-certificate-required" that will be returned by
the invalid_client_certificate criterion in the case that no client
certificate was provided. Determine this using the new 'presented' field
populated from the Envoy metadata.
2023-07-25 10:03:51 -07:00
Kenneth Jenkins
4698e4661a
authorize: omit client cert rule when not needed (#4386)
Currently we always add an invalid_client_certificate deny rule to all
PPL policies. Instead, let's add this rule only when a client CA is
configured. This way, if a user is not using client certificates at all,
they won't see any reason strings related to client certificates in the
authorize logs.

Change the "valid-client-certificate-or-none-required" reason string to
just "valid-client-certificate" accordingly.

Pass the main Evaluator config to NewPolicyEvaluator so that we can
determine whether there is a client CA configured or not. Extract the
existing default deny rule to a separate method. Add unit tests
exercising the new behavior.
2023-07-24 15:27:57 -07:00
Caleb Doxsey
438aecd7bc
config: add customization options for logging (#4383)
* config: add customization options for logging

* config: validate log fields

* allocate slices once
2023-07-24 13:17:03 -06:00
Caleb Doxsey
78e7a3e7d0
config: validate log levels (#4367)
* config: validate log levels

* fix SetLevel

* document unset, merge warn/warning
2023-07-17 16:41:48 -06:00
Kenneth Jenkins
a1388592d8
stub out HPKE public key fetch for self-hosted authenticate (#4360)
Fetch the HPKE public key only when configured to use the hosted
authenticate service. Determine whether we are using the hosted
authenticate service by comparing the resolved authenticate domain with
a hard-coded list of hosted authenticate domains.

Extract this list of hosted authenticate domains to the internal/urlutil
package in order to keep a single source of truth for this data.
2023-07-13 10:04:34 -07:00
guangwu
4674b98cfb
chore: unnecessary use of fmt.Sprintf (#4349)
Remove fmt.Sprintf() calls where the format string contains no formatting verbs.
2023-07-12 09:44:29 -07:00