Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

# rpm -qa|grep -i PG

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
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
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
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

Try this:

# chcon -t postgresql_t /path/to/pgbouncer

and restart pgbouncer.

share|improve this answer

Your Answer


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.