LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 07-14-2011, 07:07 AM   #1
thatishari
LQ Newbie
 
Registered: Sep 2009
Posts: 11

Rep: Reputation: 1
Postgresql giving connection timed out because of iptables


Hi,

In our development box we are configured postgresql to work with Jboss. The thing is we have firewall iptables in our linux box. when the iptables is stopped we can connect the postgres db locally using -h option, also we can connect thru a weblink we have created using Jboss. But when the iptables is started we can't connect the db locally using the -h option and the web is giving the below error.

Caused by: org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
at org.postgresql.core.v3.ConnectionFactoryImpl.openC onnectionImpl(ConnectionFactoryImpl.java:136)
at org.postgresql.core.ConnectionFactory.openConnecti on(ConnectionFactory.java:66)
at org.postgresql.jdbc2.AbstractJdbc2Connection.<init >(AbstractJdbc2Connection.java:125)
at org.postgresql.jdbc3.AbstractJdbc3Connection.<init >(AbstractJdbc3Connection.java:30)
at org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3C onnection.java:24)
at org.postgresql.Driver.makeConnection(Driver.java:3 93)
at org.postgresql.Driver.connect(Driver.java:267)
at org.jboss.resource.adapter.jdbc.local.LocalManaged ConnectionFactory.getLocalManagedConnection(LocalM anagedConnectionFactory.java:207).

We have defined the postgres,Jboss ports plus all the ports in the start up error logs in the iptables still same issue persists. I have also attached the iptables and Jboss startup error logs which is because of the postgres db.

Your replies are highly welcome.
Attached Files
File Type: txt iptables-1.txt (2.4 KB, 20 views)
File Type: txt Jboss_startup_failure-1.txt (35.0 KB, 23 views)
 
Old 07-15-2011, 12:29 AM   #2
kmassare
LQ Newbie
 
Registered: Apr 2011
Location: California, US
Distribution: Fedora
Posts: 28

Rep: Reputation: 8
Try adding the following lines to your iptables:

-A INPUT -i lo -j ACCEPT
-A OUTPUT -o lo -j ACCEPT
 
Old 07-19-2011, 02:32 AM   #3
thatishari
LQ Newbie
 
Registered: Sep 2009
Posts: 11

Original Poster
Rep: Reputation: 1
Thanks kmassare.. It works well but i have a query regarding it. Will it accept outbound connections too? our requirement is to block the incoming and outgoing connections (apart from the port specified) which are not in the iptables.
 
Old 07-20-2011, 12:23 AM   #4
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
The rules affect only the loopback interface.

They don't poke any holes on actual external interfaces.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ssh: connection to host port: 22: Connection timed out lost connection cucolin@ Linux - Server 4 11-22-2011 06:15 AM
Connection Timed Out jwthomas Linux - Server 1 05-08-2009 09:34 PM
Mysql giving max connection errors, server has no connection limit. Jukas Linux - Server 1 03-26-2008 04:06 AM
sendmail - Connection timed out [dsn=4.0.0 stat=Deferred: Connection timed out] ananthak Linux - Software 0 04-24-2007 07:28 AM
Postgresql is giving me a VERY BAD time, help very much needed AlexSapec Linux - Software 1 02-22-2006 08:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 07:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration