Re: Problem with pl/python procedure connecting to the internet

From: s d <daku(dot)sandor(at)gmail(dot)com>
To: Igor Sosa Mayor <joseleopoldo1792(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Problem with pl/python procedure connecting to the internet
Date: 2015-08-23 17:31:27
Message-ID: CAKyoTgZCwx2rgHSufrPxaNZM+yPFcvZ35Y8=it1aULRqBWOhYg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 23 August 2015 at 18:59, Igor Sosa Mayor <joseleopoldo1792(at)gmail(dot)com>
wrote:

> s d <daku(dot)sandor(at)gmail(dot)com> writes:
>
> > It might be a dumb thought, but...
>
> thanks. There are not dumb thoughts with such problems...
>
> > Did you run the script from ipython as postgres user?
> > External programs called by triggers run as postgres, and maybe your
> > postgres user doesn't have rights to reach the remote service.
>
> i don't understand exactly (it is the 1. time I write a procedure even
> in PG). It is so:
> 1. I run ipython as my user (igor);
> 2. I run postgres both as user and as postgres. In both cases the same
> error. PG does not run ipython, because ipython is just a console for
> python. PG should only run python (2 or 3).
>
> IN any case, important is your last thought... I dont see in the doc of
> PG in the chapter of rules and privileges nothing about privileges to
> make internet connections...
>
>
Ok. You run IPython, as Igor, so your script runs in it as the user igor,
with igor's permissions.
When you run the same script from PG it runs as the OS user
postgres(regardless of which PG user fired it), with the permissions of the
OS user postgres.
And maybe, just maybe the postgres user can't get trough your firewall,
iptables rule, or something.
By the way: What OS do you use?
If it's possible try to log into your OS as postgres, start IPython and run
your script. If it fails we have a suspect.

Regards,
Sandor

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Igor Sosa Mayor 2015-08-23 17:38:38 Re: Problem with pl/python procedure connecting to the internet
Previous Message Adrian Klaver 2015-08-23 17:24:43 Re: Problem with pl/python procedure connecting to the internet