Difference between revisions of "PostgreSQL"
Line 48: | Line 48: | ||
host all all 172.16.100.0/24 md5 | host all all 172.16.100.0/24 md5 | ||
# Specific host(s) | # Specific host(s) | ||
− | host all all 5.39.81.23/32 | + | host all all 5.39.81.23/32 md5 |
### Reject other incoming connections | ### Reject other incoming connections |
Revision as of 17:28, 24 April 2015
Required packages
apt-get install postgresql postgresql-doc
Configuration
Edit the server configuration file
vim /etc/postgresql/xxx/main/
Adjust the access rights, at the end:
########
# USER access
########
# Allow postgresql super administrator login, using password
local all postgres md5
# Allow other users connection
local all all trust
########
# IP@ filtering
#######
### No password required
# Enable localhost
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
# Enable specific host(s)
host all all 172.16.100.62/32 trust
### Forbid remote connection for non-trusted locations
host all postgres 0.0.0.0/0 reject
### Password required
# Local network
host all all 172.16.100.0/24 md5
# Specific host(s)
host all all 5.39.81.23/32 md5
### Reject other incoming connections
host all all 0.0.0.0/0 reject
References
- Very good explanation of access restrictions and configuration: http://www.depesz.com/2007/10/04/ident/
- Setup example: http://technobytz.com/install-postgresql-9-3-ubuntu.html