Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c7f9cac8ce | ||
|
|
01b441f639 |
No files matched your search
@@ -591,121 +591,8 @@ jobs:
|
||||
- name: Run external-LDAP distributed smoke
|
||||
run: tests/ldap-smoke-distributed/run.sh
|
||||
|
||||
# API tests against a stand-alone NATS server in operator (JWT) mode. The embedded nats service
|
||||
# does not support JWT, so oCIS runs with OCIS_EXCLUDE_RUN_SERVICES=nats. The caches and the
|
||||
# userlog store use memory by default; OCIS_CACHE_STORE and OCIS_PERSISTENT_STORE move them to
|
||||
# NATS (nats-js-kv). The other stores use NATS by default.
|
||||
# tests/nats-jwt/verify.sh then checks that every client used the creds.
|
||||
nats-jwt-tests:
|
||||
needs: [build-and-test]
|
||||
name: natsJwt-${{ matrix.name }}-${{ matrix.creds }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
# events: postprocessing, storage-users, activitylog, search; stores: postprocessing, activitylog
|
||||
- name: events-stores
|
||||
creds: file
|
||||
suites: apiAsyncUpload,apiActivities,apiSearch1
|
||||
# events: sharing; stores: storage-system (shares), storage-publiclink (password links)
|
||||
- name: sharing
|
||||
creds: content
|
||||
suites: apiSharingNgShares,apiSharingNgItemLinkShare
|
||||
# userlog, eventhistory, and notifications (needs email)
|
||||
- name: notifications
|
||||
creds: file
|
||||
suites: apiNotification
|
||||
extra_consumers: notifications
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
|
||||
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
||||
with:
|
||||
node-version: "24"
|
||||
|
||||
- name: Enable pnpm
|
||||
run: corepack enable && corepack prepare pnpm@10.28.1 --activate
|
||||
|
||||
- uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0
|
||||
with:
|
||||
php-version: "8.4"
|
||||
extensions: curl, xml, mbstring, zip, ldap, gd
|
||||
tools: composer
|
||||
|
||||
- name: Start NATS in operator mode
|
||||
run: tests/nats-jwt/start-nats.sh
|
||||
env:
|
||||
NATS_JWT_DIR: ${{ runner.temp }}/nats-jwt
|
||||
|
||||
- name: Run ${{ matrix.suites }} with NATS JWT credentials (${{ matrix.creds }})
|
||||
env:
|
||||
NATS_JWT_DIR: ${{ runner.temp }}/nats-jwt
|
||||
CREDS_MODE: ${{ matrix.creds }}
|
||||
BEHAT_SUITES: ${{ matrix.suites }}
|
||||
OCIS_EXCLUDE_RUN_SERVICES: nats
|
||||
OCIS_CACHE_STORE: nats-js-kv
|
||||
OCIS_PERSISTENT_STORE: nats-js-kv
|
||||
run: |
|
||||
if [ "$CREDS_MODE" = "file" ]; then
|
||||
export OCIS_NATS_CREDS_FILE="$NATS_JWT_DIR/user.creds"
|
||||
else
|
||||
OCIS_NATS_CREDS="$(cat "$NATS_JWT_DIR/user.creds")"
|
||||
export OCIS_NATS_CREDS
|
||||
fi
|
||||
python3 tests/acceptance/run-github.py
|
||||
|
||||
# Run the checks also when the tests fail: a client without creds is the first thing to rule out.
|
||||
- name: Verify the NATS JWT account state
|
||||
if: ${{ !cancelled() }}
|
||||
env:
|
||||
NATS_JWT_DIR: ${{ runner.temp }}/nats-jwt
|
||||
NATS_JWT_EXTRA_BUCKETS: ${{ matrix.extra_buckets }}
|
||||
NATS_JWT_EXTRA_CONSUMERS: ${{ matrix.extra_consumers }}
|
||||
run: tests/nats-jwt/verify.sh
|
||||
|
||||
- name: NATS server log
|
||||
if: failure()
|
||||
run: docker logs nats-jwt
|
||||
|
||||
# Starts oCIS with the services that are off by default (audit, policies, antivirus, notifications),
|
||||
# and checks the /readyz endpoints. The readiness checks of the services use the creds.
|
||||
nats-jwt-startup-check:
|
||||
name: natsJwt-startup-check
|
||||
needs: [build-and-test]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
|
||||
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
||||
with:
|
||||
node-version: "24"
|
||||
|
||||
- name: Enable pnpm
|
||||
run: corepack enable && corepack prepare pnpm@10.28.1 --activate
|
||||
|
||||
# web/idp assets must be embedded for `ocis server` to come up (same as run-github.py)
|
||||
- name: Generate assets
|
||||
run: make ci-node-generate
|
||||
|
||||
- name: Build oCIS
|
||||
run: make -C ocis build
|
||||
|
||||
- name: Run the NATS JWT startup check
|
||||
run: tests/nats-jwt/startup-check.sh
|
||||
env:
|
||||
NATS_JWT_DIR: ${{ runner.temp }}/nats-jwt
|
||||
|
||||
all-acceptance-tests:
|
||||
needs: [local-api-tests, cli-tests, ldap-pool-tests, core-api-tests, litmus, cs3api, wopi-builtin, wopi-cs3, e2e-tests, external-ldap-tests, external-ldap-distributed-tests, nats-jwt-tests, nats-jwt-startup-check]
|
||||
needs: [local-api-tests, cli-tests, ldap-pool-tests, core-api-tests, litmus, cs3api, wopi-builtin, wopi-cs3, e2e-tests, external-ldap-tests, external-ldap-distributed-tests]
|
||||
runs-on: ubuntu-latest
|
||||
if: always()
|
||||
steps:
|
||||
|
||||
@@ -16,7 +16,7 @@ on:
|
||||
env:
|
||||
NODE_VERSION: '24'
|
||||
PNPM_VERSION: '10.28.1'
|
||||
GOLANG_BUILD_IMAGE: 'golang:1.26.8-alpine3.23@sha256:a8fa79c5bd40d880b52bd3b6d7669ecdcfd00e85facdd427d279efb5ddd79cb1'
|
||||
GOLANG_BUILD_IMAGE: 'golang:1.25.13-alpine3.23@sha256:42fc3368d1c50170a452f2bf4a1dfd292a065870c3f258d799aad4316671cb69'
|
||||
|
||||
jobs:
|
||||
determine-release-type:
|
||||
@@ -94,12 +94,10 @@ jobs:
|
||||
!.git
|
||||
retention-days: 1
|
||||
|
||||
# Disabled, like on stable-8.1, stable-8.2 and master. Image building, scanning
|
||||
# and publishing happen in the owncloud-docker/ocis repository, which keeps a
|
||||
# per-minor .trivyignore. Kept here (not deleted) to stay in sync with the
|
||||
# newer branches.
|
||||
# Builds the release image locally and runs the Trivy security gate against it.
|
||||
# Image publishing to Docker Hub happens in a separate repository; this job only
|
||||
# builds (load, no push) so the vulnerability gate still blocks a bad release.
|
||||
docker-build:
|
||||
if: false
|
||||
name: docker-build (${{ matrix.arch }})
|
||||
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-24.04' || 'ubuntu-24.04-arm' }}
|
||||
needs: [determine-release-type, generate-code, security-scan-trivy]
|
||||
@@ -255,7 +253,7 @@ jobs:
|
||||
|
||||
create-github-release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [determine-release-type, build-binaries, license-check, generate-changelog, security-scan-trivy]
|
||||
needs: [determine-release-type, build-binaries, license-check, generate-changelog, security-scan-trivy, docker-build]
|
||||
steps:
|
||||
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
|
||||
with:
|
||||
@@ -286,6 +284,7 @@ jobs:
|
||||
needs:
|
||||
- determine-release-type
|
||||
- generate-code
|
||||
- docker-build
|
||||
- build-binaries
|
||||
- security-scan-trivy
|
||||
- license-check
|
||||
@@ -319,6 +318,7 @@ jobs:
|
||||
needs:
|
||||
- determine-release-type
|
||||
- generate-code
|
||||
- docker-build
|
||||
- build-binaries
|
||||
- security-scan-trivy
|
||||
- license-check
|
||||
|
||||
-187
@@ -1,6 +1,5 @@
|
||||
# Table of Contents
|
||||
|
||||
* [Changelog for 8.0.9](#changelog-for-809-2026-10-02)
|
||||
* [Changelog for 8.0.8](#changelog-for-808-2026-08-20)
|
||||
* [Changelog for 8.0.7](#changelog-for-807-2026-07-31)
|
||||
* [Changelog for 8.0.6](#changelog-for-806-2026-07-15)
|
||||
@@ -68,192 +67,6 @@
|
||||
* [Changelog for 1.1.0](#changelog-for-110-2021-01-22)
|
||||
* [Changelog for 1.0.0](#changelog-for-100-2020-12-17)
|
||||
|
||||
# Changelog for [8.0.9] (2026-10-02)
|
||||
|
||||
The following sections list the changes for 8.0.9.
|
||||
|
||||
[8.0.9]: https://github.com/owncloud/ocis/compare/v8.0.8...v8.0.9
|
||||
|
||||
## Summary
|
||||
|
||||
* Security - Bump grpc-go dependency: [#13020](https://github.com/owncloud/ocis/pull/13020)
|
||||
* Security - Bump axios to 1.20.0: [#13056](https://github.com/owncloud/ocis/pull/13056)
|
||||
* Bugfix - Keep shares visible in sharedWithMe when a resource cannot be statted: [#12430](https://github.com/owncloud/ocis/pull/12430)
|
||||
* Bugfix - Release the quota of upload sessions with unreadable node metadata: [#12739](https://github.com/owncloud/ocis/pull/12739)
|
||||
* Bugfix - Remove the unmarshalable request body field from graph log messages: [#12918](https://github.com/owncloud/ocis/pull/12918)
|
||||
* Bugfix - Correct introduction version for OCIS_LDAP_INSTANCE_MAPPER_CACHE_TTL: [#12949](https://github.com/owncloud/ocis/pull/12949)
|
||||
* Bugfix - Return a retryable 503 when the OIDC userinfo call fails transiently: [#13047](https://github.com/owncloud/ocis/pull/13047)
|
||||
* Change - Replace GRPC_MAX_CONNECTION_AGE with client keepalive: [#13020](https://github.com/owncloud/ocis/pull/13020)
|
||||
* Enhancement - Add TLS support for the frontend stat cache store connection: [#12777](https://github.com/owncloud/ocis/pull/12777)
|
||||
* Enhancement - Make the public share expiry janitor configurable: [#13020](https://github.com/owncloud/ocis/pull/13020)
|
||||
* Enhancement - The public link resolution flag added to PROPFIND: [#13020](https://github.com/owncloud/ocis/pull/13020)
|
||||
|
||||
## Details
|
||||
|
||||
* Security - Bump grpc-go dependency: [#13020](https://github.com/owncloud/ocis/pull/13020)
|
||||
|
||||
We've updated the google.golang.org/grpc dependency to fix a reported
|
||||
denial-of-service vulnerability related to gRPC server handling of requests
|
||||
missing authority or Host headers. As no tagged release containing the fix was
|
||||
available yet, we pulled in a pre-release snapshot of grpc-go that includes it,
|
||||
which also required bumping the minimum Go version to 1.26.8.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/13020
|
||||
|
||||
* Security - Bump axios to 1.20.0: [#13056](https://github.com/owncloud/ocis/pull/13056)
|
||||
|
||||
We've updated the axios dependency of the idp service to 1.20.0. This fixes
|
||||
several denial-of-service, request-smuggling and server-side request forgery
|
||||
vulnerabilities flagged by the release filesystem scan.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/13056
|
||||
|
||||
* Bugfix - Keep shares visible in sharedWithMe when a resource cannot be statted: [#12430](https://github.com/owncloud/ocis/pull/12430)
|
||||
|
||||
The graph `sharedWithMe` handler resolves each received share by fanning out a
|
||||
per-resource `Stat` call with a concurrency limit, all sharing the request
|
||||
context. When a `Stat` failed for any reason (slow or stuck downstream, deleted
|
||||
space, gateway error, deadline exceeded) the worker logged at debug and returned
|
||||
without emitting a drive item, so the share was silently omitted from the
|
||||
response and the handler still returned `200 OK` with a partial,
|
||||
non-deterministic list. A single chronically-slow share could therefore make
|
||||
other, recently-accepted shares intermittently invisible, and repeated calls
|
||||
returned different subsets of the user's shares.
|
||||
|
||||
The handler now:
|
||||
|
||||
- bounds each per-share `Stat` with its own timeout derived from the request
|
||||
context, so one slow resource can no longer consume the deadline shared by all
|
||||
the other shares. The bound is configurable via
|
||||
`GRAPH_RECEIVED_SHARES_STAT_TIMEOUT` (default `10s`); - returns a degraded drive
|
||||
item built from the data already present in the share record (ids, permissions,
|
||||
grantees, timestamps, mountpoint name) when the resource cannot be statted due
|
||||
to a transient or indeterminate failure (timeout, slow or unavailable
|
||||
downstream), so the share stays visible instead of intermittently disappearing.
|
||||
A genuinely missing resource or revoked access (for example after the sharer was
|
||||
deleted) still drops the share, as before; - logs the dropped/degraded shares at
|
||||
warning level with a per-request count for operator visibility.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/12430
|
||||
|
||||
* Bugfix - Release the quota of upload sessions with unreadable node metadata: [#12739](https://github.com/owncloud/ocis/pull/12739)
|
||||
|
||||
When an upload's target node lost its metadata, e.g. because an ancestor was
|
||||
moved to the trash while the upload was still in flight, the upload could never
|
||||
finish processing. It stayed in "Processing" forever, could not be downloaded or
|
||||
deleted, and kept consuming the space quota.
|
||||
|
||||
Cleaning such a session up with `ocis storage-users uploads sessions --clean`
|
||||
did not help either: it removed the uploaded bytes and the session info file
|
||||
before failing to revert the node, so it destroyed the only copy of the data
|
||||
without releasing any quota.
|
||||
|
||||
Cleanup now reverts the node before removing anything irreversible and falls
|
||||
back to the session metadata when the node cannot be read, so the quota is
|
||||
released and the orphaned node is removed. If the quota cannot be released the
|
||||
upload is kept so it can be retried instead of being lost.
|
||||
|
||||
A new `--orphaned` filter lists the affected sessions:
|
||||
|
||||
```
|
||||
ocis storage-users uploads sessions --orphaned
|
||||
ocis storage-users uploads sessions --orphaned --clean
|
||||
```
|
||||
|
||||
Note that evaluating the filter reads the node metadata of every session, so it
|
||||
is only done when the flag is set.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/12739
|
||||
|
||||
* Bugfix - Remove the unmarshalable request body field from graph log messages: [#12918](https://github.com/owncloud/ocis/pull/12918)
|
||||
|
||||
We've removed the `body` field from the log messages of the graph service's HTTP
|
||||
handlers. The field was set from `http.Request.Body`, an `io.ReadCloser`, which
|
||||
can never be serialized into a useful log value.
|
||||
|
||||
The tracing middleware replaces the request body with a wrapper that carries an
|
||||
exported function field, so serializing it failed outright and the log line was
|
||||
emitted with `"body": "marshaling error: json: unsupported type: func(int64)"`
|
||||
instead of the payload. Without the tracing middleware the field serialized to
|
||||
an empty object. In both cases the intended payload was never logged.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/12918
|
||||
|
||||
* Bugfix - Correct introduction version for OCIS_LDAP_INSTANCE_MAPPER_CACHE_TTL: [#12949](https://github.com/owncloud/ocis/pull/12949)
|
||||
|
||||
We changed the documented introduction version of the
|
||||
OCIS_LDAP_INSTANCE_MAPPER_CACHE_TTL from 8.0.0 to 8.3.0.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/12949
|
||||
|
||||
* Bugfix - Return a retryable 503 when the OIDC userinfo call fails transiently: [#13047](https://github.com/owncloud/ocis/pull/13047)
|
||||
|
||||
A transient failure of the OIDC userinfo call (a timeout, a network error or a
|
||||
5xx/429 from the IdP) was mapped to HTTP 401. Clients read the 401 as an invalid
|
||||
session and logged the user out on a brief IdP slowdown.
|
||||
|
||||
The proxy now distinguishes a transient IdP failure from an authentication
|
||||
failure and returns a retryable 503 (with Retry-After) for the former, so
|
||||
clients retry and keep their session. A genuinely invalid or expired token still
|
||||
returns 401.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/13047
|
||||
|
||||
* Change - Replace GRPC_MAX_CONNECTION_AGE with client keepalive: [#13020](https://github.com/owncloud/ocis/pull/13020)
|
||||
|
||||
The grpc clients now send a keepalive ping while a request is in flight and fail
|
||||
the requests on a connection whose peer stops answering, instead of waiting for
|
||||
as long as the caller allows. This covers both the reva CS3 clients (gateway,
|
||||
storage-users, storage-shares, ...) and the go-micro based clients used for
|
||||
inter-service calls between the other oCIS services. Set
|
||||
GRPC_CLIENT_KEEPALIVE_TIME and GRPC_CLIENT_KEEPALIVE_TIMEOUT to enable and tune
|
||||
this; leave them unset to keep grpc's own default (no pings).
|
||||
|
||||
GRPC_MAX_CONNECTION_AGE has been removed. It only closed healthy connections on
|
||||
a timer, never ended a request that was already in flight, and silently did
|
||||
nothing when its value had no unit suffix.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/13020
|
||||
|
||||
* Enhancement - Add TLS support for the frontend stat cache store connection: [#12777](https://github.com/owncloud/ocis/pull/12777)
|
||||
|
||||
The frontend service was the only remaining place where a `nats-js-kv` store
|
||||
connection could not be secured. Its OCS stat cache forwarded the store type,
|
||||
nodes, database, table, TTL and credentials to reva, but not the TLS settings,
|
||||
so the connection stayed plaintext with no operator toggle to change it. The
|
||||
stat cache now honours `OCIS_CACHE_ENABLE_TLS`, `OCIS_CACHE_TLS_INSECURE` and
|
||||
`OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE` like every other cache and store.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/12777
|
||||
|
||||
* Enhancement - Make the public share expiry janitor configurable: [#13020](https://github.com/owncloud/ocis/pull/13020)
|
||||
|
||||
The sharing service runs a background janitor that permanently deletes expired
|
||||
public shares. Whether that cleanup runs at all could previously only be set in
|
||||
the sharing service's yaml config, and how often it ran was fixed internally
|
||||
with no way to tune it.
|
||||
|
||||
Both settings are now exposed as environment variables:
|
||||
OCIS_SHARING_ENABLE_EXPIRED_SHARES_CLEANUP toggles the cleanup (default:
|
||||
enabled, expired shares stay hidden from listings even when disabled), and the
|
||||
new OCIS_SHARING_JANITOR_RUN_INTERVAL sets the interval in seconds between
|
||||
janitor runs (default: 3600).
|
||||
|
||||
https://github.com/owncloud/ocis/pull/13020
|
||||
|
||||
* Enhancement - The public link resolution flag added to PROPFIND: [#13020](https://github.com/owncloud/ocis/pull/13020)
|
||||
|
||||
The public link resolution flag and the context timeout added to PROPFIND
|
||||
request The ocdav PROPFIND handler resolves public link shares to populate the
|
||||
oc:share-type property. A new toggle for skipping that lookup. The toggle is now
|
||||
exposed as OCDAV_DISABLE_PROPFIND_PUBLIC_LINK_RESOLUTION, which can be set to
|
||||
reduce load on services for large collections. Also, the bounded context was
|
||||
added for least public share request. Since this property is needed only to
|
||||
display an icon next to files in the list, indicating that a public link exists,
|
||||
it can be omitted if the ListPublicShares request is slow.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/13020
|
||||
|
||||
# Changelog for [8.0.8] (2026-08-20)
|
||||
|
||||
The following sections list the changes for 8.0.8.
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
Bugfix: Return a retryable 503 when the OIDC userinfo call fails transiently
|
||||
|
||||
A transient failure of the OIDC userinfo call (a timeout, a network error or a
|
||||
5xx/429 from the IdP) was mapped to HTTP 401. Clients read the 401 as an invalid
|
||||
session and logged the user out on a brief IdP slowdown.
|
||||
|
||||
The proxy now distinguishes a transient IdP failure from an authentication
|
||||
failure and returns a retryable 503 (with Retry-After) for the former, so clients
|
||||
retry and keep their session. A genuinely invalid or expired token still returns
|
||||
401.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/13047
|
||||
@@ -1,15 +0,0 @@
|
||||
Change: Replace GRPC_MAX_CONNECTION_AGE with client keepalive
|
||||
|
||||
The grpc clients now send a keepalive ping while a request is in flight and fail
|
||||
the requests on a connection whose peer stops answering, instead of waiting for
|
||||
as long as the caller allows. This covers both the reva CS3 clients (gateway,
|
||||
storage-users, storage-shares, ...) and the go-micro based clients used for
|
||||
inter-service calls between the other oCIS services. Set GRPC_CLIENT_KEEPALIVE_TIME
|
||||
and GRPC_CLIENT_KEEPALIVE_TIMEOUT to enable and tune this; leave them unset to keep
|
||||
grpc's own default (no pings).
|
||||
|
||||
GRPC_MAX_CONNECTION_AGE has been removed. It only closed healthy connections on
|
||||
a timer, never ended a request that was already in flight, and silently did
|
||||
nothing when its value had no unit suffix.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/13020
|
||||
@@ -1,14 +0,0 @@
|
||||
Enhancement: Make the public share expiry janitor configurable
|
||||
|
||||
The sharing service runs a background janitor that permanently deletes
|
||||
expired public shares. Whether that cleanup runs at all could previously only
|
||||
be set in the sharing service's yaml config, and how often it ran was fixed
|
||||
internally with no way to tune it.
|
||||
|
||||
Both settings are now exposed as environment variables:
|
||||
OCIS_SHARING_ENABLE_EXPIRED_SHARES_CLEANUP toggles the cleanup (default:
|
||||
enabled, expired shares stay hidden from listings even when disabled), and
|
||||
the new OCIS_SHARING_JANITOR_RUN_INTERVAL sets the interval in seconds
|
||||
between janitor runs (default: 3600).
|
||||
|
||||
https://github.com/owncloud/ocis/pull/13020
|
||||
@@ -1,12 +0,0 @@
|
||||
Enhancement: The public link resolution flag added to PROPFIND
|
||||
|
||||
The public link resolution flag and the context timeout added to PROPFIND request
|
||||
The ocdav PROPFIND handler resolves public link shares to populate the oc:share-type property.
|
||||
A new toggle for skipping that lookup. The toggle is now exposed as
|
||||
OCDAV_DISABLE_PROPFIND_PUBLIC_LINK_RESOLUTION, which can be set to reduce load
|
||||
on services for large collections.
|
||||
Also, the bounded context was added for least public share request. Since this property is needed only
|
||||
to display an icon next to files in the list, indicating that a public link exists,
|
||||
it can be omitted if the ListPublicShares request is slow.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/13020
|
||||
@@ -1,7 +0,0 @@
|
||||
Security: Bump axios to 1.20.0
|
||||
|
||||
We've updated the axios dependency of the idp service to 1.20.0. This fixes
|
||||
several denial-of-service, request-smuggling and server-side request forgery
|
||||
vulnerabilities flagged by the release filesystem scan.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/13056
|
||||
@@ -1,9 +0,0 @@
|
||||
Security: Bump grpc-go dependency
|
||||
|
||||
We've updated the google.golang.org/grpc dependency to fix a reported
|
||||
denial-of-service vulnerability related to gRPC server handling of requests
|
||||
missing authority or Host headers. As no tagged release containing the fix was
|
||||
available yet, we pulled in a pre-release snapshot of grpc-go that includes it,
|
||||
which also required bumping the minimum Go version to 1.26.8.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/13020
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,5 +0,0 @@
|
||||
Enhancement: Bump Reva version
|
||||
|
||||
bumped reva version
|
||||
|
||||
https://github.com/owncloud/ocis/pull/13152
|
||||
@@ -1,61 +0,0 @@
|
||||
Enhancement: Add NATS JWT authentication with a .creds file
|
||||
|
||||
A NATS server in operator (JWT) mode authenticates a client with a user JWT and
|
||||
an NKey seed. Before this change, oCIS could connect to NATS only with a
|
||||
username and a password. Thus oCIS could not use a shared NATS cluster with one
|
||||
NATS account for each instance.
|
||||
|
||||
oCIS now accepts JWT credentials for all NATS connections: the events, the
|
||||
caches, the persistent stores, the service registry, and the health checks.
|
||||
You can give the path of a NATS `.creds` file or the content of such a file:
|
||||
|
||||
- `OCIS_NATS_CREDS_FILE`: the path of a `.creds` file. oCIS reads the file
|
||||
again on each reconnect, so a rotated JWT works without a restart.
|
||||
- `OCIS_NATS_CREDS`: the content of a `.creds` file. Use it when you cannot
|
||||
mount a file.
|
||||
|
||||
Each service also has its own variables, for example `PROXY_EVENTS_CREDS_FILE`
|
||||
and `GRAPH_CACHE_CREDS`. The service registry reads
|
||||
`MICRO_REGISTRY_AUTH_CREDS_FILE` and `MICRO_REGISTRY_AUTH_CREDS`. If they are
|
||||
empty, the registry uses the `OCIS_NATS_*` variables. The registry reads only
|
||||
environment variables, not the `ocis.yaml` file.
|
||||
|
||||
A service-specific variable takes precedence over a global variable. In the
|
||||
same scope, the content takes precedence over the file.
|
||||
|
||||
When JWT credentials are set, oCIS does not send the username and the
|
||||
password. This rule also uses the scope. Example: `OCIS_NATS_CREDS_FILE` is set,
|
||||
and `GRAPH_CACHE_AUTH_USERNAME` and `GRAPH_CACHE_AUTH_PASSWORD` are set. Then
|
||||
the graph cache uses the username and the password. A username or a password
|
||||
alone does not replace the JWT credentials. The same applies to `MICRO_REGISTRY_AUTH_USERNAME` and
|
||||
`MICRO_REGISTRY_AUTH_PASSWORD` for the service registry.
|
||||
|
||||
oCIS checks the credentials at startup and gives a clear error for an invalid
|
||||
value. oCIS checks the credentials of a store or a cache only when its type is
|
||||
`nats-js` or `nats-js-kv`. Other types do not use the credentials.
|
||||
|
||||
The embedded nats service does not support JWT mode. To use JWT
|
||||
authentication, run an external NATS cluster in operator mode and do not start
|
||||
the embedded nats service, for example with `OCIS_EXCLUDE_RUN_SERVICES=nats`.
|
||||
|
||||
The NATS health checks of the services now use the same authentication and TLS
|
||||
settings as the service connections. Before this change, the health checks
|
||||
connected without credentials and without TLS. The proxy health check also used
|
||||
the events cluster ID as the NATS address. It now uses the events endpoint.
|
||||
Each health check skips the check when the NATS address is empty. Each health
|
||||
check keeps one NATS connection and uses it again for each probe. Each probe
|
||||
sends a PING to the NATS server, so the check finds a lost server at once. A
|
||||
slow NATS server does not block the other probes. The health check of a store
|
||||
succeeds when one node of the store is reachable, like the store connection.
|
||||
|
||||
The userlog service had no default node for its store. With
|
||||
`OCIS_PERSISTENT_STORE=nats-js-kv` it could not connect to NATS. It now uses
|
||||
`127.0.0.1:9233` like the other services.
|
||||
|
||||
The create home cache of the gateway service did not get the TLS settings. It
|
||||
now has the variables `GATEWAY_CREATE_HOME_CACHE_ENABLE_TLS`,
|
||||
`GATEWAY_CREATE_HOME_CACHE_TLS_INSECURE`, and
|
||||
`GATEWAY_CREATE_HOME_CACHE_TLS_ROOT_CA_CERTIFICATE`, and it uses the global
|
||||
`OCIS_CACHE_*` TLS variables.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/13220
|
||||
File renamed without changes.
@@ -1,13 +0,0 @@
|
||||
Bugfix: Disable the persistence of the gateway provider cache
|
||||
|
||||
The gateway service sent the wrong config key to reva for the provider cache.
|
||||
Reva reads the key `cache_disable_persistence`, but the gateway sent
|
||||
`disable_persistence`. Thus the variables `OCIS_CACHE_DISABLE_PERSISTENCE` and
|
||||
`GATEWAY_PROVIDER_CACHE_DISABLE_PERSISTENCE` had no effect on the provider
|
||||
cache. The provider cache always used persistence.
|
||||
|
||||
The gateway now sends the correct key. Check your configuration before you
|
||||
upgrade. If `OCIS_CACHE_DISABLE_PERSISTENCE=true` is set, the provider cache
|
||||
now stops the persistence. This is the documented behavior.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/13220
|
||||
File renamed without changes.
@@ -1,17 +0,0 @@
|
||||
Bugfix: Skip a not-ready node before reusing a cached grpc client
|
||||
|
||||
The grpc client selector cached one client per resolved node address. It returned
|
||||
that client without a health check. When a node died, every caller kept reusing
|
||||
the same cached client. Every call against that node waited for grpc's default
|
||||
connect timeout before it failed.
|
||||
|
||||
`pkg/rgrpc/todo/pool/selector.go` now stores the connection together with the
|
||||
client. The selector shuffles the known node addresses on each lookup. This way,
|
||||
load still spreads across nodes. The selector then walks the addresses and skips
|
||||
any cached connection in the `TransientFailure`, `Connecting`, or `Shutdown`
|
||||
state. It returns the first node that is ready, or dials a node it has not tried
|
||||
yet. If no known node is ready, the selector reuses the first node it found. The
|
||||
caller then gets a fast, real error instead of a long stall.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/13147
|
||||
https://github.com/owncloud/reva/pull/766
|
||||
@@ -1,7 +0,0 @@
|
||||
Security: Mask secret values in the proxy debug output
|
||||
|
||||
The debug server of the proxy service did not mask all secret configuration
|
||||
values. The proxy now masks these values. A new test checks that every secret
|
||||
value of the proxy configuration stays masked.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/13220
|
||||
@@ -39,6 +39,16 @@ variables:
|
||||
default_value: ""
|
||||
description: ""
|
||||
do_ignore: true
|
||||
- rawname: _serverMaxConnectionAgeEnv
|
||||
path: ocis-pkg/service/grpc/keepalive.go:19
|
||||
foundincode: true
|
||||
name: GRPC_MAX_CONNECTION_AGE
|
||||
type: Duration
|
||||
default_value: "9223372036854775807"
|
||||
description: Timeout for GRPC connections. After timeout, a new connection will
|
||||
be established automatically. The default value is in ns and is about 2.5 mio
|
||||
h.
|
||||
do_ignore: false
|
||||
- rawname: MICRO_LOG_LEVEL
|
||||
path: ocis-pkg/log/log.go:34
|
||||
foundincode: true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module github.com/owncloud/ocis/v2
|
||||
|
||||
go 1.26.10
|
||||
go 1.25.13
|
||||
|
||||
require (
|
||||
dario.cat/mergo v1.0.2
|
||||
@@ -56,10 +56,8 @@ require (
|
||||
github.com/mitchellh/mapstructure v1.5.0
|
||||
github.com/mna/pigeon v1.3.0
|
||||
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
|
||||
github.com/nats-io/jwt/v2 v2.8.2
|
||||
github.com/nats-io/nats-server/v2 v2.14.4
|
||||
github.com/nats-io/nats.go v1.54.0
|
||||
github.com/nats-io/nkeys v0.4.16
|
||||
github.com/nats-io/nats.go v1.52.0
|
||||
github.com/olekukonko/tablewriter v1.1.4
|
||||
github.com/onsi/ginkgo v1.16.5
|
||||
github.com/onsi/ginkgo/v2 v2.32.0
|
||||
@@ -67,7 +65,7 @@ require (
|
||||
github.com/open-policy-agent/opa v1.19.0
|
||||
github.com/orcaman/concurrent-map v1.0.0
|
||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245
|
||||
github.com/owncloud/reva/v2 v2.0.0-20261030091239-56e5da61b2b3
|
||||
github.com/owncloud/reva/v2 v2.0.0-20261001074810-94c6e48f5c45
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/pkg/xattr v0.4.12
|
||||
github.com/prometheus/client_golang v1.24.1
|
||||
@@ -97,16 +95,16 @@ require (
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.45.0
|
||||
go.opentelemetry.io/otel/sdk v1.45.0
|
||||
go.opentelemetry.io/otel/trace v1.45.0
|
||||
golang.org/x/crypto v0.58.0
|
||||
golang.org/x/crypto v0.55.0
|
||||
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f
|
||||
golang.org/x/image v0.45.0
|
||||
golang.org/x/net v0.62.0
|
||||
golang.org/x/net v0.58.0
|
||||
golang.org/x/oauth2 v0.36.0
|
||||
golang.org/x/sync v0.24.0
|
||||
golang.org/x/term v0.47.0
|
||||
golang.org/x/text v0.43.0
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260817212433-ac3dfec99bb1
|
||||
google.golang.org/grpc v1.86.0-dev
|
||||
golang.org/x/sync v0.22.0
|
||||
golang.org/x/term v0.45.0
|
||||
golang.org/x/text v0.41.0
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260803160001-6ac0973c030d
|
||||
google.golang.org/grpc v1.83.2
|
||||
google.golang.org/protobuf v1.36.12
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
gotest.tools/v3 v3.5.2
|
||||
@@ -241,7 +239,7 @@ require (
|
||||
github.com/json-iterator/go v1.1.13-0.20220915233716-71ac16282d12 // indirect
|
||||
github.com/juliangruber/go-intersect v1.1.0 // indirect
|
||||
github.com/kevinburke/ssh_config v1.6.0 // indirect
|
||||
github.com/klauspost/compress v1.20.0 // indirect
|
||||
github.com/klauspost/compress v1.19.1 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.4.0 // indirect
|
||||
github.com/klauspost/crc32 v1.3.0 // indirect
|
||||
github.com/kovidgoyal/go-parallel v1.1.1 // indirect
|
||||
@@ -276,6 +274,8 @@ require (
|
||||
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
|
||||
github.com/mschoch/smat v0.2.0 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/nats-io/jwt/v2 v2.8.2 // indirect
|
||||
github.com/nats-io/nkeys v0.4.16 // indirect
|
||||
github.com/nats-io/nuid v1.0.1 // indirect
|
||||
github.com/nxadm/tail v1.4.8 // indirect
|
||||
github.com/oklog/run v1.2.0 // indirect
|
||||
@@ -340,12 +340,12 @@ require (
|
||||
go.uber.org/zap v1.27.1 // indirect
|
||||
go.yaml.in/yaml/v2 v2.4.4 // indirect
|
||||
go.yaml.in/yaml/v3 v3.0.5 // indirect
|
||||
golang.org/x/mod v0.41.0 // indirect
|
||||
golang.org/x/sys v0.49.0 // indirect
|
||||
golang.org/x/mod v0.40.0 // indirect
|
||||
golang.org/x/sys v0.47.0 // indirect
|
||||
golang.org/x/time v0.15.0 // indirect
|
||||
golang.org/x/tools v0.51.0 // indirect
|
||||
golang.org/x/tools v0.49.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20261012220534-4341edf3f941 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260819154853-08b0e4226688 // indirect
|
||||
gopkg.in/cenkalti/backoff.v1 v1.1.0 // indirect
|
||||
gopkg.in/ini.v1 v1.67.3 // indirect
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
|
||||
@@ -360,9 +360,7 @@ replace github.com/egirna/icap-client => github.com/kobergj/icap-client v0.0.0-2
|
||||
|
||||
replace github.com/unrolled/secure => github.com/DeepDiver1975/secure v0.0.0-20240611112133-abc838fb797c
|
||||
|
||||
replace github.com/go-micro/plugins/v4/store/nats-js-kv => github.com/kobergj/plugins/v4/store/nats-js-kv v0.0.0-20261030085317-811a2ded849b
|
||||
|
||||
replace github.com/go-micro/plugins/v4/events/natsjs => github.com/kobergj/plugins/v4/events/natsjs v1.2.1-0.20261030085317-811a2ded849b
|
||||
replace github.com/go-micro/plugins/v4/store/nats-js-kv => github.com/kobergj/plugins/v4/store/nats-js-kv v0.0.0-20260609111813-fc78af4c9138
|
||||
|
||||
replace go-micro.dev/v4 => github.com/kobergj/go-micro/v4 v4.0.0-20250610135441-d0b187215699
|
||||
|
||||
|
||||
@@ -329,6 +329,8 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||
github.com/go-micro/plugins/v4/client/grpc v1.2.1 h1:7xAwZRCO6mdUtBHsYIQs1/eCTdhCrnjF70GB+AVd6L0=
|
||||
github.com/go-micro/plugins/v4/client/grpc v1.2.1/go.mod h1:3fDuzyfYLwEImn8+lkhKl3W4Ay1jFevkTeC32PBlgQs=
|
||||
github.com/go-micro/plugins/v4/events/natsjs v1.2.2 h1:vEYsXV0m5jGqGMpVHcscnM/aj/gGA13qCAhWXIDbcCE=
|
||||
github.com/go-micro/plugins/v4/events/natsjs v1.2.2/go.mod h1:cL0O63th39fZ+M/aRJvajz7Qnmv+UTXugOq1k3qrYiQ=
|
||||
github.com/go-micro/plugins/v4/logger/zerolog v1.2.0 h1:JZ516VQ9zekRoi868XG7x0EWxZ2AMq/euHIBChITsTI=
|
||||
github.com/go-micro/plugins/v4/logger/zerolog v1.2.0/go.mod h1:AieYOIeOxobYa5B8WGEqxXM3Ndi26tDIu9fZ4RYkCvQ=
|
||||
github.com/go-micro/plugins/v4/registry/memory v1.2.0 h1:R0G2tltffuG+fQnk+/JuAdgEJX4J+LuOafZDoNd8ow0=
|
||||
@@ -570,8 +572,8 @@ github.com/kevinburke/ssh_config v1.6.0 h1:J1FBfmuVosPHf5GRdltRLhPJtJpTlMdKTBjRg
|
||||
github.com/kevinburke/ssh_config v1.6.0/go.mod h1:q2RIzfka+BXARoNexmF9gkxEX7DmvbW9P4hIVx2Kg4M=
|
||||
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/klauspost/compress v1.20.0 h1:a3C1ke2ohxFymNlb2HWAHjDeKCI90scRskErZkR0ezA=
|
||||
github.com/klauspost/compress v1.20.0/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI=
|
||||
github.com/klauspost/compress v1.19.1 h1:VsB4HPswih7mmZ8WleSFQ75c/Ui1M4trX5oAsJnhSlk=
|
||||
github.com/klauspost/compress v1.19.1/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ=
|
||||
github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.4.0 h1:S6Hrbc7+ywsr0r+RLapfGBHfyefhCTwEh3A0tV913Dw=
|
||||
github.com/klauspost/cpuid/v2 v2.4.0/go.mod h1:19jmZ9mjzoF//ddRSUsv0zfBTJWh3QJh9FNxZTMrGxU=
|
||||
@@ -583,10 +585,8 @@ github.com/kobergj/gowebdav v0.0.0-20251030165916-532350997dde h1:HYcp4J4xYe2m9K
|
||||
github.com/kobergj/gowebdav v0.0.0-20251030165916-532350997dde/go.mod h1:bHA7t77X/QFExdeAnDzK6vKM34kEZAcE1OX4MfiwjkE=
|
||||
github.com/kobergj/icap-client v0.0.0-20250116172800-8eaa5022532b h1:NBKEgFtIukCreWOEvtrgNQusqosGyhlxzyiHbba1zEI=
|
||||
github.com/kobergj/icap-client v0.0.0-20250116172800-8eaa5022532b/go.mod h1:HpntrRsQA6RKNXy2Nbr4kVj+NO3OYWpAQUVxeya+3sU=
|
||||
github.com/kobergj/plugins/v4/events/natsjs v1.2.1-0.20261030085317-811a2ded849b h1:ZHS4QAR8uvLWVFLDx4TfGmtsVGTc4kp36QyErxq4dbE=
|
||||
github.com/kobergj/plugins/v4/events/natsjs v1.2.1-0.20261030085317-811a2ded849b/go.mod h1:XtyfEYt0MT+1OQwQXaZ0Ez9onbW3DJnKLOY3lfagmFU=
|
||||
github.com/kobergj/plugins/v4/store/nats-js-kv v0.0.0-20261030085317-811a2ded849b h1:822uZuexGaBfpEhMpK6f55izI1eKkxRZUBPURlta5j0=
|
||||
github.com/kobergj/plugins/v4/store/nats-js-kv v0.0.0-20261030085317-811a2ded849b/go.mod h1:jHG0DF69hKf+o6uEJ/O4D5iGoAJnatURDXGzV9o0Ouw=
|
||||
github.com/kobergj/plugins/v4/store/nats-js-kv v0.0.0-20260609111813-fc78af4c9138 h1:xuwWIZj+NCv8f6EJsZon1trR463gnP9WFt8h6VgCH98=
|
||||
github.com/kobergj/plugins/v4/store/nats-js-kv v0.0.0-20260609111813-fc78af4c9138/go.mod h1:pjcozWijkNPbEtX5SIQaxEW/h8VAVZYTLx+70bmB3LY=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kovidgoyal/go-parallel v1.1.1 h1:1OzpNjtrUkBPq3UaqrnvOoB2F9RttSt811uiUXyI7ok=
|
||||
@@ -697,8 +697,8 @@ github.com/nats-io/jwt/v2 v2.8.2 h1:XXRgB60MSTnqsRwejQurVDs/hcv2dkt+86GjI+I/bMc=
|
||||
github.com/nats-io/jwt/v2 v2.8.2/go.mod h1:Ag/56sq9OblL4JgdYufDd16Egb17Kr/8WwwuO/forVc=
|
||||
github.com/nats-io/nats-server/v2 v2.14.4 h1:efgjZ8cdExAKRuqSg8UPJFprb+l7NlBtSDPhDlw3rO4=
|
||||
github.com/nats-io/nats-server/v2 v2.14.4/go.mod h1:BltdpOYestjbtQSnVO2zGHdg5SGBZjt+GYTgB9LZq/I=
|
||||
github.com/nats-io/nats.go v1.54.0 h1:vsXoOxjHp/GmPUN+EcI7uOf/uB+iAP+kEsAFNQN0yzA=
|
||||
github.com/nats-io/nats.go v1.54.0/go.mod h1:y+DZoD1oBOYfZTU681eTUiUjI0vbqYGixNVFHcjHJ0k=
|
||||
github.com/nats-io/nats.go v1.52.0 h1:n3avV4VBsCgsdwh71TppsTwtv+QdPs7ntSKM8qJLGsc=
|
||||
github.com/nats-io/nats.go v1.52.0/go.mod h1:26HypzazeOkyO3/mqd1zZd53STJN0EjCYF9Uy2ZOBno=
|
||||
github.com/nats-io/nkeys v0.4.16 h1:rd5oAuLOb8mnAycB0xleuEBNS1pVVnN0fv/FF34Eypg=
|
||||
github.com/nats-io/nkeys v0.4.16/go.mod h1:llLgWoI0o4z/Q57q2R1kHfmocyhGV6VG/U18Glg1Afs=
|
||||
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
|
||||
@@ -735,8 +735,8 @@ github.com/orcaman/concurrent-map v1.0.0 h1:I/2A2XPCb4IuQWcQhBhSwGfiuybl/J0ev9HD
|
||||
github.com/orcaman/concurrent-map v1.0.0/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI=
|
||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245 h1:JRidLTAKhnvyLMRtVtSF4lhBa0NSAOs6fof+d6JnKII=
|
||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245/go.mod h1:z61VMGAJRtR1nbgXWiNoCkxUXP1B3Je9rMuJbnGd+Og=
|
||||
github.com/owncloud/reva/v2 v2.0.0-20261030091239-56e5da61b2b3 h1:KegUHcvap8WRaSD4d2t6eBtJYlhpW/uQYTHaLiwzeok=
|
||||
github.com/owncloud/reva/v2 v2.0.0-20261030091239-56e5da61b2b3/go.mod h1:BxBZoLbpILgxfiiyGOi5KAMSHCIJ6Kqg9Gbk1LU9fLQ=
|
||||
github.com/owncloud/reva/v2 v2.0.0-20261001074810-94c6e48f5c45 h1://i0KWRVB8U7vN3mrc+z1c3U/j0vpw/tcrdD5RuKJvQ=
|
||||
github.com/owncloud/reva/v2 v2.0.0-20261001074810-94c6e48f5c45/go.mod h1:LSXqMWTC7Ya6uxmqp1ksrWYZXBuZ6PhcmVimxyG8U5o=
|
||||
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw=
|
||||
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0=
|
||||
github.com/pablodz/inotifywaitgo v0.0.12 h1:DVJJTFMDlSAdO46yisPF2vzozs/r+4k6ih8MVghq78M=
|
||||
@@ -1014,8 +1014,8 @@ golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0
|
||||
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
|
||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
||||
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
|
||||
golang.org/x/crypto v0.58.0 h1:COkYLr4k7nDI4r6QtMML2AfzeIswWHAJthLS6K/M/54=
|
||||
golang.org/x/crypto v0.58.0/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w=
|
||||
golang.org/x/crypto v0.55.0 h1:+KWHjbgOaAQ66dh/YlkZKHlz9ZUlq61AFirAR9ntP8M=
|
||||
golang.org/x/crypto v0.55.0/go.mod h1:uq0V9dE/fzQuJtbnL+2EhWOE63vo164FY8xqEnV9xis=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||
@@ -1053,8 +1053,8 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.41.0 h1:qJmnOUb4YB+FsEuM3HcWucdZASCPGhsX6uljO6pog0c=
|
||||
golang.org/x/mod v0.41.0/go.mod h1:Ek9pY8RKWXwsWvd3rQiHYtMqkjSUV+s1Rj7j4H5Ur6o=
|
||||
golang.org/x/mod v0.40.0 h1:hUv+3cXcdRHz08UmSiOob7sadHig73uo5bkXxQ/tvUs=
|
||||
golang.org/x/mod v0.40.0/go.mod h1:0/weTWkPWGBikyTWAX3dkjVztMmBA5hM0DH6BElSupE=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
@@ -1098,8 +1098,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
||||
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
|
||||
golang.org/x/net v0.62.0 h1:18ELalfM5+XNRwzM2nYqXsZQ9ByS1uhj2O/U7+5jqRY=
|
||||
golang.org/x/net v0.62.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI=
|
||||
golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To=
|
||||
golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
@@ -1123,8 +1123,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ
|
||||
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA=
|
||||
golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0=
|
||||
golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek=
|
||||
golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
@@ -1187,8 +1187,8 @@ golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA=
|
||||
golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
|
||||
golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs=
|
||||
golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
@@ -1196,8 +1196,8 @@ golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
||||
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
|
||||
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
|
||||
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
|
||||
golang.org/x/term v0.47.0 h1:cpyOwQkr2Nzxe2p6KnrTG7Ei2wtzjsuSjhpXXepZ/BM=
|
||||
golang.org/x/term v0.47.0/go.mod h1:efAfAuG6RKABvg1ArGebRkvX6LXul14SM67o2e4mUCY=
|
||||
golang.org/x/term v0.45.0 h1:NwWyBmoJCbfTHpxrWoZ9C6/VxOf7ic219I8xZZFdrf0=
|
||||
golang.org/x/term v0.45.0/go.mod h1:9aqxs0blBcrm/n0L9QW0aRVD+ktan8ssZromtqJC43w=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
@@ -1209,8 +1209,8 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc=
|
||||
golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s=
|
||||
golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8=
|
||||
golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
@@ -1263,8 +1263,8 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f
|
||||
golang.org/x/tools v0.0.0-20210112230658-8b4aab62c064/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
golang.org/x/tools v0.51.0 h1:k4Xc/1Om9jwkBJBo4NVLMSARBoWtK10mx+W5BnXCeAI=
|
||||
golang.org/x/tools v0.51.0/go.mod h1:9eEncMayCV6zRMGhR5eZEC2iBx98qWcF1HZ9Z7wJOoA=
|
||||
golang.org/x/tools v0.49.0 h1:3NI7VXzL9+1WZD52Dx2ttoPwD5DWrFGpl9mFZDlmisI=
|
||||
golang.org/x/tools v0.49.0/go.mod h1:SJNXV9DBKT0UbdttsQjbfJlAE/q+y36++zo3uL3N0Oo=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
@@ -1325,10 +1325,10 @@ google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6D
|
||||
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7 h1:XzmzkmB14QhVhgnawEVsOn6OFsnpyxNPRY9QV01dNB0=
|
||||
google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7/go.mod h1:L43LFes82YgSonw6iTXTxXUX1OlULt4AQtkik4ULL/I=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260817212433-ac3dfec99bb1 h1:lrupDmKL3p5kEX1M92oan027eCKcouzjuPbH6YBK+Rs=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260817212433-ac3dfec99bb1/go.mod h1:q/3oV3jAi5vwelxsVAprMBC8BcM2zmNe+IjRGd+9/ks=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20261012220534-4341edf3f941 h1:QG6hS4zFplRZvOQedzei4t2pT/zkQc3VR1u+S9/rcAw=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20261012220534-4341edf3f941/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260803160001-6ac0973c030d h1:FarXi840EJWSHYTN3ERkADbPWjl307+FGrA22KAVjjc=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260803160001-6ac0973c030d/go.mod h1:K/+WGbmBY7aNW1HDw1fJnKYo10i0DkAX6pows00dLig=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260819154853-08b0e4226688 h1:cYNAzI2sUwhmCcoj9TxvihSrqsxt6uIkj3rDRhSDmW4=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260819154853-08b0e4226688/go.mod h1:DjtHYE8FKJLivXcBEjGwndXfIC23G0VpXiXKqG179uA=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||
@@ -1342,8 +1342,8 @@ google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3Iji
|
||||
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
||||
google.golang.org/grpc v1.86.0-dev h1:FLq7hcApuJeJ70J9+k0FvmXsNCwS8B2/MeAfYdy3GHY=
|
||||
google.golang.org/grpc v1.86.0-dev/go.mod h1:Ovl0ECo4xx5r4kn/6d4BPSNB7OIFuu6EAjOzjtVAKaM=
|
||||
google.golang.org/grpc v1.83.2 h1:EManeRomTObA0BU7I8vXgg/78uE5MJ9M8B39EX2WscU=
|
||||
google.golang.org/grpc v1.83.2/go.mod h1:YPI1hK3kDked6iHvgX3tR0y+nX/qpMFKhPgFsokw1S8=
|
||||
google.golang.org/grpc/examples v0.0.0-20211102180624-670c133e568e h1:m7aQHHqd0q89mRwhwS9Bx2rjyl/hsFAeta+uGrHsQaU=
|
||||
google.golang.org/grpc/examples v0.0.0-20211102180624-670c133e568e/go.mod h1:gID3PKrg7pWKntu9Ss6zTLJ0ttC0X9IHgREOCZwbCVU=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
|
||||
@@ -3,12 +3,8 @@ package checks
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/nats-io/nats.go"
|
||||
"github.com/owncloud/reva/v2/pkg/events/stream"
|
||||
revastore "github.com/owncloud/reva/v2/pkg/store"
|
||||
)
|
||||
|
||||
// NewNatsCheck checks the reachability of a nats server.
|
||||
@@ -25,108 +21,3 @@ func NewNatsCheck(natsCluster string, options ...nats.Option) func(context.Conte
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// natsCheckTimeout limits a probe when the probe context has no deadline.
|
||||
const natsCheckTimeout = 2 * time.Second
|
||||
|
||||
// NewNatsCheckWithConfig checks the reachability of the nats server at address.
|
||||
// The address can contain more than one server, separated by commas.
|
||||
// The check authenticates and uses TLS like the service connections configured by cfg.
|
||||
// The check uses address and ignores the endpoint of cfg. An empty address means
|
||||
// that the service does not use NATS. The function then returns nil.
|
||||
//
|
||||
// The check keeps one connection and uses it again for each probe. A new connection
|
||||
// for each probe reads the .creds file each time. A probe can then read a rotated file
|
||||
// before the write is complete. Each connection also counts against the connection
|
||||
// limit of the NATS account. The nats client reconnects the connection when it loses
|
||||
// the server. The connection reads the .creds file again on each reconnect.
|
||||
//
|
||||
// The connection status stays CONNECTED until the client notices a lost server.
|
||||
// Thus each probe sends a PING to the server and waits for the PONG.
|
||||
func NewNatsCheckWithConfig(address string, cfg stream.NatsConfig) func(context.Context) error {
|
||||
if address == "" {
|
||||
return nil
|
||||
}
|
||||
c := &natsCheck{address: address, cfg: cfg, lock: make(chan struct{}, 1)}
|
||||
return c.check
|
||||
}
|
||||
|
||||
// NewNatsStoreCheck checks the reachability of the nodes of a store.
|
||||
// The store connects to any node that it can reach. Thus the check succeeds when
|
||||
// one node is reachable. A check of each node fails when one node of a healthy
|
||||
// cluster is down.
|
||||
// The function returns nil when the store type is not a NATS type or when the store has no nodes.
|
||||
func NewNatsStoreCheck(storeType string, nodes []string, cfg stream.NatsConfig) func(context.Context) error {
|
||||
if !revastore.UsesNats(storeType) || len(nodes) == 0 {
|
||||
return nil
|
||||
}
|
||||
return NewNatsCheckWithConfig(strings.Join(nodes, ","), cfg)
|
||||
}
|
||||
|
||||
type natsCheck struct {
|
||||
address string
|
||||
cfg stream.NatsConfig
|
||||
|
||||
// lock holds one token. A probe holds the token while it creates the connection.
|
||||
// A probe that waits for the token stops when its context ends.
|
||||
lock chan struct{}
|
||||
conn *nats.Conn
|
||||
}
|
||||
|
||||
func (c *natsCheck) check(ctx context.Context) error {
|
||||
if _, ok := ctx.Deadline(); !ok {
|
||||
var cancel context.CancelFunc
|
||||
ctx, cancel = context.WithTimeout(ctx, natsCheckTimeout)
|
||||
defer cancel()
|
||||
}
|
||||
|
||||
conn, err := c.connection(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !conn.IsConnected() {
|
||||
return fmt.Errorf("nats server not connected: status %v, last error %v", conn.Status(), conn.LastError())
|
||||
}
|
||||
if err := conn.FlushWithContext(ctx); err != nil {
|
||||
return fmt.Errorf("nats server not reachable: %v", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// connection returns the connection. It creates the connection on the first call.
|
||||
// The nats client then connects again by itself, so the connection does not close.
|
||||
// A failed configuration does not create a connection. The next probe tries again.
|
||||
func (c *natsCheck) connection(ctx context.Context) (*nats.Conn, error) {
|
||||
select {
|
||||
case c.lock <- struct{}{}:
|
||||
case <-ctx.Done():
|
||||
return nil, fmt.Errorf("could not connect to nats server: %v", ctx.Err())
|
||||
}
|
||||
defer func() { <-c.lock }()
|
||||
|
||||
if c.conn != nil {
|
||||
return c.conn, nil
|
||||
}
|
||||
|
||||
options, err := stream.NatsOptions(c.cfg)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not configure the nats connection: %v", err)
|
||||
}
|
||||
// The first connect blocks the probe. The timeout keeps the connect in the probe deadline.
|
||||
deadline, _ := ctx.Deadline()
|
||||
timeout := min(time.Until(deadline), natsCheckTimeout)
|
||||
if timeout <= 0 {
|
||||
return nil, fmt.Errorf("could not connect to nats server: %v", context.DeadlineExceeded)
|
||||
}
|
||||
options = append(options,
|
||||
nats.Timeout(timeout),
|
||||
nats.RetryOnFailedConnect(true),
|
||||
nats.MaxReconnects(-1),
|
||||
)
|
||||
conn, err := nats.Connect(c.address, options...)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not connect to nats server: %v", err)
|
||||
}
|
||||
c.conn = conn
|
||||
return conn, nil
|
||||
}
|
||||
@@ -1,163 +0,0 @@
|
||||
package checks_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/checks"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/natstest"
|
||||
"github.com/owncloud/reva/v2/pkg/events/stream"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestNewNatsCheckWithConfig(t *testing.T) {
|
||||
s, creds := natstest.StartOperatorServer(t)
|
||||
url := s.ClientURL()
|
||||
|
||||
t.Run("empty address", func(t *testing.T) {
|
||||
require.Nil(t, checks.NewNatsCheckWithConfig("", stream.NatsConfig{}))
|
||||
})
|
||||
credsFile := filepath.Join(t.TempDir(), "user.creds")
|
||||
require.NoError(t, os.WriteFile(credsFile, creds, 0o600))
|
||||
|
||||
t.Run("no credentials", func(t *testing.T) {
|
||||
require.Error(t, checks.NewNatsCheckWithConfig(url, stream.NatsConfig{})(context.Background()))
|
||||
})
|
||||
|
||||
t.Run("username and password", func(t *testing.T) {
|
||||
require.Error(t, checks.NewNatsCheckWithConfig(url, stream.NatsConfig{
|
||||
AuthUsername: "user",
|
||||
AuthPassword: "pass",
|
||||
})(context.Background()))
|
||||
})
|
||||
|
||||
t.Run("creds file", func(t *testing.T) {
|
||||
require.NoError(t, checks.NewNatsCheckWithConfig(url, stream.NatsConfig{
|
||||
CredsFile: credsFile,
|
||||
})(context.Background()))
|
||||
})
|
||||
|
||||
t.Run("creds content", func(t *testing.T) {
|
||||
require.NoError(t, checks.NewNatsCheckWithConfig(url, stream.NatsConfig{
|
||||
Creds: string(creds),
|
||||
AuthUsername: "ignored",
|
||||
AuthPassword: "ignored",
|
||||
})(context.Background()))
|
||||
})
|
||||
|
||||
t.Run("invalid creds", func(t *testing.T) {
|
||||
err := checks.NewNatsCheckWithConfig(url, stream.NatsConfig{Creds: "not a creds file"})(context.Background())
|
||||
require.ErrorContains(t, err, "could not configure the nats connection")
|
||||
})
|
||||
|
||||
t.Run("probes use the same connection", func(t *testing.T) {
|
||||
rotatedFile := filepath.Join(t.TempDir(), "user.creds")
|
||||
require.NoError(t, os.WriteFile(rotatedFile, creds, 0o600))
|
||||
check := checks.NewNatsCheckWithConfig(url, stream.NatsConfig{CredsFile: rotatedFile})
|
||||
require.NoError(t, check(context.Background()))
|
||||
|
||||
// A rotation writes the file. The connection is open, so the probe does not read the file.
|
||||
require.NoError(t, os.WriteFile(rotatedFile, creds[:len(creds)/3], 0o600))
|
||||
require.NoError(t, check(context.Background()))
|
||||
})
|
||||
|
||||
t.Run("probe retries invalid creds", func(t *testing.T) {
|
||||
laterFile := filepath.Join(t.TempDir(), "user.creds")
|
||||
check := checks.NewNatsCheckWithConfig(url, stream.NatsConfig{CredsFile: laterFile})
|
||||
require.ErrorContains(t, check(context.Background()), "could not configure the nats connection")
|
||||
|
||||
require.NoError(t, os.WriteFile(laterFile, creds, 0o600))
|
||||
require.NoError(t, check(context.Background()))
|
||||
})
|
||||
|
||||
t.Run("probe fails after the server stops", func(t *testing.T) {
|
||||
s, creds := natstest.StartOperatorServer(t)
|
||||
url := s.ClientURL()
|
||||
check := checks.NewNatsCheckWithConfig(url, stream.NatsConfig{Creds: string(creds)})
|
||||
require.NoError(t, check(context.Background()))
|
||||
|
||||
s.Shutdown()
|
||||
require.Error(t, check(context.Background()))
|
||||
})
|
||||
}
|
||||
|
||||
func TestNewNatsCheckWithConfigUnresponsiveServer(t *testing.T) {
|
||||
// The listener accepts connections, but it never sends the NATS INFO message.
|
||||
l, err := net.Listen("tcp", "127.0.0.1:0")
|
||||
require.NoError(t, err)
|
||||
t.Cleanup(func() { _ = l.Close() })
|
||||
go func() {
|
||||
for {
|
||||
c, err := l.Accept()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
t.Cleanup(func() { _ = c.Close() })
|
||||
}
|
||||
}()
|
||||
|
||||
check := checks.NewNatsCheckWithConfig("nats://"+l.Addr().String(), stream.NatsConfig{})
|
||||
var wg sync.WaitGroup
|
||||
for range 5 {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond)
|
||||
defer cancel()
|
||||
start := time.Now()
|
||||
require.Error(t, check(ctx))
|
||||
require.Less(t, time.Since(start), time.Second)
|
||||
}()
|
||||
}
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
func TestNewNatsStoreCheck(t *testing.T) {
|
||||
s, creds := natstest.StartOperatorServer(t)
|
||||
url := s.ClientURL()
|
||||
cfg := stream.NatsConfig{Creds: string(creds)}
|
||||
|
||||
t.Run("nats-js-kv", func(t *testing.T) {
|
||||
require.NoError(t, checks.NewNatsStoreCheck("nats-js-kv", []string{url}, cfg)(context.Background()))
|
||||
})
|
||||
|
||||
t.Run("nats-js", func(t *testing.T) {
|
||||
require.NoError(t, checks.NewNatsStoreCheck("nats-js", []string{url}, cfg)(context.Background()))
|
||||
})
|
||||
|
||||
t.Run("nats store without credentials", func(t *testing.T) {
|
||||
require.Error(t, checks.NewNatsStoreCheck("nats-js-kv", []string{url}, stream.NatsConfig{})(context.Background()))
|
||||
})
|
||||
|
||||
t.Run("other store types", func(t *testing.T) {
|
||||
for _, storeType := range []string{"memory", "redis-sentinel", "noop", ""} {
|
||||
require.Nil(t, checks.NewNatsStoreCheck(storeType, []string{url}, stream.NatsConfig{}), storeType)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("no nodes", func(t *testing.T) {
|
||||
require.Nil(t, checks.NewNatsStoreCheck("nats-js-kv", nil, stream.NatsConfig{}))
|
||||
})
|
||||
|
||||
t.Run("one node is down", func(t *testing.T) {
|
||||
// Nothing listens on the first node.
|
||||
l, err := net.Listen("tcp", "127.0.0.1:0")
|
||||
require.NoError(t, err)
|
||||
down := "nats://" + l.Addr().String()
|
||||
require.NoError(t, l.Close())
|
||||
|
||||
require.NoError(t, checks.NewNatsStoreCheck("nats-js-kv", []string{down, url}, cfg)(context.Background()))
|
||||
})
|
||||
|
||||
t.Run("all nodes are down", func(t *testing.T) {
|
||||
s, creds := natstest.StartOperatorServer(t)
|
||||
check := checks.NewNatsStoreCheck("nats-js-kv", []string{s.ClientURL()}, stream.NatsConfig{Creds: string(creds)})
|
||||
s.Shutdown()
|
||||
require.Error(t, check(context.Background()))
|
||||
})
|
||||
}
|
||||
@@ -61,14 +61,13 @@ type Runtime struct {
|
||||
type Config struct {
|
||||
*shared.Commons `yaml:"shared"`
|
||||
|
||||
Tracing *shared.Tracing `yaml:"tracing"`
|
||||
Log *shared.Log `yaml:"log"`
|
||||
Cache *shared.Cache `yaml:"cache"`
|
||||
GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"`
|
||||
GRPCClientOptions *shared.GRPCClientOptions `yaml:"grpc_client_options"`
|
||||
GRPCServiceTLS *shared.GRPCServiceTLS `yaml:"grpc_service_tls"`
|
||||
HTTPServiceTLS shared.HTTPServiceTLS `yaml:"http_service_tls"`
|
||||
Reva *shared.Reva `yaml:"reva"`
|
||||
Tracing *shared.Tracing `yaml:"tracing"`
|
||||
Log *shared.Log `yaml:"log"`
|
||||
Cache *shared.Cache `yaml:"cache"`
|
||||
GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"`
|
||||
GRPCServiceTLS *shared.GRPCServiceTLS `yaml:"grpc_service_tls"`
|
||||
HTTPServiceTLS shared.HTTPServiceTLS `yaml:"http_service_tls"`
|
||||
Reva *shared.Reva `yaml:"reva"`
|
||||
|
||||
Mode Mode // DEPRECATED
|
||||
File string
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
package envdecode
|
||||
|
||||
import (
|
||||
"os"
|
||||
"reflect"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// NATS JWT credentials use two fields: the path of a .creds file (<prefix>CredsFile)
|
||||
// and the content of a .creds file (<prefix>Creds). Each field has its own list of
|
||||
// environment variables, for example "OCIS_NATS_CREDS_FILE;GRAPH_CACHE_CREDS_FILE"
|
||||
// and "OCIS_NATS_CREDS;GRAPH_CACHE_CREDS". The decoder sets each field on its own,
|
||||
// so both fields can have a value from a different scope. The same applies to the
|
||||
// username and the password (<prefix>AuthUsername and <prefix>AuthPassword).
|
||||
//
|
||||
// The more specific scope must win. Inside one scope the content wins over the file,
|
||||
// and the JWT credentials win over the username and the password.
|
||||
const (
|
||||
credsSuffix = "Creds"
|
||||
credsFileSuffix = "CredsFile"
|
||||
authUsernameSuffix = "AuthUsername"
|
||||
authPasswordSuffix = "AuthPassword"
|
||||
)
|
||||
|
||||
// resolveCredsScope applies the scope rules to each creds pair of the struct s.
|
||||
//
|
||||
// - It clears the creds content when the creds file comes from a more specific scope.
|
||||
// Example: OCIS_NATS_CREDS is set globally and GRAPH_CACHE_CREDS_FILE is set for
|
||||
// the service. Then the service uses the file.
|
||||
// - It clears the creds content and the creds file when the username and the password
|
||||
// both have a value and one of them comes from a more specific environment variable.
|
||||
// Example: OCIS_NATS_CREDS_FILE is set globally, and GRAPH_CACHE_AUTH_USERNAME and
|
||||
// GRAPH_CACHE_AUTH_PASSWORD are set for the service. Then the connection uses the
|
||||
// username and the password. The function keeps credentials from a config file or
|
||||
// a default, because these credentials have no environment scope to compare.
|
||||
func resolveCredsScope(s reflect.Value) {
|
||||
t := s.Type()
|
||||
for i := 0; i < t.NumField(); i++ {
|
||||
credsField := t.Field(i)
|
||||
if !credsField.IsExported() || credsField.Type.Kind() != reflect.String || !strings.HasSuffix(credsField.Name, credsSuffix) {
|
||||
continue
|
||||
}
|
||||
prefix := strings.TrimSuffix(credsField.Name, credsSuffix)
|
||||
fileField, ok := stringField(t, prefix+credsFileSuffix)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
|
||||
creds := s.FieldByIndex(credsField.Index)
|
||||
file := s.FieldByIndex(fileField.Index)
|
||||
if creds.String() != "" && file.String() != "" &&
|
||||
envScope(fileField.Tag.Get("env")) > envScope(credsField.Tag.Get("env")) {
|
||||
creds.SetString("")
|
||||
}
|
||||
|
||||
credsScope := max(valueScope(creds, credsField), valueScope(file, fileField))
|
||||
if credsScope >= 0 && authScope(s, prefix) > credsScope {
|
||||
creds.SetString("")
|
||||
file.SetString("")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// authScope returns the scope of the username and the password with the given prefix.
|
||||
// It returns -1 when the username or the password is empty. A username or a password
|
||||
// alone cannot authenticate, so it does not replace the JWT credentials. Otherwise
|
||||
// it returns the more specific scope of the two values.
|
||||
func authScope(s reflect.Value, prefix string) int {
|
||||
scope := -1
|
||||
for _, suffix := range []string{authUsernameSuffix, authPasswordSuffix} {
|
||||
f, ok := stringField(s.Type(), prefix+suffix)
|
||||
if !ok {
|
||||
return -1
|
||||
}
|
||||
v := s.FieldByIndex(f.Index)
|
||||
if v.String() == "" {
|
||||
return -1
|
||||
}
|
||||
scope = max(scope, valueScope(v, f))
|
||||
}
|
||||
return scope
|
||||
}
|
||||
|
||||
// stringField returns the field of t with the given name when it is a string field.
|
||||
func stringField(t reflect.Type, name string) (reflect.StructField, bool) {
|
||||
f, ok := t.FieldByName(name)
|
||||
if !ok || f.Type.Kind() != reflect.String {
|
||||
return reflect.StructField{}, false
|
||||
}
|
||||
return f, true
|
||||
}
|
||||
|
||||
// valueScope returns the scope of the value v of the field f. It returns -1 when v is empty.
|
||||
func valueScope(v reflect.Value, f reflect.StructField) int {
|
||||
if v.String() == "" {
|
||||
return -1
|
||||
}
|
||||
return envScope(f.Tag.Get("env"))
|
||||
}
|
||||
|
||||
// envScope returns the position of the last environment variable of the tag that is set.
|
||||
// A later variable is more specific. It returns -1 when no variable is set, so a value
|
||||
// from a config file or a default has the lowest scope.
|
||||
func envScope(tag string) int {
|
||||
names := strings.Split(strings.Split(tag, ",")[0], ";")
|
||||
scope := -1
|
||||
for i, name := range names {
|
||||
if name == "" {
|
||||
continue
|
||||
}
|
||||
if _, set := os.LookupEnv(name); set {
|
||||
scope = i
|
||||
}
|
||||
}
|
||||
return scope
|
||||
}
|
||||
@@ -1,190 +0,0 @@
|
||||
package envdecode
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
type credsScopeEvents struct {
|
||||
Endpoint string `env:"TEST_EVENTS_ENDPOINT"`
|
||||
CredsFile string `env:"TEST_NATS_CREDS_FILE;TEST_SVC_EVENTS_CREDS_FILE"`
|
||||
Creds string `env:"TEST_NATS_CREDS;TEST_SVC_EVENTS_CREDS"`
|
||||
}
|
||||
|
||||
type credsScopeCache struct {
|
||||
ProviderCacheCredsFile string `env:"TEST_NATS_CREDS_FILE;TEST_SVC_CACHE_CREDS_FILE"`
|
||||
ProviderCacheCreds string `env:"TEST_NATS_CREDS;TEST_SVC_CACHE_CREDS"`
|
||||
}
|
||||
|
||||
type credsScopeConfig struct {
|
||||
Events credsScopeEvents
|
||||
Cache *credsScopeCache
|
||||
}
|
||||
|
||||
func TestResolveCredsScope(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
env map[string]string
|
||||
preset credsScopeEvents // values from a config file
|
||||
wantFile string
|
||||
wantCreds string
|
||||
}{
|
||||
{
|
||||
name: "service file wins over global content",
|
||||
env: map[string]string{"TEST_NATS_CREDS": "global", "TEST_SVC_EVENTS_CREDS_FILE": "/svc.creds"},
|
||||
wantFile: "/svc.creds",
|
||||
},
|
||||
{
|
||||
name: "service content wins over global file",
|
||||
env: map[string]string{"TEST_NATS_CREDS_FILE": "/global.creds", "TEST_SVC_EVENTS_CREDS": "svc"},
|
||||
wantFile: "/global.creds",
|
||||
wantCreds: "svc",
|
||||
},
|
||||
{
|
||||
name: "global scope keeps both, the content wins later",
|
||||
env: map[string]string{"TEST_NATS_CREDS_FILE": "/global.creds", "TEST_NATS_CREDS": "global"},
|
||||
wantFile: "/global.creds",
|
||||
wantCreds: "global",
|
||||
},
|
||||
{
|
||||
name: "service scope keeps both, the content wins later",
|
||||
env: map[string]string{"TEST_SVC_EVENTS_CREDS_FILE": "/svc.creds", "TEST_SVC_EVENTS_CREDS": "svc"},
|
||||
wantFile: "/svc.creds",
|
||||
wantCreds: "svc",
|
||||
},
|
||||
{
|
||||
name: "global content env wins over a file from the config file",
|
||||
env: map[string]string{"TEST_NATS_CREDS": "global"},
|
||||
preset: credsScopeEvents{CredsFile: "/yaml.creds"},
|
||||
wantFile: "/yaml.creds",
|
||||
wantCreds: "global",
|
||||
},
|
||||
{
|
||||
name: "service file env wins over content from the config file",
|
||||
env: map[string]string{"TEST_SVC_EVENTS_CREDS_FILE": "/svc.creds"},
|
||||
preset: credsScopeEvents{Creds: "yaml"},
|
||||
wantFile: "/svc.creds",
|
||||
},
|
||||
{
|
||||
name: "only the file",
|
||||
env: map[string]string{"TEST_NATS_CREDS_FILE": "/global.creds"},
|
||||
wantFile: "/global.creds",
|
||||
wantCreds: "",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Setenv("TEST_EVENTS_ENDPOINT", "nats")
|
||||
for k, v := range tc.env {
|
||||
t.Setenv(k, v)
|
||||
}
|
||||
cfg := credsScopeConfig{Events: tc.preset}
|
||||
if err := Decode(&cfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if cfg.Events.CredsFile != tc.wantFile || cfg.Events.Creds != tc.wantCreds {
|
||||
t.Errorf("got file %q creds %q, want file %q creds %q", cfg.Events.CredsFile, cfg.Events.Creds, tc.wantFile, tc.wantCreds)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
type credsScopeAuth struct {
|
||||
AuthUsername string `env:"TEST_EVENTS_AUTH_USERNAME;TEST_SVC_EVENTS_AUTH_USERNAME"`
|
||||
AuthPassword string `env:"TEST_EVENTS_AUTH_PASSWORD;TEST_SVC_EVENTS_AUTH_PASSWORD"`
|
||||
CredsFile string `env:"TEST_NATS_CREDS_FILE;TEST_SVC_EVENTS_CREDS_FILE"`
|
||||
Creds string `env:"TEST_NATS_CREDS;TEST_SVC_EVENTS_CREDS"`
|
||||
}
|
||||
|
||||
func TestResolveCredsScopeUsernameAndPassword(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
env map[string]string
|
||||
preset credsScopeAuth // values from a config file
|
||||
wantFile string
|
||||
wantCreds string
|
||||
}{
|
||||
{
|
||||
name: "service username and password win over a global file",
|
||||
env: map[string]string{"TEST_NATS_CREDS_FILE": "/global.creds", "TEST_SVC_EVENTS_AUTH_USERNAME": "user", "TEST_SVC_EVENTS_AUTH_PASSWORD": "pass"},
|
||||
wantFile: "",
|
||||
},
|
||||
{
|
||||
name: "service username and password win over global content and a global file",
|
||||
env: map[string]string{"TEST_NATS_CREDS": "global", "TEST_NATS_CREDS_FILE": "/global.creds", "TEST_SVC_EVENTS_AUTH_USERNAME": "user", "TEST_SVC_EVENTS_AUTH_PASSWORD": "pass"},
|
||||
},
|
||||
{
|
||||
name: "service username and global password win over a global file",
|
||||
env: map[string]string{"TEST_NATS_CREDS_FILE": "/global.creds", "TEST_SVC_EVENTS_AUTH_USERNAME": "user", "TEST_EVENTS_AUTH_PASSWORD": "pass"},
|
||||
wantFile: "",
|
||||
},
|
||||
{
|
||||
name: "service password alone does not win over global content",
|
||||
env: map[string]string{"TEST_NATS_CREDS": "global", "TEST_SVC_EVENTS_AUTH_PASSWORD": "pass"},
|
||||
wantCreds: "global",
|
||||
},
|
||||
{
|
||||
name: "service username alone does not win over a global file",
|
||||
env: map[string]string{"TEST_NATS_CREDS_FILE": "/global.creds", "TEST_SVC_EVENTS_AUTH_USERNAME": "user"},
|
||||
wantFile: "/global.creds",
|
||||
},
|
||||
{
|
||||
name: "global username does not win over a global file",
|
||||
env: map[string]string{"TEST_NATS_CREDS_FILE": "/global.creds", "TEST_EVENTS_AUTH_USERNAME": "user"},
|
||||
wantFile: "/global.creds",
|
||||
},
|
||||
{
|
||||
name: "service username does not win over service content",
|
||||
env: map[string]string{"TEST_SVC_EVENTS_CREDS": "svc", "TEST_SVC_EVENTS_AUTH_USERNAME": "user"},
|
||||
wantCreds: "svc",
|
||||
},
|
||||
{
|
||||
name: "service file wins over a global username",
|
||||
env: map[string]string{"TEST_SVC_EVENTS_CREDS_FILE": "/svc.creds", "TEST_EVENTS_AUTH_USERNAME": "user"},
|
||||
wantFile: "/svc.creds",
|
||||
},
|
||||
{
|
||||
name: "username from the config file does not win over a global file",
|
||||
env: map[string]string{"TEST_NATS_CREDS_FILE": "/global.creds"},
|
||||
preset: credsScopeAuth{AuthUsername: "user", AuthPassword: "pass"},
|
||||
wantFile: "/global.creds",
|
||||
},
|
||||
{
|
||||
name: "service username and password do not clear a file from the config file",
|
||||
env: map[string]string{"TEST_SVC_EVENTS_AUTH_USERNAME": "user", "TEST_SVC_EVENTS_AUTH_PASSWORD": "pass"},
|
||||
preset: credsScopeAuth{CredsFile: "/yaml.creds"},
|
||||
wantFile: "/yaml.creds",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
for k, v := range tc.env {
|
||||
t.Setenv(k, v)
|
||||
}
|
||||
cfg := tc.preset
|
||||
if err := Decode(&cfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if cfg.CredsFile != tc.wantFile || cfg.Creds != tc.wantCreds {
|
||||
t.Errorf("got file %q creds %q, want file %q creds %q", cfg.CredsFile, cfg.Creds, tc.wantFile, tc.wantCreds)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestResolveCredsScopePrefixedPointerStruct(t *testing.T) {
|
||||
t.Setenv("TEST_NATS_CREDS", "global")
|
||||
t.Setenv("TEST_SVC_CACHE_CREDS_FILE", "/cache.creds")
|
||||
cfg := credsScopeConfig{Cache: &credsScopeCache{}}
|
||||
if err := Decode(&cfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if cfg.Cache.ProviderCacheCredsFile != "/cache.creds" || cfg.Cache.ProviderCacheCreds != "" {
|
||||
t.Errorf("got file %q creds %q", cfg.Cache.ProviderCacheCredsFile, cfg.Cache.ProviderCacheCreds)
|
||||
}
|
||||
// the events struct has only the global content, so it keeps it
|
||||
if cfg.Events.Creds != "global" {
|
||||
t.Errorf("events creds %q, want %q", cfg.Events.Creds, "global")
|
||||
}
|
||||
}
|
||||
@@ -210,8 +210,6 @@ func decode(target interface{}, strict bool) (int, error) {
|
||||
}
|
||||
}
|
||||
|
||||
resolveCredsScope(s)
|
||||
|
||||
return setFieldCount, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -55,9 +55,6 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
if cfg.GRPCClientTLS == nil {
|
||||
cfg.GRPCClientTLS = &shared.GRPCClientTLS{}
|
||||
}
|
||||
if cfg.GRPCClientOptions == nil {
|
||||
cfg.GRPCClientOptions = &shared.GRPCClientOptions{}
|
||||
}
|
||||
if cfg.GRPCServiceTLS == nil {
|
||||
cfg.GRPCServiceTLS = &shared.GRPCServiceTLS{}
|
||||
}
|
||||
@@ -81,10 +78,6 @@ func EnsureCommons(cfg *config.Config) {
|
||||
cfg.Commons.GRPCClientTLS = cfg.GRPCClientTLS
|
||||
}
|
||||
|
||||
if cfg.GRPCClientOptions != nil {
|
||||
cfg.Commons.GRPCClientOptions = cfg.GRPCClientOptions
|
||||
}
|
||||
|
||||
if cfg.GRPCServiceTLS != nil {
|
||||
cfg.Commons.GRPCServiceTLS = cfg.GRPCServiceTLS
|
||||
}
|
||||
|
||||
@@ -43,12 +43,7 @@ func (c CheckHandlerConfiguration) WithLogger(l log.Logger) CheckHandlerConfigur
|
||||
}
|
||||
|
||||
// WithCheck sets a check for the CheckHandlerConfiguration.
|
||||
// A nil check means that nothing needs a check. WithCheck then does not add it.
|
||||
func (c CheckHandlerConfiguration) WithCheck(name string, check checker) CheckHandlerConfiguration {
|
||||
if check == nil {
|
||||
return c
|
||||
}
|
||||
|
||||
if _, ok := c.checks[name]; ok {
|
||||
c.logger.Panic().Str("check", name).Msg("check already exists")
|
||||
}
|
||||
|
||||
@@ -41,12 +41,6 @@ func TestCheckHandlerConfiguration(t *testing.T) {
|
||||
handlerConfiguration.WithCheck("check-1", nopCheck)
|
||||
require.Equal(t, 3, nopCheckCounter)
|
||||
})
|
||||
|
||||
t.Run("nil check is skipped", func(t *testing.T) {
|
||||
rec := httptest.NewRecorder()
|
||||
handlers.NewCheckHandler(handlerConfiguration.WithCheck("check-nil", nil)).ServeHTTP(rec, httptest.NewRequest("GET", "/", nil))
|
||||
require.Equal(t, http.StatusOK, rec.Code)
|
||||
})
|
||||
}
|
||||
|
||||
func TestCheckHandler(t *testing.T) {
|
||||
|
||||
@@ -6,17 +6,15 @@ import (
|
||||
"crypto/tls"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
natsjskv "github.com/go-micro/plugins/v4/store/nats-js-kv"
|
||||
"github.com/nats-io/nats.go"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/generators"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/log"
|
||||
"github.com/owncloud/reva/v2/pkg/natsauth"
|
||||
revastore "github.com/owncloud/reva/v2/pkg/store"
|
||||
"go-micro.dev/v4/registry"
|
||||
"go-micro.dev/v4/server"
|
||||
@@ -29,10 +27,6 @@ var (
|
||||
_registryAddressEnv = "MICRO_REGISTRY_ADDRESS"
|
||||
_registryUsernameEnv = "MICRO_REGISTRY_AUTH_USERNAME"
|
||||
_registryPasswordEnv = "MICRO_REGISTRY_AUTH_PASSWORD"
|
||||
_registryCredsFileEnv = "MICRO_REGISTRY_AUTH_CREDS_FILE"
|
||||
_registryCredsEnv = "MICRO_REGISTRY_AUTH_CREDS"
|
||||
_natsCredsFileEnv = "OCIS_NATS_CREDS_FILE"
|
||||
_natsCredsEnv = "OCIS_NATS_CREDS"
|
||||
_registryEnableTLSEnv = "MICRO_REGISTRY_ENABLE_TLS"
|
||||
_registryTLSInsecureEnv = "MICRO_REGISTRY_TLS_INSECURE"
|
||||
_registryTLSRootCAEnv = "MICRO_REGISTRY_TLS_ROOT_CA_CERTIFICATE"
|
||||
@@ -76,9 +70,6 @@ type storeregistry struct {
|
||||
typ string
|
||||
defaultTTL time.Duration
|
||||
lock sync.RWMutex
|
||||
|
||||
// credsChecked is true after the first check of the NATS credentials.
|
||||
credsChecked atomic.Bool
|
||||
}
|
||||
|
||||
// Init inits the registry
|
||||
@@ -225,27 +216,19 @@ func (n *storeregistry) storeOptions(opts registry.Options) []store.Option {
|
||||
natsOptions := nats.GetDefaultOptions()
|
||||
natsOptions.Name = generators.GenerateConnectionName(serviceName, generators.NTypeRegistry)
|
||||
natsOptions.User, natsOptions.Password = getAuth()
|
||||
credsOpt, err := n.credentialsOption()
|
||||
if err != nil {
|
||||
exit(serviceName, err, "cannot use the nats credentials of the registry")
|
||||
}
|
||||
if credsOpt != nil {
|
||||
natsOptions.User, natsOptions.Password = "", ""
|
||||
if err := credsOpt(&natsOptions); err != nil {
|
||||
exit(serviceName, err, "cannot use the nats credentials of the registry")
|
||||
}
|
||||
}
|
||||
if tlsConf := getTLS(); tlsConf != nil {
|
||||
natsOptions.TLSConfig = tlsConf
|
||||
natsOptions.Secure = true
|
||||
}
|
||||
natsOptions.ReconnectedCB = func(_ *nats.Conn) {
|
||||
if err := n.Init(); err != nil {
|
||||
exit(serviceName, err, "cannot reconnect to nats")
|
||||
fmt.Println("cannot reconnect to nats")
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
natsOptions.ClosedCB = func(_ *nats.Conn) {
|
||||
exit(serviceName, nil, "nats connection closed")
|
||||
fmt.Println("nats connection closed")
|
||||
os.Exit(1)
|
||||
}
|
||||
storeoptions = append(storeoptions, natsjskv.NatsOptions(natsOptions))
|
||||
|
||||
@@ -260,45 +243,6 @@ func getAuth() (string, string) {
|
||||
return os.Getenv(_registryUsernameEnv), os.Getenv(_registryPasswordEnv)
|
||||
}
|
||||
|
||||
// credentialsOption returns the nats.Option for the JWT credentials of the registry.
|
||||
//
|
||||
// Only the first call checks the credentials, at startup. An invalid value then stops
|
||||
// the service. Later calls happen in Init, for example after a reconnect. A rotated
|
||||
// .creds file can then be partly written. So later calls do not check the file.
|
||||
// The option of a later call reads the file only when the connection connects.
|
||||
// The connection retries on an error.
|
||||
func (n *storeregistry) credentialsOption() (nats.Option, error) {
|
||||
credsFile, creds := getCreds()
|
||||
if !n.credsChecked.Swap(true) {
|
||||
return natsauth.CredentialsOption(credsFile, creds)
|
||||
}
|
||||
return natsauth.Option(credsFile, creds), nil
|
||||
}
|
||||
|
||||
// exit logs the error through the oCIS logger and stops the process. The registry
|
||||
// constructor cannot return an error, because go-micro defines its signature.
|
||||
func exit(serviceName string, err error, msg string) {
|
||||
logger := log.NewLogger(log.Name(serviceName), log.Level("error"))
|
||||
logger.Error().Err(err).Msg(msg)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// getCreds returns the path and the content of the NATS .creds file for the registry.
|
||||
// The registry variables take precedence. If both are empty, the registry uses the global
|
||||
// OCIS_NATS_* variables. The registry username and password are also registry variables.
|
||||
// When both have a value, they take precedence over the global variables. The registry
|
||||
// then does not use the global credentials.
|
||||
func getCreds() (string, string) {
|
||||
credsFile, creds := os.Getenv(_registryCredsFileEnv), os.Getenv(_registryCredsEnv)
|
||||
if credsFile != "" || creds != "" {
|
||||
return credsFile, creds
|
||||
}
|
||||
if user, password := getAuth(); user != "" && password != "" {
|
||||
return "", ""
|
||||
}
|
||||
return os.Getenv(_natsCredsFileEnv), os.Getenv(_natsCredsEnv)
|
||||
}
|
||||
|
||||
var (
|
||||
_tlsOnce sync.Once
|
||||
_tlsConfig *tls.Config
|
||||
|
||||
@@ -1,133 +0,0 @@
|
||||
package natsjsregistry
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/nats-io/nats.go"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/natstest"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestGetCreds(t *testing.T) {
|
||||
t.Run("no variables", func(t *testing.T) {
|
||||
credsFile, creds := getCreds()
|
||||
require.Empty(t, credsFile)
|
||||
require.Empty(t, creds)
|
||||
})
|
||||
|
||||
t.Run("global variables", func(t *testing.T) {
|
||||
t.Setenv(_natsCredsFileEnv, "/global.creds")
|
||||
t.Setenv(_natsCredsEnv, "global")
|
||||
credsFile, creds := getCreds()
|
||||
require.Equal(t, "/global.creds", credsFile)
|
||||
require.Equal(t, "global", creds)
|
||||
})
|
||||
|
||||
t.Run("registry file takes precedence over global variables", func(t *testing.T) {
|
||||
t.Setenv(_natsCredsFileEnv, "/global.creds")
|
||||
t.Setenv(_natsCredsEnv, "global")
|
||||
t.Setenv(_registryCredsFileEnv, "/registry.creds")
|
||||
credsFile, creds := getCreds()
|
||||
require.Equal(t, "/registry.creds", credsFile)
|
||||
require.Empty(t, creds)
|
||||
})
|
||||
|
||||
t.Run("registry content takes precedence over global variables", func(t *testing.T) {
|
||||
t.Setenv(_natsCredsFileEnv, "/global.creds")
|
||||
t.Setenv(_registryCredsEnv, "registry")
|
||||
credsFile, creds := getCreds()
|
||||
require.Empty(t, credsFile)
|
||||
require.Equal(t, "registry", creds)
|
||||
})
|
||||
|
||||
t.Run("registry username and password take precedence over global variables", func(t *testing.T) {
|
||||
t.Setenv(_natsCredsFileEnv, "/global.creds")
|
||||
t.Setenv(_natsCredsEnv, "global")
|
||||
t.Setenv(_registryUsernameEnv, "user")
|
||||
t.Setenv(_registryPasswordEnv, "pass")
|
||||
credsFile, creds := getCreds()
|
||||
require.Empty(t, credsFile)
|
||||
require.Empty(t, creds)
|
||||
})
|
||||
|
||||
t.Run("registry username alone does not take precedence over global variables", func(t *testing.T) {
|
||||
t.Setenv(_natsCredsFileEnv, "/global.creds")
|
||||
t.Setenv(_registryUsernameEnv, "user")
|
||||
credsFile, creds := getCreds()
|
||||
require.Equal(t, "/global.creds", credsFile)
|
||||
require.Empty(t, creds)
|
||||
})
|
||||
|
||||
t.Run("registry file takes precedence over registry username", func(t *testing.T) {
|
||||
t.Setenv(_registryCredsFileEnv, "/registry.creds")
|
||||
t.Setenv(_registryUsernameEnv, "user")
|
||||
credsFile, creds := getCreds()
|
||||
require.Equal(t, "/registry.creds", credsFile)
|
||||
require.Empty(t, creds)
|
||||
})
|
||||
}
|
||||
|
||||
func TestCredentialsOptionChecksOnlyOnce(t *testing.T) {
|
||||
creds := natstest.Creds(t)
|
||||
credsFile := filepath.Join(t.TempDir(), "user.creds")
|
||||
require.NoError(t, os.WriteFile(credsFile, creds, 0o600))
|
||||
t.Setenv(_natsCredsFileEnv, credsFile)
|
||||
|
||||
n := &storeregistry{}
|
||||
|
||||
// first call: credentialsOption checks the file
|
||||
opt, err := n.credentialsOption()
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, opt)
|
||||
|
||||
// a rotation writes the file partly
|
||||
require.NoError(t, os.WriteFile(credsFile, creds[:len(creds)/3], 0o600))
|
||||
|
||||
// later call, for example from Init after a reconnect: no check, no error
|
||||
opt, err = n.credentialsOption()
|
||||
require.NoError(t, err)
|
||||
o := nats.GetDefaultOptions()
|
||||
require.NoError(t, opt(&o), "applying the option must not read the file")
|
||||
require.NotNil(t, o.UserJWT)
|
||||
require.NotNil(t, o.SignatureCB)
|
||||
|
||||
// the connect attempt with the partly written file fails, NATS retries it
|
||||
_, err = o.SignatureCB([]byte("nonce"))
|
||||
require.Error(t, err)
|
||||
|
||||
// a missing file during the rotation also fails only the connect attempt
|
||||
require.NoError(t, os.Remove(credsFile))
|
||||
_, err = o.UserJWT()
|
||||
require.Error(t, err)
|
||||
|
||||
// after the rotation the callbacks use the new file
|
||||
newCreds := natstest.Creds(t)
|
||||
require.NoError(t, os.WriteFile(credsFile, newCreds, 0o600))
|
||||
userJWT, err := o.UserJWT()
|
||||
require.NoError(t, err)
|
||||
require.Contains(t, string(newCreds), userJWT)
|
||||
_, err = o.SignatureCB([]byte("nonce"))
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestCredentialsOptionFirstCallFails(t *testing.T) {
|
||||
t.Setenv(_natsCredsFileEnv, filepath.Join(t.TempDir(), "missing.creds"))
|
||||
n := &storeregistry{}
|
||||
_, err := n.credentialsOption()
|
||||
require.Error(t, err)
|
||||
}
|
||||
|
||||
func TestCredentialsOptionContent(t *testing.T) {
|
||||
t.Setenv(_natsCredsEnv, string(natstest.Creds(t)))
|
||||
n := &storeregistry{}
|
||||
for i := 0; i < 2; i++ {
|
||||
opt, err := n.credentialsOption()
|
||||
require.NoError(t, err)
|
||||
o := nats.GetDefaultOptions()
|
||||
require.NoError(t, opt(&o))
|
||||
_, err = o.SignatureCB([]byte("nonce"))
|
||||
require.NoError(t, err)
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
// Package natstest has helpers for tests with NATS JWT credentials.
|
||||
package natstest
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/nats-io/jwt/v2"
|
||||
"github.com/nats-io/nats-server/v2/server"
|
||||
"github.com/nats-io/nkeys"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// Creds returns the content of a ".creds" file for a new user in a new account.
|
||||
// No server knows the account, so use the content only for the checks of the format.
|
||||
func Creds(t *testing.T) []byte {
|
||||
t.Helper()
|
||||
accountKP, err := nkeys.CreateAccount()
|
||||
require.NoError(t, err)
|
||||
return UserCreds(t, accountKP)
|
||||
}
|
||||
|
||||
// UserCreds returns the content of a ".creds" file for a new user of the account accountKP.
|
||||
func UserCreds(t *testing.T, accountKP nkeys.KeyPair) []byte {
|
||||
t.Helper()
|
||||
userKP, err := nkeys.CreateUser()
|
||||
require.NoError(t, err)
|
||||
userPub, err := userKP.PublicKey()
|
||||
require.NoError(t, err)
|
||||
userJWT, err := jwt.NewUserClaims(userPub).Encode(accountKP)
|
||||
require.NoError(t, err)
|
||||
seed, err := userKP.Seed()
|
||||
require.NoError(t, err)
|
||||
creds, err := jwt.FormatUserConfig(userJWT, seed)
|
||||
require.NoError(t, err)
|
||||
return creds
|
||||
}
|
||||
|
||||
// StartOperatorServer starts a NATS server in operator (JWT) mode.
|
||||
// It returns the server and the ".creds" content of a user.
|
||||
func StartOperatorServer(t *testing.T) (*server.Server, []byte) {
|
||||
t.Helper()
|
||||
|
||||
operatorKP, err := nkeys.CreateOperator()
|
||||
require.NoError(t, err)
|
||||
operatorPub, err := operatorKP.PublicKey()
|
||||
require.NoError(t, err)
|
||||
operatorJWT, err := jwt.NewOperatorClaims(operatorPub).Encode(operatorKP)
|
||||
require.NoError(t, err)
|
||||
operator, err := jwt.DecodeOperatorClaims(operatorJWT)
|
||||
require.NoError(t, err)
|
||||
|
||||
accountKP, err := nkeys.CreateAccount()
|
||||
require.NoError(t, err)
|
||||
accountPub, err := accountKP.PublicKey()
|
||||
require.NoError(t, err)
|
||||
accountJWT, err := jwt.NewAccountClaims(accountPub).Encode(operatorKP)
|
||||
require.NoError(t, err)
|
||||
|
||||
resolver := &server.MemAccResolver{}
|
||||
require.NoError(t, resolver.Store(accountPub, accountJWT))
|
||||
|
||||
s, err := server.NewServer(&server.Options{
|
||||
Host: "127.0.0.1",
|
||||
Port: -1,
|
||||
TrustedOperators: []*jwt.OperatorClaims{operator},
|
||||
AccountResolver: resolver,
|
||||
NoLog: true,
|
||||
NoSigs: true,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
go s.Start()
|
||||
t.Cleanup(s.Shutdown)
|
||||
require.True(t, s.ReadyForConnections(10*time.Second))
|
||||
|
||||
return s, UserCreds(t, accountKP)
|
||||
}
|
||||
+14
-29
@@ -112,21 +112,17 @@ func (c *oidcClient) lookupWellKnownOpenidConfiguration(ctx context.Context) err
|
||||
}
|
||||
resp, err := c.httpClient.Do(req.WithContext(ctx))
|
||||
if err != nil {
|
||||
return classifyTransport(err)
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return classifyTransport(err)
|
||||
return fmt.Errorf("unable to read response body: %v", err)
|
||||
}
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
err := fmt.Errorf("%s: %s", resp.Status, body)
|
||||
if statusIsTransient(resp.StatusCode) {
|
||||
return errors.Join(ErrTemporarilyUnavailable, err)
|
||||
}
|
||||
return err
|
||||
return fmt.Errorf("%s: %s", resp.Status, body)
|
||||
}
|
||||
|
||||
var p ProviderMetadata
|
||||
@@ -151,7 +147,7 @@ func (c *oidcClient) lookupWellKnownOpenidConfiguration(ctx context.Context) err
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *oidcClient) getKeyfunc() (*keyfunc.JWKS, error) {
|
||||
func (c *oidcClient) getKeyfunc() *keyfunc.JWKS {
|
||||
c.jwksLock.Lock()
|
||||
defer c.jwksLock.Unlock()
|
||||
if c.JWKS == nil {
|
||||
@@ -171,10 +167,10 @@ func (c *oidcClient) getKeyfunc() (*keyfunc.JWKS, error) {
|
||||
if err != nil {
|
||||
c.JWKS = nil
|
||||
c.Logger.Error().Err(err).Msg("Failed to create JWKS from resource at the given URL.")
|
||||
return nil, err
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return c.JWKS, nil
|
||||
return c.JWKS
|
||||
}
|
||||
|
||||
type stringAsBool bool
|
||||
@@ -240,19 +236,15 @@ func (c *oidcClient) UserInfo(ctx context.Context, tokenSource oauth2.TokenSourc
|
||||
|
||||
resp, err := c.httpClient.Do(req.WithContext(ctx))
|
||||
if err != nil {
|
||||
return nil, classifyTransport(err)
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, classifyTransport(err)
|
||||
return nil, err
|
||||
}
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
err := fmt.Errorf("%s: %s", resp.Status, body)
|
||||
if statusIsTransient(resp.StatusCode) {
|
||||
return nil, errors.Join(ErrTemporarilyUnavailable, err)
|
||||
}
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("%s: %s", resp.Status, body)
|
||||
}
|
||||
|
||||
ct := resp.Header.Get("Content-Type")
|
||||
@@ -298,11 +290,7 @@ func (c *oidcClient) VerifyAccessToken(ctx context.Context, token string) (RegCl
|
||||
func (c *oidcClient) verifyAccessTokenJWT(token string) (RegClaimsWithSID, jwt.MapClaims, error) {
|
||||
var claims RegClaimsWithSID
|
||||
mapClaims := jwt.MapClaims{}
|
||||
jwks, err := c.getKeyfunc()
|
||||
if err != nil {
|
||||
// A JWKS fetch timeout/network error is transient (503), not a bad token (401).
|
||||
return claims, mapClaims, classifyTransport(err)
|
||||
}
|
||||
jwks := c.getKeyfunc()
|
||||
if jwks == nil {
|
||||
return claims, mapClaims, errors.New("error initializing jwks keyfunc")
|
||||
}
|
||||
@@ -314,9 +302,9 @@ func (c *oidcClient) verifyAccessTokenJWT(token string) (RegClaimsWithSID, jwt.M
|
||||
issuer = c.provider.AccessTokenIssuer
|
||||
}
|
||||
|
||||
_, err = jwt.ParseWithClaims(token, &claims, jwks.Keyfunc, jwt.WithIssuer(issuer))
|
||||
_, err := jwt.ParseWithClaims(token, &claims, jwks.Keyfunc, jwt.WithIssuer(issuer))
|
||||
if err != nil {
|
||||
return claims, mapClaims, classifyTransport(err)
|
||||
return claims, mapClaims, err
|
||||
}
|
||||
_, _, err = new(jwt.Parser).ParseUnverified(token, mapClaims)
|
||||
// TODO: decode mapClaims to sth readable
|
||||
@@ -334,10 +322,7 @@ func (c *oidcClient) VerifyLogoutToken(ctx context.Context, rawToken string) (*L
|
||||
if err := c.lookupWellKnownOpenidConfiguration(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
jwks, err := c.getKeyfunc()
|
||||
if err != nil {
|
||||
return nil, classifyTransport(err)
|
||||
}
|
||||
jwks := c.getKeyfunc()
|
||||
if jwks == nil {
|
||||
return nil, errors.New("error initializing jwks keyfunc")
|
||||
}
|
||||
@@ -352,7 +337,7 @@ func (c *oidcClient) VerifyLogoutToken(ctx context.Context, rawToken string) (*L
|
||||
supportedSigAlgs = []string{RS256}
|
||||
}
|
||||
|
||||
_, err = jwt.ParseWithClaims(rawToken, &claims, jwks.Keyfunc, jwt.WithValidMethods(supportedSigAlgs), jwt.WithIssuer(c.issuer))
|
||||
_, err := jwt.ParseWithClaims(rawToken, &claims, jwks.Keyfunc, jwt.WithValidMethods(supportedSigAlgs), jwt.WithIssuer(c.issuer))
|
||||
if err != nil {
|
||||
c.Logger.Debug().Err(err).Msg("Failed to parse logout token")
|
||||
return nil, err
|
||||
|
||||
@@ -4,16 +4,11 @@ import (
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"crypto/rsa"
|
||||
"errors"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/MicahParks/keyfunc/v2"
|
||||
"github.com/golang-jwt/jwt/v5"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/oidc"
|
||||
"github.com/owncloud/ocis/v2/services/proxy/pkg/config"
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
type signingKey struct {
|
||||
@@ -191,68 +186,6 @@ func (l logoutVerificationTest) run(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// A userinfo call that returns a transient status (429/5xx) must be classified as
|
||||
// temporarily unavailable so the proxy answers 503, not 401 (#12999). A genuine
|
||||
// auth status (401/403) must stay a plain error that maps to 401.
|
||||
func TestUserInfoStatusClassification(t *testing.T) {
|
||||
tests := []struct {
|
||||
status int
|
||||
transient bool
|
||||
}{
|
||||
{http.StatusUnauthorized, false},
|
||||
{http.StatusForbidden, false},
|
||||
{http.StatusInternalServerError, true},
|
||||
{http.StatusBadGateway, true},
|
||||
{http.StatusServiceUnavailable, true},
|
||||
{http.StatusTooManyRequests, true},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(http.StatusText(tt.status), func(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(tt.status)
|
||||
}))
|
||||
defer srv.Close()
|
||||
|
||||
c := oidc.NewOIDCClient(
|
||||
oidc.WithProviderMetadata(&oidc.ProviderMetadata{UserinfoEndpoint: srv.URL}),
|
||||
oidc.WithHTTPClient(srv.Client()),
|
||||
)
|
||||
|
||||
_, err := c.UserInfo(context.Background(),
|
||||
oauth2.StaticTokenSource(&oauth2.Token{AccessToken: "t"}))
|
||||
if err == nil {
|
||||
t.Fatalf("expected an error for status %d", tt.status)
|
||||
}
|
||||
if got := errors.Is(err, oidc.ErrTemporarilyUnavailable); got != tt.transient {
|
||||
t.Fatalf("status %d: transient = %v, want %v (err=%v)", tt.status, got, tt.transient, err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// A transient failure while discovering the IdP (well-known/JWKS) during access-token
|
||||
// verification must be classified as temporarily unavailable, not surfaced as a 401 (#12999).
|
||||
func TestVerifyAccessTokenTransientDiscovery(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusServiceUnavailable)
|
||||
}))
|
||||
defer srv.Close()
|
||||
|
||||
c := oidc.NewOIDCClient(
|
||||
oidc.WithOidcIssuer(srv.URL),
|
||||
oidc.WithHTTPClient(srv.Client()),
|
||||
oidc.WithAccessTokenVerifyMethod(config.AccessTokenVerificationJWT),
|
||||
)
|
||||
|
||||
_, _, err := c.VerifyAccessToken(context.Background(), "any.token.here")
|
||||
if err == nil {
|
||||
t.Fatal("expected an error for a 503 during discovery")
|
||||
}
|
||||
if !errors.Is(err, oidc.ErrTemporarilyUnavailable) {
|
||||
t.Fatalf("discovery 503 must be transient, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func newRSAKey(t testing.TB) *signingKey {
|
||||
priv, err := rsa.GenerateKey(rand.Reader, 1028)
|
||||
if err != nil {
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
package oidc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// ErrTemporarilyUnavailable marks a transient IdP failure (timeout, network error
|
||||
// or 5xx/429), which callers should treat as retryable (503) rather than as an
|
||||
// authentication failure (401).
|
||||
var ErrTemporarilyUnavailable = errors.New("oidc: identity provider temporarily unavailable")
|
||||
|
||||
func classifyTransport(err error) error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
// context.Canceled means the caller hung up or the server is shutting down, not an IdP outage.
|
||||
var netErr net.Error
|
||||
if errors.Is(err, context.DeadlineExceeded) || errors.As(err, &netErr) {
|
||||
return errors.Join(ErrTemporarilyUnavailable, err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// statusIsTransient lists the retryable statuses explicitly so a permanent 5xx
|
||||
// (501, 505) fails fast instead of being retried forever.
|
||||
func statusIsTransient(status int) bool {
|
||||
switch status {
|
||||
case http.StatusTooManyRequests,
|
||||
http.StatusInternalServerError,
|
||||
http.StatusBadGateway,
|
||||
http.StatusServiceUnavailable,
|
||||
http.StatusGatewayTimeout:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
package oidc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net"
|
||||
"net/http"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type timeoutErr struct{}
|
||||
|
||||
func (timeoutErr) Error() string { return "i/o timeout" }
|
||||
func (timeoutErr) Timeout() bool { return true }
|
||||
func (timeoutErr) Temporary() bool { return true }
|
||||
|
||||
var _ net.Error = timeoutErr{}
|
||||
|
||||
func TestClassifyTransport(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
err error
|
||||
transient bool
|
||||
}{
|
||||
{"nil", nil, false},
|
||||
{"deadline exceeded", context.DeadlineExceeded, true},
|
||||
{"canceled", context.Canceled, false},
|
||||
{"wrapped deadline", errors.Join(errors.New("get userinfo"), context.DeadlineExceeded), true},
|
||||
{"net error", timeoutErr{}, true},
|
||||
{"plain error", errors.New("token revoked"), false},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got := classifyTransport(tt.err)
|
||||
if tt.err == nil {
|
||||
if got != nil {
|
||||
t.Fatalf("expected nil, got %v", got)
|
||||
}
|
||||
return
|
||||
}
|
||||
if errors.Is(got, ErrTemporarilyUnavailable) != tt.transient {
|
||||
t.Fatalf("transient = %v, want %v (err=%v)", !tt.transient, tt.transient, got)
|
||||
}
|
||||
if !errors.Is(got, tt.err) {
|
||||
t.Fatalf("classifyTransport dropped the underlying error: %v", got)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestStatusIsTransient(t *testing.T) {
|
||||
tests := map[int]bool{
|
||||
http.StatusUnauthorized: false,
|
||||
http.StatusForbidden: false,
|
||||
http.StatusNotFound: false,
|
||||
http.StatusTooManyRequests: true,
|
||||
http.StatusInternalServerError: true,
|
||||
http.StatusBadGateway: true,
|
||||
http.StatusServiceUnavailable: true,
|
||||
http.StatusGatewayTimeout: true,
|
||||
http.StatusNotImplemented: false,
|
||||
http.StatusHTTPVersionNotSupported: false,
|
||||
}
|
||||
for status, want := range tests {
|
||||
if got := statusIsTransient(status); got != want {
|
||||
t.Errorf("statusIsTransient(%d) = %v, want %v", status, got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,6 @@ import (
|
||||
"go-micro.dev/v4/client"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
"go.opentelemetry.io/otel/trace/noop"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/keepalive"
|
||||
)
|
||||
|
||||
// ClientOptions represent options (e.g. tls settings) for the grpc clients
|
||||
@@ -22,7 +20,6 @@ type ClientOptions struct {
|
||||
tlsMode string
|
||||
caCert string
|
||||
tp trace.TracerProvider
|
||||
kp keepalive.ClientParameters
|
||||
}
|
||||
|
||||
// Option is used to pass client options
|
||||
@@ -53,18 +50,6 @@ func WithTraceProvider(tp trace.TracerProvider) ClientOption {
|
||||
}
|
||||
}
|
||||
|
||||
// WithKeepaliveParams allows setting the grpc keepalive params for grpc clients, derived from
|
||||
// co.GRPCClientKeepaliveTime/-Timeout. Without a configured keepalive time this is a no-op and the
|
||||
// clients keep grpc's own behavior, see GetClientKeepaliveParams.
|
||||
func WithKeepaliveParams(co *shared.GRPCClientOptions) ClientOption {
|
||||
return func(o *ClientOptions) {
|
||||
if co == nil {
|
||||
return
|
||||
}
|
||||
o.kp = GetClientKeepaliveParams(co.GRPCClientKeepaliveTime, co.GRPCClientKeepaliveTimeout)
|
||||
}
|
||||
}
|
||||
|
||||
func GetClientOptions(t *shared.GRPCClientTLS) []ClientOption {
|
||||
opts := []ClientOption{
|
||||
WithTLSMode(t.Mode),
|
||||
@@ -87,13 +72,6 @@ func NewClient(opts ...ClientOption) (client.Client, error) {
|
||||
mtracer.WithTraceProvider(options.tp),
|
||||
)),
|
||||
}
|
||||
|
||||
if options.kp != (keepalive.ClientParameters{}) {
|
||||
// same mechanism the reva pool uses in grpc.NewConn (pkg/rgrpc/todo/pool/connection.go),
|
||||
// so that a black-holed peer is detected here as well instead of hanging for the caller's full timeout
|
||||
cOpts = append(cOpts, withDefaultCallOptions(mgrpcc.DialOptions(grpc.WithKeepaliveParams(options.kp))))
|
||||
}
|
||||
|
||||
switch options.tlsMode {
|
||||
case "insecure":
|
||||
if os.Getenv("OCIS_INSECURE") != "true" {
|
||||
@@ -126,15 +104,3 @@ func NewClient(opts ...ClientOption) (client.Client, error) {
|
||||
|
||||
return mgrpcc.NewClient(cOpts...), nil
|
||||
}
|
||||
|
||||
// withDefaultCallOptions applies client.CallOptions (e.g. mgrpcc.DialOptions) to the client's
|
||||
// default CallOptions. The go-micro grpc plugin only reads dial options back out of the default
|
||||
// CallOptions.Context set at construction time (not per-call CallOptions), so this is the only
|
||||
// way to make them apply to every dial the client makes.
|
||||
func withDefaultCallOptions(callOpts ...client.CallOption) client.Option {
|
||||
return func(o *client.Options) {
|
||||
for _, co := range callOpts {
|
||||
co(&o.CallOptions)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
package grpc
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/shared"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go-micro.dev/v4/client"
|
||||
)
|
||||
|
||||
func TestWithDefaultCallOptionsAppliesGivenCallOptionsToDefaults(t *testing.T) {
|
||||
var applied int
|
||||
fake := client.CallOption(func(_ *client.CallOptions) {
|
||||
applied++
|
||||
})
|
||||
|
||||
opt := withDefaultCallOptions(fake, fake)
|
||||
var opts client.Options
|
||||
opt(&opts)
|
||||
|
||||
assert.Equal(t, 2, applied)
|
||||
}
|
||||
|
||||
// TestNewClientKeepaliveDialOptions ensures that keepalive params configured via
|
||||
// WithKeepaliveParams end up in the client's *default* CallOptions.Context, and only then. That
|
||||
// context is where the go-micro grpc plugin looks up the dial options on every dial (see
|
||||
// grpcClient.getGrpcDialOptions in github.com/go-micro/plugins/v4/client/grpc, which reads
|
||||
// g.opts.CallOptions.Context and ignores per-call CallOptions). Without them a black-holed peer
|
||||
// would hang the caller for as long as it allows instead of being detected by the keepalive ping.
|
||||
//
|
||||
// The dial options themselves cannot be asserted on: the plugin stores them under an unexported
|
||||
// context key, so a non-nil context is as close as this package can get from the outside.
|
||||
func TestNewClientKeepaliveDialOptions(t *testing.T) {
|
||||
// the plugin needs a registry to construct a client, and an in-memory one keeps the test
|
||||
// from reaching out to a nats-js-kv that isn't there
|
||||
t.Setenv("MICRO_REGISTRY", "memory")
|
||||
// an empty address is treated like an unset one by ocis-pkg/registry
|
||||
t.Setenv("MICRO_REGISTRY_ADDRESS", "")
|
||||
|
||||
tests := map[string]struct {
|
||||
opts []ClientOption
|
||||
wantContextSet bool
|
||||
}{
|
||||
"keepalive configured": {
|
||||
opts: []ClientOption{
|
||||
WithKeepaliveParams(&shared.GRPCClientOptions{GRPCClientKeepaliveTime: 30 * time.Second}),
|
||||
},
|
||||
wantContextSet: true,
|
||||
},
|
||||
"no keepalive option leaves grpc's own dial defaults untouched": {
|
||||
wantContextSet: false,
|
||||
},
|
||||
"keepalive option without a configured time leaves grpc's own dial defaults untouched": {
|
||||
opts: []ClientOption{WithKeepaliveParams(&shared.GRPCClientOptions{})},
|
||||
wantContextSet: false,
|
||||
},
|
||||
"keepalive option without any options leaves grpc's own dial defaults untouched": {
|
||||
opts: []ClientOption{WithKeepaliveParams(nil)},
|
||||
wantContextSet: false,
|
||||
},
|
||||
}
|
||||
|
||||
for name, tt := range tests {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
c, err := NewClient(append(GetClientOptions(&shared.GRPCClientTLS{Mode: "off"}), tt.opts...)...)
|
||||
require.NoError(t, err)
|
||||
|
||||
if tt.wantContextSet {
|
||||
assert.NotNil(t, c.Options().CallOptions.Context)
|
||||
return
|
||||
}
|
||||
assert.Nil(t, c.Options().CallOptions.Context)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,51 +1,24 @@
|
||||
package grpc
|
||||
|
||||
import (
|
||||
"math"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"google.golang.org/grpc/keepalive"
|
||||
)
|
||||
|
||||
// GetClientKeepaliveParams turns the configured GRPCClientKeepaliveTime/-Timeout into grpc
|
||||
// keepalive client parameters for the go-micro based clients built in this package. Once they are
|
||||
// set, a peer that stops answering on an established connection can be told apart from one that is
|
||||
// merely slow: grpc pings it while an rpc is in flight and fails the requests on that connection
|
||||
// when no answer arrives within the timeout, instead of waiting for as long as the caller allows.
|
||||
//
|
||||
// Keepalive is strictly opt-in and driven by the keepalive time alone. Without a positive time this
|
||||
// returns the zero ClientParameters, which NewClient reads as "add no keepalive dial option at
|
||||
// all", so grpc's own behavior applies and no pings are sent - a deployment that configured nothing
|
||||
// behaves exactly as it did before this package started setting keepalive params. A positive time
|
||||
// with no usable timeout gets a working default instead, so detection cannot be left half
|
||||
// configured.
|
||||
//
|
||||
// Values are taken as configured; nothing is salvaged or second-guessed. A malformed value - '20'
|
||||
// without a unit suffix, say - is dropped by ocis-pkg/config/envdecode before it reaches this
|
||||
// function and therefore reads as "not configured" here. reva's pool.GetClientKeepaliveParams
|
||||
// (https://github.com/owncloud/reva/blob/master/pkg/rgrpc/todo/pool/keepalive.go) parses the same
|
||||
// two env vars itself for the CS3 clients and applies the same rules, so both sets of clients
|
||||
// behave identically for every input. grpc also raises any time below '10s' to '10s' on its own.
|
||||
func GetClientKeepaliveParams(grpcClientKeepaliveTime, grpcClientKeepaliveTimeout time.Duration) keepalive.ClientParameters {
|
||||
// used when a keepalive time is configured but the timeout is not usable, so that a half
|
||||
// configured setup still gives up on a dead peer rather than sitting out grpc's longer
|
||||
// stock timeout of 20s
|
||||
const _defaultKeepaliveTimeout = 10 * time.Second
|
||||
const (
|
||||
_serverMaxConnectionAgeEnv = "GRPC_MAX_CONNECTION_AGE"
|
||||
|
||||
if grpcClientKeepaliveTime <= 0 {
|
||||
// not configured: the zero value tells NewClient to skip the keepalive dial option, so
|
||||
// grpc's own behavior applies and no pings are sent
|
||||
return keepalive.ClientParameters{}
|
||||
}
|
||||
if grpcClientKeepaliveTimeout <= 0 {
|
||||
// a time without a usable timeout: fall back to a working default
|
||||
grpcClientKeepaliveTimeout = _defaultKeepaliveTimeout
|
||||
}
|
||||
// same default as grpc
|
||||
infinity = time.Duration(math.MaxInt64)
|
||||
_defaultMaxConnectionAge = infinity
|
||||
)
|
||||
|
||||
return keepalive.ClientParameters{
|
||||
Time: grpcClientKeepaliveTime,
|
||||
Timeout: grpcClientKeepaliveTimeout,
|
||||
// no pings on connections that have no rpc in flight: an idle connection has nothing
|
||||
// to rescue, and staying quiet keeps us clear of any server side ping enforcement
|
||||
PermitWithoutStream: false,
|
||||
// GetMaxConnectionAge returns the maximum grpc connection age.
|
||||
func GetMaxConnectionAge() time.Duration {
|
||||
d, err := time.ParseDuration(os.Getenv(_serverMaxConnectionAgeEnv))
|
||||
if err != nil {
|
||||
return _defaultMaxConnectionAge
|
||||
}
|
||||
return d
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
package grpc
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/config/envdecode"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/shared"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// must match the env tags on shared.GRPCClientOptions. GetClientKeepaliveParams itself reads no
|
||||
// environment, so these are only needed to exercise the decoding the services do before calling it.
|
||||
const (
|
||||
_clientKeepaliveTimeEnv = "GRPC_CLIENT_KEEPALIVE_TIME"
|
||||
_clientKeepaliveTimeoutEnv = "GRPC_CLIENT_KEEPALIVE_TIMEOUT"
|
||||
)
|
||||
|
||||
func TestGetClientKeepaliveParams(t *testing.T) {
|
||||
tests := map[string]struct {
|
||||
time, timeout time.Duration
|
||||
wantTime, wantTimeo time.Duration
|
||||
}{
|
||||
"nothing configured disables keepalive entirely": {
|
||||
wantTime: 0,
|
||||
wantTimeo: 0,
|
||||
},
|
||||
"nothing configured disables keepalive even if the timeout is set": {
|
||||
timeout: 5 * time.Second,
|
||||
wantTime: 0,
|
||||
wantTimeo: 0,
|
||||
},
|
||||
"a negative time disables keepalive as well": {
|
||||
time: -5 * time.Second,
|
||||
timeout: 5 * time.Second,
|
||||
wantTime: 0,
|
||||
wantTimeo: 0,
|
||||
},
|
||||
"valid values are used as configured": {
|
||||
time: 30 * time.Second,
|
||||
timeout: 5 * time.Second,
|
||||
wantTime: 30 * time.Second,
|
||||
wantTimeo: 5 * time.Second,
|
||||
},
|
||||
"a time without a timeout falls back to the working default": {
|
||||
time: 30 * time.Second,
|
||||
wantTime: 30 * time.Second,
|
||||
wantTimeo: 10 * time.Second,
|
||||
},
|
||||
"a time with a negative timeout falls back to the working default": {
|
||||
time: 30 * time.Second,
|
||||
timeout: -5 * time.Second,
|
||||
wantTime: 30 * time.Second,
|
||||
wantTimeo: 10 * time.Second,
|
||||
},
|
||||
}
|
||||
|
||||
for name, tt := range tests {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
params := GetClientKeepaliveParams(tt.time, tt.timeout)
|
||||
|
||||
assert.Equal(t, tt.wantTime, params.Time)
|
||||
assert.Equal(t, tt.wantTimeo, params.Timeout)
|
||||
assert.False(t, params.PermitWithoutStream)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// TestGetClientKeepaliveParamsAfterEnvdecode drives the two env vars through the same decoder the
|
||||
// services use, to pin down what the supported env var spellings actually produce. Only fields
|
||||
// tagged 'strict' make envdecode report a value it cannot parse, so a duration without a unit
|
||||
// suffix is dropped and reaches GetClientKeepaliveParams as a zero, which this package treats as
|
||||
// "not configured". reva's pool reads the same two env vars for the CS3 clients and arrives at the
|
||||
// same result for these inputs, so the two stay in step.
|
||||
func TestGetClientKeepaliveParamsAfterEnvdecode(t *testing.T) {
|
||||
tests := map[string]struct {
|
||||
env map[string]string
|
||||
wantTime, wantTimeo time.Duration
|
||||
}{
|
||||
"parseable values are honored": {
|
||||
env: map[string]string{
|
||||
_clientKeepaliveTimeEnv: "45s",
|
||||
_clientKeepaliveTimeoutEnv: "7s",
|
||||
},
|
||||
wantTime: 45 * time.Second,
|
||||
wantTimeo: 7 * time.Second,
|
||||
},
|
||||
"a time without a unit suffix is dropped and reads as not configured": {
|
||||
env: map[string]string{_clientKeepaliveTimeEnv: "20"},
|
||||
wantTime: 0,
|
||||
wantTimeo: 0,
|
||||
},
|
||||
"an empty time reads as not configured": {
|
||||
env: map[string]string{_clientKeepaliveTimeEnv: ""},
|
||||
wantTime: 0,
|
||||
wantTimeo: 0,
|
||||
},
|
||||
"a timeout without a unit suffix falls back but keeps the configured time": {
|
||||
env: map[string]string{
|
||||
_clientKeepaliveTimeEnv: "45s",
|
||||
_clientKeepaliveTimeoutEnv: "7",
|
||||
},
|
||||
wantTime: 45 * time.Second,
|
||||
wantTimeo: 10 * time.Second,
|
||||
},
|
||||
"a timeout alone does not enable keepalive": {
|
||||
env: map[string]string{_clientKeepaliveTimeoutEnv: "7s"},
|
||||
wantTime: 0,
|
||||
wantTimeo: 0,
|
||||
},
|
||||
}
|
||||
|
||||
for name, tt := range tests {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
for k, v := range tt.env {
|
||||
t.Setenv(k, v)
|
||||
}
|
||||
|
||||
var co shared.GRPCClientOptions
|
||||
require.NoError(t, envdecode.Decode(&co))
|
||||
|
||||
params := GetClientKeepaliveParams(co.GRPCClientKeepaliveTime, co.GRPCClientKeepaliveTimeout)
|
||||
assert.Equal(t, tt.wantTime, params.Time)
|
||||
assert.Equal(t, tt.wantTimeo, params.Timeout)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -24,12 +24,6 @@ import (
|
||||
ocismetadata "github.com/owncloud/ocis/v2/ocis-pkg/service/grpc/handler/metadata"
|
||||
)
|
||||
|
||||
// _minKeepalivePingInterval is the shortest keepalive ping interval we accept
|
||||
// from a client. Clients cannot ping more often than every ten seconds, so this
|
||||
// leaves headroom below that; grpc's own default would GOAWAY anything more
|
||||
// frequent than every five minutes.
|
||||
const _minKeepalivePingInterval = 5 * time.Second
|
||||
|
||||
// Service simply wraps the go-micro grpc service.
|
||||
type Service struct {
|
||||
micro.Service
|
||||
@@ -39,11 +33,8 @@ type Service struct {
|
||||
func NewServiceWithClient(client client.Client, opts ...Option) (Service, error) {
|
||||
var mServer server.Server
|
||||
sopts := newOptions(opts...)
|
||||
// accept the keepalive pings clients send while an rpc is in flight, so that
|
||||
// they can tell a peer that stopped answering from one that is merely slow
|
||||
keepaliveParams := grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{
|
||||
MinTime: _minKeepalivePingInterval,
|
||||
PermitWithoutStream: true,
|
||||
keepaliveParams := grpc.KeepaliveParams(keepalive.ServerParameters{
|
||||
MaxConnectionAge: GetMaxConnectionAge(), // this forces clients to reconnect after 30 seconds, triggering a new DNS lookup to pick up new IPs
|
||||
})
|
||||
tlsConfig := &tls.Config{}
|
||||
|
||||
|
||||
@@ -4,8 +4,6 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/config/defaults"
|
||||
"github.com/owncloud/reva/v2/pkg/natsauth"
|
||||
revastore "github.com/owncloud/reva/v2/pkg/store"
|
||||
)
|
||||
|
||||
func MissingMachineAuthApiKeyError(service string) error {
|
||||
@@ -95,18 +93,3 @@ func MissingWOPISecretError(service string) error {
|
||||
"the config/corresponding environment variable).",
|
||||
service, defaults.BaseConfigPath())
|
||||
}
|
||||
|
||||
// CheckNatsCredentials checks the NATS JWT credentials of a store at startup. The reva
|
||||
// store cannot return an error for invalid credentials. It only logs the error, and each
|
||||
// store operation fails later. It returns no error when both values are empty.
|
||||
// Only the nats-js and nats-js-kv stores use the credentials. For other store types,
|
||||
// it does not check the credentials.
|
||||
func CheckNatsCredentials(service, store, credsFile, creds string) error {
|
||||
if !revastore.UsesNats(store) {
|
||||
return nil
|
||||
}
|
||||
if err := natsauth.Check(credsFile, creds); err != nil {
|
||||
return fmt.Errorf("The NATS credentials for %s are not valid: %w", service, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package shared
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/natstest"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestCheckNatsCredentials(t *testing.T) {
|
||||
t.Run("no credentials", func(t *testing.T) {
|
||||
require.NoError(t, CheckNatsCredentials("proxy", "nats-js-kv", "", ""))
|
||||
})
|
||||
|
||||
t.Run("valid content", func(t *testing.T) {
|
||||
require.NoError(t, CheckNatsCredentials("proxy", "nats-js-kv", "", string(natstest.Creds(t))))
|
||||
})
|
||||
|
||||
t.Run("partly written content", func(t *testing.T) {
|
||||
creds := string(natstest.Creds(t))
|
||||
err := CheckNatsCredentials("proxy", "nats-js-kv", "", creds[:len(creds)/3])
|
||||
require.ErrorContains(t, err, "proxy")
|
||||
})
|
||||
|
||||
t.Run("missing file", func(t *testing.T) {
|
||||
err := CheckNatsCredentials("proxy", "nats-js-kv", filepath.Join(t.TempDir(), "missing.creds"), "")
|
||||
require.ErrorContains(t, err, "proxy")
|
||||
})
|
||||
|
||||
t.Run("store without nats", func(t *testing.T) {
|
||||
for _, store := range []string{"memory", "redis-sentinel", "noop", ""} {
|
||||
require.NoError(t, CheckNatsCredentials("proxy", store, filepath.Join(t.TempDir(), "missing.creds"), ""), store)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("nats-js store", func(t *testing.T) {
|
||||
err := CheckNatsCredentials("proxy", "nats-js", filepath.Join(t.TempDir(), "missing.creds"), "")
|
||||
require.ErrorContains(t, err, "proxy")
|
||||
})
|
||||
}
|
||||
@@ -42,22 +42,6 @@ type GRPCClientTLS struct {
|
||||
CACert string `yaml:"cacert" env:"OCIS_GRPC_CLIENT_TLS_CACERT" desc:"Path/File name for the root CA certificate (in PEM format) used to validate TLS server certificates of the go-micro based grpc services." introductionVersion:"pre5.0"`
|
||||
}
|
||||
|
||||
// GRPCClientOptions holds settings that apply to the grpc clients of all services, both the
|
||||
// reva CS3 clients and the go-micro based ones.
|
||||
type GRPCClientOptions struct {
|
||||
// NOTE: you will not find GRPCMaxReceivedMessageSize being used in the code. The envvar is actually extracted in revas `pool` package: https://github.com/cs3org/reva/blob/edge/pkg/rgrpc/todo/pool/connection.go
|
||||
// It is mentioned here again so it is documented
|
||||
GRPCMaxReceivedMessageSize int `yaml:"grpc_max_received_message_size" env:"OCIS_GRPC_MAX_RECEIVED_MESSAGE_SIZE" desc:"The maximum body size for grpc requests. Defaults to '10240000' bytes (10MB). Note that large values can potentially hide errors but may lead to network timeouts. Should only be changed temporarily to regain access for large folders with 25.000+ files to copy out data." introductionVersion:"pre5.0"`
|
||||
// The two keepalive settings below apply to both the reva CS3 clients (revas `pool` package:
|
||||
// https://github.com/owncloud/reva/blob/master/pkg/rgrpc/todo/pool/keepalive.go) and the
|
||||
// go-micro based clients (GetClientKeepaliveParams in ocis-pkg/service/grpc/keepalive.go),
|
||||
// which read them independently of each other but apply the same rules, so both behave
|
||||
// identically for every input. Keepalive is off unless the time is set to a duration that
|
||||
// parses; a value without a unit suffix leaves the clients without pings.
|
||||
GRPCClientKeepaliveTime time.Duration `yaml:"grpc_client_keepalive_time" env:"GRPC_CLIENT_KEEPALIVE_TIME" desc:"How long a grpc client connection with an ongoing request may stay silent before the server is pinged to check whether it is still answering. Set a duration like '20s' to enable detection of unresponsive peers. Leaving it unset, or at '0', sends no pings at all, which is grpc's own default. Values below '10s' are raised to '10s' by grpc. Make sure to include the unit suffix, a bare number is not a valid duration." introductionVersion:"8.3.0"`
|
||||
GRPCClientKeepaliveTimeout time.Duration `yaml:"grpc_client_keepalive_timeout" env:"GRPC_CLIENT_KEEPALIVE_TIMEOUT" desc:"How long a grpc client waits for the answer to a keepalive ping before it considers the connection dead and fails all requests on it. Defaults to '10s'. Has no effect unless GRPC_CLIENT_KEEPALIVE_TIME is set. See GRPC_CLIENT_KEEPALIVE_TIME." introductionVersion:"8.3.0"`
|
||||
}
|
||||
|
||||
type GRPCServiceTLS struct {
|
||||
Enabled bool `yaml:"enabled" env:"OCIS_GRPC_TLS_ENABLED" desc:"Activates TLS for the grpc based services using the server certifcate and key configured via OCIS_GRPC_TLS_CERTIFICATE and OCIS_GRPC_TLS_KEY. If OCIS_GRPC_TLS_CERTIFICATE is not set a temporary server certificate is generated - to be used with OCIS_GRPC_CLIENT_TLS_MODE=insecure." introductionVersion:"pre5.0"`
|
||||
Cert string `yaml:"cert" env:"OCIS_GRPC_TLS_CERTIFICATE" desc:"Path/File name of the TLS server certificate (in PEM format) for the grpc services." introductionVersion:"pre5.0"`
|
||||
@@ -72,35 +56,38 @@ type HTTPServiceTLS struct {
|
||||
}
|
||||
|
||||
type Cache struct {
|
||||
Store string `yaml:"store" env:"OCIS_CACHE_STORE" desc:"The type of the cache store. Supported values are: 'memory', 'redis-sentinel', 'nats-js-kv', 'noop'. See the text description for details." introductionVersion:"pre5.0"`
|
||||
Nodes []string `yaml:"nodes" env:"OCIS_CACHE_STORE_NODES" desc:"A comma separated list of nodes to access the configured store. This has no effect when 'memory' store is configured. Note that the behaviour how nodes are used is dependent on the library of the configured store." introductionVersion:"pre5.0"`
|
||||
Database string `yaml:"database" env:"OCIS_CACHE_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
|
||||
Table string `yaml:"table" env:"OCIS_CACHE_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"`
|
||||
TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL" desc:"Time to live for events in the store. The duration can be set as number followed by a unit identifier like s, m or h." introductionVersion:"pre5.0"`
|
||||
DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"`
|
||||
AuthUsername string `yaml:"auth_username" env:"OCIS_CACHE_AUTH_USERNAME" desc:"The username to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"pre5.0"`
|
||||
AuthPassword string `mask:"password" yaml:"auth_password" env:"OCIS_CACHE_AUTH_PASSWORD" desc:"The password to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"pre5.0"`
|
||||
EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the NATS store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the NATS store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate used to validate the NATS store TLS certificate. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
Store string `yaml:"store" env:"OCIS_CACHE_STORE" desc:"The type of the cache store. Supported values are: 'memory', 'redis-sentinel', 'nats-js-kv', 'noop'. See the text description for details." introductionVersion:"pre5.0"`
|
||||
Nodes []string `yaml:"nodes" env:"OCIS_CACHE_STORE_NODES" desc:"A comma separated list of nodes to access the configured store. This has no effect when 'memory' store is configured. Note that the behaviour how nodes are used is dependent on the library of the configured store." introductionVersion:"pre5.0"`
|
||||
Database string `yaml:"database" env:"OCIS_CACHE_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
|
||||
Table string `yaml:"table" env:"OCIS_CACHE_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"`
|
||||
TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL" desc:"Time to live for events in the store. The duration can be set as number followed by a unit identifier like s, m or h." introductionVersion:"pre5.0"`
|
||||
DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"`
|
||||
AuthUsername string `yaml:"auth_username" env:"OCIS_CACHE_AUTH_USERNAME" desc:"The username to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"pre5.0"`
|
||||
AuthPassword string `yaml:"auth_password" env:"OCIS_CACHE_AUTH_PASSWORD" desc:"The password to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"pre5.0"`
|
||||
EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the NATS store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the NATS store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate used to validate the NATS store TLS certificate. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
}
|
||||
|
||||
// Commons holds configuration that are common to all extensions. Each extension can then decide whether
|
||||
// to overwrite its values.
|
||||
type Commons struct {
|
||||
Log *Log `yaml:"log"`
|
||||
Tracing *Tracing `yaml:"tracing"`
|
||||
Cache *Cache `mask:"struct" yaml:"cache"`
|
||||
GRPCClientTLS *GRPCClientTLS `yaml:"grpc_client_tls"`
|
||||
GRPCClientOptions *GRPCClientOptions `yaml:"grpc_client_options"`
|
||||
GRPCServiceTLS *GRPCServiceTLS `yaml:"grpc_service_tls"`
|
||||
HTTPServiceTLS HTTPServiceTLS `yaml:"http_service_tls"`
|
||||
OcisURL string `yaml:"ocis_url" env:"OCIS_URL" desc:"URL, where oCIS is reachable for users." introductionVersion:"pre5.0"`
|
||||
TokenManager *TokenManager `mask:"struct" yaml:"token_manager"`
|
||||
Reva *Reva `yaml:"reva"`
|
||||
MachineAuthAPIKey string `mask:"password" yaml:"machine_auth_api_key" env:"OCIS_MACHINE_AUTH_API_KEY" desc:"Machine auth API key used to validate internal requests necessary for the access to resources from other services." introductionVersion:"pre5.0"`
|
||||
TransferSecret string `mask:"password" yaml:"transfer_secret,omitempty" env:"REVA_TRANSFER_SECRET" desc:"The secret used for signing the requests towards the data gateway for up- and downloads." introductionVersion:"pre5.0"`
|
||||
SystemUserID string `yaml:"system_user_id" env:"OCIS_SYSTEM_USER_ID" desc:"ID of the oCIS storage-system system user. Admins need to set the ID for the storage-system system user in this config option which is then used to reference the user. Any reasonable long string is possible, preferably this would be an UUIDv4 format." introductionVersion:"pre5.0"`
|
||||
SystemUserAPIKey string `mask:"password" yaml:"system_user_api_key" env:"SYSTEM_USER_API_KEY" desc:"API key for all system users." introductionVersion:"pre5.0"`
|
||||
AdminUserID string `yaml:"admin_user_id" env:"OCIS_ADMIN_USER_ID" desc:"ID of a user, that should receive admin privileges. Consider that the UUID can be encoded in some LDAP deployment configurations like in .ldif files. These need to be decoded beforehand." introductionVersion:"pre5.0"`
|
||||
Log *Log `yaml:"log"`
|
||||
Tracing *Tracing `yaml:"tracing"`
|
||||
Cache *Cache `yaml:"cache"`
|
||||
GRPCClientTLS *GRPCClientTLS `yaml:"grpc_client_tls"`
|
||||
GRPCServiceTLS *GRPCServiceTLS `yaml:"grpc_service_tls"`
|
||||
HTTPServiceTLS HTTPServiceTLS `yaml:"http_service_tls"`
|
||||
OcisURL string `yaml:"ocis_url" env:"OCIS_URL" desc:"URL, where oCIS is reachable for users." introductionVersion:"pre5.0"`
|
||||
TokenManager *TokenManager `mask:"struct" yaml:"token_manager"`
|
||||
Reva *Reva `yaml:"reva"`
|
||||
MachineAuthAPIKey string `mask:"password" yaml:"machine_auth_api_key" env:"OCIS_MACHINE_AUTH_API_KEY" desc:"Machine auth API key used to validate internal requests necessary for the access to resources from other services." introductionVersion:"pre5.0"`
|
||||
TransferSecret string `mask:"password" yaml:"transfer_secret,omitempty" env:"REVA_TRANSFER_SECRET" desc:"The secret used for signing the requests towards the data gateway for up- and downloads." introductionVersion:"pre5.0"`
|
||||
SystemUserID string `yaml:"system_user_id" env:"OCIS_SYSTEM_USER_ID" desc:"ID of the oCIS storage-system system user. Admins need to set the ID for the storage-system system user in this config option which is then used to reference the user. Any reasonable long string is possible, preferably this would be an UUIDv4 format." introductionVersion:"pre5.0"`
|
||||
SystemUserAPIKey string `mask:"password" yaml:"system_user_api_key" env:"SYSTEM_USER_API_KEY" desc:"API key for all system users." introductionVersion:"pre5.0"`
|
||||
AdminUserID string `yaml:"admin_user_id" env:"OCIS_ADMIN_USER_ID" desc:"ID of a user, that should receive admin privileges. Consider that the UUID can be encoded in some LDAP deployment configurations like in .ldif files. These need to be decoded beforehand." introductionVersion:"pre5.0"`
|
||||
|
||||
// NOTE: you will not fing GRPCMaxReceivedMessageSize size being used in the code. The envvar is actually extracted in revas `pool` package: https://github.com/cs3org/reva/blob/edge/pkg/rgrpc/todo/pool/connection.go
|
||||
// It is mentioned here again so it is documented
|
||||
GRPCMaxReceivedMessageSize int `env:"OCIS_GRPC_MAX_RECEIVED_MESSAGE_SIZE" desc:"The maximum body size for grpc requests. Defaults to '10240000' bytes (10MB). Note that large values can potentially hide errors but may lead to network timeouts. Should only be changed temporarily to regain access for large folders with 25.000+ files to copy out data." introductionVersion:"pre5.0"`
|
||||
}
|
||||
@@ -16,7 +16,7 @@ var (
|
||||
// LatestTag is the latest released version plus the dev meta version.
|
||||
// Will be overwritten by the release pipeline
|
||||
// Needs a manual change for every tagged release
|
||||
LatestTag = "8.0.9"
|
||||
LatestTag = "8.0.8"
|
||||
|
||||
// Date indicates the build date.
|
||||
// This has been removed, it looks like you can only replace static strings with recent go versions
|
||||
|
||||
@@ -90,7 +90,6 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
microstore.Database(cfg.Store.Database),
|
||||
microstore.Table(cfg.Store.Table),
|
||||
store.Authentication(cfg.Store.AuthUsername, cfg.Store.AuthPassword),
|
||||
store.Credentials(cfg.Store.CredsFile, cfg.Store.Creds),
|
||||
store.TLS(cfg.Store.EnableTLS, cfg.Store.TLSInsecure, cfg.Store.TLSRootCACertificate),
|
||||
)
|
||||
|
||||
@@ -112,7 +111,7 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
}
|
||||
|
||||
grpcClient, err := ogrpc.NewClient(
|
||||
append(ogrpc.GetClientOptions(cfg.GRPCClientTLS), ogrpc.WithKeepaliveParams(cfg.GRPCClientOptions), ogrpc.WithTraceProvider(tracerProvider))...,
|
||||
append(ogrpc.GetClientOptions(cfg.GRPCClientTLS), ogrpc.WithTraceProvider(tracerProvider))...,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -20,9 +20,8 @@ type Config struct {
|
||||
Events Events `yaml:"events"`
|
||||
Store Store `yaml:"store"`
|
||||
|
||||
RevaGateway string `yaml:"reva_gateway" env:"OCIS_REVA_GATEWAY" desc:"CS3 gateway used to look up user metadata" introductionVersion:"5.0"`
|
||||
GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"`
|
||||
GRPCClientOptions *shared.GRPCClientOptions `yaml:"grpc_client_options"`
|
||||
RevaGateway string `yaml:"reva_gateway" env:"OCIS_REVA_GATEWAY" desc:"CS3 gateway used to look up user metadata" introductionVersion:"5.0"`
|
||||
GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"`
|
||||
|
||||
HTTP HTTP `yaml:"http"`
|
||||
TokenManager *TokenManager `yaml:"token_manager"`
|
||||
@@ -44,24 +43,20 @@ type Events struct {
|
||||
EnableTLS bool `yaml:"enable_tls" env:"OCIS_EVENTS_ENABLE_TLS" desc:"Enable TLS for the connection to the events broker. The events broker is the ocis service which receives and delivers events between the services." introductionVersion:"5.0"`
|
||||
AuthUsername string `yaml:"username" env:"OCIS_EVENTS_AUTH_USERNAME" desc:"The username to authenticate with the events broker. The events broker is the ocis service which receives and delivers events between the services." introductionVersion:"5.0"`
|
||||
AuthPassword string `yaml:"password" env:"OCIS_EVENTS_AUTH_PASSWORD" desc:"The password to authenticate with the events broker. The events broker is the ocis service which receives and delivers events between the services." introductionVersion:"5.0"`
|
||||
CredsFile string `yaml:"creds_file" env:"OCIS_NATS_CREDS_FILE" desc:"Path to a NATS .creds file with a user JWT and an NKey seed. Use it to authenticate with the events broker when NATS runs in JWT (operator) mode. When set, the service does not use the username and the password. The service reads the file again on each reconnect." introductionVersion:"8.3.0"`
|
||||
Creds string `mask:"password" yaml:"creds" env:"OCIS_NATS_CREDS" desc:"Content of a NATS .creds file with a user JWT and an NKey seed. Use it to authenticate with the events broker when NATS runs in JWT (operator) mode. A service-specific variable takes precedence over a global variable. In the same scope, the content takes precedence over the path of a .creds file. When set, the service does not use the username and the password." introductionVersion:"8.3.0"`
|
||||
}
|
||||
|
||||
// Store configures the store to use
|
||||
type Store struct {
|
||||
Store string `yaml:"store" env:"OCIS_PERSISTENT_STORE;ACTIVITYLOG_STORE" desc:"The type of the store. Supported values are: 'memory', 'nats-js-kv', 'redis-sentinel', 'noop'. See the text description for details." introductionVersion:"pre5.0"`
|
||||
Nodes []string `yaml:"nodes" env:"OCIS_PERSISTENT_STORE_NODES;ACTIVITYLOG_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' store is configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
Database string `yaml:"database" env:"ACTIVITYLOG_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
|
||||
Table string `yaml:"table" env:"ACTIVITYLOG_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"`
|
||||
TTL time.Duration `yaml:"ttl" env:"OCIS_PERSISTENT_STORE_TTL;ACTIVITYLOG_STORE_TTL" desc:"Time to live for events in the store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;ACTIVITYLOG_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;ACTIVITYLOG_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
CredsFile string `yaml:"creds_file" env:"OCIS_NATS_CREDS_FILE;ACTIVITYLOG_STORE_CREDS_FILE" desc:"Path to a NATS .creds file with a user JWT and an NKey seed. Use it to authenticate with the store when NATS runs in JWT (operator) mode. When set, the service does not use the username and the password. Exception: a service-specific username and password take precedence over the global OCIS_NATS_CREDS and OCIS_NATS_CREDS_FILE variables when both have a value. The service reads the file again on each reconnect. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
Creds string `mask:"password" yaml:"creds" env:"OCIS_NATS_CREDS;ACTIVITYLOG_STORE_CREDS" desc:"Content of a NATS .creds file with a user JWT and an NKey seed. Use it to authenticate with the store when NATS runs in JWT (operator) mode. A service-specific variable takes precedence over a global variable. In the same scope, the content takes precedence over the path of a .creds file. When set, the service does not use the username and the password. Exception: a service-specific username and password take precedence over the global OCIS_NATS_CREDS and OCIS_NATS_CREDS_FILE variables when both have a value. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
EnableTLS bool `yaml:"enable_tls" env:"OCIS_PERSISTENT_STORE_ENABLE_TLS;ACTIVITYLOG_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_PERSISTENT_STORE_TLS_INSECURE;ACTIVITYLOG_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_PERSISTENT_STORE_TLS_ROOT_CA_CERTIFICATE;ACTIVITYLOG_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
Store string `yaml:"store" env:"OCIS_PERSISTENT_STORE;ACTIVITYLOG_STORE" desc:"The type of the store. Supported values are: 'memory', 'nats-js-kv', 'redis-sentinel', 'noop'. See the text description for details." introductionVersion:"pre5.0"`
|
||||
Nodes []string `yaml:"nodes" env:"OCIS_PERSISTENT_STORE_NODES;ACTIVITYLOG_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' store is configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
Database string `yaml:"database" env:"ACTIVITYLOG_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
|
||||
Table string `yaml:"table" env:"ACTIVITYLOG_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"`
|
||||
TTL time.Duration `yaml:"ttl" env:"OCIS_PERSISTENT_STORE_TTL;ACTIVITYLOG_STORE_TTL" desc:"Time to live for events in the store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;ACTIVITYLOG_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;ACTIVITYLOG_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
EnableTLS bool `yaml:"enable_tls" env:"OCIS_PERSISTENT_STORE_ENABLE_TLS;ACTIVITYLOG_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_PERSISTENT_STORE_TLS_INSECURE;ACTIVITYLOG_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_PERSISTENT_STORE_TLS_ROOT_CA_CERTIFICATE;ACTIVITYLOG_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
}
|
||||
|
||||
// ServiceAccount is the configuration for the used service account
|
||||
|
||||
@@ -71,10 +71,6 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
cfg.GRPCClientTLS = structs.CopyOrZeroValue(cfg.Commons.GRPCClientTLS)
|
||||
}
|
||||
|
||||
if cfg.GRPCClientOptions == nil && cfg.Commons != nil {
|
||||
cfg.GRPCClientOptions = structs.CopyOrZeroValue(cfg.Commons.GRPCClientOptions)
|
||||
}
|
||||
|
||||
if cfg.TokenManager == nil && cfg.Commons != nil && cfg.Commons.TokenManager != nil {
|
||||
cfg.TokenManager = &config.TokenManager{
|
||||
JWTSecret: cfg.Commons.TokenManager.JWTSecret,
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"errors"
|
||||
|
||||
ociscfg "github.com/owncloud/ocis/v2/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/shared"
|
||||
"github.com/owncloud/ocis/v2/services/activitylog/pkg/config"
|
||||
"github.com/owncloud/ocis/v2/services/activitylog/pkg/config/defaults"
|
||||
|
||||
@@ -35,5 +34,5 @@ func ParseConfig(cfg *config.Config) error {
|
||||
|
||||
// Validate validates the config
|
||||
func Validate(cfg *config.Config) error {
|
||||
return shared.CheckNatsCredentials(cfg.Service.Name, cfg.Store.Store, cfg.Store.CredsFile, cfg.Store.Creds)
|
||||
return nil
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/handlers"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/service/debug"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/version"
|
||||
"github.com/owncloud/reva/v2/pkg/events/stream"
|
||||
)
|
||||
|
||||
// Server initializes the debug service and server.
|
||||
@@ -19,7 +18,7 @@ func Server(opts ...Option) (*http.Server, error) {
|
||||
WithCheck("http reachability", checks.NewHTTPCheck(options.Config.HTTP.Addr))
|
||||
|
||||
readyHandlerConfiguration := healthHandlerConfiguration.
|
||||
WithCheck("nats reachability", checks.NewNatsCheckWithConfig(options.Config.Events.Endpoint, stream.NatsConfig(options.Config.Events)))
|
||||
WithCheck("nats reachability", checks.NewNatsCheck(options.Config.Events.Endpoint))
|
||||
|
||||
return debug.NewService(
|
||||
debug.Logger(options.Logger),
|
||||
|
||||
@@ -11,7 +11,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2026-09-15 02:26+0000\n"
|
||||
"POT-Creation-Date: 2026-07-15 03:10+0000\n"
|
||||
"PO-Revision-Date: 2026-01-02 10:10+0000\n"
|
||||
"Last-Translator: Martin <github@diemattels.at>, 2026\n"
|
||||
"Language-Team: Catalan (https://app.transifex.com/owncloud-org/teams/6149/ca/)\n"
|
||||
|
||||
@@ -11,7 +11,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2026-09-15 02:26+0000\n"
|
||||
"POT-Creation-Date: 2026-07-15 03:10+0000\n"
|
||||
"PO-Revision-Date: 2026-01-02 10:10+0000\n"
|
||||
"Last-Translator: Martin <github@diemattels.at>, 2026\n"
|
||||
"Language-Team: German (https://app.transifex.com/owncloud-org/teams/6149/de/)\n"
|
||||
|
||||
@@ -11,7 +11,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2026-09-15 02:26+0000\n"
|
||||
"POT-Creation-Date: 2026-07-15 03:10+0000\n"
|
||||
"PO-Revision-Date: 2026-01-02 10:10+0000\n"
|
||||
"Last-Translator: Martin <github@diemattels.at>, 2026\n"
|
||||
"Language-Team: English (United Kingdom) (https://app.transifex.com/owncloud-org/teams/6149/en_GB/)\n"
|
||||
|
||||
@@ -11,7 +11,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2026-09-15 02:26+0000\n"
|
||||
"POT-Creation-Date: 2026-07-15 03:10+0000\n"
|
||||
"PO-Revision-Date: 2026-01-02 10:10+0000\n"
|
||||
"Last-Translator: Martin <github@diemattels.at>, 2026\n"
|
||||
"Language-Team: English (United States) (https://app.transifex.com/owncloud-org/teams/6149/en_US/)\n"
|
||||
|
||||
@@ -12,7 +12,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2026-09-15 02:26+0000\n"
|
||||
"POT-Creation-Date: 2026-07-15 03:10+0000\n"
|
||||
"PO-Revision-Date: 2026-01-02 10:10+0000\n"
|
||||
"Last-Translator: Victor Vinuela <vinuela.victor@dissectio.com>, 2026\n"
|
||||
"Language-Team: Spanish (https://app.transifex.com/owncloud-org/teams/6149/es/)\n"
|
||||
|
||||
@@ -11,7 +11,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2026-09-20 02:26+0000\n"
|
||||
"POT-Creation-Date: 2026-07-20 03:13+0000\n"
|
||||
"PO-Revision-Date: 2026-01-02 10:10+0000\n"
|
||||
"Last-Translator: Markus Sorola, 2026\n"
|
||||
"Language-Team: Finnish (Finland) (https://app.transifex.com/owncloud-org/teams/6149/fi_FI/)\n"
|
||||
|
||||
@@ -12,7 +12,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2026-09-15 02:26+0000\n"
|
||||
"POT-Creation-Date: 2026-07-15 03:10+0000\n"
|
||||
"PO-Revision-Date: 2026-01-02 10:10+0000\n"
|
||||
"Last-Translator: Cesare Capoferri, 2026\n"
|
||||
"Language-Team: Italian (https://app.transifex.com/owncloud-org/teams/6149/it/)\n"
|
||||
|
||||
@@ -12,7 +12,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2026-09-29 02:27+0000\n"
|
||||
"POT-Creation-Date: 2026-07-29 03:09+0000\n"
|
||||
"PO-Revision-Date: 2026-01-02 10:10+0000\n"
|
||||
"Last-Translator: miyasaka miyabi, 2026\n"
|
||||
"Language-Team: Japanese (https://app.transifex.com/owncloud-org/teams/6149/ja/)\n"
|
||||
|
||||
@@ -12,7 +12,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2026-09-15 02:26+0000\n"
|
||||
"POT-Creation-Date: 2026-07-15 03:10+0000\n"
|
||||
"PO-Revision-Date: 2026-01-02 10:10+0000\n"
|
||||
"Last-Translator: BoneNI, 2026\n"
|
||||
"Language-Team: Lao (https://app.transifex.com/owncloud-org/teams/6149/lo/)\n"
|
||||
|
||||
@@ -12,7 +12,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2026-09-15 02:26+0000\n"
|
||||
"POT-Creation-Date: 2026-07-15 03:10+0000\n"
|
||||
"PO-Revision-Date: 2026-01-02 10:10+0000\n"
|
||||
"Last-Translator: Martin <github@diemattels.at>, 2026\n"
|
||||
"Language-Team: Portuguese (https://app.transifex.com/owncloud-org/teams/6149/pt/)\n"
|
||||
|
||||
@@ -11,7 +11,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2026-09-15 02:26+0000\n"
|
||||
"POT-Creation-Date: 2026-07-15 03:10+0000\n"
|
||||
"PO-Revision-Date: 2026-01-02 10:10+0000\n"
|
||||
"Last-Translator: Martin <github@diemattels.at>, 2026\n"
|
||||
"Language-Team: Portuguese (Brazil) (https://app.transifex.com/owncloud-org/teams/6149/pt_BR/)\n"
|
||||
|
||||
@@ -11,7 +11,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2026-09-24 02:26+0000\n"
|
||||
"POT-Creation-Date: 2026-07-24 03:11+0000\n"
|
||||
"PO-Revision-Date: 2026-01-02 10:10+0000\n"
|
||||
"Last-Translator: Martin <github@diemattels.at>, 2026\n"
|
||||
"Language-Team: Russian (https://app.transifex.com/owncloud-org/teams/6149/ru/)\n"
|
||||
|
||||
@@ -12,7 +12,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2026-09-15 02:26+0000\n"
|
||||
"POT-Creation-Date: 2026-07-15 03:10+0000\n"
|
||||
"PO-Revision-Date: 2026-01-02 10:10+0000\n"
|
||||
"Last-Translator: Miha Podobnik, 2026\n"
|
||||
"Language-Team: Slovenian (https://app.transifex.com/owncloud-org/teams/6149/sl/)\n"
|
||||
|
||||
@@ -11,7 +11,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2026-09-15 02:26+0000\n"
|
||||
"POT-Creation-Date: 2026-07-15 03:10+0000\n"
|
||||
"PO-Revision-Date: 2026-01-02 10:10+0000\n"
|
||||
"Last-Translator: Martin <github@diemattels.at>, 2026\n"
|
||||
"Language-Team: Albanian (https://app.transifex.com/owncloud-org/teams/6149/sq/)\n"
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
# Translators:
|
||||
# Martin <github@diemattels.at>, 2026
|
||||
# Daniel Nylander <po@danielnylander.se>, 2026
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2026-09-24 02:26+0000\n"
|
||||
"PO-Revision-Date: 2026-01-02 10:10+0000\n"
|
||||
"Last-Translator: Daniel Nylander <po@danielnylander.se>, 2026\n"
|
||||
"Language-Team: Swedish (https://app.transifex.com/owncloud-org/teams/6149/sv/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Language: sv\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#: pkg/service/response.go:44
|
||||
msgid "description"
|
||||
msgstr "beskrivning"
|
||||
|
||||
#: pkg/service/response.go:43
|
||||
msgid "display name"
|
||||
msgstr "visningsnamn"
|
||||
|
||||
#: pkg/service/response.go:42
|
||||
msgid "expiration date"
|
||||
msgstr "utgångsdatum"
|
||||
|
||||
#: pkg/service/response.go:41
|
||||
msgid "password"
|
||||
msgstr "lösenord"
|
||||
|
||||
#: pkg/service/response.go:40
|
||||
msgid "permission"
|
||||
msgstr "behörighet"
|
||||
|
||||
#: pkg/service/response.go:45
|
||||
msgid "shared-with-me"
|
||||
msgstr "delat-med-mig"
|
||||
|
||||
#: pkg/service/response.go:39
|
||||
msgid "some field"
|
||||
msgstr "något fält"
|
||||
|
||||
#: pkg/service/response.go:26
|
||||
msgid "{resource} was downloaded via public link {token}"
|
||||
msgstr "{resource} laddades ner via offentlig länk {token}"
|
||||
|
||||
#: pkg/service/response.go:24
|
||||
msgid "{user} added {resource} to {folder}"
|
||||
msgstr "{user} lade till {resource} i {folder}"
|
||||
|
||||
#: pkg/service/response.go:36
|
||||
msgid "{user} added {sharee} as member of {space}"
|
||||
msgstr "{user} lade till {sharee} som medlem i {space}"
|
||||
|
||||
#: pkg/service/response.go:27
|
||||
msgid "{user} deleted {resource} from {folder}"
|
||||
msgstr "{user} tog bort {resource} från {folder}"
|
||||
|
||||
#: pkg/service/response.go:28
|
||||
msgid "{user} moved {resource} to {folder}"
|
||||
msgstr "{user} flyttade {resource} till {folder}"
|
||||
|
||||
#: pkg/service/response.go:35
|
||||
msgid "{user} removed link to {resource}"
|
||||
msgstr "{user} tog bort länken till {resource}"
|
||||
|
||||
#: pkg/service/response.go:32
|
||||
msgid "{user} removed {sharee} from {resource}"
|
||||
msgstr "{user} tog bort {sharee} från {resource}"
|
||||
|
||||
#: pkg/service/response.go:37
|
||||
msgid "{user} removed {sharee} from {space}"
|
||||
msgstr "{user} tog bort {sharee} från {space}"
|
||||
|
||||
#: pkg/service/response.go:29
|
||||
msgid "{user} renamed {oldResource} to {resource}"
|
||||
msgstr "{user} bytte namn på {oldResource} till {resource}"
|
||||
|
||||
#: pkg/service/response.go:33
|
||||
msgid "{user} shared {resource} via link"
|
||||
msgstr "{user} delade {resource} via länk"
|
||||
|
||||
#: pkg/service/response.go:30
|
||||
msgid "{user} shared {resource} with {sharee}"
|
||||
msgstr "{user} delade {resource} med {sharee}"
|
||||
|
||||
#: pkg/service/response.go:34
|
||||
msgid "{user} updated {field} for a link {token} on {resource}"
|
||||
msgstr "{user} uppdaterade {field} för en länk {token} på {resource}"
|
||||
|
||||
#: pkg/service/response.go:31
|
||||
msgid "{user} updated {field} for the {resource}"
|
||||
msgstr "{user} uppdaterade {field} för {resource}"
|
||||
|
||||
#: pkg/service/response.go:25
|
||||
msgid "{user} updated {resource} in {folder}"
|
||||
msgstr "{user} uppdaterade {resource} i {folder}"
|
||||
@@ -11,7 +11,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2026-09-15 02:26+0000\n"
|
||||
"POT-Creation-Date: 2026-07-15 03:10+0000\n"
|
||||
"PO-Revision-Date: 2026-01-02 10:10+0000\n"
|
||||
"Last-Translator: Martin <github@diemattels.at>, 2026\n"
|
||||
"Language-Team: Uyghur (https://app.transifex.com/owncloud-org/teams/6149/ug/)\n"
|
||||
|
||||
@@ -11,7 +11,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2026-09-24 02:26+0000\n"
|
||||
"POT-Creation-Date: 2026-07-24 03:11+0000\n"
|
||||
"PO-Revision-Date: 2026-01-02 10:10+0000\n"
|
||||
"Last-Translator: Martin <github@diemattels.at>, 2026\n"
|
||||
"Language-Team: Ukrainian (https://app.transifex.com/owncloud-org/teams/6149/uk/)\n"
|
||||
|
||||
@@ -12,7 +12,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2026-10-01 02:36+0000\n"
|
||||
"POT-Creation-Date: 2026-07-31 03:12+0000\n"
|
||||
"PO-Revision-Date: 2026-01-02 10:10+0000\n"
|
||||
"Last-Translator: 振东 刘, 2026\n"
|
||||
"Language-Team: Chinese Traditional (https://app.transifex.com/owncloud-org/teams/6149/zh-Hant/)\n"
|
||||
|
||||
@@ -13,7 +13,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2026-09-15 02:26+0000\n"
|
||||
"POT-Creation-Date: 2026-07-15 03:10+0000\n"
|
||||
"PO-Revision-Date: 2026-01-02 10:10+0000\n"
|
||||
"Last-Translator: 許明凱 <yuteson@gmail.com>, 2026\n"
|
||||
"Language-Team: Chinese (https://app.transifex.com/owncloud-org/teams/6149/zh/)\n"
|
||||
|
||||
@@ -13,7 +13,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2026-10-01 02:36+0000\n"
|
||||
"POT-Creation-Date: 2026-07-31 03:12+0000\n"
|
||||
"PO-Revision-Date: 2026-01-02 10:10+0000\n"
|
||||
"Last-Translator: 振东 刘, 2026\n"
|
||||
"Language-Team: Chinese (China) (https://app.transifex.com/owncloud-org/teams/6149/zh_CN/)\n"
|
||||
|
||||
@@ -13,7 +13,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2026-09-15 02:26+0000\n"
|
||||
"POT-Creation-Date: 2026-07-15 03:10+0000\n"
|
||||
"PO-Revision-Date: 2026-01-02 10:10+0000\n"
|
||||
"Last-Translator: 許明凱 <yuteson@gmail.com>, 2026\n"
|
||||
"Language-Team: Chinese (Hong Kong) (https://app.transifex.com/owncloud-org/teams/6149/zh_HK/)\n"
|
||||
|
||||
@@ -13,7 +13,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2026-09-15 02:26+0000\n"
|
||||
"POT-Creation-Date: 2026-07-15 03:10+0000\n"
|
||||
"PO-Revision-Date: 2026-01-02 10:10+0000\n"
|
||||
"Last-Translator: 許明凱 <yuteson@gmail.com>, 2026\n"
|
||||
"Language-Team: Chinese (Taiwan) (https://app.transifex.com/owncloud-org/teams/6149/zh_TW/)\n"
|
||||
|
||||
@@ -58,8 +58,6 @@ type Events struct {
|
||||
EnableTLS bool `yaml:"enable_tls" env:"OCIS_EVENTS_ENABLE_TLS;ANTIVIRUS_EVENTS_ENABLE_TLS" desc:"Enable TLS for the connection to the events broker. The events broker is the ocis service which receives and delivers events between the services." introductionVersion:"pre5.0"`
|
||||
AuthUsername string `yaml:"username" env:"OCIS_EVENTS_AUTH_USERNAME;ANTIVIRUS_EVENTS_AUTH_USERNAME" desc:"The username to authenticate with the events broker. The events broker is the ocis service which receives and delivers events between the services." introductionVersion:"5.0"`
|
||||
AuthPassword string `yaml:"password" env:"OCIS_EVENTS_AUTH_PASSWORD;ANTIVIRUS_EVENTS_AUTH_PASSWORD" desc:"The password to authenticate with the events broker. The events broker is the ocis service which receives and delivers events between the services." introductionVersion:"5.0"`
|
||||
CredsFile string `yaml:"creds_file" env:"OCIS_NATS_CREDS_FILE;ANTIVIRUS_EVENTS_CREDS_FILE" desc:"Path to a NATS .creds file with a user JWT and an NKey seed. Use it to authenticate with the events broker when NATS runs in JWT (operator) mode. When set, the service does not use the username and the password. Exception: a service-specific username and password take precedence over the global OCIS_NATS_CREDS and OCIS_NATS_CREDS_FILE variables when both have a value. The service reads the file again on each reconnect." introductionVersion:"8.3.0"`
|
||||
Creds string `mask:"password" yaml:"creds" env:"OCIS_NATS_CREDS;ANTIVIRUS_EVENTS_CREDS" desc:"Content of a NATS .creds file with a user JWT and an NKey seed. Use it to authenticate with the events broker when NATS runs in JWT (operator) mode. A service-specific variable takes precedence over a global variable. In the same scope, the content takes precedence over the path of a .creds file. When set, the service does not use the username and the password. Exception: a service-specific username and password take precedence over the global OCIS_NATS_CREDS and OCIS_NATS_CREDS_FILE variables when both have a value." introductionVersion:"8.3.0"`
|
||||
}
|
||||
|
||||
// Scanner provides configuration options for the virus scanner
|
||||
|
||||
@@ -12,7 +12,6 @@ import (
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/handlers"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/service/debug"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/version"
|
||||
"github.com/owncloud/reva/v2/pkg/events/stream"
|
||||
)
|
||||
|
||||
// Server initializes the debug service and server.
|
||||
@@ -21,7 +20,7 @@ func Server(opts ...Option) (*http.Server, error) {
|
||||
|
||||
readyHandlerConfiguration := handlers.NewCheckHandlerConfiguration().
|
||||
WithLogger(options.Logger).
|
||||
WithCheck("nats reachability", checks.NewNatsCheckWithConfig(options.Config.Events.Endpoint, stream.NatsConfig(options.Config.Events))).
|
||||
WithCheck("nats reachability", checks.NewNatsCheck(options.Config.Events.Endpoint)).
|
||||
WithCheck("antivirus reachability", func(ctx context.Context) error {
|
||||
cfg := options.Config
|
||||
switch cfg.Scanner.Type {
|
||||
|
||||
@@ -31,8 +31,6 @@ type Events struct {
|
||||
EnableTLS bool `yaml:"enable_tls" env:"OCIS_EVENTS_ENABLE_TLS;AUDIT_EVENTS_ENABLE_TLS" desc:"Enable TLS for the connection to the events broker. The events broker is the ocis service which receives and delivers events between the services." introductionVersion:"pre5.0"`
|
||||
AuthUsername string `yaml:"username" env:"OCIS_EVENTS_AUTH_USERNAME;AUDIT_EVENTS_AUTH_USERNAME" desc:"The username to authenticate with the events broker. The events broker is the ocis service which receives and delivers events between the services." introductionVersion:"5.0"`
|
||||
AuthPassword string `yaml:"password" env:"OCIS_EVENTS_AUTH_PASSWORD;AUDIT_EVENTS_AUTH_PASSWORD" desc:"The password to authenticate with the events broker. The events broker is the ocis service which receives and delivers events between the services." introductionVersion:"5.0"`
|
||||
CredsFile string `yaml:"creds_file" env:"OCIS_NATS_CREDS_FILE;AUDIT_EVENTS_CREDS_FILE" desc:"Path to a NATS .creds file with a user JWT and an NKey seed. Use it to authenticate with the events broker when NATS runs in JWT (operator) mode. When set, the service does not use the username and the password. Exception: a service-specific username and password take precedence over the global OCIS_NATS_CREDS and OCIS_NATS_CREDS_FILE variables when both have a value. The service reads the file again on each reconnect." introductionVersion:"8.3.0"`
|
||||
Creds string `mask:"password" yaml:"creds" env:"OCIS_NATS_CREDS;AUDIT_EVENTS_CREDS" desc:"Content of a NATS .creds file with a user JWT and an NKey seed. Use it to authenticate with the events broker when NATS runs in JWT (operator) mode. A service-specific variable takes precedence over a global variable. In the same scope, the content takes precedence over the path of a .creds file. When set, the service does not use the username and the password. Exception: a service-specific username and password take precedence over the global OCIS_NATS_CREDS and OCIS_NATS_CREDS_FILE variables when both have a value." introductionVersion:"8.3.0"`
|
||||
}
|
||||
|
||||
// Auditlog holds audit log information
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/handlers"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/service/debug"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/version"
|
||||
"github.com/owncloud/reva/v2/pkg/events/stream"
|
||||
)
|
||||
|
||||
// Server initializes the debug service and server.
|
||||
@@ -16,7 +15,7 @@ func Server(opts ...Option) (*http.Server, error) {
|
||||
|
||||
readyHandlerConfiguration := handlers.NewCheckHandlerConfiguration().
|
||||
WithLogger(options.Logger).
|
||||
WithCheck("nats reachability", checks.NewNatsCheckWithConfig(options.Config.Events.Endpoint, stream.NatsConfig(options.Config.Events)))
|
||||
WithCheck("nats reachability", checks.NewNatsCheck(options.Config.Events.Endpoint))
|
||||
|
||||
return debug.NewService(
|
||||
debug.Logger(options.Logger),
|
||||
|
||||
@@ -107,7 +107,7 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
}
|
||||
|
||||
grpcClient, err := ogrpc.NewClient(
|
||||
append(ogrpc.GetClientOptions(cfg.GRPCClientTLS), ogrpc.WithKeepaliveParams(cfg.GRPCClientOptions), ogrpc.WithTraceProvider(traceProvider))...,
|
||||
append(ogrpc.GetClientOptions(cfg.GRPCClientTLS), ogrpc.WithTraceProvider(traceProvider))...,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -17,8 +17,7 @@ type Config struct {
|
||||
GRPC GRPCConfig `yaml:"grpc"`
|
||||
HTTP HTTP `yaml:"http"`
|
||||
|
||||
GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"`
|
||||
GRPCClientOptions *shared.GRPCClientOptions `yaml:"grpc_client_options"`
|
||||
GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"`
|
||||
|
||||
TokenManager *TokenManager `yaml:"token_manager"`
|
||||
Reva *shared.Reva `yaml:"reva"`
|
||||
|
||||
@@ -76,9 +76,6 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
if cfg.GRPCClientTLS == nil && cfg.Commons != nil {
|
||||
cfg.GRPCClientTLS = structs.CopyOrZeroValue(cfg.Commons.GRPCClientTLS)
|
||||
}
|
||||
if cfg.GRPCClientOptions == nil && cfg.Commons != nil {
|
||||
cfg.GRPCClientOptions = structs.CopyOrZeroValue(cfg.Commons.GRPCClientOptions)
|
||||
}
|
||||
|
||||
if cfg.Reva == nil && cfg.Commons != nil {
|
||||
cfg.Reva = structs.CopyOrZeroValue(cfg.Commons.Reva)
|
||||
|
||||
@@ -37,8 +37,6 @@ type Events struct {
|
||||
EnableTLS bool `yaml:"enable_tls" env:"OCIS_EVENTS_ENABLE_TLS;CLIENTLOG_EVENTS_ENABLE_TLS" desc:"Enable TLS for the connection to the events broker. The events broker is the ocis service which receives and delivers events between the services." introductionVersion:"5.0"`
|
||||
AuthUsername string `yaml:"username" env:"OCIS_EVENTS_AUTH_USERNAME;CLIENTLOG_EVENTS_AUTH_USERNAME" desc:"The username to authenticate with the events broker. The events broker is the ocis service which receives and delivers events between the services." introductionVersion:"5.0"`
|
||||
AuthPassword string `yaml:"password" env:"OCIS_EVENTS_AUTH_PASSWORD;CLIENTLOG_EVENTS_AUTH_PASSWORD" desc:"The password to authenticate with the events broker. The events broker is the ocis service which receives and delivers events between the services." introductionVersion:"5.0"`
|
||||
CredsFile string `yaml:"creds_file" env:"OCIS_NATS_CREDS_FILE;CLIENTLOG_EVENTS_CREDS_FILE" desc:"Path to a NATS .creds file with a user JWT and an NKey seed. Use it to authenticate with the events broker when NATS runs in JWT (operator) mode. When set, the service does not use the username and the password. Exception: a service-specific username and password take precedence over the global OCIS_NATS_CREDS and OCIS_NATS_CREDS_FILE variables when both have a value. The service reads the file again on each reconnect." introductionVersion:"8.3.0"`
|
||||
Creds string `mask:"password" yaml:"creds" env:"OCIS_NATS_CREDS;CLIENTLOG_EVENTS_CREDS" desc:"Content of a NATS .creds file with a user JWT and an NKey seed. Use it to authenticate with the events broker when NATS runs in JWT (operator) mode. A service-specific variable takes precedence over a global variable. In the same scope, the content takes precedence over the path of a .creds file. When set, the service does not use the username and the password. Exception: a service-specific username and password take precedence over the global OCIS_NATS_CREDS and OCIS_NATS_CREDS_FILE variables when both have a value." introductionVersion:"8.3.0"`
|
||||
}
|
||||
|
||||
// TokenManager is the config for using the reva token manager
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/handlers"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/service/debug"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/version"
|
||||
"github.com/owncloud/reva/v2/pkg/events/stream"
|
||||
)
|
||||
|
||||
// Server initializes the debug service and server.
|
||||
@@ -16,7 +15,7 @@ func Server(opts ...Option) (*http.Server, error) {
|
||||
|
||||
readyHandlerConfiguration := handlers.NewCheckHandlerConfiguration().
|
||||
WithLogger(options.Logger).
|
||||
WithCheck("nats reachability", checks.NewNatsCheckWithConfig(options.Config.Events.Endpoint, stream.NatsConfig(options.Config.Events)))
|
||||
WithCheck("nats reachability", checks.NewNatsCheck(options.Config.Events.Endpoint))
|
||||
|
||||
return debug.NewService(
|
||||
debug.Logger(options.Logger),
|
||||
|
||||
@@ -83,7 +83,6 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
microstore.Database(cfg.Store.Database),
|
||||
microstore.Table(cfg.Store.Table),
|
||||
store.Authentication(cfg.Store.AuthUsername, cfg.Store.AuthPassword),
|
||||
store.Credentials(cfg.Store.CredsFile, cfg.Store.Creds),
|
||||
store.TLS(cfg.Store.EnableTLS, cfg.Store.TLSInsecure, cfg.Store.TLSRootCACertificate),
|
||||
)
|
||||
|
||||
|
||||
@@ -59,5 +59,5 @@ func Validate(cfg *config.Config) error {
|
||||
cfg.Service.Name, ocisdefaults.BaseConfigPath())
|
||||
}
|
||||
|
||||
return shared.CheckNatsCredentials(cfg.Service.Name, cfg.Store.Store, cfg.Store.CredsFile, cfg.Store.Creds)
|
||||
return nil
|
||||
}
|
||||
@@ -4,15 +4,13 @@ import "time"
|
||||
|
||||
// Store configures the store to use
|
||||
type Store struct {
|
||||
Store string `yaml:"store" env:"OCIS_PERSISTENT_STORE;COLLABORATION_STORE" desc:"The type of the store. Supported values are: 'memory', 'nats-js-kv', 'redis-sentinel', 'noop'. See the text description for details." introductionVersion:"7.0.0"`
|
||||
Nodes []string `yaml:"nodes" env:"OCIS_PERSISTENT_STORE_NODES;COLLABORATION_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' store is configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"7.0.0"`
|
||||
Database string `yaml:"database" env:"COLLABORATION_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"7.0.0"`
|
||||
Table string `yaml:"table" env:"COLLABORATION_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"7.0.0"`
|
||||
TTL time.Duration `yaml:"ttl" env:"OCIS_PERSISTENT_STORE_TTL;COLLABORATION_STORE_TTL" desc:"Time to live for events in the store. Defaults to '30m' (30 minutes). See the Environment Variable Types description for more details." introductionVersion:"7.0.0"`
|
||||
Store string `yaml:"store" env:"OCIS_PERSISTENT_STORE;COLLABORATION_STORE" desc:"The type of the store. Supported values are: 'memory', 'nats-js-kv', 'redis-sentinel', 'noop'. See the text description for details." introductionVersion:"7.0.0"`
|
||||
Nodes []string `yaml:"nodes" env:"OCIS_PERSISTENT_STORE_NODES;COLLABORATION_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' store is configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"7.0.0"`
|
||||
Database string `yaml:"database" env:"COLLABORATION_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"7.0.0"`
|
||||
Table string `yaml:"table" env:"COLLABORATION_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"7.0.0"`
|
||||
TTL time.Duration `yaml:"ttl" env:"OCIS_PERSISTENT_STORE_TTL;COLLABORATION_STORE_TTL" desc:"Time to live for events in the store. Defaults to '30m' (30 minutes). See the Environment Variable Types description for more details." introductionVersion:"7.0.0"`
|
||||
AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;COLLABORATION_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"7.0.0"`
|
||||
AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;COLLABORATION_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"7.0.0"`
|
||||
CredsFile string `yaml:"creds_file" env:"OCIS_NATS_CREDS_FILE;COLLABORATION_STORE_CREDS_FILE" desc:"Path to a NATS .creds file with a user JWT and an NKey seed. Use it to authenticate with the store when NATS runs in JWT (operator) mode. When set, the service does not use the username and the password. Exception: a service-specific username and password take precedence over the global OCIS_NATS_CREDS and OCIS_NATS_CREDS_FILE variables when both have a value. The service reads the file again on each reconnect. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
Creds string `mask:"password" yaml:"creds" env:"OCIS_NATS_CREDS;COLLABORATION_STORE_CREDS" desc:"Content of a NATS .creds file with a user JWT and an NKey seed. Use it to authenticate with the store when NATS runs in JWT (operator) mode. A service-specific variable takes precedence over a global variable. In the same scope, the content takes precedence over the path of a .creds file. When set, the service does not use the username and the password. Exception: a service-specific username and password take precedence over the global OCIS_NATS_CREDS and OCIS_NATS_CREDS_FILE variables when both have a value. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
EnableTLS bool `yaml:"enable_tls" env:"OCIS_PERSISTENT_STORE_ENABLE_TLS;COLLABORATION_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_PERSISTENT_STORE_TLS_INSECURE;COLLABORATION_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_PERSISTENT_STORE_TLS_ROOT_CA_CERTIFICATE;COLLABORATION_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
|
||||
@@ -41,7 +41,7 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
}
|
||||
|
||||
cfg.GrpcClient, err = ogrpc.NewClient(
|
||||
append(ogrpc.GetClientOptions(cfg.GRPCClientTLS), ogrpc.WithKeepaliveParams(cfg.GRPCClientOptions), ogrpc.WithTraceProvider(traceProvider))...,
|
||||
append(ogrpc.GetClientOptions(cfg.GRPCClientTLS), ogrpc.WithTraceProvider(traceProvider))...,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -72,7 +72,6 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
microstore.Database(cfg.Store.Database),
|
||||
microstore.Table(cfg.Store.Table),
|
||||
store.Authentication(cfg.Store.AuthUsername, cfg.Store.AuthPassword),
|
||||
store.Credentials(cfg.Store.CredsFile, cfg.Store.Creds),
|
||||
store.TLS(cfg.Store.EnableTLS, cfg.Store.TLSInsecure, cfg.Store.TLSRootCACertificate),
|
||||
)
|
||||
|
||||
|
||||
@@ -18,10 +18,9 @@ type Config struct {
|
||||
Log *Log `yaml:"log"`
|
||||
Debug Debug `yaml:"debug"`
|
||||
|
||||
GRPC GRPCConfig `yaml:"grpc"`
|
||||
GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"`
|
||||
GRPCClientOptions *shared.GRPCClientOptions `yaml:"grpc_client_options"`
|
||||
GrpcClient client.Client `yaml:"-"`
|
||||
GRPC GRPCConfig `yaml:"grpc"`
|
||||
GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"`
|
||||
GrpcClient client.Client `yaml:"-"`
|
||||
|
||||
Events Events `yaml:"events"`
|
||||
Store Store `yaml:"store"`
|
||||
@@ -38,15 +37,13 @@ type GRPCConfig struct {
|
||||
|
||||
// Store configures the store to use
|
||||
type Store struct {
|
||||
Store string `yaml:"store" env:"OCIS_PERSISTENT_STORE;EVENTHISTORY_STORE" desc:"The type of the store. Supported values are: 'memory', 'nats-js-kv', 'redis-sentinel', 'noop'. See the text description for details." introductionVersion:"pre5.0"`
|
||||
Nodes []string `yaml:"nodes" env:"OCIS_PERSISTENT_STORE_NODES;EVENTHISTORY_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' store is configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
Database string `yaml:"database" env:"EVENTHISTORY_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
|
||||
Table string `yaml:"table" env:"EVENTHISTORY_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"`
|
||||
TTL time.Duration `yaml:"ttl" env:"OCIS_PERSISTENT_STORE_TTL;EVENTHISTORY_STORE_TTL" desc:"Time to live for events in the store. Defaults to '336h' (2 weeks). See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
Store string `yaml:"store" env:"OCIS_PERSISTENT_STORE;EVENTHISTORY_STORE" desc:"The type of the store. Supported values are: 'memory', 'nats-js-kv', 'redis-sentinel', 'noop'. See the text description for details." introductionVersion:"pre5.0"`
|
||||
Nodes []string `yaml:"nodes" env:"OCIS_PERSISTENT_STORE_NODES;EVENTHISTORY_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' store is configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
Database string `yaml:"database" env:"EVENTHISTORY_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
|
||||
Table string `yaml:"table" env:"EVENTHISTORY_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"`
|
||||
TTL time.Duration `yaml:"ttl" env:"OCIS_PERSISTENT_STORE_TTL;EVENTHISTORY_STORE_TTL" desc:"Time to live for events in the store. Defaults to '336h' (2 weeks). See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;EVENTHISTORY_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;EVENTHISTORY_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
CredsFile string `yaml:"creds_file" env:"OCIS_NATS_CREDS_FILE;EVENTHISTORY_STORE_CREDS_FILE" desc:"Path to a NATS .creds file with a user JWT and an NKey seed. Use it to authenticate with the store when NATS runs in JWT (operator) mode. When set, the service does not use the username and the password. Exception: a service-specific username and password take precedence over the global OCIS_NATS_CREDS and OCIS_NATS_CREDS_FILE variables when both have a value. The service reads the file again on each reconnect. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
Creds string `mask:"password" yaml:"creds" env:"OCIS_NATS_CREDS;EVENTHISTORY_STORE_CREDS" desc:"Content of a NATS .creds file with a user JWT and an NKey seed. Use it to authenticate with the store when NATS runs in JWT (operator) mode. A service-specific variable takes precedence over a global variable. In the same scope, the content takes precedence over the path of a .creds file. When set, the service does not use the username and the password. Exception: a service-specific username and password take precedence over the global OCIS_NATS_CREDS and OCIS_NATS_CREDS_FILE variables when both have a value. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
EnableTLS bool `yaml:"enable_tls" env:"OCIS_PERSISTENT_STORE_ENABLE_TLS;EVENTHISTORY_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_PERSISTENT_STORE_TLS_INSECURE;EVENTHISTORY_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_PERSISTENT_STORE_TLS_ROOT_CA_CERTIFICATE;EVENTHISTORY_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
@@ -61,6 +58,4 @@ type Events struct {
|
||||
EnableTLS bool `yaml:"enable_tls" env:"OCIS_EVENTS_ENABLE_TLS;EVENTHISTORY_EVENTS_ENABLE_TLS" desc:"Enable TLS for the connection to the events broker. The events broker is the ocis service which receives and delivers events between the services." introductionVersion:"pre5.0"`
|
||||
AuthUsername string `yaml:"username" env:"OCIS_EVENTS_AUTH_USERNAME;EVENTHISTORY_EVENTS_AUTH_USERNAME" desc:"The username to authenticate with the events broker. The events broker is the ocis service which receives and delivers events between the services." introductionVersion:"5.0"`
|
||||
AuthPassword string `yaml:"password" env:"OCIS_EVENTS_AUTH_PASSWORD;EVENTHISTORY_EVENTS_AUTH_PASSWORD" desc:"The password to authenticate with the events broker. The events broker is the ocis service which receives and delivers events between the services." introductionVersion:"5.0"`
|
||||
CredsFile string `yaml:"creds_file" env:"OCIS_NATS_CREDS_FILE;EVENTHISTORY_EVENTS_CREDS_FILE" desc:"Path to a NATS .creds file with a user JWT and an NKey seed. Use it to authenticate with the events broker when NATS runs in JWT (operator) mode. When set, the service does not use the username and the password. Exception: a service-specific username and password take precedence over the global OCIS_NATS_CREDS and OCIS_NATS_CREDS_FILE variables when both have a value. The service reads the file again on each reconnect." introductionVersion:"8.3.0"`
|
||||
Creds string `mask:"password" yaml:"creds" env:"OCIS_NATS_CREDS;EVENTHISTORY_EVENTS_CREDS" desc:"Content of a NATS .creds file with a user JWT and an NKey seed. Use it to authenticate with the events broker when NATS runs in JWT (operator) mode. A service-specific variable takes precedence over a global variable. In the same scope, the content takes precedence over the path of a .creds file. When set, the service does not use the username and the password. Exception: a service-specific username and password take precedence over the global OCIS_NATS_CREDS and OCIS_NATS_CREDS_FILE variables when both have a value." introductionVersion:"8.3.0"`
|
||||
}
|
||||
@@ -74,9 +74,6 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
if cfg.GRPCClientTLS == nil && cfg.Commons != nil {
|
||||
cfg.GRPCClientTLS = structs.CopyOrZeroValue(cfg.Commons.GRPCClientTLS)
|
||||
}
|
||||
if cfg.GRPCClientOptions == nil && cfg.Commons != nil {
|
||||
cfg.GRPCClientOptions = structs.CopyOrZeroValue(cfg.Commons.GRPCClientOptions)
|
||||
}
|
||||
|
||||
if cfg.GRPC.TLS == nil && cfg.Commons != nil {
|
||||
cfg.GRPC.TLS = structs.CopyOrZeroValue(cfg.Commons.GRPCServiceTLS)
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"errors"
|
||||
|
||||
ociscfg "github.com/owncloud/ocis/v2/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/shared"
|
||||
"github.com/owncloud/ocis/v2/services/eventhistory/pkg/config"
|
||||
"github.com/owncloud/ocis/v2/services/eventhistory/pkg/config/defaults"
|
||||
|
||||
@@ -35,5 +34,5 @@ func ParseConfig(cfg *config.Config) error {
|
||||
|
||||
// Validate validates the config
|
||||
func Validate(cfg *config.Config) error {
|
||||
return shared.CheckNatsCredentials(cfg.Service.Name, cfg.Store.Store, cfg.Store.CredsFile, cfg.Store.Creds)
|
||||
return nil
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/handlers"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/service/debug"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/version"
|
||||
"github.com/owncloud/reva/v2/pkg/events/stream"
|
||||
)
|
||||
|
||||
// Server initializes the debug service and server.
|
||||
@@ -19,7 +18,7 @@ func Server(opts ...Option) (*http.Server, error) {
|
||||
WithCheck("grpc reachability", checks.NewGRPCCheck(options.Config.GRPC.Addr))
|
||||
|
||||
readyHandlerConfiguration := healthHandlerConfiguration.
|
||||
WithCheck("nats reachability", checks.NewNatsCheckWithConfig(options.Config.Events.Endpoint, stream.NatsConfig(options.Config.Events)))
|
||||
WithCheck("nats reachability", checks.NewNatsCheck(options.Config.Events.Endpoint))
|
||||
|
||||
return debug.NewService(
|
||||
debug.Logger(options.Logger),
|
||||
|
||||
@@ -74,7 +74,6 @@ func ListenForEvents(ctx context.Context, cfg *config.Config, l log.Logger) erro
|
||||
grpcClient, err := grpc.NewClient(
|
||||
append(
|
||||
grpc.GetClientOptions(cfg.GRPCClientTLS),
|
||||
grpc.WithKeepaliveParams(cfg.GRPCClientOptions),
|
||||
grpc.WithTraceProvider(traceProvider),
|
||||
)...,
|
||||
)
|
||||
|
||||
@@ -52,11 +52,10 @@ type Config struct {
|
||||
|
||||
Middleware Middleware `yaml:"middleware"`
|
||||
|
||||
Events Events `yaml:"events"`
|
||||
GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"`
|
||||
GRPCClientOptions *shared.GRPCClientOptions `yaml:"grpc_client_options"`
|
||||
AutoAcceptShares bool `yaml:"auto_accept_shares" env:"FRONTEND_AUTO_ACCEPT_SHARES" desc:"Defines if shares should be auto accepted by default. Users can change this setting individually in their profile." introductionVersion:"5.0"`
|
||||
ServiceAccount ServiceAccount `yaml:"service_account"`
|
||||
Events Events `yaml:"events"`
|
||||
GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"`
|
||||
AutoAcceptShares bool `yaml:"auto_accept_shares" env:"FRONTEND_AUTO_ACCEPT_SHARES" desc:"Defines if shares should be auto accepted by default. Users can change this setting individually in their profile." introductionVersion:"5.0"`
|
||||
ServiceAccount ServiceAccount `yaml:"service_account"`
|
||||
|
||||
PasswordPolicy PasswordPolicy `yaml:"password_policy"`
|
||||
Validation Validation `yaml:"validation"`
|
||||
@@ -144,8 +143,6 @@ type OCS struct {
|
||||
StatCacheDisablePersistence bool `yaml:"stat_cache_disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE" desc:"Disable persistence of the cache. Only applies when using the 'nats-js-kv' store type. Defaults to false." introductionVersion:"5.0" deprecationVersion:"7.0.0" removalVersion:"%%NEXT_PRODUCTION_VERSION%%" deprecationInfo:"The use of OCIS_CACHE_DISABLE_PERSISTENCE in the frontend service is deprecated because the OCS API is deprecated" deprecationReplacement:""`
|
||||
StatCacheAuthUsername string `yaml:"stat_cache_auth_username" env:"OCIS_CACHE_AUTH_USERNAME" desc:"The username to use for authentication. Only applies when using the 'nats-js-kv' store type." introductionVersion:"5.0" deprecationVersion:"7.0.0" removalVersion:"%%NEXT_PRODUCTION_VERSION%%" deprecationInfo:"The use of OCIS_CACHE_AUTH_USERNAME in the frontend service is deprecated because the OCS API is deprecated OCS API is deprecated" deprecationReplacement:""`
|
||||
StatCacheAuthPassword string `yaml:"stat_cache_auth_password" env:"OCIS_CACHE_AUTH_PASSWORD" desc:"The password to use for authentication. Only applies when using the 'nats-js-kv' store type." introductionVersion:"5.0" deprecationVersion:"7.0.0" removalVersion:"%%NEXT_PRODUCTION_VERSION%%" deprecationInfo:"The use of OCIS_CACHE_AUTH_PASSWORD in the frontend service is deprecated because the OCS API is deprecated OCS API is deprecated" deprecationReplacement:""`
|
||||
StatCacheCredsFile string `yaml:"stat_cache_creds_file" env:"OCIS_NATS_CREDS_FILE" desc:"Path to a NATS .creds file with a user JWT and an NKey seed. Use it to authenticate with the cache when NATS runs in JWT (operator) mode. When set, the service does not use the username and the password. The service reads the file again on each reconnect. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
StatCacheCreds string `mask:"password" yaml:"stat_cache_creds" env:"OCIS_NATS_CREDS" desc:"Content of a NATS .creds file with a user JWT and an NKey seed. Use it to authenticate with the cache when NATS runs in JWT (operator) mode. A service-specific variable takes precedence over a global variable. In the same scope, the content takes precedence over the path of a .creds file. When set, the service does not use the username and the password. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
StatCacheEnableTLS bool `yaml:"stat_cache_enable_tls" env:"OCIS_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the stat cache store. Only applies when using the 'nats-js-kv' store type." introductionVersion:"8.3.0"`
|
||||
StatCacheTLSInsecure bool `yaml:"stat_cache_tls_insecure" env:"OCIS_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the stat cache store connection. Only applies when using the 'nats-js-kv' store type." introductionVersion:"8.3.0"`
|
||||
StatCacheTLSRootCACertificate string `yaml:"stat_cache_tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the stat cache store TLS connection. Only applies when using the 'nats-js-kv' store type." introductionVersion:"8.3.0"`
|
||||
@@ -186,8 +183,6 @@ type Events struct {
|
||||
EnableTLS bool `yaml:"enable_tls" env:"OCIS_EVENTS_ENABLE_TLS;FRONTEND_EVENTS_ENABLE_TLS" desc:"Enable TLS for the connection to the events broker. The events broker is the ocis service which receives and delivers events between the services." introductionVersion:"5.0"`
|
||||
AuthUsername string `yaml:"username" env:"OCIS_EVENTS_AUTH_USERNAME;FRONTEND_EVENTS_AUTH_USERNAME" desc:"The username to authenticate with the events broker. The events broker is the ocis service which receives and delivers events between the services." introductionVersion:"5.0"`
|
||||
AuthPassword string `yaml:"password" env:"OCIS_EVENTS_AUTH_PASSWORD;FRONTEND_EVENTS_AUTH_PASSWORD" desc:"The password to authenticate with the events broker. The events broker is the ocis service which receives and delivers events between the services." introductionVersion:"5.0"`
|
||||
CredsFile string `yaml:"creds_file" env:"OCIS_NATS_CREDS_FILE;FRONTEND_EVENTS_CREDS_FILE" desc:"Path to a NATS .creds file with a user JWT and an NKey seed. Use it to authenticate with the events broker when NATS runs in JWT (operator) mode. When set, the service does not use the username and the password. Exception: a service-specific username and password take precedence over the global OCIS_NATS_CREDS and OCIS_NATS_CREDS_FILE variables when both have a value. The service reads the file again on each reconnect." introductionVersion:"8.3.0"`
|
||||
Creds string `mask:"password" yaml:"creds" env:"OCIS_NATS_CREDS;FRONTEND_EVENTS_CREDS" desc:"Content of a NATS .creds file with a user JWT and an NKey seed. Use it to authenticate with the events broker when NATS runs in JWT (operator) mode. A service-specific variable takes precedence over a global variable. In the same scope, the content takes precedence over the path of a .creds file. When set, the service does not use the username and the password. Exception: a service-specific username and password take precedence over the global OCIS_NATS_CREDS and OCIS_NATS_CREDS_FILE variables when both have a value." introductionVersion:"8.3.0"`
|
||||
}
|
||||
|
||||
// ServiceAccount is the configuration for the used service account
|
||||
|
||||
@@ -51,10 +51,6 @@ func Validate(cfg *config.Config) error {
|
||||
cfg.GRPCClientTLS = structs.CopyOrZeroValue(cfg.Commons.GRPCClientTLS)
|
||||
}
|
||||
|
||||
if cfg.GRPCClientOptions == nil && cfg.Commons != nil {
|
||||
cfg.GRPCClientOptions = structs.CopyOrZeroValue(cfg.Commons.GRPCClientOptions)
|
||||
}
|
||||
|
||||
// Set password enforcement on all public links when config is set
|
||||
if cfg.OCS.PublicShareMustHavePassword {
|
||||
cfg.OCS.WriteablePublicShareMustHavePassword = true
|
||||
|
||||
@@ -171,8 +171,6 @@ func FrontendConfigFromStruct(cfg *config.Config, logger log.Logger) (map[string
|
||||
"cache_disable_persistence": cfg.OCS.StatCacheDisablePersistence,
|
||||
"cache_auth_username": cfg.OCS.StatCacheAuthUsername,
|
||||
"cache_auth_password": cfg.OCS.StatCacheAuthPassword,
|
||||
"cache_creds_file": cfg.OCS.StatCacheCredsFile,
|
||||
"cache_creds": cfg.OCS.StatCacheCreds,
|
||||
"cache_enable_tls": cfg.OCS.StatCacheEnableTLS,
|
||||
"cache_tls_insecure": cfg.OCS.StatCacheTLSInsecure,
|
||||
"cache_tls_root_ca_certificate": cfg.OCS.StatCacheTLSRootCACertificate,
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/handlers"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/service/debug"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/version"
|
||||
"github.com/owncloud/reva/v2/pkg/events/stream"
|
||||
)
|
||||
|
||||
// Server initializes the debug service and server.
|
||||
@@ -19,7 +18,7 @@ func Server(opts ...Option) (*http.Server, error) {
|
||||
WithCheck("web reachability", checks.NewHTTPCheck(options.Config.HTTP.Addr))
|
||||
|
||||
readyHandlerConfiguration := healthHandlerConfiguration.
|
||||
WithCheck("nats reachability", checks.NewNatsCheckWithConfig(options.Config.Events.Endpoint, stream.NatsConfig(options.Config.Events)))
|
||||
WithCheck("nats reachability", checks.NewNatsCheck(options.Config.Events.Endpoint))
|
||||
|
||||
return debug.NewService(
|
||||
debug.Logger(options.Logger),
|
||||
|
||||
@@ -88,28 +88,21 @@ type StorageRegistry struct {
|
||||
|
||||
// Cache holds cache config
|
||||
type Cache struct {
|
||||
ProviderCacheStore string `yaml:"provider_cache_store" env:"OCIS_CACHE_STORE;GATEWAY_PROVIDER_CACHE_STORE" desc:"The type of the cache store. Supported values are: 'memory', 'redis-sentinel', 'nats-js-kv', 'noop'. See the text description for details." introductionVersion:"pre5.0"`
|
||||
ProviderCacheNodes []string `yaml:"provider_cache_nodes" env:"OCIS_CACHE_STORE_NODES;GATEWAY_PROVIDER_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' store is configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
ProviderCacheDatabase string `yaml:"provider_cache_database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
|
||||
ProviderCacheTTL time.Duration `yaml:"provider_cache_ttl" env:"OCIS_CACHE_TTL;GATEWAY_PROVIDER_CACHE_TTL" desc:"Default time to live for user info in the cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
ProviderCacheDisablePersistence bool `yaml:"provider_cache_disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;GATEWAY_PROVIDER_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the provider cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"`
|
||||
ProviderCacheAuthUsername string `yaml:"provider_cache_auth_username" env:"OCIS_CACHE_AUTH_USERNAME;GATEWAY_PROVIDER_CACHE_AUTH_USERNAME" desc:"The username to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
ProviderCacheAuthPassword string `yaml:"provider_cache_auth_password" env:"OCIS_CACHE_AUTH_PASSWORD;GATEWAY_PROVIDER_CACHE_AUTH_PASSWORD" desc:"The password to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
ProviderCacheCredsFile string `yaml:"provider_cache_creds_file" env:"OCIS_NATS_CREDS_FILE;GATEWAY_PROVIDER_CACHE_CREDS_FILE" desc:"Path to a NATS .creds file with a user JWT and an NKey seed. Use it to authenticate with the cache when NATS runs in JWT (operator) mode. When set, the service does not use the username and the password. Exception: a service-specific username and password take precedence over the global OCIS_NATS_CREDS and OCIS_NATS_CREDS_FILE variables when both have a value. The service reads the file again on each reconnect. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
ProviderCacheCreds string `mask:"password" yaml:"provider_cache_creds" env:"OCIS_NATS_CREDS;GATEWAY_PROVIDER_CACHE_CREDS" desc:"Content of a NATS .creds file with a user JWT and an NKey seed. Use it to authenticate with the cache when NATS runs in JWT (operator) mode. A service-specific variable takes precedence over a global variable. In the same scope, the content takes precedence over the path of a .creds file. When set, the service does not use the username and the password. Exception: a service-specific username and password take precedence over the global OCIS_NATS_CREDS and OCIS_NATS_CREDS_FILE variables when both have a value. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
ProviderCacheEnableTLS bool `yaml:"provider_cache_enable_tls" env:"OCIS_CACHE_ENABLE_TLS;GATEWAY_PROVIDER_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
ProviderCacheTLSInsecure bool `yaml:"provider_cache_tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;GATEWAY_PROVIDER_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the cache store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
ProviderCacheTLSRootCACertificate string `yaml:"provider_cache_tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;GATEWAY_PROVIDER_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the cache store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
CreateHomeCacheStore string `yaml:"create_home_cache_store" env:"OCIS_CACHE_STORE;GATEWAY_CREATE_HOME_CACHE_STORE" desc:"The type of the cache store. Supported values are: 'memory', 'redis-sentinel', 'nats-js-kv', 'noop'. See the text description for details." introductionVersion:"pre5.0"`
|
||||
CreateHomeCacheNodes []string `yaml:"create_home_cache_nodes" env:"OCIS_CACHE_STORE_NODES;GATEWAY_CREATE_HOME_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' store is configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
CreateHomeCacheDatabase string `yaml:"create_home_cache_database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
|
||||
CreateHomeCacheTTL time.Duration `yaml:"create_home_cache_ttl" env:"OCIS_CACHE_TTL;GATEWAY_CREATE_HOME_CACHE_TTL" desc:"Default time to live for user info in the cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
CreateHomeCacheDisablePersistence bool `yaml:"create_home_cache_disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;GATEWAY_CREATE_HOME_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the create home cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"`
|
||||
CreateHomeCacheAuthUsername string `yaml:"create_home_cache_auth_username" env:"OCIS_CACHE_AUTH_USERNAME;GATEWAY_CREATE_HOME_CACHE_AUTH_USERNAME" desc:"The username to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
CreateHomeCacheAuthPassword string `yaml:"create_home_cache_auth_password" env:"OCIS_CACHE_AUTH_PASSWORD;GATEWAY_CREATE_HOME_CACHE_AUTH_PASSWORD" desc:"The password to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
CreateHomeCacheCredsFile string `yaml:"create_home_cache_creds_file" env:"OCIS_NATS_CREDS_FILE;GATEWAY_CREATE_HOME_CACHE_CREDS_FILE" desc:"Path to a NATS .creds file with a user JWT and an NKey seed. Use it to authenticate with the cache when NATS runs in JWT (operator) mode. When set, the service does not use the username and the password. Exception: a service-specific username and password take precedence over the global OCIS_NATS_CREDS and OCIS_NATS_CREDS_FILE variables when both have a value. The service reads the file again on each reconnect. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
CreateHomeCacheCreds string `mask:"password" yaml:"create_home_cache_creds" env:"OCIS_NATS_CREDS;GATEWAY_CREATE_HOME_CACHE_CREDS" desc:"Content of a NATS .creds file with a user JWT and an NKey seed. Use it to authenticate with the cache when NATS runs in JWT (operator) mode. A service-specific variable takes precedence over a global variable. In the same scope, the content takes precedence over the path of a .creds file. When set, the service does not use the username and the password. Exception: a service-specific username and password take precedence over the global OCIS_NATS_CREDS and OCIS_NATS_CREDS_FILE variables when both have a value. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
CreateHomeCacheEnableTLS bool `yaml:"create_home_cache_enable_tls" env:"OCIS_CACHE_ENABLE_TLS;GATEWAY_CREATE_HOME_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
CreateHomeCacheTLSInsecure bool `yaml:"create_home_cache_tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;GATEWAY_CREATE_HOME_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the cache store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
CreateHomeCacheTLSRootCACertificate string `yaml:"create_home_cache_tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;GATEWAY_CREATE_HOME_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the cache store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
ProviderCacheStore string `yaml:"provider_cache_store" env:"OCIS_CACHE_STORE;GATEWAY_PROVIDER_CACHE_STORE" desc:"The type of the cache store. Supported values are: 'memory', 'redis-sentinel', 'nats-js-kv', 'noop'. See the text description for details." introductionVersion:"pre5.0"`
|
||||
ProviderCacheNodes []string `yaml:"provider_cache_nodes" env:"OCIS_CACHE_STORE_NODES;GATEWAY_PROVIDER_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' store is configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
ProviderCacheDatabase string `yaml:"provider_cache_database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
|
||||
ProviderCacheTTL time.Duration `yaml:"provider_cache_ttl" env:"OCIS_CACHE_TTL;GATEWAY_PROVIDER_CACHE_TTL" desc:"Default time to live for user info in the cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
ProviderCacheDisablePersistence bool `yaml:"provider_cache_disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;GATEWAY_PROVIDER_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the provider cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"`
|
||||
ProviderCacheAuthUsername string `yaml:"provider_cache_auth_username" env:"OCIS_CACHE_AUTH_USERNAME;GATEWAY_PROVIDER_CACHE_AUTH_USERNAME" desc:"The username to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
ProviderCacheAuthPassword string `yaml:"provider_cache_auth_password" env:"OCIS_CACHE_AUTH_PASSWORD;GATEWAY_PROVIDER_CACHE_AUTH_PASSWORD" desc:"The password to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
ProviderCacheEnableTLS bool `yaml:"provider_cache_enable_tls" env:"OCIS_CACHE_ENABLE_TLS;GATEWAY_PROVIDER_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
ProviderCacheTLSInsecure bool `yaml:"provider_cache_tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;GATEWAY_PROVIDER_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the cache store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
ProviderCacheTLSRootCACertificate string `yaml:"provider_cache_tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;GATEWAY_PROVIDER_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the cache store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
|
||||
CreateHomeCacheStore string `yaml:"create_home_cache_store" env:"OCIS_CACHE_STORE;GATEWAY_CREATE_HOME_CACHE_STORE" desc:"The type of the cache store. Supported values are: 'memory', 'redis-sentinel', 'nats-js-kv', 'noop'. See the text description for details." introductionVersion:"pre5.0"`
|
||||
CreateHomeCacheNodes []string `yaml:"create_home_cache_nodes" env:"OCIS_CACHE_STORE_NODES;GATEWAY_CREATE_HOME_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' store is configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
CreateHomeCacheDatabase string `yaml:"create_home_cache_database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
|
||||
CreateHomeCacheTTL time.Duration `yaml:"create_home_cache_ttl" env:"OCIS_CACHE_TTL;GATEWAY_CREATE_HOME_CACHE_TTL" desc:"Default time to live for user info in the cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
CreateHomeCacheDisablePersistence bool `yaml:"create_home_cache_disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;GATEWAY_CREATE_HOME_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the create home cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"`
|
||||
CreateHomeCacheAuthUsername string `yaml:"create_home_cache_auth_username" env:"OCIS_CACHE_AUTH_USERNAME;GATEWAY_CREATE_HOME_CACHE_AUTH_USERNAME" desc:"The username to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
CreateHomeCacheAuthPassword string `yaml:"create_home_cache_auth_password" env:"OCIS_CACHE_AUTH_PASSWORD;GATEWAY_CREATE_HOME_CACHE_AUTH_PASSWORD" desc:"The password to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package config
|
||||
|
||||
import "github.com/owncloud/reva/v2/pkg/events/stream"
|
||||
|
||||
// ProviderCacheNatsConfig returns the reva NATS config for the provider cache.
|
||||
// The cache can have more than one node, so the config has no endpoint.
|
||||
func (c Cache) ProviderCacheNatsConfig() stream.NatsConfig {
|
||||
return stream.NatsConfig{
|
||||
EnableTLS: c.ProviderCacheEnableTLS,
|
||||
TLSInsecure: c.ProviderCacheTLSInsecure,
|
||||
TLSRootCACertificate: c.ProviderCacheTLSRootCACertificate,
|
||||
AuthUsername: c.ProviderCacheAuthUsername,
|
||||
AuthPassword: c.ProviderCacheAuthPassword,
|
||||
CredsFile: c.ProviderCacheCredsFile,
|
||||
Creds: c.ProviderCacheCreds,
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestNatsConfigSetsAllFields fails when a new field of stream.NatsConfig is not mapped.
|
||||
func TestNatsConfigSetsAllFields(t *testing.T) {
|
||||
cfg := Cache{
|
||||
ProviderCacheEnableTLS: true,
|
||||
ProviderCacheTLSInsecure: true,
|
||||
ProviderCacheTLSRootCACertificate: "/ca.pem",
|
||||
ProviderCacheAuthUsername: "user",
|
||||
ProviderCacheAuthPassword: "pass",
|
||||
ProviderCacheCredsFile: "/user.creds",
|
||||
ProviderCacheCreds: "creds",
|
||||
}
|
||||
got := reflect.ValueOf(cfg.ProviderCacheNatsConfig())
|
||||
for i := 0; i < got.NumField(); i++ {
|
||||
name := got.Type().Field(i).Name
|
||||
if name != "Endpoint" && name != "Cluster" && got.Field(i).IsZero() {
|
||||
t.Errorf("field %s is not set", name)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,34 +66,27 @@ func GatewayConfigFromStruct(cfg *config.Config, logger log.Logger) map[string]i
|
||||
"transfer_expires": cfg.TransferExpires,
|
||||
// cache and TTLs
|
||||
"provider_cache_config": map[string]interface{}{
|
||||
"cache_store": cfg.Cache.ProviderCacheStore,
|
||||
"cache_nodes": cfg.Cache.ProviderCacheNodes,
|
||||
"cache_database": cfg.Cache.ProviderCacheDatabase,
|
||||
"cache_table": "provider",
|
||||
"cache_ttl": cfg.Cache.ProviderCacheTTL,
|
||||
"cache_disable_persistence": cfg.Cache.ProviderCacheDisablePersistence,
|
||||
"cache_auth_username": cfg.Cache.ProviderCacheAuthUsername,
|
||||
"cache_auth_password": cfg.Cache.ProviderCacheAuthPassword,
|
||||
"cache_creds_file": cfg.Cache.ProviderCacheCredsFile,
|
||||
"cache_creds": cfg.Cache.ProviderCacheCreds,
|
||||
"cache_enable_tls": cfg.Cache.ProviderCacheEnableTLS,
|
||||
"cache_tls_insecure": cfg.Cache.ProviderCacheTLSInsecure,
|
||||
"cache_store": cfg.Cache.ProviderCacheStore,
|
||||
"cache_nodes": cfg.Cache.ProviderCacheNodes,
|
||||
"cache_database": cfg.Cache.ProviderCacheDatabase,
|
||||
"cache_table": "provider",
|
||||
"cache_ttl": cfg.Cache.ProviderCacheTTL,
|
||||
"disable_persistence": cfg.Cache.ProviderCacheDisablePersistence,
|
||||
"cache_auth_username": cfg.Cache.ProviderCacheAuthUsername,
|
||||
"cache_auth_password": cfg.Cache.ProviderCacheAuthPassword,
|
||||
"cache_enable_tls": cfg.Cache.ProviderCacheEnableTLS,
|
||||
"cache_tls_insecure": cfg.Cache.ProviderCacheTLSInsecure,
|
||||
"cache_tls_root_ca_certificate": cfg.Cache.ProviderCacheTLSRootCACertificate,
|
||||
},
|
||||
"create_personal_space_cache_config": map[string]interface{}{
|
||||
"cache_store": cfg.Cache.CreateHomeCacheStore,
|
||||
"cache_nodes": cfg.Cache.CreateHomeCacheNodes,
|
||||
"cache_database": cfg.Cache.CreateHomeCacheDatabase,
|
||||
"cache_table": "create_personal_space",
|
||||
"cache_ttl": cfg.Cache.CreateHomeCacheTTL,
|
||||
"cache_disable_persistence": cfg.Cache.CreateHomeCacheDisablePersistence,
|
||||
"cache_auth_username": cfg.Cache.CreateHomeCacheAuthUsername,
|
||||
"cache_auth_password": cfg.Cache.CreateHomeCacheAuthPassword,
|
||||
"cache_creds_file": cfg.Cache.CreateHomeCacheCredsFile,
|
||||
"cache_creds": cfg.Cache.CreateHomeCacheCreds,
|
||||
"cache_enable_tls": cfg.Cache.CreateHomeCacheEnableTLS,
|
||||
"cache_tls_insecure": cfg.Cache.CreateHomeCacheTLSInsecure,
|
||||
"cache_tls_root_ca_certificate": cfg.Cache.CreateHomeCacheTLSRootCACertificate,
|
||||
"cache_store": cfg.Cache.CreateHomeCacheStore,
|
||||
"cache_nodes": cfg.Cache.CreateHomeCacheNodes,
|
||||
"cache_database": cfg.Cache.CreateHomeCacheDatabase,
|
||||
"cache_table": "create_personal_space",
|
||||
"cache_ttl": cfg.Cache.CreateHomeCacheTTL,
|
||||
"cache_disable_persistence": cfg.Cache.CreateHomeCacheDisablePersistence,
|
||||
"cache_auth_username": cfg.Cache.CreateHomeCacheAuthUsername,
|
||||
"cache_auth_password": cfg.Cache.CreateHomeCacheAuthPassword,
|
||||
},
|
||||
},
|
||||
"authregistry": map[string]interface{}{
|
||||
|
||||
Loaded 100 of 596 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user