E-F-A / eFa5

eFa version 5.x
Other
9 stars 3 forks source link

add support for external database server #23

Open bilias opened 4 days ago

bilias commented 4 days ago

I've been running eFa for years on external database. Actually on galera cluster but let's just stick to external for now as this is the first step. This helps me having a redundant active-active setup of 2 eFa servers using the same DB for mailwatch.

Although most of scripts use /etc/eFa/* files to read the SQL password, localhost is hardcoded everywhere.

It's quite easy to update many of the scripts to accept host (as well as db and user) from /etc/eFa/ config files. This comes helpfull when updating software to not override back to localhost.

Examples: /var/www/html/sgwi/includes/config.inc.php /usr/share/MailScanner/perl/custom/MailWatchConf.pm /etc/cron.daily/trim-txrep /etc/cron.daily/mailwatch /usr/sbin/eFa-Daily-DMARC

There might be others for eFa5 (I've done this for efa3 and efa4)

Are you interested in providing pull requests for getting MySQL connections from config files the same way passwords are fetched?

There are also other files which are not scriptable like /etc/sqlgrey/sqlgrey.conf /var/www/html/mailscanner/conf.php /etc/mail/spamassassin/mailscanner.cf

These could be updated with a sed script, or maybe the /etc/eFa/* config file should also point to each file that needs change.

I use mysql-server in /etc/hosts to point to the server and hardcoded mysql-server everywhere and maybe this could also be extended per db as an alternative or extension to my proposal.

What do you think about this?

Seeing back I found this one: https://github.com/E-F-A/v4/pull/355

shawniverson commented 1 day ago

I think this is a good thing to implement. The earlier pull request has some issues and merge conflicts so it never was merged. If this is done I would like to extend eFa to prompt for local/remote database information during initial setup.