Compare commits

..
Author SHA1 Message Date
Thomas Schweiger b3dd57b573 fix: make oidc client using proxy env settings 2026-09-10 13:06:16 +02:00
5 changed files with 42 additions and 30 deletions

No files matched your search

+24 -16
View File
@@ -97,15 +97,19 @@ func Server(cfg *config.Config) *cobra.Command {
return err
}
// Clone the default transport so that the proxy configuration from the
// environment (HTTP_PROXY, HTTPS_PROXY, NO_PROXY) is honored when talking
// to the IDP. A bare &http.Transport{} leaves Proxy nil and never proxies.
oidcTransport := http.DefaultTransport.(*http.Transport).Clone()
oidcTransport.TLSClientConfig = &tls.Config{
MinVersion: tls.VersionTLS12,
InsecureSkipVerify: cfg.OIDC.Insecure, //nolint:gosec
}
oidcTransport.DisableKeepAlives = true
oidcHTTPClient := &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
MinVersion: tls.VersionTLS12,
InsecureSkipVerify: cfg.OIDC.Insecure, //nolint:gosec
},
DisableKeepAlives: true,
},
Timeout: time.Second * 10,
Transport: oidcTransport,
Timeout: time.Second * 10,
}
oidcClient := oidc.NewOIDCClient(
@@ -272,15 +276,19 @@ func loadMiddlewares(logger log.Logger, cfg *config.Config,
logger.Fatal().Msgf("Invalid role assignment driver '%s'", cfg.RoleAssignment.Driver)
}
// Clone the default transport so that the proxy configuration from the
// environment (HTTP_PROXY, HTTPS_PROXY, NO_PROXY) is honored when talking
// to the IDP. A bare &http.Transport{} leaves Proxy nil and never proxies.
oidcTransport := http.DefaultTransport.(*http.Transport).Clone()
oidcTransport.TLSClientConfig = &tls.Config{
MinVersion: tls.VersionTLS12,
InsecureSkipVerify: cfg.OIDC.Insecure, //nolint:gosec
}
oidcTransport.DisableKeepAlives = true
oidcHTTPClient := &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
MinVersion: tls.VersionTLS12,
InsecureSkipVerify: cfg.OIDC.Insecure, //nolint:gosec
},
DisableKeepAlives: true,
},
Timeout: time.Second * 10,
Transport: oidcTransport,
Timeout: time.Second * 10,
}
var authenticators []middleware.Authenticator
+2 -2
View File
@@ -13,7 +13,7 @@ Fill the new index by indexing all spaces again:
```shell
# the service keeps running while it happens
opencloud search index --all-spaces --insecure
opencloud search index --all-spaces
```
Once the new index is filled, every index but the one with the highest
@@ -31,7 +31,7 @@ The new index is a directory next to the old `bleve` one, both in
bleve index cannot be copied, index all spaces again:
```shell
opencloud search index --all-spaces --insecure
opencloud search index --all-spaces
```
Once the new index is filled, every directory but the one with the highest
+2 -2
View File
@@ -124,14 +124,14 @@ opencloud search index --space $SPACE_ID
It can also be used to re-index all spaces:
```shell
opencloud search index --all-spaces --insecure
opencloud search index --all-spaces
```
Please note that a reindex only picks up new or changed files. Files that have already been indexed are not scanned again, even if the configuration or the whole extractor has been changed. To force a full rescan (re-running the extractor on every file) you need to use the `force-rescan` flag:
```shell
opencloud search index --all-spaces --force-rescan --insecure
opencloud search index --all-spaces --force-rescan
```
## Metrics
+2 -2
View File
@@ -27,7 +27,7 @@ func Reconcile(index string, r SchemaReconciler, logger log.Logger) (Classificat
case VerdictAdditive:
persisted, err := r.ApplyAdditive()
if persisted {
logger.Warn().Strs("fields", classification.NewFields).Str("index", index).Msg("extended the search index mapping with new fields; documents indexed before the upgrade do not contain them and queries on these fields will miss those documents until they are re-indexed; to re-index everything run: opencloud search index --all-spaces --force-rescan --insecure")
logger.Warn().Strs("fields", classification.NewFields).Str("index", index).Msg("extended the search index mapping with new fields; documents indexed before the upgrade do not contain them and queries on these fields will miss those documents until they are re-indexed; to re-index everything run: opencloud search index --all-spaces --force-rescan")
}
if err != nil {
return classification, err
@@ -40,5 +40,5 @@ func Reconcile(index string, r SchemaReconciler, logger log.Logger) (Classificat
// LogNewIndexCreated logs that a fresh, empty index was created and how to
// backfill it. The create path does not run through Reconcile.
func LogNewIndexCreated(logger log.Logger, index string) {
logger.Info().Str("index", index).Msg("created a new empty search index; if this OpenCloud instance already held files, they are not in it yet, index them by running: opencloud search index --all-spaces --force-rescan --insecure")
logger.Info().Str("index", index).Msg("created a new empty search index; if this OpenCloud instance already held files, they are not in it yet, index them by running: opencloud search index --all-spaces --force-rescan")
}
+12 -8
View File
@@ -72,15 +72,19 @@ func Server(opts ...Option) (ohttp.Service, error) {
),
)
// Clone the default transport so that the proxy configuration from the
// environment (HTTP_PROXY, HTTPS_PROXY, NO_PROXY) is honored when talking
// to the IDP. A bare &http.Transport{} leaves Proxy nil and never proxies.
oidcTransport := http.DefaultTransport.(*http.Transport).Clone()
oidcTransport.TLSClientConfig = &tls.Config{
MinVersion: tls.VersionTLS12,
InsecureSkipVerify: options.Config.Insecure, //nolint:gosec
}
oidcTransport.DisableKeepAlives = true
var oidcHTTPClient = &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
MinVersion: tls.VersionTLS12,
InsecureSkipVerify: options.Config.Insecure, //nolint:gosec
},
DisableKeepAlives: true,
},
Timeout: time.Second * 10,
Transport: oidcTransport,
Timeout: time.Second * 10,
}
mux.Use(middleware.OidcAuth(