Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm using freshly installed CentOS 5.7 Linux 64 bit with PGDG packages:

# rpm -qa|grep -i PG
postgresql-libs-8.4.8-2PGDG.rhel5
pgdg-centos-8.4-2
postgresql-8.4.8-2PGDG.rhel5
pgbouncer-1.3.4-1.rhel5
postgresql-server-8.4.8-2PGDG.rhel5

and get the following Apache-errors in /var/log/audit/audit.log

type=AVC msg=audit(1316700316.235:41): avc:  denied  { write } for
pid=2748 comm="httpd" name=".s.PGSQL.6432" dev=sda1 ino=754350
scontext=system_u:system_r:httpd_t:s0
tcontext=system_u:object_r:tmp_t:s0 tclass=sock_file
type=SYSCALL msg=audit(1316700316.235:41): arch=c000003e syscall=42
success=no exit=-13 a0=c a1=2b712748bee0 a2=6e a3=0 items=0 ppid=2721
pid=2748 auid=4294967295 uid=48 gid=48 euid=48 suid=48 fsuid=48
egid=48 sgid=48 fsgid=48 tty=(none) ses=4294967295 comm="httpd"
exe="/usr/sbin/httpd" subj=system_u:system_r:httpd_t:s0 key=(null)

And here are the files in question (PostgreSQL at "port" 5432 and pgbouncer at "port" 6432):

# ls -aZ /tmp/
srwxrwxrwx  postgres postgres system_u:object_r:postgresql_tmp_t .s.PGSQL.5432
-rw-------  postgres postgres system_u:object_r:postgresql_tmp_t
.s.PGSQL.5432.lock
srwxrwxrwx  postgres postgres system_u:object_r:tmp_t          .s.PGSQL.6432

Does anybody please know, how to permanently make the file .s.PGSQL.6432 above of the same postgresql_tmp_t "type" as s.PGSQL.5432 (which probably will solve the problem)?

By looking at the processes I think, that somehow I must move pgbouncer process from initrc_t to postgresql_t:

# ps uawxZ
system_u:system_r:initrc_t      postgres  2610  0.0  0.0  17020   780 ?        S    15:47   0:00 pgbouncer -d /etc/pgbouncer.ini
system_u:system_r:postgresql_t  postgres  2666  0.1  2.4 1192464 25216 ?       S    15:48   0:02 /usr/bin/postmaster -p 5432 -D    /var/lib/pgsql/data
system_u:system_r:httpd_t       root      2721  0.0  1.0 260608 10564 ?        Ss   15:48   0:00 /usr/sbin/httpd
system_u:system_r:httpd_t       apache    2747  0.0  0.9 261632  9728 ?        S    15:48   0:00 /usr/sbin/httpd
system_u:system_r:httpd_t       apache    2748  0.0  0.9 261632  9728 ?        S    15:48   0:00 /usr/sbin/httpd
share|improve this question
add comment

2 Answers 2

up vote 0 down vote accepted

Stealing from quanta a bit, but its probably more along the lines of..

# chcon -t postgresql_exec_t /path/to/pgbouncer

then restart.

share|improve this answer
add comment

Try this:

# chcon -t postgresql_t /path/to/pgbouncer

and restart pgbouncer.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.