Warracker icon indicating copy to clipboard operation
Warracker copied to clipboard

db password

Open luci-serendipity opened this issue 1 year ago • 3 comments

I believe it could be beneficial to use RNG to create the default db password. and then omit it from the envirnment variables unless explicitly provided. I just ran into an issue where I moved the service I created for warracker into a dockerfile. This resulted in an error where the dockers were being provided the correct "default" password. What I discovered is that originally, the db had the whole literal variable set as the password.

Original > ${DB_PASSWORD:-warranty_password} Intended > warranty_password service used original dockerfile used intended

I was able to manually change the password to something other than the default anyway but I found this odd. FYI, I have an unusual setup. I'm using terraform to deploy my server. I already have to escape interpolation from terraform by doing odd things so it was already overly complicated. I'm not suprised I missed this.

luci-serendipity avatar Jul 06 '25 17:07 luci-serendipity

If you’re curious and the service is down, you can hop back into the DB docker and reset the password manually. The DB container is the one that actually holds the password (obvious, but spelling it out in case someone else stumbles on this later).

  • Enter the commands below into a shell on the host running the warracker dockers

# Change this to whatever new password you want:
NEW_PASS="s3cr3t_pw"

# Now exec into the DB docker and change the password to NEW_PASS.
docker exec -it warrackerdb psql -U warranty_user -d warranty_db \
 -c "ALTER USER warranty_user WITH PASSWORD '${NEW_PASS}';"

# Update your environment variable to match and echo it back as a sanity check:
export DB_PASSWORD="${NEW_PASS}" && echo "Your new password is ${NEW_PASS}"

At this point you’ll need to restart things so the new password is picked up.

  • If it’s running as a service: (Be sure to restart your service. The service name may differ from what is listed below. You can check the usual location /etc/systemd/system/ to see what your warracker service(s) are called.)

systemctl restart warrackerdb.service warracker.service
- ## If warracker docker is running as docker containers:
docker restart warracker warrackerdb

luci-serendipity avatar Jul 06 '25 18:07 luci-serendipity

@icywhisker-official interesting use case, I will look the best possible ways around this, and review RNG as well :)

sassanix avatar Jul 06 '25 23:07 sassanix

An update on this one, since it has been open a while.

The problem you hit, the literal ${DB_PASSWORD:...} string ending up as the database password, came from the variable interpolation in your deployment tooling rather than from Warracker itself, so there is nothing to fix on that side.

The suggestion underneath it, that Warracker should not ship a known default database password, is being addressed. 1.0.5 deprecates the built-in defaults for DB_USER, DB_PASSWORD, DB_ADMIN_USER and DB_ADMIN_PASSWORD: the app now logs a startup warning naming any of them that are unset and still falling back to the defaults. In 1.0.6 the defaults are removed entirely, and every installation will have to set its own credentials explicitly.

I went with removal rather than generating a random password in the app. A generated password still has to be shared with the separate database container and surfaced to the admin somehow, which creates its own mismatch problems. Explicit configuration reaches the same end state, no known default, with less machinery.

I will leave this open until 1.0.6 lands, and close it then.

sassanix avatar Nov 01 '26 16:11 sassanix