PostgreSQL

Revision as of 18:28, 24 April 2015 by WikiFreak (talk | contribs)


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          trust

### Reject other incoming connections
host    all         all         0.0.0.0/0             reject


References