Re: Trying to solve a SocketError [Errno 13] Permission with PL/Python in PostgreSQL 9.3

From: Marcos Ortiz <mlortiz(at)uci(dot)cu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Trying to solve a SocketError [Errno 13] Permission with PL/Python in PostgreSQL 9.3
Date: 2015-05-23 22:46:37
Message-ID: 5561034D.2050507@uci.cu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 23/05/15 18:38, Tom Lane wrote:
> Marcos Ortiz <mlortiz(at)uci(dot)cu> writes:
>> O.S: CentOS 7 64 bits
>> We are working here to integrate PostgreSQL with Neo4j through PL/Python
>> using the py2neo module for it, and when we want to send sentences to
>> Neo4j using port 7474, the executed code raises a SocketError [Errno 13]
>> Permission denied.
>> I tested the same code in a normal python script outside of PostgreSQL,
>> and it works well, but the problem is when I use the code inside
>> PostgreSQL with PL/Python.
> Probably SELinux is set up to deny random connections originating from the
> postgresql daemon. If disabling SELinux makes the problem go away then
> that's it. (I do *not* recommend that as a permanent solution, of course.
> You'll want to find some finer-grained change to the security policy.
> Don't remember enough about SELinux to know what the most likely bet is.)
>
> regards, tom lane
I'm agree with you, Tom.
I will find the SELinux policy to allow this, because I don't want to
disable SELinux in the system.
Searching in the system with getgetsebool -a | grep postgresql, this was
the result:

postgresql_can_rsync --> off
postgresql_selinux_transmit_client_label --> off
postgresql_selinux_unconfined_dbadm --> on
postgresql_selinux_users_ddl --> on
selinuxuser_postgresql_connect_enabled --> off

--
Marcos Ortiz <http://about.me/marcosortiz>, Sr. Product Manager (Data
Infrastructure) at UCI
@marcosluis2186 <http://twitter.com/marcosluis2186>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marcos Ortiz 2015-05-23 22:51:04 Re: Trying to solve a SocketError [Errno 13] Permission with PL/Python in PostgreSQL 9.3
Previous Message Adrian Klaver 2015-05-23 22:40:51 Re: Trying to solve a SocketError [Errno 13] Permission with PL/Python in PostgreSQL 9.3