-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Default pg_hba is extremely insecure #31
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
Comments
See #29 |
I understand that you can provide your own configuration, but what I mean here is that the defaults need to be reasonable, because many might not change the default configuration. In most cases, trust should not be used except with 127.0.0.1 |
In almost every case running this image is the same as 127.0.0.1. Unless you forward the port with |
Yes, you are right. Just it is fairly common that people will export the database port with My suggestion is that it is always good to have a reasonable default configuration specially for something that will be used by so many people. |
Please correct me if I'm wrong, but with |
By default there is no default password for PostgresSQL, and typically first thing people do after installation is to set a password. But with such extremely unsecured default, even after setting a password, still anyone in the world can connect without a password. Additionally, you do not need to include any passwords in the Dockerfile, you can pass the password as environment variable or generate it on the fly. Check the comments on the docker hub, many are really frustrated from such insecure default configuration of the official image |
@iTech-Developer: Passing password as command line argument is not secure either. Randomly generated one is also no go because it's not flexible enough. I fully agree with you that default settings might look strange for someone new to Docker (count me as one) but alternatives you mentioned are not better (from security pov) at all. Taking this into account there is no gain in making docker image overcomplicated. IMHO LDAP or Kerberos is the only reasonable and secure way but also not the most popular one. |
I agree with you, all what I am suggesting that we should have a reasonable default in the official image, not either super secure or no security at all! Beside from issue #29 it is clear that some people did not expect such default insecure behavior |
I did a little research and think we can do similar to mysql and have a If that sounds amenable, I can get on a PR (unless someone else wants to do it). |
+1 from me -- sounds really simple and non-intrusive for existing users as We'll just want to be sure to add the warning to the documentation too. |
+1, sane defaults are a good idea. At the very least, an obvious warning on the Docker registry would be nice. |
The fix for this issue makes launching these containers for dev annoying. There should be a flag to turn back on allowing user logins with passwords. Right now you have to inject your own pg_hba.conf. |
Yes, this change is plain out stupid. The security model of how Docker links containers together provides all the necessary protection. Someone clearly slept through their Docker class. Here is an excerpt from the Linking Containers Together page:
|
@Starefossen actually links provide zero security unless you are actually running the docker daemon with I'll admit that we might have gone too tight on the security that people were initially complaining was "too insecure" here. The original thought is that you are using something like |
This kinda sucks if you want multiple databases and users for one postgresql container which seems to me as a good way to do things (isn't it?) so now if you want any kind of user isolation from the apps, you should provide your pg_hba.conf because only the |
It might be more reasonable to replace the following line in pg_hba
echo 'host all all 0.0.0.0/0 trust';
with
echo 'host all all 0.0.0.0/0 md5';
Because the current configuration simply enables anyone in the world to connect to the database with no authentication whatsoever, which is really a very serious security problem because it is very likely that someone might leave the default setting of the image!
Quoting PostgreSQL documentation
The text was updated successfully, but these errors were encountered: