Skip to content

Commit 967abb7

Browse files
committed
Merge branch 'feature/PB-50003_Passbolt-container-doesnt-start-when-JWT-keys-are-mounted-as-a-read-only-secret' into 'master'
PB-50003: allow failure of the JWT keypair permissions adjustment See merge request passbolt/passbolt_docker!248
2 parents 9526a51 + c48fdb7 commit 967abb7

3 files changed

Lines changed: 25 additions & 3 deletions

File tree

scripts/entrypoint/passbolt/entrypoint-openshift.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,16 @@ function jwt_keys_creation() {
9090
if [[ ! -f "$passbolt_config/jwt/jwt.key" || ! -f "$passbolt_config/jwt/jwt.pem" ]]; then
9191
mkdir -p "$passbolt_config/jwt"
9292
chmod 770 "$passbolt_config/jwt"
93-
9493
/usr/share/php/passbolt/bin/cake passbolt create_jwt_keys
94+
fi
95+
}
9596

97+
function jwt_keys_permissions_adjustments() {
98+
if [[ "${PASSBOLT_PLUGINS_JWT_AUTHENTICATION_ENABLED}" == "false" ]]; then
99+
return 0
100+
fi
101+
102+
if [[ -f "$passbolt_config/jwt/jwt.key" && -f "$passbolt_config/jwt/jwt.pem" ]]; then
96103
chmod 640 "$passbolt_config/jwt/jwt.key"
97104
chown www-data:0 "$passbolt_config/jwt/jwt.key"
98105
chmod 640 "$passbolt_config/jwt/jwt.pem"
@@ -112,8 +119,8 @@ function install() {
112119
fi
113120

114121
import_subscription || true
115-
116122
jwt_keys_creation
123+
jwt_keys_permissions_adjustments || echo "[WARN] An attempt to adjust the JWT keypair permission failed. This may be expected if you mount your own keypair as read-only and may be fine as long as the Passbolt server can read said keypair. You can use the health-check command to find any issue with your instance: https://www.passbolt.com/docs/hosting/troubleshooting/logs/#api" >&2
117124
install_command || migrate_command && echo "Enjoy! ☮"
118125
check_fullbase_url
119126
}

scripts/entrypoint/passbolt/entrypoint-rootless.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,16 @@ function jwt_keys_creation() {
9090
if [[ ! -f "$passbolt_config/jwt/jwt.key" || ! -f "$passbolt_config/jwt/jwt.pem" ]]; then
9191
mkdir -p "$passbolt_config/jwt"
9292
chmod 770 "$passbolt_config/jwt"
93-
9493
/usr/share/php/passbolt/bin/cake passbolt create_jwt_keys
94+
fi
95+
}
96+
97+
function jwt_keys_permissions_adjustments() {
98+
if [[ "${PASSBOLT_PLUGINS_JWT_AUTHENTICATION_ENABLED}" == "false" ]]; then
99+
return 0
100+
fi
95101

102+
if [[ -f "$passbolt_config/jwt/jwt.key" && -f "$passbolt_config/jwt/jwt.pem" ]]; then
96103
chmod 640 "$passbolt_config/jwt/jwt.key"
97104
chmod 640 "$passbolt_config/jwt/jwt.pem"
98105
chmod 750 "$passbolt_config/jwt"
@@ -111,6 +118,7 @@ function install() {
111118

112119
import_subscription || true
113120
jwt_keys_creation
121+
jwt_keys_permissions_adjustments || echo "[WARN] An attempt to adjust the JWT keypair permission failed. This may be expected if you mount your own keypair as read-only and may be fine as long as the Passbolt server can read said keypair. You can use the health-check command to find any issue with your instance: https://www.passbolt.com/docs/hosting/troubleshooting/logs/#api" >&2
114122
install_command || migrate_command && echo "Enjoy! ☮"
115123
check_fullbase_url
116124
}

scripts/entrypoint/passbolt/entrypoint.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ function jwt_keys_creation() {
9595
chown www-data:www-data "$passbolt_config/jwt"
9696
su -c '/usr/share/php/passbolt/bin/cake passbolt create_jwt_keys' -s /bin/bash www-data
9797
fi
98+
}
99+
100+
function jwt_keys_permissions_adjustments() {
101+
if [[ "${PASSBOLT_PLUGINS_JWT_AUTHENTICATION_ENABLED}" == "false" ]]; then
102+
return 0
103+
fi
98104

99105
if [[ -f "$passbolt_config/jwt/jwt.key" && -f "$passbolt_config/jwt/jwt.pem" ]]; then
100106
chmod 640 "$passbolt_config/jwt/jwt.key"
@@ -118,6 +124,7 @@ function install() {
118124

119125
import_subscription || true
120126
jwt_keys_creation
127+
jwt_keys_permissions_adjustments || echo "[WARN] An attempt to adjust the JWT keypair permission failed. This may be expected if you mount your own keypair as read-only and may be fine as long as the Passbolt server can read said keypair. You can use the health-check command to find any issue with your instance: https://www.passbolt.com/docs/hosting/troubleshooting/logs/#api" >&2
121128
install_command || migrate_command && echo "Enjoy! ☮"
122129
check_fullbase_url
123130
}

0 commit comments

Comments
 (0)