Skip to content

Commit acc60d1

Browse files
authored
Merge branch 'main' into feature/automatic-user-confirmation
2 parents 848efbe + 55f883a commit acc60d1

36 files changed

Lines changed: 1060 additions & 781 deletions

.env.template

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,14 @@
316316
## unauthenticated access to potentially sensitive data.
317317
# SHOW_PASSWORD_HINT=false
318318

319+
#########################
320+
### Client settings ###
321+
#########################
322+
323+
## Control whether clients onboarding interstitials are suppressed
324+
## (post-login welcome dialogs, extension install prompts, setup extension redirects, and premium upsell modals)
325+
# CLIENT_SUPPRESS_ONBOARDING=false
326+
319327
#########################
320328
### Advanced settings ###
321329
#########################

docker/Dockerfile.debian

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,13 @@ ARG DB=sqlite,mysql,postgresql
9696
# dummy project, except the target folder
9797
# This folder contains the compiled dependencies
9898
RUN source /env-cargo && \
99-
# Workaround for xx related build issues
99+
# Configure xx-cargo for target pkg-config and Debian transitive library lookup
100100
# https://github.com/tonistiigi/xx/pull/108#issuecomment-3700635977
101+
# https://github.com/dani-garcia/vaultwarden/discussions/7522
102+
if xx-info is-cross; then \
103+
XX_RUSTFLAGS="-C link-arg=-Wl,-rpath-link,/usr/lib/$(xx-info triple)"; \
104+
export XX_RUSTFLAGS; \
105+
fi && \
101106
PKG_CONFIG="$(command -v "$(xx-info)-pkg-config")" xx-cargo build --features ${DB} --profile "${CARGO_PROFILE}" && \
102107
find . -not -path "./target*" -delete
103108

@@ -113,8 +118,13 @@ RUN source /env-cargo && \
113118
# Also do this for build.rs to ensure the version is rechecked
114119
touch build.rs src/main.rs && \
115120
# Create a symlink to the binary target folder to easy copy the binary in the final stage
116-
# Workaround for xx related build issues
121+
# Configure xx-cargo for target pkg-config and Debian transitive library lookup
117122
# https://github.com/tonistiigi/xx/pull/108#issuecomment-3700635977
123+
# https://github.com/dani-garcia/vaultwarden/discussions/7522
124+
if xx-info is-cross; then \
125+
XX_RUSTFLAGS="-C link-arg=-Wl,-rpath-link,/usr/lib/$(xx-info triple)"; \
126+
export XX_RUSTFLAGS; \
127+
fi && \
118128
PKG_CONFIG="$(command -v "$(xx-info)-pkg-config")" xx-cargo build --features ${DB} --profile "${CARGO_PROFILE}" && \
119129
if [[ "${CARGO_PROFILE}" == "dev" ]] ; then \
120130
ln -vfsr "/app/target/${CARGO_TARGET}/debug" /app/target/final ; \

docker/Dockerfile.j2

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,13 @@
2828
# [docker.io/vaultwarden/web-vault:{{ vault_version | replace('+', '_') }}]
2929
#
3030
{% macro xx_cargo_config() -%}
31-
# Workaround for xx related build issues
31+
# Configure xx-cargo for target pkg-config and Debian transitive library lookup
3232
# https://github.com/tonistiigi/xx/pull/108#issuecomment-3700635977
33+
# https://github.com/dani-garcia/vaultwarden/discussions/7522
34+
if xx-info is-cross; then \
35+
XX_RUSTFLAGS="-C link-arg=-Wl,-rpath-link,/usr/lib/$(xx-info triple)"; \
36+
export XX_RUSTFLAGS; \
37+
fi && \
3338
PKG_CONFIG="$(command -v "$(xx-info)-pkg-config")" xx-cargo build --features ${DB} --profile "${CARGO_PROFILE}"
3439
{%- endmacro %}
3540
FROM --platform=linux/amd64 docker.io/vaultwarden/web-vault@{{ vault_image_digest }} AS vault

playwright/.env.template

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,19 @@ TEST_USER3=test3
2121
TEST_USER3_PASSWORD=${TEST_USER3}
2222
TEST_USER3_MAIL=${TEST_USER3}@yopmail.com
2323

24+
TEST_USER4=test4
25+
TEST_USER4_PASSWORD=${TEST_USER4}
26+
TEST_USER4_MAIL=${TEST_USER4}@yopmail.com
27+
28+
TEST_USER5=test5
29+
TEST_USER5_PASSWORD=${TEST_USER5}
30+
TEST_USER5_MAIL=${TEST_USER5}@yopmail.com
31+
2432
###################
2533
# Keycloak Config #
2634
###################
27-
KEYCLOAK_ADMIN=admin
28-
KEYCLOAK_ADMIN_PASSWORD=${KEYCLOAK_ADMIN}
35+
KC_BOOTSTRAP_ADMIN_USERNAME=admin
36+
KC_BOOTSTRAP_ADMIN_PASSWORD=${KC_BOOTSTRAP_ADMIN_USERNAME}
2937
KC_HTTP_HOST=127.0.0.1
3038
KC_HTTP_PORT=8080
3139

@@ -39,8 +47,10 @@ DUMMY_AUTHORITY=http://${KC_HTTP_HOST}:${KC_HTTP_PORT}/realms/${DUMMY_REALM}
3947
######################
4048
ROCKET_ADDRESS=0.0.0.0
4149
ROCKET_PORT=8000
42-
DOMAIN=http://localhost:${ROCKET_PORT}
50+
ROCKET_TLS={certs="/data/ssl/localhost.crt",key="/data/ssl/localhost.key"}
51+
DOMAIN=https://127.0.0.1:${ROCKET_PORT}
4352
LOG_LEVEL=info,oidcwarden::sso=debug
53+
SSO_DEBUG_TOKENS=true
4454
I_REALLY_WANT_VOLATILE_STORAGE=true
4555

4656
SSO_ENABLED=true

playwright/README.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Integration tests
22

33
This allows running integration tests using [Playwright](https://playwright.dev/).
4-
5-
It uses its own `test.env` with different ports to not collide with a running dev instance.
4+
\
5+
It usse its own [test.env](/test/scenarios/test.env) with different ports to not collide with a running dev instance.
66

77
## Install
88

@@ -11,11 +11,11 @@ Databases (`Mariadb`, `Mysql` and `Postgres`) and `Playwright` will run in conta
1111

1212
### Running Playwright outside docker
1313

14-
It is possible to run `Playwright` outside of the container, this removes the need to rebuild the image for each change.
15-
You will additionally need `nodejs` then run:
14+
It's possible to run `Playwright` outside of the container, this remove the need to rebuild the image for each change.
15+
You'll additionally need `nodejs` then run:
1616

1717
```bash
18-
npm ci --ignore-scripts
18+
npm ci --ignore-scripts --allow-git=none --allow-remote=none
1919
npx playwright install-deps
2020
npx playwright install firefox
2121
```
@@ -65,7 +65,7 @@ DOCKER_BUILDKIT=1 docker compose --profile playwright --env-file test.env run Pl
6565
If you want you can keep the DB and Keycloak runnning (states are not impacted by the tests):
6666

6767
```bash
68-
PW_KEEP_SERVICE_RUNNNING=true npx playwright test
68+
PW_KEEP_SERVICE_RUNNING=true npx playwright test
6969
```
7070

7171
### Running specific tests
@@ -77,7 +77,7 @@ DOCKER_BUILDKIT=1 docker compose --profile playwright --env-file test.env run Pl
7777
DOCKER_BUILDKIT=1 docker compose --profile playwright --env-file test.env run Playwright test --project=sqlite login
7878
```
7979

80-
To run only a specifc test (It might fail if it has dependency):
80+
To run only a specific test (It might fail if it has dependency):
8181

8282
```bash
8383
DOCKER_BUILDKIT=1 docker compose --profile playwright --env-file test.env run Playwright test --project=sqlite -g "Account creation"
@@ -92,7 +92,7 @@ This does not start the server, you will need to start it manually.
9292

9393
```bash
9494
DOCKER_BUILDKIT=1 docker compose --profile playwright --env-file test.env up Vaultwarden
95-
npx playwright codegen "http://127.0.0.1:8003"
95+
npx playwright codegen "https://127.0.0.1:8000" --ignore-https-errors
9696
```
9797

9898
## Override web-vault
@@ -112,12 +112,11 @@ You can check the result running:
112112
DOCKER_BUILDKIT=1 docker compose --profile playwright --env-file test.env up Vaultwarden
113113
```
114114

115-
Then check `http://127.0.0.1:8003/admin/diagnostics` with `admin`.
115+
Then check `https://127.0.0.1:8003/admin/diagnostics` with `admin`.
116116

117117
# OpenID Connect test setup
118118

119-
Additionally this `docker-compose` template allows to run locally Vaultwarden,
120-
[Keycloak](https://www.keycloak.org/) and [Maildev](https://github.com/timshel/maildev) to test OIDC.
119+
Additionally this `docker-compose` template allow to run locally `Vaultwarden`, [Keycloak](https://www.keycloak.org/) and [Maildev](https://github.com/timshel/maildev) to test OIDC.
121120

122121
## Setup
123122

@@ -131,18 +130,17 @@ Then start the stack (the `profile` is required to run `Vaultwarden`) :
131130
```bash
132131
> docker compose --profile vaultwarden --env-file .env up
133132
....
134-
keycloakSetup_1 | Logging into http://127.0.0.1:8080 as user admin of realm master
133+
keycloakSetup_1 | Logging into https://127.0.0.1:8080 as user admin of realm master
135134
keycloakSetup_1 | Created new realm with id 'test'
136135
keycloakSetup_1 | 74af4933-e386-4e64-ba15-a7b61212c45e
137136
oidc_keycloakSetup_1 exited with code 0
138137
```
139138

140-
Wait until `oidc_keycloakSetup_1 exited with code 0` which indicates the correct setup of the Keycloak realm, client and user
141-
(It is normal for this container to stop once the configuration is done).
139+
Wait until `oidc_keycloakSetup_1 exited with code 0` which indicate the correct setup of the Keycloak realm, client and user (It's normal for this container to stop once the configuration is done).
142140

143141
Then you can access :
144142

145-
- `Vaultwarden` on http://0.0.0.0:8000 with the default user `test@yopmail.com/test`.
143+
- `Vaultwarden` on https://0.0.0.0:8000 with the default user `test@yopmail.com/test`.
146144
- `Keycloak` on http://0.0.0.0:8080/admin/master/console/ with the default user `admin/admin`
147145
- `Maildev` on http://0.0.0.0:1080
148146

@@ -171,7 +169,7 @@ docker compose --profile vaultwarden --env-file .env build VaultwardenPrebuild V
171169
All configuration for `keycloak` / `Vaultwarden` / `keycloak_setup.sh` can be found in [.env](.env.template).
172170
The content of the file will be loaded as environment variables in all containers.
173171

174-
- `keycloak` [configuration](https://www.keycloak.org/server/all-config) includes `KEYCLOAK_ADMIN` / `KEYCLOAK_ADMIN_PASSWORD` and any variable prefixed `KC_` ([more information](https://www.keycloak.org/server/configuration#_example_configuring_the_db_url_host_parameter)).
172+
- `keycloak` [configuration](https://www.keycloak.org/server/all-config) include `KC_BOOTSTRAP_ADMIN_USERNAME` / `KC_BOOTSTRAP_ADMIN_PASSWORD` and any variable prefixed `KC_` ([more information](https://www.keycloak.org/server/configuration#_example_configuring_the_db_url_host_parameter)).
175173
- All `Vaultwarden` configuration can be set (EX: `SMTP_*`)
176174

177175
## Cleanup

playwright/compose/keycloak/setup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ done
1717

1818
set -e
1919

20-
kcadm.sh config credentials --server "http://${KC_HTTP_HOST}:${KC_HTTP_PORT}" --realm master --user "$KEYCLOAK_ADMIN" --password "$KEYCLOAK_ADMIN_PASSWORD" --client admin-cli
20+
kcadm.sh config credentials --server "http://${KC_HTTP_HOST}:${KC_HTTP_PORT}" --realm master --user "$KC_BOOTSTRAP_ADMIN_USERNAME" --password "$KC_BOOTSTRAP_ADMIN_PASSWORD" --client admin-cli
2121

2222
kcadm.sh create realms -s realm="$TEST_REALM" -s enabled=true -s "accessTokenLifespan=600"
2323
kcadm.sh create clients -r test -s "clientId=$SSO_CLIENT_ID" -s "secret=$SSO_CLIENT_SECRET" -s "redirectUris=[\"$DOMAIN/*\"]" -i
@@ -39,6 +39,6 @@ kcadm.sh create realms -s realm="$DUMMY_REALM" -s enabled=true -s "accessTokenLi
3939
# THEN in another terminal:
4040
# docker exec -it keycloakSetup-dev /bin/bash
4141
# export PATH=$PATH:/opt/keycloak/bin
42-
# kcadm.sh config credentials --server "http://${KC_HTTP_HOST}:${KC_HTTP_PORT}" --realm master --user "$KEYCLOAK_ADMIN" --password "$KEYCLOAK_ADMIN_PASSWORD" --client admin-cli
42+
# kcadm.sh config credentials --server "http://${KC_HTTP_HOST}:${KC_HTTP_PORT}" --realm master --user "$KC_BOOTSTRAP_ADMIN_USERNAME" --password "$KC_BOOTSTRAP_ADMIN_PASSWORD" --client admin-cli
4343
# ENJOY
4444
# Doc: https://wjw465150.gitbooks.io/keycloak-documentation/content/server_admin/topics/admin-cli.html

playwright/compose/playwright/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ RUN mkdir /playwright
2828
WORKDIR /playwright
2929

3030
COPY package.json package-lock.json .
31-
RUN npm ci --ignore-scripts && npx playwright install-deps && npx playwright install firefox
31+
RUN npm ci --ignore-scripts --allow-git=none --allow-remote=none && npx playwright install-deps && npx playwright install firefox
3232

3333
COPY docker-compose.yml test.env ./
3434
COPY compose ./compose

playwright/compose/warden/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ WORKDIR /
3535

3636
COPY --from=prebuilt /start.sh .
3737
COPY --from=prebuilt /vaultwarden .
38+
COPY --from=build /data ./data
3839
COPY --from=build /web-vault ./web-vault
3940

4041
ENTRYPOINT ["/start.sh"]

playwright/compose/warden/build.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,14 @@ if [[ ! -z "$REPO_URL" ]] && [[ ! -z "$COMMIT_HASH" ]] ; then
2222

2323
mv build /web-vault
2424
fi
25+
26+
# Lower the KDF iterations default for faster tests.
27+
sed -i 's/(6e5,2e6,6e5)/(1e5,2e6,1e5)/' /web-vault/app/main.*.js
28+
29+
# Generate a self signed cert
30+
mkdir -p /data/ssl; cd /data/ssl
31+
32+
openssl req -x509 -out localhost.crt -keyout localhost.key \
33+
-newkey rsa:2048 -nodes -sha256 \
34+
-subj '/CN=localhost' -extensions EXT -config <( \
35+
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")

playwright/docker-compose.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,15 @@ services:
2424
environment:
2525
- ADMIN_TOKEN
2626
- DATABASE_URL
27+
- CLIENT_SUPPRESS_ONBOARDING
28+
- EMAIL_2FA_AUTO_FALLBACK
2729
- I_REALLY_WANT_VOLATILE_STORAGE
2830
- LOG_LEVEL
2931
- LOGIN_RATELIMIT_MAX_BURST
3032
- SMTP_HOST
3133
- SMTP_FROM
3234
- SMTP_DEBUG
35+
- SSO_AUTH_ONLY_NOT_SESSION
3336
- SSO_DEBUG_TOKENS
3437
- SSO_ENABLED
3538
- SSO_FRONTEND
@@ -70,7 +73,7 @@ services:
7073
Mysql:
7174
profiles: ["playwright"]
7275
container_name: playwright_mysql
73-
image: mysql:8.4.1
76+
image: mysql:9.7.0
7477
env_file: test.env
7578
healthcheck:
7679
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
@@ -82,7 +85,7 @@ services:
8285
Postgres:
8386
profiles: ["playwright"]
8487
container_name: playwright_postgres
85-
image: postgres:16.3
88+
image: postgres:18.4
8689
env_file: test.env
8790
healthcheck:
8891
test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
@@ -94,15 +97,15 @@ services:
9497
Maildev:
9598
profiles: ["vaultwarden", "maildev"]
9699
container_name: maildev
97-
image: timshel/maildev:3.0.4
100+
image: timshel/maildev:3.2.19
98101
ports:
99102
- ${SMTP_PORT}:1025
100103
- 1080:1080
101104

102105
Keycloak:
103106
profiles: ["keycloak", "vaultwarden"]
104107
container_name: keycloak-${ENV:-dev}
105-
image: quay.io/keycloak/keycloak:26.3.4
108+
image: quay.io/keycloak/keycloak:26.6.2
106109
network_mode: "host"
107110
command:
108111
- start-dev
@@ -112,12 +115,12 @@ services:
112115
profiles: ["keycloak", "vaultwarden"]
113116
container_name: keycloakSetup-${ENV:-dev}
114117
image: keycloak_setup-${ENV:-dev}
118+
network_mode: "host"
115119
build:
116120
context: compose/keycloak
117121
dockerfile: Dockerfile
118122
args:
119-
KEYCLOAK_VERSION: 26.3.4
120-
network_mode: "host"
123+
KEYCLOAK_VERSION: 26.6.2
121124
depends_on:
122125
- Keycloak
123126
restart: "no"

0 commit comments

Comments
 (0)