All of lore.kernel.org
 help / color / mirror / Atom feed
From: KaiGai Kohei <kaigai@kaigai.gr.jp>
To: cpebenito@tresys.com
Cc: selinux@tycho.nsa.gov
Subject: unable to connect PostgreSQL from user_t
Date: Sat, 16 Jun 2007 14:33:07 +0900	[thread overview]
Message-ID: <46737613.3020205@kaigai.gr.jp> (raw)

[-- Attachment #1: Type: text/plain, Size: 771 bytes --]

I found the following definition at 'policy/modules/services/postgresql.te'

--------------------------------
ifdef(`TODO',`
ifdef(`targeted_policy', `', `
bool allow_user_postgresql_connect false;

if (allow_user_postgresql_connect) {
# allow any user domain to connect to the database server
allow userdomain postgresql_t:unix_stream_socket connectto;
allow userdomain postgresql_var_run_t:sock_file write;
allow userdomain postgresql_tmp_t:sock_file write;
}
')
--------------------------------
Is there any reason why this block is disabled now, although
'mysql_stream_connect($_t)' is enabled at 'system/userdomain.if' ?

The attached patch enables the definition and moves them into
userdomain.(if|te) as mysql did.

Thanks,
-- 
KaiGai Kohei <kaigai@kaigai.gr.jp>


[-- Attachment #2: refpolicy-add-userdomain-pgsql-connect.patch --]
[-- Type: text/x-diff, Size: 1737 bytes --]

Index: refpolicy-tresys/policy/modules/services/postgresql.te
===================================================================
--- refpolicy-tresys/policy/modules/services/postgresql.te	(revision 2336)
+++ refpolicy-tresys/policy/modules/services/postgresql.te	(working copy)
@@ -175,16 +175,6 @@
 ')
 
 ifdef(`TODO',`
-ifdef(`targeted_policy', `', `
-bool allow_user_postgresql_connect false;
-
-if (allow_user_postgresql_connect) {
-# allow any user domain to connect to the database server
-allow userdomain postgresql_t:unix_stream_socket connectto;
-allow userdomain postgresql_var_run_t:sock_file write;
-allow userdomain postgresql_tmp_t:sock_file write;
-}
-')
 ifdef(`distro_debian', `
 	init_exec_script_files(postgresql_t)
 	# gross hack
Index: refpolicy-tresys/policy/modules/system/userdomain.te
===================================================================
--- refpolicy-tresys/policy/modules/system/userdomain.te	(revision 2336)
+++ refpolicy-tresys/policy/modules/system/userdomain.te	(working copy)
@@ -32,6 +32,13 @@
 
 ## <desc>
 ## <p>
+## Allow users to connect to PostgreSQL
+## </p>
+## </desc>
+gen_tunable(allow_user_postgresql_connect,false)
+
+## <desc>
+## <p>
 ## Allow regular users direct mouse access
 ## </p>
 ## </desc>
Index: refpolicy-tresys/policy/modules/system/userdomain.if
===================================================================
--- refpolicy-tresys/policy/modules/system/userdomain.if	(revision 2336)
+++ refpolicy-tresys/policy/modules/system/userdomain.if	(working copy)
@@ -891,6 +891,12 @@
 	')
 
 	optional_policy(`
+		tunable_policy(`allow_user_postgresql_connect',`
+			postgresql_stream_connect($1_t)
+		')
+	')
+
+	optional_policy(`
 		nscd_socket_use($1_t)
 	')
 

             reply	other threads:[~2007-06-16  5:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-16  5:33 KaiGai Kohei [this message]
2007-06-19 14:24 ` unable to connect PostgreSQL from user_t Christopher J. PeBenito

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46737613.3020205@kaigai.gr.jp \
    --to=kaigai@kaigai.gr.jp \
    --cc=cpebenito@tresys.com \
    --cc=selinux@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.