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

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to