Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for external database server #23

Open
bilias opened this issue Oct 9, 2024 · 3 comments
Open

add support for external database server #23

bilias opened this issue Oct 9, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@bilias
Copy link

bilias commented Oct 9, 2024

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:
E-F-A/v4#355

@shawniverson shawniverson added the enhancement New feature or request label Oct 11, 2024
@shawniverson
Copy link
Member

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.

@bilias
Copy link
Author

bilias commented Oct 14, 2024

ok, I will start pushing updates.

How do you want to handle the update for the config file?

For instance for /etc/eFa/MailWatch-Config
I'm planning to add something like
MAILWATCHSQLHOST:localhost
for the default setup.

How do you suggest this line be added there?
Maybe %post of MailWatch.spec ?

@shawniverson
Copy link
Member

shawniverson commented Oct 15, 2024

That would work or in the eFa package update script itself, like this:

if [[-z $(grep MAILWATCHSQLHOST /etc/eFa/MailWatch-Config ) ]]; then 
   echo "MAILWATCHSQLHOST:localhost" >> /etc/eFa/MailWatch-Config
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants