Directory/File Access Permissions for COPY and Generic File Access Functions

Поиск
Список
Период
Сортировка
От Brightwell, Adam
Тема Directory/File Access Permissions for COPY and Generic File Access Functions
Дата
Msg-id CAKRt6CRCQ1jmh3o8gkBBHxWqBJz4StnYUQjO0W8Kauru_SfPKA@mail.gmail.com
обсуждение исходный текст
Ответы Re: Directory/File Access Permissions for COPY and Generic File Access Functions
Re: Directory/File Access Permissions for COPY and Generic File Access Functions
Список pgsql-hackers
All,

The attached patch for review implements a directory permission system that allows for providing a directory read/write capability to directories for COPY TO/FROM and Generic File Access Functions to non-superusers.  This is not a complete solution as it does not currently contain documentation or regression tests.  Though it is my hopes to get some feedback as I am sure there are some aspects of it that need to be reworked.  So I thought I'd put it out there for comments/review.

The approach taken is to create "directory aliases" that have a unique name and path, as well as an associated ACL list.  A superuser can create a new alias to any directory on the system and then provide READ or WRITE permissions to any non-superuser.  When a non-superuser then attempts to execute a COPY TO/FROM or any one of the generic file access functions, a permission check is performed against the aliases for the user and target directory.  Superusers are allowed to bypass all of these checks.  All alias paths must be an absolute path in order to avoid potential risks.  However, in the generic file access functions superusers are still allowed to execute the functions with a relative path where non-superusers are required to provide an absolute path.

- Implementation Details -

System Catalog:
pg_diralias
 - dirname - the name of the directory alias
 - dirpath - the directory path - must be absolute
 - diracl - the ACL for the directory

Syntax:
CREATE DIRALIAS <name> AS '<path>'
ALTER DIRALIAS <name> AS '<path>'
ALTER DIRALIAS <name> RENAME TO <new_name>
DROP DIRALIAS <name>

This is probably the area that I would really appreciate your thoughts and recommendations. To GRANT permissions to a directory alias, I had to create a special variant of GRANT since READ and WRITE are not reserved keywords and causes grammar issues.  Therefore, I chose to start with the following syntax:

GRANT ON DIRALIAS <name> <permissions> TO <roles>

where <permissions> is either READ, WRITE or ALL.

Any comments, suggestions or feedback would be greatly appreciated.

Thanks,
Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: Improve automatic analyze messages for inheritance trees
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Directory/File Access Permissions for COPY and Generic File Access Functions