1
0
mirror of https://github.com/thib8956/nginx-proxy synced 2025-02-24 17:58:16 +00:00

169 Commits

Author SHA1 Message Date
浊酒
af877cf784 feat: Add proxy header X-Forwarded-Host
Co-authored-by: Richard Hansen <rhansen@rhansen.org>
2022-12-26 17:59:50 -05:00
Nicolas Duchon
6f4f9ec20c
Merge pull request #1927 from rhansen/untrusted-headers
feat: Option to not trust `X-Forwarded-*` headers from clients
2022-12-26 20:47:05 +01:00
Nicolas Duchon
7c0d38cd2e
Merge pull request #1985 from hiqdev/networks-order
Make sure networks order is the same
2022-12-26 16:59:41 +01:00
Richard Hansen
8aa00fcea2 feat: Option to not trust X-Forwarded-* headers from clients
If header values from a malicious client are passed to the backend
server unchecked and unchanged, the client may be able to subvert
security checks done by the backend server.
2022-12-19 02:48:01 -05:00
dependabot[bot]
e5b340cb6f
chore(deps): bump docker from 5.0.3 to 6.0.1 in /test/requirements
Bumps [docker](https://github.com/docker/docker-py) from 5.0.3 to 6.0.1.
- [Release notes](https://github.com/docker/docker-py/releases)
- [Commits](https://github.com/docker/docker-py/compare/5.0.3...6.0.1)

---
updated-dependencies:
- dependency-name: docker
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-01 14:30:16 +00:00
dependabot[bot]
b53e09373a
chore(deps): bump backoff from 1.11.1 to 2.2.1 in /test/requirements
Bumps [backoff](https://github.com/litl/backoff) from 1.11.1 to 2.2.1.
- [Release notes](https://github.com/litl/backoff/releases)
- [Changelog](https://github.com/litl/backoff/blob/master/CHANGELOG.md)
- [Commits](https://github.com/litl/backoff/compare/v1.11.1...v2.2.1)

---
updated-dependencies:
- dependency-name: backoff
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-01 13:02:13 +00:00
dependabot[bot]
302ecfff51
chore(deps): bump requests from 2.27.1 to 2.28.1 in /test/requirements
Bumps [requests](https://github.com/psf/requests) from 2.27.1 to 2.28.1.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.27.1...v2.28.1)

---
updated-dependencies:
- dependency-name: requests
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-01 12:00:48 +00:00
dependabot[bot]
d23a746833
chore(deps): bump pytest from 7.1.2 to 7.2.0 in /test/requirements
Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.1.2 to 7.2.0.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/7.1.2...7.2.0)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-26 04:21:21 +00:00
SilverFire - Dmitry Naumenko
510d376f00 Make sure networks order is the same 2022-05-11 12:56:18 +00:00
dependabot[bot]
20e76ac7a6
chore(deps): bump pytest from 7.1.1 to 7.1.2 in /test/requirements
Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.1.1 to 7.1.2.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/7.1.1...7.1.2)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-25 04:22:00 +00:00
dependabot[bot]
1cc3bbf5ce
chore(deps): bump pytest from 7.0.1 to 7.1.1 in /test/requirements
Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.0.1 to 7.1.1.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/7.0.1...7.1.1)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-18 04:16:58 +00:00
Gilles Filippini
5aba125fb7
chore: do not copy useless files into the image
Move required files but 'nginx.tmpl' into a local 'app' folder and copy the
folder content into the image.

'nginx.tmpl' should be moved as well, but this is a breaking change for
configuration with a separate 'docker-gen' container.
2022-03-07 16:01:15 +01:00
Nicolas Duchon
0185a2971c
tests: fix virtual path tests for new dhparam 2022-02-24 15:21:14 +01:00
Alexander Lieret
7ede0fa4b9
test: fix: Rename new test files 2022-02-24 15:08:18 +01:00
Alexander Lieret
2509fc1076
test: Add test cases for NETWORK_ACCESS=internal 2022-02-24 15:08:18 +01:00
Alexander Lieret
6a580ad664
test: Add test case for location config priority 2022-02-24 15:08:18 +01:00
Alexander Lieret
4099fcd618
test: Add test case for default app redirect
Co-authored-by: Jonathan Underwood <junderwood@bitcoinbank.co.jp>
2022-02-24 15:08:18 +01:00
Alexander Lieret
e08b3487c9
test: Add test to cover SSL of path-based routing 2022-02-24 15:08:18 +01:00
Alexander Lieret
33eab70d32
feat: Add custom location block to virtual paths
This features allows the custom location blocks to be added to the
virtual path based routing. The custom config can be specified for each
container individually.
2022-02-24 15:08:17 +01:00
Alexander Lieret
4b85e95824
feat: Replace path stripping with variable
This commit removes the automatic path stripping and replaces it with a
user configurable environment variable. This can be set individually for
each container.
2022-02-24 15:08:17 +01:00
Alexander Lieret
9df330e51e
feat: Add user customizable default root response 2022-02-24 15:08:15 +01:00
Alexander Lieret
fc4c4e17ca
ci: Add tests for the virtual-path routing
@gregsymons test cases were too outdated to be ported easily. The new
tests should include the coverage of the old ones.
2022-02-24 15:07:02 +01:00
Robin Windey
18027fa71b
Add container logs in case testcontainer exited unexpectedly 2022-02-20 15:10:05 +01:00
dependabot[bot]
42535c01d9
chore(deps): bump pytest from 7.0.0 to 7.0.1 in /test/requirements
Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.0.0 to 7.0.1.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/7.0.0...7.0.1)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-14 04:20:00 +00:00
dependabot[bot]
dc8094daf5
chore(deps): bump pytest from 6.2.5 to 7.0.0 in /test/requirements
Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.5 to 7.0.0.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/6.2.5...7.0.0)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-07 04:23:26 +00:00
Nicolas Duchon
e22ae4a6fd
tests: display container version 2022-01-12 10:17:49 +01:00
Nicolas Duchon
fde0e809e4
chore: jwilder/docker-gen > nginx-proxy/docker-gen 2022-01-11 19:55:29 +01:00
Nicolas Duchon
ed7b17d9d7
Merge pull request #1856 from polarathene/tests/fix-container-networking
tests: Fix pytest container networking issues
2022-01-06 10:32:40 +01:00
dependabot[bot]
b9ac4b936e
chore(deps): bump requests from 2.26.0 to 2.27.1 in /test/requirements
Bumps [requests](https://github.com/psf/requests) from 2.26.0 to 2.27.1.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.26.0...v2.27.1)

---
updated-dependencies:
- dependency-name: requests
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-06 04:21:32 +00:00
polarathene
6b3ee66783 chore: white-space housekeeping
Noticed some trailing white-space. Removed for consistency with the rest of the file.
2022-01-01 01:39:51 +13:00
polarathene
115461744b fix: Skip IPv6 when forced but not available + avoid none network
A test on raw IP addresses doesn't reach the existing IPv6 skip logic, added that to avoid a test failing when only IPv4 is available (eg: standard docker container networks).

Additionally some other tests set the `none` network and connecting to this fails as it's not allowed? Preventing that from happening resolves the final failing tests within containerized pytest.
2022-01-01 01:38:13 +13:00
polarathene
04b0181980 fix: Ensure networks are actually connected to pytest container
The `network` object would never be in a list of network names (strings), and without `greedy=True` arg as the `docker-py` API docs note, the containers will not be part of the results, thus always returning an empty list which was not intended..

Now the network will properly match the current networks for pytest container, avoiding duplicate connect attempts, and the network list result will actually have containers to count when filtering by length.
2021-12-31 22:30:49 +13:00
polarathene
0e5d97a268 fix: Don't connect pytest container to networks when using host network
This is not compatible or required, since host networking is no longer isolated to container networks only.
2021-12-31 22:14:26 +13:00
polarathene
b2b4c71997 fix: Don't remove pytest container when running with host network mode
When the container runs with host networking instead of the default bridge, the `$HOSTNAME` / `/etc/hostname` reflects that of the host instead of the container ID , which causes the pytest container to get removed accidentally.

Using a container name instead we can more reliably target the container to avoid removing it, should we need to run with host networking instead.
2021-12-31 22:12:25 +13:00
polarathene
e748d53a1f chore: Extract hostname access to a var
DRY and clearer that we're referring to the pytest container.
2021-12-31 21:51:40 +13:00
polarathene
93c04dce8d fix: Properly detect pytest running via container
The original `/.dockerenv` approach is no longer valid, and context wise we're only using this for the test suite, so using an ENV in that container is a better solution.
2021-12-31 21:42:38 +13:00
polarathene
c5166f580e tests: Add utility method to verify TLS chain of trust 2021-12-21 18:44:51 +13:00
polarathene
9dc9d90d34 tests: Verify site-specific DH params feature works correctly
This addition requires usage of `DEFAULT_HOST` on containers tested to ensure they don't accidentally use `web2` as their default fallback (due to no SNI / `-servername` requested in openssl queries), otherwise they would be testing against the incorrect DH params response.

They could alternatively request an FQDN explicitly as well, instead of relying on implicit fallback/default server selection behaviour.

---

`web2.nginx-proxy.tld.dhparam.pem` is a copy of `ffdhe2048.pem`.
2021-12-21 18:41:43 +13:00
polarathene
0f15130476 tests: Verify correct DH group size when negotiating
Additionally allows for adding extra openssl params when needed.
2021-12-21 18:41:43 +13:00
polarathene
75528bdfcb chore: Refactor checksum comparisons
- Use a DRY method instead.
- ENV test changed from 2048-bit to 3072-bit to avoid confusion in a future test that should not be mixed up accidentally with 2048-bit elsewhere.
- Custom DH file test comparison changed to match other comparisons for equality against the expected DH param content.
- Related comments revised, additional comment for context added by the test definition.
- Minor white-space adjustments.
2021-12-21 18:41:43 +13:00
Nicolas Duchon
496e0f5f27
tests: mark test_deleted_cert as xfail
test_delete_cert_and_restart_reverseproxy still fails intermitently
2021-12-15 13:01:38 +01:00
Nicolas Duchon
83e3b25c46
Merge pull request #1797 from polarathene/feat/prefer-rfc-7919-dhparams
feat: Use RFC 7919 DH groups + Remove DH generation
2021-10-21 08:35:39 +02:00
Nicolas Duchon
36c4ed7632
test: replace test dhparam.pem with ffdhe3072.pem 2021-10-20 21:04:29 +02:00
Nicolas Duchon
ab7ac0aadb
fix: backward compatibility w/ DHPARAM_GENERATION
Also use true rather than 1 to stay consistent
with other boolean environment variables
2021-10-20 19:15:27 +02:00
dependabot[bot]
b1b1b700ea
chore(deps): bump docker from 5.0.2 to 5.0.3 in /test/requirements
Bumps [docker](https://github.com/docker/docker-py) from 5.0.2 to 5.0.3.
- [Release notes](https://github.com/docker/docker-py/releases)
- [Commits](https://github.com/docker/docker-py/compare/5.0.2...5.0.3)

---
updated-dependencies:
- dependency-name: docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-08 04:27:38 +00:00
polarathene
41bd4076c0 chore: DRY up test_dhparam.yml
Use YAML anchors for repeated values providing a single source of truth.

I would use `x-*` convention to store anchors above service containers, but this seems to require a compose config that defines the services (and version?) keys, which this test setup was failing to be compatible with for some reason..
2021-09-29 15:20:08 +13:00
polarathene
0cd573f043 tests(pytest.sh): Update Syntax
- Added clarification comment of the DIR command
- Quoted `ARGS` usage required wrapping `ARGS` assignment in an array to properly expand. This wasn't broken before, but is required change to keep ShellCheck  lint happy.
- Quote wrapped `DIR` usage, the volume target had an extra `/` before the `DIR` which seems unnecessary as `pwd` should return absolute path.
- Expanded `docker run` options to long-form.
2021-09-28 21:59:53 +13:00
polarathene
e81001615c tests: Improve error handling output and use regular string comparisons
As this project isn't exactly python focused apart from the test suite, I'll assume other contributors are probably not as experienced with python either. Since this is a rather technical test, the extra comments should help grok the functionality without floundering around with the docs.

When the subprocess raises an exception due to an issue with the command (_eg using `-CAfile` arg to `openssl` with an invalid path_), the tests would output large walls of text that wasn't particularly helpful in troubleshooting the issue. `stderr` was also leaking out inbetween the test case results in the terminal, this has been resolved by ensuring that output is caught and piped, which keeps it available to python when an exception is raised. Identifying the actual error cause and location is now much nicer.

Updated the output to be plain string content instead of byte strings, this works fine :)
2021-09-28 21:59:53 +13:00
polarathene
1d2f308cdf feat: Bring back ability to skip default DH params
Adds back the ability to avoid using DH params, provided no file was explicitly supplied.

This used to be `DHPARAM_GENERATION=false`, the equivalent is now `DHPARAM_SKIP=1` (default 0). Previous name was no longer appropriate.

Ensures that if a user has explicitly provided their own dhparam file to still output a warning instead of the skip message, since `DHPARAM_SKIP=1` doesn't disable the support in nginx.
2021-09-28 21:59:53 +13:00
polarathene
fd35a09240 tests: Revise dhparams tests
- `dhparam_generation` tests are no longer necessary, dropped.

Modified the remaining `dhparam` test to use multiple `nginx-proxy` images to verify correct behavior for different configs.

Tests now cover:

- Default (ffdhe4096) is used.
- Alternative via ENV (ffdhe2048) works correctly.
- Invalid group via ENV (1024-bit) fails.
- Custom DH params provided via file mount works with warning emitted.

---

- `assert_log_contains`: added a `container_name` arg with `nginxproxy` as the default value. This allows multiple nginx-proxy containers to utilize this method instead.

- Extracted out the `openssl` test (_to `negotiate_cipher()`_) and modified it to be a bit more flexible. It now takes a container with optional extra args to pass to `openssl` command called, as well as the `grep` string to match. This made the original test redundant, so I've dropped it.

- Added two methods to use `negotiate_cipher()`, one verifies a DHE cipher suite was negotiated and checks that a DH emphermal key was also mentioned in the output. The other method verifies the expectation of failing to negotiate a valid cipher if DH params have not been set, while verifying that non-DHE cipher suites can be successfully negotiated.

- Added a `get_env()` method for extracting attached environments on a container. This is useful for verifying invalid `DHPARAM_BITS` values (eg `1024`-bit).

- The original `Server Temp Key` assertion was incorrect, it was expecting a value that is unrelated to DHE cipher suite support (_`X25519` is related to ECDHE_). This is due to TLS 1.3 being negotiated where you cannot use custom DH params, nor influence the negotiated cipher due to this mechanism changing from TLS 1.3. TLS 1.3 does support DH params, but it internally negotiates RFC 7919 group between server and client instead. Thus to verify expectations, the connection via `openssl` is made explicitly with TLS 1.2 instead.
2021-09-28 21:59:53 +13:00