Wiki source for KbPsqlJailed


Show raw source

=====KB: Problemas con Postgresql en una jaula=====

Para habilitar acceso a Postgresql usando psql en una jaula...

Usando Jailkit podemos crear la jaula usando:
%%(;/etc/jailkit/jk_init.ini)[postgresql]
comment = PostgreSQL Server
executables = /usr/bin/psql
regularfiles = /tmp/.s.PGSQL.5432%%

Y desde el shell para ejecutarlo:
%%(bash)$ jk_init -j /jail postgresql%%
o en caso de ser un upgrade agregar ##jk_init -f ...##:

Un posible problema es que no se pueda conectar localmente, sólo usando ##-h localhost##.
Al tratar de conectarse via shell al postgresql server se obtiene:

##psql: could not connect to server: Connection refused
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?##

Esto suele ocurrir después de re-iniciar el equipo, debe crearse el hard link otra vez:
%%$ rm /jail/tmp/.s.PGSQL.5432
$ ln /tmp/.s.PGSQL.5432 /jail/tmp/%%
Asegurarse también de volver a copiar .s.PGSQL.5432.lock
%%$ cp /tmp/.s.PGSQL.5432.lock /jail/tmp/%%

''NOTA:'' Siempre es un método alternativo conectarse via TCP/IP, usando:

%%$ psql -Uusuario -h localhost base_de_datos%%

Referencias:
jailkit: http://olivier.sessink.nl/jailkit/

---
CategorySysAdmin
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki