Skip to content

Troubleshooting

Arthu Santiago edited this page Nov 30, 2026 · 2 revisions

Troubleshooting

This page lists problems that happen in real installations, what causes each one and how to fix it. If yours is not here, look for the error in logs/error.log (see Logs and Security Events) and then open an issue with the log line (remove anything personal first).

The application doesn't start: "Security.salt"

Symptom: every page, and every kaw-cake command, fails with an error about the security salt.

Cause: SECURITY_SALT is empty or shorter than 32 characters, or the environment file was not read.

Fix: check that the variable is in the file and long enough, then restart Apache.

sudo grep -c '^SECURITY_SALT=.\{34,\}' /etc/keyanywhere/keyanywhere.env

The command prints 1 when the value is there and has at least 32 characters. If it prints 0, generate one as in Generating Security Keys. If it prints 1 and Apache still fails, check that /etc/apache2/envvars loads the file (Environment Variables, step 3).

The database refuses the connection: "server does not support SSL"

Symptom: every page and every kaw-cake command fails with server does not support SSL, but SSL was required.

Cause: since 2.4.1, KeyAnyWhere connects to PostgreSQL with sslmode=require, and this PostgreSQL has SSL turned off.

Fix: turn SSL on in PostgreSQL (ssl = on in postgresql.conf, with a certificate; Debian ships one) and restart it:

sudo -u postgres psql -c 'ALTER SYSTEM SET ssl = on;'
sudo systemctl restart postgresql

If the database is on the same machine and you prefer not to use SSL, lower the requirement in config/app_local.php (Configuration Files) instead:

'Datasources' => [
    'default' => [
        'ssl_mode' => 'prefer',
    ],
],

"Missing or invalid CSRF cookie"

Symptom: a form submission fails with this message.

Cause: the browser still has a CSRF cookie signed with an older SECURITY_SALT (the salt was replaced, or KeyAnyWhere was reinstalled on the same domain).

Fix: reload the page (a GET) and submit again. KeyAnyWhere drops a CSRF cookie whose signature doesn't match the current salt on the next GET, and issues a new one.

The first-run setup answers 403

Symptom: "A configuração inicial não foi autorizada" (The first-run setup was not authorized).

Cause: the address has no token, a wrong token, or CONFIG_INICIAL_TOKEN is shorter than 32 characters or missing on the server.

Fix: print the address again with the command in First-Run Setup, step 1.

kaw-cake can't connect to the database

Symptom: a CLI command fails with a connection error, while the site works.

Cause: the command was run as bin/cake (which doesn't read /etc/keyanywhere/keyanywhere.env) or as a user that can't read the file.

Fix: always run CLI commands as www-data through kaw-cake:

sudo -u www-data kaw-cake migrations status

Every page redirects to HTTPS, or HTTP doesn't work

Cause: with debug off, KeyAnyWhere accepts only HTTPS. This is on purpose.

Fix: set up the certificate on Apache itself, as in Web Server and HTTPS. KeyAnyWhere doesn't trust proxy headers (X-Forwarded-Proto), so a proxy or load balancer that ends HTTPS and talks plain HTTP to Apache is not supported: keep HTTPS all the way to Apache.

Stored passwords can't be decrypted

Symptom: after a restore or a move to a new server, entries open with an error, or their fields come out empty.

Cause: KEY_CRIPTOGRAFIC is not the one the data was encrypted with.

Fix: put back the original key from your offline copy. There is no other way: without the original key, the data cannot be read.

Cache or permission errors after an upgrade

Symptom: "Permission denied" in tmp/ or logs/, or errors about missing columns right after an upgrade.

Fix: run steps 4 and 5 of Upgrading again: migrations, cache clear, permissions and an Apache restart.

Clone this wiki locally