User def. Functions for sysadmin tasks?

Поиск
Список
Период
Сортировка
От Janning Vygen
Тема User def. Functions for sysadmin tasks?
Дата
Msg-id 200504211814.11109.vygen@gmx.de
обсуждение исходный текст
Список pgsql-general
Hi,

i like to use postgresql for managing my postfix mailserver via lookup tables.
for each mailbox domain i have a system account to have quotas per domain. (i
know there are other solutions like postfix-vda and so on)

When i add a domain to the mailsystem i have to add a user account for this
domain and afterwards do one INSERT statement to add the domain to the
postfix tables.

Does it make sense to write a C Function which triggers before insert of a
domain and adds the appropiate user to the system? The C Function runs as
user postgres, right?. So i have to add postgres to /etc/sudoers file to
allow execution of /usr/sbin/adduser as root, right?

The same way you could manage web accounts. The C Functions writes or updates
httpd.conf files to disk. Or write .htpasswd files and so on. Most
administration systems are running a cron job to do those tasks but it would
be nicer to have the webserver running in the moment the transaction
succeeds. And another benefit: you have all logic inside your database.

I thought about any security reasons not to do it. One Thought: If you can
become postgres you could add users to the system. But if you can become
postgres you could delete all data files anyway which would be much more
serious than adding or deleting users.!?

Did anybody tried something like this before? Does it make sense?

kind regards,
janning

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

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: Most specific match using between
Следующее
От: Thomas Hallgren
Дата:
Сообщение: Re: CURRENT_TIMESTAMP vs actual time