-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Secure database by restricting Postgres and Bety user accounts #626
Comments
Refer to #616 for additional context |
It looks like the instance of postgres used in the Pecan installation allows all hosts from anywhere to connect as trusted users. It is the last line in the pg_hba.conf file is host all all all trust which allows this. One command that shows this is Is this something that would be desirable to change for all instances, not just in our case (at UA)? In the same vein, he local access allows all users as well. Perhaps this can be restricted to only bety and postgres users? More information on the pg_hbe.config file can be found on the Postgresql documentation site (for example, https://www.postgresql.org/docs/10/auth-pg-hba-conf.html) |
It looks like the Bety web needs "host all all all trust". I need to investigate to see if ...11 would be a better fit (IP from docker inspect command) |
When reading the
So, for example, as I understand it, if there were a line
before the line
the latter would never be reached. In other words, just because the last line is Of course having such a line is potentially dangerous: if someone mistakenly deletes or comments out a preceding line, that could inadvertently open up access more than wanted. |
You are correct, that is how the One can do the following in the running container to confirm:
|
I have less of an issue with this in the docker framework. I don't think you should let people access the docker container directly and execute code there. Can you see what happens if you expose the port (5432) and connect to it remotely can you connect with username/password? |
We have done this and the machine running the container is able to connect to the postgres database with no changes to the pg_hba.conf file (using the default settings which allow everything) |
experimented a bit with setting PG_PASSWORD variable but this breaks the create initial database. What seems to work, and should become more standard, is to do the initialize of the database. Next you connect to the postgres database Keep in mind, if you can connect to the running docker image nothing with prevent you from connecting to the database. You still should be able to connect to the database with no password if you use Nevermind, ignore this. This failed. All of this will require the load.bety.sh script to be able to take the username/password for both bety and postgres from the command-line. Will look at that in more detail once #609 is merged. |
The minimal needed permissions should be given to the Bety account after installation. The postgres user should be restricted to prevent accidental or intentional problems
The text was updated successfully, but these errors were encountered: