Commit Graph

34 Commits

Author SHA1 Message Date
Matthieu MOREL bf4324d1fa
[chore]: enable extra-rules from gofumpt and paramTypeCombine from go-critic (#13479)
#### Description

Check if code and import statements are formatted, with additional
rules.

* https://golangci-lint.run/usage/formatters/#gofumpt
* https://go-critic.com/overview.html#paramtypecombine

This is the application of golangci-lint fmt ./... , the Makefile has
been update to include this behavior

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Co-authored-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2025-07-30 14:57:53 +00:00
Matthew Sainsbury 7d3e03e500
[chore] replace deprecated tenv with usetesting (#12576)
#### Description
There are a bunch of warnings in the lint output about tenv being
deprecated, and moving to usetesting. Reference:
https://golangci-lint.run/usage/linters/#tenv

#### Link to tracking issue
none

#### Testing
Ran `make golint` and `make all`
<!--Describe the documentation added.-->

---------

Co-authored-by: Pablo Baeyens <pablo.baeyens@datadoghq.com>
2025-03-07 19:42:15 +00:00
Vihas Makwana c119b2a55e
[configtls] add new config to specify TLS curve preferences (#12174)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Allow users to mention their preferred curve types for ECDHE handshake.
Add a new config option for this.
This will provide users with more control over specific settings during
the handshake process.

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Added

<!--Describe the documentation added.-->
#### Documentation
Updated readme<!--Please delete paragraphs that you did not use before
submitting.-->

Note: Please let me know if I need to open an issue for this.
2025-01-30 00:02:11 +00:00
Matthieu MOREL 808fb7c260
[chore]: enable gofumpt linter in client, cmd, component, config and confmap (#11587)
#### Description

[gofumpt](https://golangci-lint.run/usage/linters/#gofumpt) is a
stricter format than gofmt, while being backwards compatible.

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-12-11 08:50:57 +00:00
Matthieu MOREL 0204d957e5
[chore]: enable whitespace linter (#11579)
#### Description

[whitespace](https://golangci-lint.run/usage/linters/#whitespace) is a
linter that checks for unnecessary newlines at the start and end of
functions.

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-10-31 12:15:54 -07:00
Nathan Baulch 42e6304f65
Fix typos (#11348)
Just thought I'd contribute some typo fixes I stumbled upon. Nothing
controversial (hopefully), just 72 simple fixes.

Use the following command to get a quick and dirty summary of the
specific corrections made:
```shell
git diff HEAD^! --word-diff-regex='\w+' -U0 \
  | grep -E '\[\-.*\-\]\{\+.*\+\}' \
  | sed -r 's/.*\[\-(.*)\-\]\{\+(.*)\+\}.*/\1 \2/' \
  | sort | uniq -c | sort -n
```

FWIW, the top typos are:
* invokable (16)
* subsciption (15)
* decison (7)
* reques (3)
* dissallow (3)
* documenation (3)
* locahost (3)
* prerequistes (2)
* assinged (2)
* extenions (2)

---------

Co-authored-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-10-09 15:43:52 -07:00
Matthieu MOREL aba139c2cb
[chore]: use ErrorContains and EqualError (#11295)
#### Description

Testifylint doesn't support it yet. 
This replaces `Contains(t, err.Error()` by `ErrorContains(t, err` and
`Equal(t, err.Error()` by `EqualError(t, err`
As they both check for nil error it becomes useless to check it yourself
without having defined a custom message

<!-- Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com> -->

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-09-28 08:06:09 -07:00
Matthieu MOREL 37f783308e
[chore]: enable require-error rule from testifylint (#11199)
#### Description

Testifylint is a linter that provides best practices with the use of
testify.

This PR enables
[require-error](https://github.com/Antonboom/testifylint?tab=readme-ov-file#require-error)
rule from [testifylint](https://github.com/Antonboom/testifylint)

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-09-18 15:02:22 -07:00
Matthieu MOREL 2720f59f97
[chore]: enable error-nil and nil-compare rules from testifylint (#11120)
#### Description

Testifylint is a linter that provides best practices with the use of
testify.

This PR enables
[error-nil](https://github.com/Antonboom/testifylint?tab=readme-ov-file#error-nil)
and
[nil-compare](https://github.com/Antonboom/testifylint?tab=readme-ov-file#nil-compare)
rules from [testifylint](https://github.com/Antonboom/testifylint)

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-09-10 14:34:29 -07:00
Tyler Helmuth 06424935fd
[configtls] Add NewDefault* funcs (#9658)
Adds new `NewDefault*` funcs for all 3 config structs. 

In anticipation of the name changes from
https://github.com/open-telemetry/opentelemetry-collector/pull/9495 I've
named the functions using the new, preferred name.

Closes https://github.com/open-telemetry/opentelemetry-collector/issues/9657
2024-04-15 10:21:32 -07:00
Tyler Helmuth 282a594a13
[configtls] Deprecate *Context funcs (#9945)
Works towards
https://github.com/open-telemetry/opentelemetry-collector/issues/9811
2024-04-15 10:19:52 -07:00
Tyler Helmuth 1038b67c85
[configtls] Removed deprecated structs (#9786)
**Description:** <Describe what has changed.>
Removed deprecated structs

**Link to tracking Issue:** <Issue number if applicable>
Related to
https://github.com/open-telemetry/opentelemetry-collector/issues/9428
Related to
https://github.com/open-telemetry/opentelemetry-collector/issues/9474
Closes
https://github.com/open-telemetry/opentelemetry-collector/issues/9548
2024-03-27 19:14:07 +01:00
Tyler Helmuth 407ea439e3
[configtls] Add context.Context to public functions (#9813)
**Description:**
Opening this PR to prompt discussion about `configtls` and
`context.Context`.

We could add `context.Context` to these public functions and go through
the long deprecation/rename process, but I want to make sure it is
valuable.

Arguments against this PR:
- There isn't anything within these functions that currently rely on a
`context.Context`.
- There isn't anything inside these functions interact with the network.

Arguments in favor of this PR:
- Interacts with filesystem.
- Go best practice to allow passing context.

**Link to tracking Issue:** 
Related to
https://github.com/open-telemetry/opentelemetry-collector/issues/9811

---------

Co-authored-by: Andrzej Stencel <astencel@sumologic.com>
2024-03-27 18:33:34 +01:00
Tyler Helmuth a327d55eda
[configtls] Update IncludeSystemCACertsPool to be used in server and client RootCAs (#9835)
**Description:** 
Updates `ServerConfig` and `ClientConfig` to use
`IncludeSystemCACertsPool` when doing `LoadTLSConfig`. Previously
`IncludeSystemCACertsPool` was only used for `ServerConfig`'s
`ClientCAs` via `newClientCAsReloader`.

**Link to tracking Issue:** 
Closes
https://github.com/open-telemetry/opentelemetry-collector/issues/9789

**Testing:** 
Added more tests
2024-03-26 20:08:08 -07:00
molejnik88 d9e00e0bc0
[config/configtls] Validate MinVersion and MaxVersion (#9664)
**Description:**
Add `Validate()` method to `TLSSetting` and validate tls `min_version`
and `max_version`.

**Link to tracking Issue:** 
#9475
2024-03-07 14:20:26 -08:00
Antoine Toulme 62050a241a
[configtls] add include_system_ca_certs_pool (#9142)
**Description:**
Add `include_system_ca_certs_pool` to configtls, allowing to load system
certs and additional custom certs.

**Link to tracking Issue:**
Fixes #7774
2024-02-28 21:59:21 -08:00
Arjun Mahishi 9a83b0aa44
[configtls] Rename config structs for consistency (#9495)
**Description:** 
Simply renames a few structs in the `configtls` package for consistence.

`TLSClientSetting` to `ClientConfig`
`TLSServerSetting` to `ServerConfig`
`TLSSetting` to `Config`

**Link to tracking Issue:** Fixes #9474
2024-02-28 20:57:43 -08:00
Antoine Toulme c1599feb23
[configtls] support setting cipher suites (#9168)
**Description:**
Add `cipher_suites` to configtls:
Users can specify a list of cipher suites to pick from. If left blank, a
safe default list is used.

**Link to tracking Issue:**
Fixes #8105

**Testing:**
Unit tests

**Documentation:**
godoc and README

---------

Co-authored-by: Alex Boten <aboten@lightstep.com>
2024-01-17 15:03:30 -08:00
Erik Baranowski 07262f2290
Add support to TLSSetting to not only read from file path, but from memory (#7676)
* Add in memory support to TLSSetting

Signed-off-by: erikbaranowski <39704712+erikbaranowski@users.noreply.github.com>

* Add changelog

Signed-off-by: erikbaranowski <39704712+erikbaranowski@users.noreply.github.com>

* Add documentation

Signed-off-by: erikbaranowski <39704712+erikbaranowski@users.noreply.github.com>

* Update some message verbiage

Signed-off-by: erikbaranowski <39704712+erikbaranowski@users.noreply.github.com>

* Fix up test error messages

Signed-off-by: erikbaranowski <39704712+erikbaranowski@users.noreply.github.com>

* swap PEM properties to confiqopaque.String instead of []byte

Signed-off-by: erikbaranowski <39704712+erikbaranowski@users.noreply.github.com>

* make linter happy

Signed-off-by: erikbaranowski <39704712+erikbaranowski@users.noreply.github.com>

* Fix unit test for windows

Signed-off-by: Erik Baranowski <39704712+erikbaranowski@users.noreply.github.com>

---------

Signed-off-by: erikbaranowski <39704712+erikbaranowski@users.noreply.github.com>
Signed-off-by: Erik Baranowski <39704712+erikbaranowski@users.noreply.github.com>
2023-06-07 16:42:17 -07:00
Alex Boten 80d704deb4
[chore] use license shortform (#7694)
* [chore] use license shortform

To remain consistent w/ contrib repo, see https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/22052

Signed-off-by: Alex Boten <aboten@lightstep.com>

* make goporto

Signed-off-by: Alex Boten <aboten@lightstep.com>

---------

Signed-off-by: Alex Boten <aboten@lightstep.com>
2023-05-18 13:11:17 -07:00
Attila Korompai b2961b799e
Reload client CAs in server TLS settings on file change (#6708)
Reload client CAs in server TLS settings when file has been modified

Link to tracking Issue: #6524
---------

Co-authored-by: Alex Boten <alex@boten.ca>
Co-authored-by: Ben B. <bongartz@klimlive.de>
2023-04-03 09:48:36 -07:00
Raphael Philipe Mendes da Silva 1eda0c4e4f
Use TLS 1.2 by default when min_version is not defined (#5956)
* Use TLS 1.2 by default when min_version is not defined

* Update changelog and docs

* Update changelog
2022-08-26 16:49:32 -07:00
Chester c0a735fc54
Fixing incorrect default TLS min and TLS max versions (#5480)
* Fixing incorrect TLS min and TLS max Versions by default

* Added test cases for TLS min and TLS max versions

* Added entry to changelog

* Added Invalid TLS test cases

* TLS MinVersion and TLS MaxVersion defaults to be handled by crypto/tls

* Removed description that can go out of sync
2022-06-27 02:57:26 -07:00
wdullaer 4bae71f986
feat(configtls): Add support for reloading TLS certificates (#4737) 2022-02-04 17:04:06 -08:00
Bogdan Drutu bb8dbc1a0c
Replace usage of path.Join with filepath.Join, better windows support (#4780)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2022-02-01 00:25:36 +00:00
Bogdan Drutu 7402e94080
Use path join instead on unix style paths in tests for testdata files (#4505)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-12-02 14:58:53 -08:00
JBD d4f068db60
Allow users to set min and max TLS versions (#3591)
* Allow users to set min and max TLS versions

Users want to be to choose the min and max versions they want to allow. Introduce two new settings to make the version range configurable.

* Make linter happy
2021-07-12 19:19:41 -07:00
Simon Sawert 74aadbc7d3
Add support to skip TLS verification (#2202)
Follow up from #933 where InsecureSkipVerify was discussed but not
implemented.
2020-11-24 09:17:24 -05:00
Jay Camp 1e65674799
Update copyright (#1597)
* Update copyright

* rebase
2020-08-19 18:25:44 -07:00
Bogdan Drutu 4b3f0d7804
mTLS: Add support to configure client CA and enforce ClientAuth (#1185)
* Change configtls to parse a tls.Config to allow re-using in http connections

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* mTLS: Add support to configure client CA and enforce ClientAuth.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-06-25 07:41:04 -07:00
Bogdan Drutu cddc04f027
Add protocol server settings and remove endpoint from ReceiverSettings (#1172)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-06-24 12:59:05 -07:00
Constance Caramanolis ed5a8de82b
Refactor SecureReceiverSettings to use TLSSetting (#1015)
* Refactor SecureReceiverSettings to use TLSSetting

* Address test code coverage failure

* Update file to use new license format

* Address few small comments
2020-06-02 13:04:27 -07:00
Bruno Garcia 8aa2731844
Remove year from copyright (#964) 2020-05-26 12:44:22 -04:00
Constance Caramanolis ca99122ca8
Refactor common client TLS configuration. (#988)
* Refactor common client TLS configuration.

* Formatting and such

* Add insecure options for test bed exporters

* Fix logic in opencensus exporter

* Add insecure flag to test configs

* Rename object and simplify loading of gRPC Credentials
2020-05-21 13:57:19 -07:00