jeudi 28 janvier 2010

Linux: Iptables Allow PostgreSQL server incoming request

PostgreSQL is an object relational database system that has the features of traditional commercial database systems with enhancements to be found in next-generation DBMS systems. PostgreSQL is free and the complete source code is available.

Open port 5432

By default PostgreSQLt listen on TCP port 5432. Use the following iptables rules allows incoming client request (open port 5432) for server IP address 202.54.1.20 :
iptables -A INPUT -p tcp -s 0/0 --sport 1024:65535 -d 202.54.1.20 --dport 5432 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp -s 202.54.1.20 --sport 5432 -d 0/0 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT
As posted earlier, you do not wish give access to everyone. For example in web hosting company or in your own development center, you need to gives access to POSTGRES database server from web server only. Following example allows POSTGRES database server access (202.54.1.20) from Apache web server (202.54.1.50) only:
iptables -A INPUT -p tcp -s 202.54.1.50 --sport 1024:65535 -d 202.54.1.20 --dport 5432 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp -s 202.54.1.20 --sport 5432 -d 202.54.1.50 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT
Allow outgoing POSTGRES client request (made via postgresql command line client or perl/php script), from firewall host 202.54.1.20:
iptables -A OUTPUT -p tcp -s 202.54.1.20 --sport 1024:65535 -d 0/0 --dport 5432 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp -s 0/0 --sport 5432 -d 202.54.1.20 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT

Aucun commentaire:

Talend Certified

Certification is awarded to individuals who successfully complete a comprehensive online test covering all aspects of the use of Talend Open Studio in real-life situations. Clients trusting a systems integrator to implement a solution want to be reassured that the consultants are indeed experts in the technology. Talend certification gives them this level of assurance.

Qui êtes-vous ?

Paris, Île de France, France
I'm a textbook computer geek, who has a keen interest in programming, GIS and mapping.

Linux News

Wikipedia

Mission Topographique

Mission Topographique
Promo6 Mastére Géomatique

Talend Blog

Liste de partage de geomatiLux

Libellés

Media préferé

  • www.talend.com

Le Groupe CLLFST

Le Groupe CLLFST
SFD 2007

CLLFST & INFO+

CLLFST & INFO+
SFD 2007