Skip to content

Reference The 25 checks

Exposed databases

Security check exposed-databases

What it reads

Whether MongoDB, Redis, PostgreSQL or MySQL listen on a public address or are published by Docker, and whether the firewall on this server blocks them.

Does it need root?

It needs root for part of what it reads. Reading the firewall rules needs root. Without root, that part is skipped and never counted as passed. Run sudo kiyesi scan to include it.

When it passes

The report lists it as passed, in these words:

  • No database is open to the internet

What it can find

Critical Reported as likely

database is open to the internet on port port

Anyone can connect and read or wipe the data. Kiyesi cannot see provider_firewall from inside the server, so this is likely, not confirmed. If one protects it, say so with provider_firewall: true under ports in /etc/kiyesi/config.yaml.

Fix, to review and run yourself
bind the port to 127.0.0.1 in docker-compose.yml, then
docker compose up -d service

The fix changes with how the server is set up:

If the container was started with docker run
recreate the container with -p 127.0.0.1:port:port in place of -p port:port
Redis installed on the server
set bind 127.0.0.1 ::1 in /etc/redis/redis.conf, then sudo systemctl restart redis-server
MongoDB installed on the server
set bindIp: 127.0.0.1 under net: in /etc/mongod.conf, then sudo systemctl restart mongod
PostgreSQL installed on the server
set listen_addresses = 'localhost' in postgresql.conf, then sudo systemctl restart postgresql
MySQL installed on the server
set bind-address = 127.0.0.1 in /etc/mysql/mysql.conf.d/mysqld.cnf, then sudo systemctl restart mysql
Warning

database listens on a public address on port port, behind your provider's firewall

Only your provider's firewall, which Kiyesi cannot see from inside, keeps database from the internet. One wrong rule there opens it to everyone.

Fix, to review and run yourself
Bind database to 127.0.0.1 or a private address if only this server or your private network needs it, and check your provider's firewall does not allow port from the internet