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

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Marcos Ortiz <mlortiz(at)uci(dot)cu>, 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 23:38:05
Message-ID: 55610F5D.6000306@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 05/23/2015 04:16 PM, Marcos Ortiz wrote:
>
>
> On 23/05/15 19:09, Adrian Klaver wrote:
>> On 05/23/2015 03:51 PM, Marcos Ortiz wrote:
>>>
>>>
>>> On 23/05/15 18:40, Adrian Klaver wrote:
>>>> On 05/23/2015 03:27 PM, Marcos Ortiz wrote:
>>>>> Regards to all the list.
>>>>> First all the info about the system:
>>>>>
>>>>> O.S: CentOS 7 64 bits
>>>>> PostgreSQL version:
>>>>>
>>>>> SELECT version();
>>>>> version
>>>>> --------------------------------------------------------------------------------------------------------------
>>>>>
>>>>>
>>>>>
>>>>> PostgreSQL 9.2.7 on x86_64-redhat-linux-gnu, compiled by gcc (GCC)
>>>>> 4.8.2 20140120 (Red Hat 4.8.2-16), 64-bit
>>>>> (1 row)
>>>>>
>>>>> Neo4j version: 2.1.M
>>>>> Py2neo version: 2.0.8
>>>>> Python version:
>>>>> python
>>>>> Python 2.7.5 (default, Jun 17 2014, 18:11:42)
>>>>> [GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2
>>>>>
>>>>> Now the problem:
>>>>>
>>>>> 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.
>>>>
>>>> Well first in the code below, if I am following correctly, the socket
>>>> is 37474.
>>> Yes, Adrian. Sorry for that, the correct port is 7474. I just was
>>> testing with higher ports to
>>> see if the error persisted.
>>>>
>>>>
>>>>>
>>>>> 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.
>>>>
>>>> Second the plpythonu code is running as the postgres user, so does
>>>> that user have permissions on the socket.
>>> Did you mean the socket created by Neo4j's server right?
>>> For that reason, I created a group in the system for this named
>>> supervisor, where neo4j/postgres users are members.
>>> So, if I find the socket file for Neo4j-server, changing permissions
>>> could solve the problem. Right?
>>
>> Not sure, but a quick search found that py2neo uses the neo4j REST API
>> and that API has authorization parameters:
>>
>> http://neo4j.com/docs/stable/security-server.html
>>
>> Have you gone through the above?
> Yes, Adrian. py2neo installs a tool called neoauth, which can be used to
> create users with their respective passwords.
> For that reason, I use this way to create the graph:
>
> graph = Graph("http://neo4j:neo4j(at)10(dot)8(dot)45(dot)136:7474/db/data")
> using the user neo4j and its pass neo4j
>

Not sure if it applies but see here:

http://neo4j.com/docs/stable/rest-api-security.html
"When Neo4j is first installed you can authenticate with the default
user neo4j and the default password neo4j. However, the default password
must be changed (see the section called “User status and password
changing”) before access to resources will be permitted. ..."

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2015-05-23 23:46:10 Re: PG and undo logging
Previous Message David G. Johnston 2015-05-23 23:31:55 Re: [NOVICE] Constraint exclusion in partitions