User def. Functions for sysadmin tasks?

From: Janning Vygen <vygen(at)gmx(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: User def. Functions for sysadmin tasks?
Date: 2005-04-21 16:14:10
Message-ID: 200504211814.11109.vygen@gmx.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Hallgren 2005-04-21 16:16:30 Re: CURRENT_TIMESTAMP vs actual time
Previous Message Scott Marlowe 2005-04-21 16:11:22 Re: Most specific match using between