Skip to contentSkip to conversation

Security design of SE-PostgreSQL (1/3)

RFC KaiGai Kohei 1 participant 1 message Feb 16, 2007 SELinux security module

lore
Share & tools
lore
#0 lore raw

Hi,

In recent days, I'm making progress in development of SE-PostgreSQL. I found some issues on the work.
The followings are the issues and solutions which I planed to take. I want any comment, idea and suggestion.

1. about Binary large object

PostgreSQL has some interfaces of binary large object. lo_import() and lo_export() is arguable in them.
definiton:
lo_import(text 'file_name') lo_export(Oid blob_id, text 'file_name')

lo_import() imports a file specified with 'file_name' into PostgreSQL as a binary large object. lo_export() export a binary large object specified with blob_id into a file specified with 'file_name'.

'file_name' is a path name on the server side filesystem, not a client side. Thus, this action is handled as an interaction between PostgreSQL server process and a general file on the filesystem by the in-kernel SELinux, although it was done for the client process's request.
In the result, unexpected downgrade/upgrade is easily happen.

The hardest one is labeling behavior for the newly generated files. If we allows SE-PostgreSQL setfscreatecon() for them, it have to have enough permission set for any clients. I think it's not a happy situation.

Now I have an idea to resolve the issue by adding new access vectors which are blob:{import export}. I treated lo_import() and lo_export() as an aggregation of three data flows.
In lo_export() cases, the first of them is the flow a blob to a client, the second is a client to the server (SE-PostgreSQL) and the third is the server to the filesystem.

client <---(blob:read)----- BLOB
|
+-------(blob:export)---> SE-PostgreSQL ---(file:write)---> 'file_name'

i.e, The 'blob:export' means to allow a data flow from a client process to the server process via binary large object.

In the security policy, it can be described such as:
allow httpd_sys_script_t postgresql_t : blob {import export} ;

You can obtain the latest SE-PostgreSQL source code from:
http://code.google.com/p/sepgsql/source
and the sample security policy is here:

    http://www.kaigai.gr.jp/pub/selinux-policy-2.5.2-5.sepgsql.src.rpm

Thanks,

Signature · 6 lines
KaiGai Kohei <[email protected]>

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