我正在build立一个包含postgresql数据库的新系统,并试图locking哪些机器能够打开到数据库的连接。
我试图使用allow_user_postgresql_connect布尔来实现这一目标,但到目前为止一直无法让它阻止任何连接。
我正在testing2台服务器数据库和客户端如下。 都是运行postgres 8.4.7-2的RHEL6u2;
DB# getenforce Enforcing DB# getsebool allow_user_postgresql_connect allow_user_postgresql_connect --> on DB# service postgresql start starting postgresql service: [ OK ] Client# getenforce Enforcing Client# getsebool allow_user_postgresql_connect allow_user_postgresql_connect --> off Client-> psql -h DB "sslmode=require dbname=mydb" postgres connects
我已经尝试所有组合的allow_user_postgresql_connect在两台机器上没有能够导致它拒绝连接。
应该如何设置这个布尔值来防止机器上的用户连接到数据库?
我对SElinux很陌生,所以可能会忽略一些明显的东西。
你为什么试图使用SELinux呢? Postgres已经有了一个完美的强大的身份validation和授权系统 ,这是你应该使用这个(其他原因,因为它把失败的login放在合乎逻辑的地方:Postgres日志)。
如果您试图通过不让未经授权的系统连接到Postgres端口来进一步保护系统,那么您可能拥有授权系统(IP地址)的列表,并且可以configuration阻止来自未授权主机的stream量的防火墙规则。
试图摔跤SELinux提交像这样的东西似乎是试图驱动一个信用卡插槽的方形钉给我。