mirror of
https://github.com/getumbrel/umbrel-apps.git
synced 2026-11-26 23:50:08 +03:00
16 lines
710 B
SQL
16 lines
710 B
SQL
-- Runs once, when the database is first created. The schema (generated by the
|
|
-- init service as 001-schema.sql) creates guacadmin with the well-known
|
|
-- password "guacadmin". Replace it with the per-install Umbrel app password.
|
|
-- Guacamole stores SHA-256(password || uppercase hex salt).
|
|
\getenv guacadmin_password GUACADMIN_PASSWORD
|
|
|
|
UPDATE guacamole_user AS u
|
|
SET password_salt = s.salt,
|
|
password_hash = sha256(convert_to(:'guacadmin_password' || upper(encode(s.salt, 'hex')), 'UTF8')),
|
|
password_date = CURRENT_TIMESTAMP
|
|
FROM guacamole_entity AS e,
|
|
(SELECT sha256(gen_random_uuid()::text::bytea) AS salt) AS s
|
|
WHERE u.entity_id = e.entity_id
|
|
AND e.name = 'guacadmin'
|
|
AND e.type = 'USER';
|