Commit graph

414 commits

Author SHA1 Message Date
Matheus Fidelis
3c4e78e6b7
feature(geoip2_autoreload): Enable GeoIP2 auto_reload config (#11079)
* feature(geoip2_autoreload): GeoIP Autoreload

feature(geoip2_autoreload): fix lint

feature(geoip2_autoreload): changing flag interval

feature(geoip2_autoreload): tests - up and running

feature(geoip2_autoreload): tests - up and running

feature(geoip2): testing

feature(geoip2): remove typo

feature(geoip2_autoreload): fixing tests

* feature(geoip2_autoreload): working

* feature(geoip2_autoreload): including tests on geoip2 test file
2024-03-19 07:32:15 -07:00
bossm8
9c384c7eb8
Undo #11062 since it breaks the nginx config (#11082)
* [mTLS] Fix acme verfication when mTLS and Client CN verification is enabled

* revert mTLS location excluding acme-challenge since each location will match ultimately resulting in 404 for all request paths
2024-03-08 16:06:47 -08:00
bossm8
7d12628208
[mTLS] Fix acme verfication when mTLS and Client CN verification is enabled (#11062) 2024-03-08 12:32:40 -08:00
Ricardo Katz
02e6ebc95a
Add OTEL build test and for NGINX v1.25 (#10889)
* Add OTEL build test

* Simplify otel compilation

* Remove http2 deprecated arg

* Move image build to CI

* Turn image from scratch to optimize usage

* rollback image from scratch

* Final reviews on nginx v1.25 image

* Remove s390x from final image
2024-01-27 07:33:50 -08:00
chriss-de
ad406b64d8
Add override for proxy_intercept_errors when using Custom HTTP Errors (#9497)
* added proxy-intercept-errors config option

* fixed error when comparing locations

* fixed missing location config from annotation
added e2e test

* reversed logic for proxy-intercept-errors to disable-proxy-intercept-errors

* reversed logic to disable-proxy-intercept-errors

* reversed logic

* default has to be false

* put comment in same line as return

* run gofmt

* fixing wrong Boilerplate header

* updated code to new IngressAnnotation interface

* fixes to satisfy PR comments

* synced with upstream; fixed typo

* gofumpt disableproxyintercepterrors.go

* gofumpt
2023-11-17 05:43:54 +01:00
Ricardo Katz
30820a5acc
Deprecate opentracing (#10615) 2023-11-05 01:58:35 +01:00
Ricardo Katz
9ed0d7f7af
Separate third party NGINX configuration (#10470)
* Document container separation

* Separate configurations
2023-11-03 14:46:32 +01:00
Ricardo Katz
cbed4c6831
Remove legacy GeoIP from controller (#10495) 2023-10-11 08:53:55 +02:00
Chen Chen
d96b3f0082
Add a flag to enable or disable aio_write (#10394)
* Add a flag to enable or disable aio_write

Signed-off-by: z1cheng <imchench@gmail.com>

* Fix e2e test for aio_write

Signed-off-by: z1cheng <imchench@gmail.com>

* Remove redundant spaces to fix the 2e test

Signed-off-by: z1cheng <imchench@gmail.com>

---------

Signed-off-by: z1cheng <imchench@gmail.com>
2023-09-11 05:56:12 -07:00
Chen Chen
b3060bfbd0
Fix golangci-lint errors (#10196)
* Fix golangci-lint errors

Signed-off-by: z1cheng <imchench@gmail.com>

* Fix dupl errors

Signed-off-by: z1cheng <imchench@gmail.com>

* Fix comments

Signed-off-by: z1cheng <imchench@gmail.com>

* Fix errcheck lint errors

Signed-off-by: z1cheng <imchench@gmail.com>

* Fix assert in e2e test

Signed-off-by: z1cheng <imchench@gmail.com>

* Not interrupt the waitForPodsReady

Signed-off-by: z1cheng <imchench@gmail.com>

* Replace string with constant

Signed-off-by: z1cheng <imchench@gmail.com>

* Fix comments

Signed-off-by: z1cheng <imchench@gmail.com>

* Revert write file permision

Signed-off-by: z1cheng <imchench@gmail.com>

---------

Signed-off-by: z1cheng <imchench@gmail.com>
2023-08-31 00:36:48 -07:00
Marcelo Cyreno
93f9ac2521
Making auth access logs optional (#10335) 2023-08-28 07:37:44 -07:00
Mark Ley
8a578c9f4a
Disable Modsecurity from internal processing which affects large ingresses (#10316)
* Disable Modsecurity from interanl processing

* Fix modsecurity check logic
2023-08-14 10:35:21 -07:00
Gabor Lekeny
5d8185c9d7
Handle request_id variable correctly in auth requests (#9219)
* Handle $request_id variable correctly in auth requests

* Make share_all_vars configurable

* Fix test name
2023-08-07 06:16:32 -07:00
Ricardo Katz
c5f348ea2e
Implement annotation validation (#9673)
* Add validation to all annotations

* Add annotation validation for fcgi

* Fix reviews and fcgi e2e

* Add flag to disable cross namespace validation

* Add risk, flag for validation, tests

* Add missing formating

* Enable validation by default on tests

* Test validation flag

* remove ajp from list

* Finalize validation changes

* Add validations to CI

* Update helm docs

* Fix code review

* Use a better name for annotation risk
2023-07-21 20:32:07 -07:00
Lázár György
c8f7cb052a
Exposed continent data as variable in the case of Maxmind city files (#10157) 2023-07-06 16:39:04 -07:00
Ricardo Katz
ebb6314494
Deprecate and remove AJP support (#10158) 2023-07-02 02:26:49 -07:00
Junrui Chen
a21b5218a5
Set grpc :authority header from request header (#8912)
This is to fix that the `:authority` header is  set to `upstream_balancer`
2023-06-26 23:30:30 -07:00
Brendan Kamp
30de5999c1
fix: obsolete warnings (#10029)
Signed-off-by: Spazzy <brendankamp757@gmail.com>
2023-06-18 12:16:21 -07:00
Jintao Zhang
cccba35005
Revert "Remove fastcgi feature" (#10081)
* Revert "Remove fastcgi feature (#9864)"

This reverts commit 90ed0ccdbe.

* revert fastcgi* annotations warning

Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>

---------

Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
2023-06-13 12:55:59 -07:00
Ricardo Katz
90ed0ccdbe
Remove fastcgi feature (#9864) 2023-06-11 13:33:47 -07:00
Alexander Stanko
2794129e92
Add geoname id value into $geoip2_*_geoname_id variables (#9527) 2023-05-08 15:42:52 -07:00
Ricardo Katz
297036e169
Deprecate and remove influxdb feature (#9861) 2023-04-16 17:26:43 -07:00
Ehsan Saei
c8cb9167d3
feat: OpenTelemetry module integration (#9062)
* OpenTelemetry module integration

* e2e test

* e2e test fix

* default OpentelemetryConfig

* e2e values

* mount otel module for otel test only

* propagate IS_CHROOT

* propagate IS_CHROOT e2e test

* code doc

* comments

* golint

* opentelemetry doc

* zipkin

* zipkin

* typo

* update e2e test OpenTelemetry value

* use opentelemetry value

* revert merge conflict

* fix

* format

* review comments

* clean
2023-03-22 11:58:22 -07:00
Harpreet singh
d1af3b5cca
Add CORS template check inside location for externalAuth.SignURL (#8814)
* Add CORS template check inside location for externalAuth.SignURL

* Add testcase for CORS header for auth-signin redirect with CORS enabled.
2023-01-19 06:58:36 -08:00
Samuel Vaillant
e6dcd6845e
feat(configmap): expose gzip-disable (#9505)
* docs(configmap): add link for gzip-min-length

* feat(configmap): expose gzip-disable

* test(e2e): cover gzip settings

* docs(configmap): simplify description with NGINX link

* refactor(configmap): simplify condition
2023-01-16 17:08:32 -08:00
Jack Ivanov
275d5e15e7
Add buildResolvers to the stream module (#9184) 2023-01-09 03:01:29 -08:00
Johannes Würbach
424cc8671b
fix: disable auth access logs (#9049) 2023-01-08 14:49:27 -08:00
Phil Nichol
8ed3a27e25
Adding ipdenylist annotation (#8795)
* feat: Add support for IP Deny List

* fixed gomod

* Update package

* go mod tidy

* Revert "go mod tidy"

This reverts commit e6a837e1e7.

* update ginko version

* Updates e2e tests

* fix test typo
2023-01-08 14:43:28 -08:00
Johannes Würbach
3aa53aaf5b
fix: missing CORS headers when auth fails (#9251) 2022-12-04 17:49:01 -08:00
Johannes Würbach
6aac00648b
fix: handle 401 and 403 by external auth (#9131) 2022-10-12 15:41:04 -07:00
Nate Campbell
7cb91ef9c1
Support none keyword in log-format escape (#8692)
* Support none keyword in log-format escape


## What this PR does / why we need it:
ingress-nginx does not support disabling escaping of special characters in the nginx log. This PR exposes the setting to support that functionality.

## Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Documentation only

## Which issue/s this PR fixes
<!--
(optional, in `fixes #<issue number>` format, will close that issue when PR gets merged):

fixes #
-->

## How Has This Been Tested?
Followed the [getting-started](96b6228a6b/docs/developer-guide/getting-started.md) guide. Used ppa:longsleep/golang-backports on WSL Ubuntu to establish a golang-1.18 environment with latest docker and recommended kind. Built the dev-env successfully; had issues with make test, but they are entirely unrelated to anything I touched. Ultimate test was
```
FOCUS=log-format make kind-e2e-test
...
Ginkgo ran 1 suite in 6m29.7437865s
Test Suite Passed
```

## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
- [x] My change requires a change to the documentation.
- [x] I have updated the documentation accordingly.
- [x] I've read the [CONTRIBUTION](https://github.com/kubernetes/ingress-nginx/blob/main/CONTRIBUTING.md) guide
- [x] I have added tests to cover my changes.
- [x] All new and existing tests passed.

I did not update docs/e2e-tests.md.

* gofmt -s ./internal/ingress/controller/config/config.go
2022-09-30 08:00:29 -07:00
Markus Engel
5e6093cf59
add X-Forwarded-For in custom error template (#7892) 2022-07-28 03:23:10 -07:00
zou rui
2852e2998c
feat: support enbale nginx debug_connection (#8637) 2022-06-10 04:01:46 -07:00
Maksim Nabokikh
2c27e66cc7
feat: always set auth cookie (#8213)
* feat: always set auth cookie

Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>

* feat: Add annotation to always set auth cookie

* Add annotation
* Add global configmap key
* Provide unit tests and e2e tests
* Fix e2e documentation autogen script

Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>

* Regenerate e2e tests

Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
2022-05-19 15:27:53 -07:00
Florian Michel
ee50e38b44
disable modsecurity on error page (#8202)
* disable modsecurity on error page

* fix modsecurity error pages test

* fix variable in nginx template

* disable modsecurity on all internal locations

* fix pipeline checks for gofmt

Signed-off-by: Florian Michel <florianmichel@hotmail.de>
2022-05-04 08:29:51 -07:00
Chris Shino
f9372aa495
added new auth-tls-match-cn annotation (#8434)
* added new auth-tls-match-cn annotation

* added few more tests
2022-04-15 12:59:10 -07:00
sskserk
d4b9b486e6
Upstream keepalive time (#8319)
* nginx 1.19.10 keepalive_time parameter

* nginx v1.19.10 base image

* keepalive_time documentation

* base image

* restore base image

* e2e test

* replace default value in test
2022-04-15 04:09:10 -07:00
Filip Havlíček
db4aeea723
Fallback to ngx.var.scheme for redirectScheme with use-forward-headers when X-Forwarded-Proto is empty (#8468) 2022-04-13 20:06:48 -07:00
Ricardo Katz
3def835a6a
Jail/chroot nginx process inside controller container (#8337)
* Initial work on chrooting nginx process

* More improvements in chroot

* Fix charts and some file locations

* Fix symlink on non chrooted container

* fix psp test

* Add e2e tests to chroot image

* Fix logger

* Add internal logger in controller

* Fix overlay for chrooted tests

* Fix tests

* fix boilerplates

* Fix unittest to point to the right pid

* Fix PR review
2022-04-08 21:48:04 -07:00
Gabor Lekeny
83ce21b4dd
Add keepalive support for auth requests (#8219)
* Add keepalive support for auth requests

* Fix typo

* Address PR comments

* Log warning when auth-url contains variable in its host:port
* Generate upstream name without replacing dots to underscores in server name
* Add comment in the nginx template when the keepalive upstream block is referenced

* Workaround for auth_request module ignores keepalive in upstream block

* The `auth_request` module does not support HTTP keepalives in upstream block:
  https://trac.nginx.org/nginx/ticket/1579
* As a workaround we use ngx.location.capture but unfortunately it does not
  support HTTP/2 so `use-http2` configuration parameter is needed.

* Handle PR comments

* Address PR comments

* Handle invalid values for int parameters

* Handle PR comments

* Fix e2e test
2022-04-08 20:22:04 -07:00
Ana Claudia Riekstin
c1be3499eb
Adding some geoip variables and default values (#8159)
* adding geoIp variables that Shopify uses

* adding source remote_addr for geoip2-isp
2022-02-07 09:53:44 -08:00
Alois
0bc01f7c35
Updating from/to www redirect to use X-Forwarded-Proto (#7623) 2022-01-16 14:17:28 -08:00
Tomáš Mózes
a14edba8d5
Expose GeoIP2 Continent code as variable (#8072) 2021-12-29 16:02:50 -08:00
Tobias Salzmann
ce9deaa332
Add stream-snippet as a ConfigMap and Annotation option (#8029)
* stream snippet

* gofmt -s
2021-12-23 11:46:30 -08:00
Moh Basher
fea7fed6da
Disable default modsecurity_rules_file if modsecurity-snippet is specified (#8021)
* Disabled default modsecurity_rules_file if modsecurity-snippet is specifed

The default modsecurity_rules_file overwrites the ModSecurity-snippet if it is specified with custom config settings like "SecRuleEngine On". This will not let Modsecurity be in blocking mode even if "SecRuleEngine On" is specified in the ModSecurity-snippet configuration

* Remove unnecessary comments

Only have the default Modsecurity conf settings in case Modsecurity configuration snippet is not present and remove unnecessary comments

* Fixed modsecurity default file only if Modsecurity snippet present

Fixed if condition  Modsecurity snippet present have modsecurity default config file

* Added e2e test to disabling modsecurity conf

Added e2e in case modsecurity-snippet enabled to disable settings in default modsecurity.conf

* Validate writing to a different location

Validate also modsecurity to write to a different location instead of the default directory

* Fixed the formatting

* Fixed if empty ModsecuritySnippet

* Fixed ModsecuritySnippet condition

* Fixed the condition also in ingress controller template

* Removed the default config condition  in ingress controller template

* Fixed the default config condition in ingress controller template

* Fixed pull-ingress-nginx-test

* Revert "Fixed the default config condition in ingress controller template"

This reverts commit 9d38eca40f.

* Revert template_test

* Adjusted the formating %v
2021-12-23 03:34:38 -08:00
Ansil H
a03895d91e
Add ssl_reject_handshake to defaul server (#7977)
* Add ssl_reject_handshake to defaul server

* Added SSLRejectHandshake to NewDefault

* Added documentation
2021-11-29 08:33:23 -08:00
Christopher Larivière
65b8eeddec
Support cors-allow-origin with multiple origins (#7614)
* Add Initial support for multiple cors origins in nginx

- bump cluster version for `make dev-env`
- add buildOriginRegex function in nginx.tmpl
- add e2e 4 e2e tests for cors.go
- refers to feature request #5496

* add tests + use search to identify '*' origin

* add tests + use search to identify '*' origin

Signed-off-by: Christopher Larivière <lariviere.c@gmail.com>

* fix "should enable cors test" looking at improper values

* Modify tests and add some logic for origin validation

- add origin validation in cors ingress annotations
- add extra tests to validate regex
- properly escape regex using "QuoteMeta"
- fix some copy/paste errors

* add TrimSpace and length validation before adding a new origin

* modify documentation for cors and remove dangling comment

* add support for optional port mapping on origin

* support single-level wildcard subdomains + tests

* Remove automatic `*` fonctionality from incorrect origins

- use []string instead of basic string to avoid reparsing in template.go
- fix typo in docs
- modify template to properly enable only if the whole block is enabled
- modify cors parsing
- test properly by validating that the value returned is the proper
  origin
- update unit tests and annotation tests

* Re-add `*` when no cors origins are supplied + fix tests

- fix e2e tests to allow for `*`
- re-add `*` to cors parsing if trimmed cors-allow-origin is empty
(supplied but empty) and if it wasn't supplied at all.

* remove unecessary logic for building cors origin + remove comments

- add some edge cases in e2e tests
- rework logic for building cors origin

there was no need for logic in template.go for buildCorsOriginRegex
if there is a `*` it ill be short-circuited by first if.

if it's a wildcard domain or any domain (without a wildcard), it MUST
match the main/cors.go regex format.

if there's a star in a wildcard domain, it must be replaced with
`[A-Za-z0-9]+`

* add missing check in e2e tests
2021-11-02 12:31:42 -07:00
Rahil Patel
c8ab4dc307
add brotli-min-length configuration option (#7854)
* add `brotli-min-length` configuration option

* add e2e tests for brotli

* include check for expected content type

* fix header and format
2021-11-02 04:52:59 -07:00
Matthew Silverman
7d5452d00b
configmap: option to not trust incoming tracing spans (#7045)
* validate the sender of tracing spans

* add location-specific setting
2021-10-24 14:36:21 -07:00
Alex R
9e3c528640
Disable builtin ssl_session_cache (#7777)
Signed-off-by: Alex R <i@sepa.spb.ru>
2021-10-08 11:47:23 -07:00