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

Remote_DB.md is incomplete and missing complete information #34

Open
faisalnaeem81 opened this issue Apr 6, 2018 · 5 comments
Open

Comments

@faisalnaeem81
Copy link

Hi,

I am new to mailwatch ... please help me to have working instructions for How to configure MailScanner to log to a remote MySQL database

As per provided documentation in source code Remote_DB.md file is referencing some steps in INSTALL file and there is file available having following output. Where I can find the steps to completely configure MailScanner to log to a remote MySQL database.

File Name: INSTALL.md

INSTALLATION INSTRUCTIONS

Installation instruction has moved to http://docs.mailwatch.org
--> Neither any step referenced in Remote_DB.md mentioned here nor on provided URL


File Name: Remote_DB.md

How to configure MailScanner to log to a remote MySQL database

This document presumes that you will have a server acting as a database with PHP and MySQL installed on it, and multiple MailScanner gateways logging to the database server.

1) Follow steps 1 to 6 from the INSTALL document on the database server.

  1. Create a mailscanner user and password on the database server:
    % mysql mailscanner
    mysql> GRANT ALL ON mailscanner.* TO mailscanner IDENTIFIED BY 'password';
    mysql> flush privileges;

  2. On each MailScanner gateway, you'll need to make sure that the mysql client, perl, perl DBI and perl DBD-Mysql, are installed:
    % rpm -qa | grep "mysql"
    mysql-3.23.54a-11
    % rpm -qa | grep "perl-DB"
    perl-DBD-MySQL-2.1021-3
    perl-DBI-1.32-5

  3. From one of the MailScanner gateway, verify you can connect to the db:
    % mysql mailscanner -u mailscanner -h <db_hostname> -p
    Enter password: *******
    If you get a mysql> prompt, you can connect correctly (enter \q to quit).

  4. On each MailScanner gateway, do steps 7 to 10 from the INSTALL document, for step 7, you will also need to edit CustomConfig.pm and change the $db_host, $db_user and $db_pass variables to your local settings.

6) To complete the set-up run steps 11 to 15 on the database server.

  1. On each MailWatch system set RPC_ALLOWED_CLIENTS in conf.php to a list of IP addresses of each MailWatch system.
@asuweb
Copy link
Member

asuweb commented Apr 6, 2018

Hi,

If you only want to host the database on a remote server (i.e, the database server runs only the database and not mailwatch), then you simply need to do the following:

  1. Create user on the mysql server with host set to the IP of the mailwatch server(s) or subnet or any host (%)
  2. Install the database and grant the user in step 1 permissions to use it.
  1. Ensure the mysql server is bound to a public or private (non-localhost) IP address that can be accessed by the mailwatch server(s).
  2. Ensure port 3306 (or whatever port you are running the mysql server on) isn't blocked by a firewall.
  3. On the mailwatch host, ensure you can connect to the remote database via the mysql command line using the user you created in step 1
  4. Change the database connection settings in conf.php to use the remote host and the user in step 1
  5. Change the perl db settings in MailWatchConf.pm

@faisalnaeem81
Copy link
Author

Hi stefaweb,

Thanks for your reply.

I am interested to deploy multiple mailscanner/mailwatch instances that logging to same DB server.

Can you please suggest some working configuration.

Thanks.

@Skywalker-11
Copy link
Member

In conf.php in the web directory and in /etc/MailScanner/custom/MailWatchConf.pm change db_host to the ip/hostname of your remote mysql server.

On the remote sql server add mysql accounts for each server that should use the db via mysql query GRANT ALL ON mailscanner.* TO 'mailwatchuser'@’1.2.3.4’ IDENTIFIED BY ‘my_password’;
(replace 1.2.3.4 with the mailwatch servers ip that should log to that db and 'mailwatchuser' and 'my_password' with the credentials)

@thiagolinhares
Copy link

Hello,

Reading the installation docs, I couldn't find which steps are 1-6, 7-11 and so on.... It's not marked down.
Could you please update this references? I would love to try this feature.

Regards,
Thiago

@Skywalker-11
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants