Commit graph

436 commits

Author SHA1 Message Date
Kenneth Jenkins
832742648d
config: add new OTLP tracing fields (#5421)
Add new tracing options fields to the Settings proto and Options struct.

Co-authored-by: Joe Kralicky <joekralicky@gmail.com>
2025-01-17 14:56:42 -08:00
Kenneth Jenkins
3a2e6ce10a
config: fix JWT groups filter option (#5429)
When applying the settings proto, update the JWT groups filter option
only if the filter set is non-empty.

This is important when deploying Pomerium via the Ingress Controller in
combination with Pomerium Enterprise. In this scenario there is a
settings proto applied from both Ingress Controller and the Enterprise
console, and we want to make sure the one from Ingress Controller does
not overwrite the filter settings from Enterprise.
2025-01-16 08:53:06 -08:00
Caleb Doxsey
8bc86fe06f
config: add route name, description and logo (#5424)
* config: add route name, description and logo

* remove name generation
2025-01-14 14:55:14 -07:00
Joe Kralicky
dfd2457bb6
envoy: add internal_address_config to address deprecation warning (#5425) 2025-01-14 16:51:04 -05:00
Caleb Doxsey
5ff53ef2b1
importutil: refactor GenerateRouteNames to allow for protobuf or config routes (#5427)
* importutil: refactor GenerateRouteNames to allow for protobuf or config routes

* test via NewPolicyFromProto
2025-01-14 14:50:00 -07:00
Joe Kralicky
e5ede2d167
remove test code from config/options_test.go (#5423) 2025-01-14 14:00:38 -05:00
Joe Kralicky
6502d68162
config: set default tracing sample rate to 1.0 (#5422)
The previous default sample rate of 0.0001 is very low, so traces are
unlikely to be visible after enabling them until many thousands of
requests have been sent. This could be confusing to users.
2025-01-14 13:50:22 -05:00
Caleb Doxsey
c571769adc
config: add source ppl field (#5419) 2025-01-14 10:13:56 -07:00
Kenneth Jenkins
21b9e7890c
authorize: add filter options for JWT groups (#5417)
Add a new option for filtering to a subset of directory groups in the
Pomerium JWT and Impersonate-Group headers. Add a JWTGroupsFilter field
to both the Options struct (for a global filter) and to the Policy
struct (for per-route filter). These will be populated only from the
config protos, and not from a config file.

If either filter is set, then for each of a user's groups, the group
name or group ID will be added to the JWT groups claim only if it is an
exact string match with one of the elements of either filter.
2025-01-08 13:57:57 -08:00
Kenneth Jenkins
04585af9ef
config: generate fallback cert only as last resort (#5250)
Currently Pomerium will always generate a wildcard certificate for use 
as a fallback certificate.

If any other certificate is configured, this fallback certificate will 
not normally be presented, except in the case of a TLS connection where 
the client does not include the Server Name Indication (SNI) extension.
All modern browsers support SNI, so in practice this certificate should
never be presented to end users.

However, some network scanning tools will probe connections by IP 
addresses (without SNI), and so this fallback certificate may be
presented. The presence of this certificate may be flagged as a problem
in some automated vulnerability scans.

Let's avoid generating this fallback certificate if Pomerium has any 
other certificate configured (unless specifically requested by the Auto
TLS option). This should prevent false positive reports from these
particular vulnerability scans.
2024-12-19 09:46:59 -08:00
Caleb Doxsey
4a5b737763
config: fix lost branding settings when there are multiple configuration sources (#5401) 2024-12-19 08:47:28 -07:00
Kenneth Jenkins
84da474816
config: minor cleanup in GenerateCatchAllCertificate (#5397)
GenerateCatchAllCertificate() appears to return the same result whether
or not DeriveInternalDomainCert is nil. Let's remove this conditional.
2024-12-18 13:21:48 -08:00
Caleb Doxsey
71bcb4f28e
UDP support (#5390) 2024-12-11 13:07:31 -07:00
Caleb Doxsey
f426403bcb
envoy: enable extended connect (#5387)
* envoy: enable extended connect

* add explicit connect

* update config
2024-12-04 14:54:27 -07:00
Denis Mishin
2bb70258c3
authorize/log: remove audit logging (#5369) 2024-11-22 14:32:52 -05:00
Caleb Doxsey
5d69b925be
HTTP/3 Support (#5349)
* wip

* http3 support

* add integration test

* move some quic code

* fix codec type

* casing

* add alt-svc header

* add quic unit test
2024-11-19 08:48:30 -07:00
Caleb Doxsey
20a9be891f
envoyconfig: cleanup (#5350)
* envoyconfig: cleanup

* remove listener access log for mtls for insecure server which can't use mtls

* use new functions

* rename method

* refactor common code
2024-11-18 09:50:23 -07:00
Joe Kralicky
177f789e63
change Policy.Matches to accept a URL pointer (#5360) 2024-11-07 14:55:44 -05:00
Joe Kralicky
ebd9eea30e
Optimize Policy RouteID (#5359) 2024-11-06 12:31:52 -05:00
Joe Kralicky
c8b6b8f1a9
config: only validate redirect response code when non-nil (#5358)
* config: only validate redirect response code when non-nil

* update unit tests

---------

Co-authored-by: Kenneth Jenkins <51246568+kenjenkins@users.noreply.github.com>
2024-11-05 15:57:59 -05:00
Joe Kralicky
526e2a58d6
New integration test fixtures (#5233)
* Initial test environment implementation

* linter pass

* wip: update request latency test

* bugfixes

* Fix logic race in envoy process monitor when canceling context

* skip tests using test environment on non-linux
2024-11-05 14:31:40 -05:00
Kenneth Jenkins
3d958ff9c5
config: fix redirect response code (#5346) 2024-11-05 10:38:02 -08:00
Joe Kralicky
fe31799eb5
Fix many instances of contexts and loggers not being propagated (#5340)
This also replaces instances where we manually write "return ctx.Err()"
with "return context.Cause(ctx)" which is functionally identical, but
will also correctly propagate cause errors if present.
2024-10-25 14:50:56 -04:00
Joe Kralicky
a42e286637
Add new jwt issuer format route option (#5338) 2024-10-25 13:07:47 -04:00
Caleb Doxsey
9e9ed8853f
ppl: more flexible matchers (#5336)
* ppl: more flexible matchers

* make the string list matcher "is" match arrays with only a single item

* re-use has

* default list matcher to has
2024-10-25 07:56:57 -06:00
Caleb Doxsey
d2c14cd6d2
logging: remove ctx from global log methods (#5337)
* log: remove warn

* log: update debug

* log: update info

* remove level, log

* remove contextLogger function
2024-10-23 14:18:52 -06:00
Joe Kralicky
1ccaf1b22b
config: suppress unused warnings for all fields in embedded route envoy options (#5330) 2024-10-22 16:46:22 -04:00
Kenneth Jenkins
11054a943d
config: set_response_headers is not unknown (#5326)
Most fields in the config.Options struct are populated by the
mapstructure package, but the SetResponseHeaders field is handled
separately. As a result, when the set_response_headers key is present,
it also shows up as an unknown config option.

Add this key to the ignoreConfigFields map, to avoid logging an
incorrect "unknown config option" message when set.
2024-10-15 12:40:14 -07:00
Caleb Doxsey
075ea01b0a
core/config: allow websockets and spdy by default for k8s urls (#5325) 2024-10-10 17:55:34 -06:00
Caleb Doxsey
27947b19cb
core/config: add kubernetes_service_account_token_file (#5322)
* core/config: add kubernetes_service_account_token_file

* fix loading of token file
2024-10-10 14:53:45 -06:00
Joe Kralicky
0e13248685
Core-Zero Import (#5288)
* initial core-zero import implementation

* Update /config/import openapi description and use PUT instead of POST

* update import ui tests

* Add 413 as a possible response for /config/import

* Options/Settings type conversion tests and related bugfixes

* Fixes for proto type conversion and tests

* Update core-zero import client

* Update core-zero import client

* Update import api and environment detection

* update go.mod

* remove old testdata

* Remove usage of deleted setting after merge

* remove extra newline from --version output
2024-10-09 18:51:56 -04:00
Caleb Doxsey
410354bc00
core/go: use hashicorp/go-set (#5278) 2024-10-03 12:59:11 -06:00
Kenneth Jenkins
01d375f0bc
config: remove unused gRPC setting (#5308)
Remove the grpc_client_dns_roundrobin option as it appears to be unused
since commit bbec2cae9f.
2024-10-03 10:14:54 -07:00
Caleb Doxsey
bfc782ff06
core/zero: add pseudonymization key (#5290) 2024-09-19 14:43:01 -06:00
Caleb Doxsey
52d4899d4c
core/proxy: support loading sessions from headers and query string (#5291)
* core/proxy: support loading sessions from headers and query string

* update test
2024-09-19 09:23:13 -06:00
Joe Kralicky
d06a101f79
ppl: fix empty/no-op allow block added in some cases to converted PPL policies (#5289)
Fix empty/no-op allow block added in some cases to converted PPL policies
2024-09-16 18:52:54 -04:00
Kenneth Jenkins
6171c09596
config: remove unused databroker storage settings (#5285)
Config options concerning the TLS connection from databroker to storage
backend are now unused. TLS options for this connection can instead be
set directly in the databroker storage connection string.
2024-09-16 11:58:57 -07:00
Caleb Doxsey
10e1746471
core/authorize: remove default header logging in debug (#5287) 2024-09-13 13:04:33 -06:00
Caleb Doxsey
790c11b368
core/zero: add organization id and cluster id to bootstrap config (#5275) 2024-09-10 11:31:45 -06:00
Joe Kralicky
653d8f9594
Revert "config: allow overriding port numbers using environment variables (#5194)" (#5273)
This reverts commit fdefcf9a16.

This was originally intended for a specific integration test use case,
but it did not end up being needed. Additionally, the environment
variable names can conflict with Kubernetes service environment variables.
2024-09-09 19:30:48 -04:00
Caleb Doxsey
dad954ae16
core/logging: change log.Error function (#5251)
* core/logging: change log.Error function

* use request id
2024-09-05 15:42:46 -06:00
Caleb Doxsey
073d1564ba
core/envoy: allow TLS 1.3 (#5263) 2024-09-05 06:00:18 -06:00
Kenneth Jenkins
014824b525
proxy: deprecate the /.pomerium/jwt endpoint (#5254)
Disable the /.pomerium/jwt endpoint by default. Add a runtime flag to
temporarily opt out of the deprecation.
2024-09-04 11:22:18 -07:00
Kenneth Jenkins
2b84111058
config: sort runtime flags, name consistency (#5255)
Sort the runtime flag definitions alphabetically. Rename
envoy_resource_manager_enabled to just envoy_resource_manager for
consistency with the other flag names. (This flag hasn't been released
yet, so it should be OK to rename it.) Also add a doc comment.
2024-09-03 13:37:19 -07:00
Caleb Doxsey
f3620cf6e9
core/config: add databroker_storage_connection_string_file (#5242)
* core/config: add databroker_storage_connection_string_file

* add file to file list
2024-08-27 09:42:14 -06:00
Caleb Doxsey
d062f9d68d
core/logs: remove warnings (#5235)
* core/logs: remove warnings

* switch to error
2024-08-27 09:38:50 -06:00
Joe Kralicky
56ba07e53e
Optimize policy iterators (#5184)
* Optimize policy iterators (go1.23)

This modifies (*Options).GetAllPolicies() to use a go 1.23 iterator
instead of copying all policies on every call, which can be extremely
expensive. All existing usages of this function were updated as
necessary.

Additionally, a new (*Options).NumPolicies() method was added which
quickly computes the number of policies that would be given by
GetAllPolicies(), since there were several usages where only the
number of policies was needed.

* Fix race condition when assigning default envoy opts to a policy
2024-08-20 12:35:10 -04:00
Joe Kralicky
332932b7a8
Replace usages of x/exp/maps + bump golang.org/x/exp (#5221)
Bump golang.org/x/exp; replace usages of x/exp/maps with stdlib equivalents
2024-08-15 17:49:24 -04:00
Joe Kralicky
e3e7de741c
envoy: support http2 prior knowledge for insecure upstream targets (#5205)
This allows using the scheme 'h2c' to indicate http2 prior knowledge for
insecure upstream servers. This can be used to perform TLS termination for
GRPC servers configured with insecure credentials.

As an example, this allows the following route configuration:

routes:
  - from: https://grpc.localhost.pomerium.io
    to: h2c://localhost:9090
2024-08-13 13:40:44 -04:00
Joe Kralicky
554e77bc7c
envoy: log mtls failures (#5210)
envoy: log mtls failures

This implements limited listener-based access logging for downstream
transport failures, only enabled when downstream_mtls.enforcement is
set to 'reject_connection'. Client certificate details and the error
message will be logged.

Additionally, the new key 'client-certificate' can be set in the
access_log_fields list in the configuration, which will add peer
certificate properties (issuer, subject, SANs) to the existing
per-request http logs.

---------

Co-authored-by: Kenneth Jenkins <51246568+kenjenkins@users.noreply.github.com>
2024-08-09 14:05:10 -04:00