Skip to contentSkip to conversation

unable to connect PostgreSQL from user_t

PATCH KaiGai Kohei 2 participants 2 messages Jun 16, 2007 – Jun 19, 2007 SELinux security module

lore
Share & tools
lore
#0 lore raw

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,

Signature · 1 line
KaiGai Kohei <[email protected]>
policy/modules/services/postgresql.te +0 -10
Index: refpolicy-tresys/policy/modules/services/postgresql.te
===================================================================
@@ -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
policy/modules/system/userdomain.te +7 -0
Index: refpolicy-tresys/policy/modules/system/userdomain.te
===================================================================
@@ -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>
policy/modules/system/userdomain.if +6 -0
Index: refpolicy-tresys/policy/modules/system/userdomain.if
===================================================================
@@ -891,6 +891,12 @@
 	')
 
 	optional_policy(`
+		tunable_policy(`allow_user_postgresql_connect',`
+			postgresql_stream_connect($1_t)
+		')
+	')
+
+	optional_policy(`
 		nscd_socket_use($1_t)
 	')
 
#1 lore raw
Quoted 8 lines · KaiGai Kohei

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

Quoted 9 lines
# 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' ?

No, just a block that missed getting converted from the example policy.

Quoted 2 lines

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

Merged, though I moved the userdomain.if change down a few lines.

Signature · 9 lines
Chris PeBenito
Tresys Technology, LLC
(410) 290-1411 x150


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.