pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #11365: denied apache cgi connect
8+ messages / 5 participants
[nested] [flat]

* BUG #11365: denied apache cgi connect
@ 2014-09-07 01:05 chenchuanling@msn.com
  2014-09-07 16:36 ` Re: BUG #11365: denied apache cgi connect Tom Lane <tgl@sss.pgh.pa.us>
  2014-09-07 21:50 ` Re: BUG #11365: denied apache cgi connect Jeff Janes <jeff.janes@gmail.com>
  0 siblings, 2 replies; 8+ messages in thread

From: chenchuanling@msn.com @ 2014-09-07 01:05 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      11365
Logged by:          chenchunling
Email address:      chenchuanling@msn.com
PostgreSQL version: 9.3.5
Operating system:   centos6.3
Description:        

Centos 6.3 integrated 8.4.11 version no problem,but upgrade to version 9.3.5
apache cgi connection denied.Must be set: setenforce 0, such ability can
be.

selinux log:
Sep  6 20:39:55 test kernel: type=1400 audit(1410050395.142:792): avc: 
denied  { connectto } for  pid=9559 comm="servergi"
path="/tmp/.s.PGSQL.5432"
scontext=unconfined_u:system_r:httpd_sys_script_t:s0
tcontext=unconfined_u:system_r:initrc_t:s0 tclass=unix_stream_socket
Sep  6 20:39:55 test kernel: type=1400 audit(1410050395.144:793): avc: 
denied  { connectto } for  pid=9559 comm="servergi"
path="/tmp/.s.PGSQL.5432"
scontext=unconfined_u:system_r:httpd_sys_script_t:s0
tcontext=unconfined_u:system_r:initrc_t:s0 tclass=unix_stream_socket



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #11365: denied apache cgi connect
  2014-09-07 01:05 BUG #11365: denied apache cgi connect chenchuanling@msn.com
@ 2014-09-07 16:36 ` Tom Lane <tgl@sss.pgh.pa.us>
  2014-09-07 22:22   ` Re: BUG #11365: denied apache cgi connect John R Pierce <pierce@hogranch.com>
  1 sibling, 1 reply; 8+ messages in thread

From: Tom Lane @ 2014-09-07 16:36 UTC (permalink / raw)
  To: chenchuanling@msn.com; +Cc: pgsql-bugs

chenchuanling@msn.com writes:
> Centos 6.3 integrated 8.4.11 version no problem,but upgrade to version 9.3.5
> apache cgi connection denied.Must be set: setenforce 0, such ability can
> be.

That's not something the PG community can do anything about.  If there's a
bug in the SELinux policy for apache, you need to complain to Red Hat to
get it fixed.

I suspect though that if you dig a little bit, you will find that this
case has been foreseen, and there's a SELinux policy boolean that you
are supposed to set to allow apache processes to do database access.
A quick browse in the output of "semanage boolean -l" suggests that
"allow_user_postgresql_connect" might be the right thing, or maybe
"httpd_can_network_connect_db" ...

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #11365: denied apache cgi connect
  2014-09-07 01:05 BUG #11365: denied apache cgi connect chenchuanling@msn.com
  2014-09-07 16:36 ` Re: BUG #11365: denied apache cgi connect Tom Lane <tgl@sss.pgh.pa.us>
@ 2014-09-07 22:22   ` John R Pierce <pierce@hogranch.com>
  2014-09-08 05:02     ` Re: BUG #11365: denied apache cgi connect Jan Wieck <jan@wi3ck.info>
  0 siblings, 1 reply; 8+ messages in thread

From: John R Pierce @ 2014-09-07 22:22 UTC (permalink / raw)
  To: pgsql-bugs

On 9/7/2014 9:36 AM, Tom Lane wrote:
> That's not something the PG community can do anything about.  If there's a
> bug in the SELinux policy for apache, you need to complain to Red Hat to
> get it fixed.
>
> I suspect though that if you dig a little bit, you will find that this
> case has been foreseen, and there's a SELinux policy boolean that you
> are supposed to set to allow apache processes to do database access.
> A quick browse in the output of "semanage boolean -l" suggests that
> "allow_user_postgresql_connect" might be the right thing, or maybe
> "httpd_can_network_connect_db" ...

the PGDG packagers probably should include some level of database 
selinux policy settings.  maybe a special RPM that sets the apache 
database policy or something.


-- 
john r pierce                                      37N 122W
somewhere on the middle of the left coast



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #11365: denied apache cgi connect
  2014-09-07 01:05 BUG #11365: denied apache cgi connect chenchuanling@msn.com
  2014-09-07 16:36 ` Re: BUG #11365: denied apache cgi connect Tom Lane <tgl@sss.pgh.pa.us>
  2014-09-07 22:22   ` Re: BUG #11365: denied apache cgi connect John R Pierce <pierce@hogranch.com>
@ 2014-09-08 05:02     ` Jan Wieck <jan@wi3ck.info>
  2014-09-08 06:06       ` Re: BUG #11365: denied apache cgi connect John R Pierce <pierce@hogranch.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Jan Wieck @ 2014-09-08 05:02 UTC (permalink / raw)
  To: John R Pierce <pierce@hogranch.com>; pgsql-bugs

On 09/07/2014 06:22 PM, John R Pierce wrote:
> On 9/7/2014 9:36 AM, Tom Lane wrote:
>> That's not something the PG community can do anything about.  If there's a
>> bug in the SELinux policy for apache, you need to complain to Red Hat to
>> get it fixed.
>>
>> I suspect though that if you dig a little bit, you will find that this
>> case has been foreseen, and there's a SELinux policy boolean that you
>> are supposed to set to allow apache processes to do database access.
>> A quick browse in the output of "semanage boolean -l" suggests that
>> "allow_user_postgresql_connect" might be the right thing, or maybe
>> "httpd_can_network_connect_db" ...
>
> the PGDG packagers probably should include some level of database
> selinux policy settings.  maybe a special RPM that sets the apache
> database policy or something.

"Some special RPM" to do what exactly? Just because someone has 
PostgreSQL and Apache installed on their system doesn't mean they wanted 
httpd to be able to try to connect to their MySQL server on another 
machine in the network. Precisely that is what 
httpd_can_network_connect_db would allow (as a side effect).

So please be more precise in what exactly that special RPM should set or 
enable.


Regards,
Jan

-- 
Jan Wieck
Senior Software Engineer
http://slony.info


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #11365: denied apache cgi connect
  2014-09-07 01:05 BUG #11365: denied apache cgi connect chenchuanling@msn.com
  2014-09-07 16:36 ` Re: BUG #11365: denied apache cgi connect Tom Lane <tgl@sss.pgh.pa.us>
  2014-09-07 22:22   ` Re: BUG #11365: denied apache cgi connect John R Pierce <pierce@hogranch.com>
  2014-09-08 05:02     ` Re: BUG #11365: denied apache cgi connect Jan Wieck <jan@wi3ck.info>
@ 2014-09-08 06:06       ` John R Pierce <pierce@hogranch.com>
  2014-09-08 06:24         ` Re: BUG #11365: denied apache cgi connect Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 8+ messages in thread

From: John R Pierce @ 2014-09-08 06:06 UTC (permalink / raw)
  To: pgsql-bugs

On 9/7/2014 10:02 PM, Jan Wieck wrote:
>> the PGDG packagers probably should include some level of database
>> selinux policy settings.  maybe a special RPM that sets the apache
>> database policy or something.
>

I probably should have said 'could' instead of 'probably should'.

> "Some special RPM" to do what exactly? Just because someone has 
> PostgreSQL and Apache installed on their system doesn't mean they 
> wanted httpd to be able to try to connect to their MySQL server on 
> another machine in the network. Precisely that is what 
> httpd_can_network_connect_db would allow (as a side effect).
>
> So please be more precise in what exactly that special RPM should set 
> or enable.

this RPM would be called something like 
postgresqlXY-apache-selinuxpolicy, and if installed, it would add the 
selinux policy that allows apache to connect to postgres version X.Y as 
installed from the same repository.  if uninstalled, it would remove 
that policy.


-- 
john r pierce                                      37N 122W
somewhere on the middle of the left coast



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #11365: denied apache cgi connect
  2014-09-07 01:05 BUG #11365: denied apache cgi connect chenchuanling@msn.com
  2014-09-07 16:36 ` Re: BUG #11365: denied apache cgi connect Tom Lane <tgl@sss.pgh.pa.us>
  2014-09-07 22:22   ` Re: BUG #11365: denied apache cgi connect John R Pierce <pierce@hogranch.com>
  2014-09-08 05:02     ` Re: BUG #11365: denied apache cgi connect Jan Wieck <jan@wi3ck.info>
  2014-09-08 06:06       ` Re: BUG #11365: denied apache cgi connect John R Pierce <pierce@hogranch.com>
@ 2014-09-08 06:24         ` Tom Lane <tgl@sss.pgh.pa.us>
  2014-09-08 07:00           ` Re: BUG #11365: denied apache cgi connect John R Pierce <pierce@hogranch.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Tom Lane @ 2014-09-08 06:24 UTC (permalink / raw)
  To: John R Pierce <pierce@hogranch.com>; +Cc: pgsql-bugs

John R Pierce <pierce@hogranch.com> writes:
> On 9/7/2014 10:02 PM, Jan Wieck wrote:
>> So please be more precise in what exactly that special RPM should set 
>> or enable.

> this RPM would be called something like 
> postgresqlXY-apache-selinuxpolicy, and if installed, it would add the 
> selinux policy that allows apache to connect to postgres version X.Y as 
> installed from the same repository.  if uninstalled, it would remove 
> that policy.

Hm ... would that not be in direct conflict with existing policy
variables?

I don't actually know a lot about what the standard Red Hat selinux
policy does in this area.  If it were seriously broken, I'd probably
have heard more about it during the years I worked there.  Not that
that's much of an argument, but it's some evidence for "there's no
fire here, only smoke".  Anyway, I remain of the opinion that it'd
be best to press Red Hat's selinux people to fix/clarify/document
their policy's behavior for apache-to-database connections.  Trying
to override the system policy with drive-by updates seems like a recipe
for disaster.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #11365: denied apache cgi connect
  2014-09-07 01:05 BUG #11365: denied apache cgi connect chenchuanling@msn.com
  2014-09-07 16:36 ` Re: BUG #11365: denied apache cgi connect Tom Lane <tgl@sss.pgh.pa.us>
  2014-09-07 22:22   ` Re: BUG #11365: denied apache cgi connect John R Pierce <pierce@hogranch.com>
  2014-09-08 05:02     ` Re: BUG #11365: denied apache cgi connect Jan Wieck <jan@wi3ck.info>
  2014-09-08 06:06       ` Re: BUG #11365: denied apache cgi connect John R Pierce <pierce@hogranch.com>
  2014-09-08 06:24         ` Re: BUG #11365: denied apache cgi connect Tom Lane <tgl@sss.pgh.pa.us>
@ 2014-09-08 07:00           ` John R Pierce <pierce@hogranch.com>
  0 siblings, 0 replies; 8+ messages in thread

From: John R Pierce @ 2014-09-08 07:00 UTC (permalink / raw)
  To: pgsql-bugs

On 9/7/2014 11:24 PM, Tom Lane wrote:
> Hm ... would that not be in direct conflict with existing policy
> variables?

good questions, and I'm not versed enough in the specifics to be able to 
answer.  indeed, I have a rather shaky and sketchy understanding of the 
details of selinux...    in my development lab environment, too often 
the first problem its caused, I've had to shut it off so my developers 
could get their jobs done.   our software is only used inhouse, and 
manufacturing operations has not been remotely interested in dealing 
with selinux.   Even if I carefully supported it with my group's stuff, 
they'd still be shutting it off for other reasons, beyond my control.


> I don't actually know a lot about what the standard Red Hat selinux
> policy does in this area.  If it were seriously broken, I'd probably
> have heard more about it during the years I worked there.  Not that
> that's much of an argument, but it's some evidence for "there's no
> fire here, only smoke".  Anyway, I remain of the opinion that it'd
> be best to press Red Hat's selinux people to fix/clarify/document
> their policy's behavior for apache-to-database connections.  Trying
> to override the system policy with drive-by updates seems like a recipe
> for disaster.

presumably other add-on packages need specific policies for themselves 
to operate in a selinux environment?  I wonder how they do this.    I'm 
envisioning this policy we add as something that doesn't conflict with 
existing policies, just adds the minimal magic to make it play nicely.



-- 
john r pierce                                      37N 122W
somewhere on the middle of the left coast



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #11365: denied apache cgi connect
  2014-09-07 01:05 BUG #11365: denied apache cgi connect chenchuanling@msn.com
@ 2014-09-07 21:50 ` Jeff Janes <jeff.janes@gmail.com>
  1 sibling, 0 replies; 8+ messages in thread

From: Jeff Janes @ 2014-09-07 21:50 UTC (permalink / raw)
  To: chenchuanling@msn.com; +Cc: pgsql-bugs

On Sat, Sep 6, 2014 at 6:05 PM, <chenchuanling@msn.com> wrote:

> The following bug has been logged on the website:
>
> Bug reference:      11365
> Logged by:          chenchunling
> Email address:      chenchuanling@msn.com
> PostgreSQL version: 9.3.5
> Operating system:   centos6.3
> Description:
>
> Centos 6.3 integrated 8.4.11 version no problem,but upgrade to version
> 9.3.5
> apache cgi connection denied.Must be set: setenforce 0, such ability can
> be.
>
> selinux log:
> Sep  6 20:39:55 test kernel: type=1400 audit(1410050395.142:792): avc:
> denied  { connectto } for  pid=9559 comm="servergi"
> path="/tmp/.s.PGSQL.5432"
> scontext=unconfined_u:system_r:httpd_sys_script_t:s0
> tcontext=unconfined_u:system_r:initrc_t:s0 tclass=unix_stream_socket
> Sep  6 20:39:55 test kernel: type=1400 audit(1410050395.144:793): avc:
> denied  { connectto } for  pid=9559 comm="servergi"
> path="/tmp/.s.PGSQL.5432"
> scontext=unconfined_u:system_r:httpd_sys_script_t:s0
> tcontext=unconfined_u:system_r:initrc_t:s0 tclass=unix_stream_socket
>

In addition to Tom's comments, you could try specifying "localhost" so that
it connects over TCP rather than linux sockets.

There are all kinds of things that go wrong with unix sockets.  Packagers
put the sockets in weird places.  Services run with private temp files that
mask the real socket directory with something else.

Cheers,

Jeff

^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2014-09-08 07:00 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-09-07 01:05 BUG #11365: denied apache cgi connect chenchuanling@msn.com
2014-09-07 16:36 ` Tom Lane <tgl@sss.pgh.pa.us>
2014-09-07 22:22   ` John R Pierce <pierce@hogranch.com>
2014-09-08 05:02     ` Jan Wieck <jan@wi3ck.info>
2014-09-08 06:06       ` John R Pierce <pierce@hogranch.com>
2014-09-08 06:24         ` Tom Lane <tgl@sss.pgh.pa.us>
2014-09-08 07:00           ` John R Pierce <pierce@hogranch.com>
2014-09-07 21:50 ` Jeff Janes <jeff.janes@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox