diff --git a/interface/lib/classes/tools_monitor.inc.php b/interface/lib/classes/tools_monitor.inc.php
index 91040174683f42e4f27530ff31cfc9270a45c991..5f94cab672af068611b08691237d0e5279439f17 100644
--- a/interface/lib/classes/tools_monitor.inc.php
+++ b/interface/lib/classes/tools_monitor.inc.php
@@ -576,6 +576,27 @@ class tools_monitor {
return $html;
}
+ function showMx_ip_match() {
+ global $app;
+
+ /* fetch the Data from the DB */
+ $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'mx_ip_match' and server_id = ? ORDER BY created DESC", $_SESSION['monitor']['server_id']);
+
+ if(isset($record['data'])) {
+ $data = unserialize($record['data']);
+ $html = '
diff --git a/interface/web/monitor/lib/lang/ar.lng b/interface/web/monitor/lib/lang/ar.lng
index c3604197a3fd51442b1d057cfe39c69247f73077..ea5e546547d5f5455c4c33530791756d5647fb13 100644
--- a/interface/web/monitor/lib/lang/ar.lng
+++ b/interface/web/monitor/lib/lang/ar.lng
@@ -166,4 +166,10 @@ $wb['monitor_title_mongodb_txt'] = 'MongoDB Log';
$wb['Data Log History'] = 'Data Log History';
$wb['Database size'] = 'Database size';
$wb['MySQL Database size'] = 'MySQL Database size';
+$wb['monitor_title_mx_ip_match_txt'] = 'MX record to server IP match';
+$wb['monitor_serverstate_mx_ip_match_nodata_txt'] = 'No MX record check data present';
+$wb['monitor_serverstate_mx_ip_match_warning_txt'] = 'Not all DNS MX records match the server IP';
+$wb['monitor_serverstate_mx_ip_match_ok_txt'] = 'All mail domains match up with DNS.';
+$wb['monitor_serverstate_mx_ip_match_unknown_txt'] = 'Mail domains MX check unknown.';
+$wb['monitor_serverstate_mx_ip_match_note_txt'] = 'note: If your using an external smtp service for e.g. spam filtering then add that name in the Server Config -> Mail -> Additional smtp hostnames to keep them out of this list.';
?>
diff --git a/interface/web/monitor/lib/lang/bg.lng b/interface/web/monitor/lib/lang/bg.lng
index b6c94dcc5119adb6ad83182002e548d56d9e2fa9..0b3719fbf061ee3541c18e848f5e55a94b6889db 100644
--- a/interface/web/monitor/lib/lang/bg.lng
+++ b/interface/web/monitor/lib/lang/bg.lng
@@ -166,4 +166,10 @@ $wb['monitor_title_mongodb_txt'] = 'MongoDB Log';
$wb['Data Log History'] = 'Data Log History';
$wb['Database size'] = 'Database size';
$wb['MySQL Database size'] = 'MySQL Database size';
+$wb['monitor_title_mx_ip_match_txt'] = 'MX record to server IP match';
+$wb['monitor_serverstate_mx_ip_match_nodata_txt'] = 'No MX record check data present';
+$wb['monitor_serverstate_mx_ip_match_warning_txt'] = 'Not all DNS MX records match the server IP';
+$wb['monitor_serverstate_mx_ip_match_ok_txt'] = 'All mail domains match up with DNS.';
+$wb['monitor_serverstate_mx_ip_match_unknown_txt'] = 'Mail domains MX check unknown.';
+$wb['monitor_serverstate_mx_ip_match_note_txt'] = 'note: If your using an external smtp service for e.g. spam filtering then add that name in the Server Config -> Mail -> Additional smtp hostnames to keep them out of this list.';
?>
diff --git a/interface/web/monitor/lib/lang/br.lng b/interface/web/monitor/lib/lang/br.lng
index 1ddfbb5fe37875b9b64ea9280f34a538680f616e..c175fe6c79935ddbffb6cb4753f8bb000cc69150 100644
--- a/interface/web/monitor/lib/lang/br.lng
+++ b/interface/web/monitor/lib/lang/br.lng
@@ -164,3 +164,9 @@ $wb['Munin'] = 'Exibir Munin';
$wb['no_munin_url_defined_txt'] = 'Nenhuma URL do Munin definida.';
$wb['no_permissions_to_view_munin_txt'] = 'Você não tem permissão para acessar o Munin.';
$wb['Database size'] = 'Banco de Dados em uso';
+$wb['monitor_title_mx_ip_match_txt'] = 'MX record to server IP match';
+$wb['monitor_serverstate_mx_ip_match_nodata_txt'] = 'No MX record check data present';
+$wb['monitor_serverstate_mx_ip_match_warning_txt'] = 'Not all DNS MX records match the server IP';
+$wb['monitor_serverstate_mx_ip_match_ok_txt'] = 'All mail domains match up with DNS.';
+$wb['monitor_serverstate_mx_ip_match_unknown_txt'] = 'Mail domains MX check unknown.';
+$wb['monitor_serverstate_mx_ip_match_note_txt'] = 'note: If your using an external smtp service for e.g. spam filtering then add that name in the Server Config -> Mail -> Additional smtp hostnames to keep them out of this list.';
diff --git a/interface/web/monitor/lib/lang/ca.lng b/interface/web/monitor/lib/lang/ca.lng
index a1ef67cbae5e05afd5051bdfe465363e7580fa98..e63a97873c27adac77f8b1747cd901bff77fd019 100644
--- a/interface/web/monitor/lib/lang/ca.lng
+++ b/interface/web/monitor/lib/lang/ca.lng
@@ -166,4 +166,10 @@ $wb['monitor_title_mongodb_txt'] = 'MongoDB Log';
$wb['Data Log History'] = 'Data Log History';
$wb['Database size'] = 'Database size';
$wb['MySQL Database size'] = 'MySQL Database size';
+$wb['monitor_title_mx_ip_match_txt'] = 'MX record to server IP match';
+$wb['monitor_serverstate_mx_ip_match_nodata_txt'] = 'No MX record check data present';
+$wb['monitor_serverstate_mx_ip_match_warning_txt'] = 'Not all DNS MX records match the server IP';
+$wb['monitor_serverstate_mx_ip_match_ok_txt'] = 'All mail domains match up with DNS.';
+$wb['monitor_serverstate_mx_ip_match_unknown_txt'] = 'Mail domains MX check unknown.';
+$wb['monitor_serverstate_mx_ip_match_note_txt'] = 'note: If your using an external smtp service for e.g. spam filtering then add that name in the Server Config -> Mail -> Additional smtp hostnames to keep them out of this list.';
?>
diff --git a/interface/web/monitor/lib/lang/cz.lng b/interface/web/monitor/lib/lang/cz.lng
index 1310d3a05fb7a10b856c631082e0c2baecfc8863..0e3abd7826751ddac1cf3c196ff2acb44a504bfd 100644
--- a/interface/web/monitor/lib/lang/cz.lng
+++ b/interface/web/monitor/lib/lang/cz.lng
@@ -164,3 +164,9 @@ $wb['monitor_title_mongodb_txt'] = 'MongoDB Log';
$wb['Data Log History'] = 'Protokol historie datového logu';
$wb['Database size'] = 'Velikost databáze';
$wb['MySQL Database size'] = 'Velikost databází MySQL';
+$wb['monitor_title_mx_ip_match_txt'] = 'MX record to server IP match';
+$wb['monitor_serverstate_mx_ip_match_nodata_txt'] = 'No MX record check data present';
+$wb['monitor_serverstate_mx_ip_match_warning_txt'] = 'Not all DNS MX records match the server IP';
+$wb['monitor_serverstate_mx_ip_match_ok_txt'] = 'All mail domains match up with DNS.';
+$wb['monitor_serverstate_mx_ip_match_unknown_txt'] = 'Mail domains MX check unknown.';
+$wb['monitor_serverstate_mx_ip_match_note_txt'] = 'note: If your using an external smtp service for e.g. spam filtering then add that name in the Server Config -> Mail -> Additional smtp hostnames to keep them out of this list.';
diff --git a/interface/web/monitor/lib/lang/de.lng b/interface/web/monitor/lib/lang/de.lng
index 629df19fdd5b3a61ba6411b2969ba1d3f9cedf72..5305ee38671d2efed8630ecd16a03a39c6f4497e 100644
--- a/interface/web/monitor/lib/lang/de.lng
+++ b/interface/web/monitor/lib/lang/de.lng
@@ -166,4 +166,10 @@ $wb['monitor_database_client_txt'] = 'Client';
$wb['monitor_database_domain_txt'] = 'Domain';
$wb['Database size'] = 'Database size';
$wb['MySQL Database size'] = 'MySQL Database size';
+$wb['monitor_title_mx_ip_match_txt'] = 'MX record to server IP match';
+$wb['monitor_serverstate_mx_ip_match_nodata_txt'] = 'No MX record check data present';
+$wb['monitor_serverstate_mx_ip_match_warning_txt'] = 'Not all DNS MX records match the server IP';
+$wb['monitor_serverstate_mx_ip_match_ok_txt'] = 'All mail domains match up with DNS.';
+$wb['monitor_serverstate_mx_ip_match_unknown_txt'] = 'Mail domains MX check unknown.';
+$wb['monitor_serverstate_mx_ip_match_note_txt'] = 'note: If your using an external smtp service for e.g. spam filtering then add that name in the Server Config -> Mail -> Additional smtp hostnames to keep them out of this list.';
?>
diff --git a/interface/web/monitor/lib/lang/dk.lng b/interface/web/monitor/lib/lang/dk.lng
index efcbcc9d4189a91887e1623a85423957f414a88e..11ff849f3c256abb96d3d57fc26e222d26eaf4c4 100644
--- a/interface/web/monitor/lib/lang/dk.lng
+++ b/interface/web/monitor/lib/lang/dk.lng
@@ -166,4 +166,10 @@ $wb['monitor_title_mongodb_txt'] = 'MongoDB Log';
$wb['Data Log History'] = 'Data Log History';
$wb['Database size'] = 'Database size';
$wb['MySQL Database size'] = 'MySQL Database size';
+$wb['monitor_title_mx_ip_match_txt'] = 'MX record to server IP match';
+$wb['monitor_serverstate_mx_ip_match_nodata_txt'] = 'No MX record check data present';
+$wb['monitor_serverstate_mx_ip_match_warning_txt'] = 'Not all DNS MX records match the server IP';
+$wb['monitor_serverstate_mx_ip_match_ok_txt'] = 'All mail domains match up with DNS.';
+$wb['monitor_serverstate_mx_ip_match_unknown_txt'] = 'Mail domains MX check unknown.';
+$wb['monitor_serverstate_mx_ip_match_note_txt'] = 'note: If your using an external smtp service for e.g. spam filtering then add that name in the Server Config -> Mail -> Additional smtp hostnames to keep them out of this list.';
?>
diff --git a/interface/web/monitor/lib/lang/el.lng b/interface/web/monitor/lib/lang/el.lng
index 798aae223ab9c68a9f12e76a25a9b86aea1d935a..8de44af4f7d5971c88bf2c47b021160ef2f5424a 100644
--- a/interface/web/monitor/lib/lang/el.lng
+++ b/interface/web/monitor/lib/lang/el.lng
@@ -166,4 +166,10 @@ $wb['monitor_title_mongodb_txt'] = 'MongoDB Log';
$wb['Data Log History'] = 'Data Log History';
$wb['Database size'] = 'Database size';
$wb['MySQL Database size'] = 'MySQL Database size';
+$wb['monitor_title_mx_ip_match_txt'] = 'MX record to server IP match';
+$wb['monitor_serverstate_mx_ip_match_nodata_txt'] = 'No MX record check data present';
+$wb['monitor_serverstate_mx_ip_match_warning_txt'] = 'Not all DNS MX records match the server IP';
+$wb['monitor_serverstate_mx_ip_match_ok_txt'] = 'All mail domains match up with DNS.';
+$wb['monitor_serverstate_mx_ip_match_unknown_txt'] = 'Mail domains MX check unknown.';
+$wb['monitor_serverstate_mx_ip_match_note_txt'] = 'note: If your using an external smtp service for e.g. spam filtering then add that name in the Server Config -> Mail -> Additional smtp hostnames to keep them out of this list.';
?>
diff --git a/interface/web/monitor/lib/lang/en.lng b/interface/web/monitor/lib/lang/en.lng
index c790ed1d763b36452700fb203a175ec3ead3b337..158a44c71cbb39d5e613ac844460e60822345068 100644
--- a/interface/web/monitor/lib/lang/en.lng
+++ b/interface/web/monitor/lib/lang/en.lng
@@ -166,4 +166,10 @@ $wb['no_munin_url_defined_txt'] = 'No Munin URL defined.';
$wb['no_permissions_to_view_munin_txt'] = 'You are not allowed to access Munin.';
$wb['Database size'] = 'Database size';
$wb['MySQL Database size'] = 'MySQL Database size';
+$wb['monitor_title_mx_ip_match_txt'] = 'MX record to server IP match';
+$wb['monitor_serverstate_mx_ip_match_nodata_txt'] = 'No MX record check data present';
+$wb['monitor_serverstate_mx_ip_match_warning_txt'] = 'Not all DNS MX records match the server IP';
+$wb['monitor_serverstate_mx_ip_match_ok_txt'] = 'All mail domains match up with DNS.';
+$wb['monitor_serverstate_mx_ip_match_unknown_txt'] = 'Mail domains MX check unknown.';
+$wb['monitor_serverstate_mx_ip_match_note_txt'] = 'note: If your using an external smtp service for e.g. spam filtering then add that name in the Server Config -> Mail -> Additional smtp hostnames to keep them out of this list.';
?>
diff --git a/interface/web/monitor/lib/lang/es.lng b/interface/web/monitor/lib/lang/es.lng
index ac044651a3206a9cfc4a1dc8d969fed515a1b910..422809c279b0cec1db3131d8a727e11602061862 100644
--- a/interface/web/monitor/lib/lang/es.lng
+++ b/interface/web/monitor/lib/lang/es.lng
@@ -166,4 +166,10 @@ $wb['Users online'] = 'Usuarios en línea';
$wb['Data Log History'] = 'Data Log History';
$wb['Database size'] = 'Database size';
$wb['MySQL Database size'] = 'MySQL Database size';
+$wb['monitor_title_mx_ip_match_txt'] = 'MX record to server IP match';
+$wb['monitor_serverstate_mx_ip_match_nodata_txt'] = 'No MX record check data present';
+$wb['monitor_serverstate_mx_ip_match_warning_txt'] = 'Not all DNS MX records match the server IP';
+$wb['monitor_serverstate_mx_ip_match_ok_txt'] = 'All mail domains match up with DNS.';
+$wb['monitor_serverstate_mx_ip_match_unknown_txt'] = 'Mail domains MX check unknown.';
+$wb['monitor_serverstate_mx_ip_match_note_txt'] = 'note: If your using an external smtp service for e.g. spam filtering then add that name in the Server Config -> Mail -> Additional smtp hostnames to keep them out of this list.';
?>
diff --git a/interface/web/monitor/lib/lang/fi.lng b/interface/web/monitor/lib/lang/fi.lng
index 1e7943cc4e6df06be7ef64c954269fef2f7ff027..8cea3fefa34089895c25c69fa69cd6425294fb7d 100644
--- a/interface/web/monitor/lib/lang/fi.lng
+++ b/interface/web/monitor/lib/lang/fi.lng
@@ -166,4 +166,10 @@ $wb['monitor_title_mongodb_txt'] = 'MongoDB Log';
$wb['Data Log History'] = 'Data Log History';
$wb['Database size'] = 'Database size';
$wb['MySQL Database size'] = 'MySQL Database size';
+$wb['monitor_title_mx_ip_match_txt'] = 'MX record to server IP match';
+$wb['monitor_serverstate_mx_ip_match_nodata_txt'] = 'No MX record check data present';
+$wb['monitor_serverstate_mx_ip_match_warning_txt'] = 'Not all DNS MX records match the server IP';
+$wb['monitor_serverstate_mx_ip_match_ok_txt'] = 'All mail domains match up with DNS.';
+$wb['monitor_serverstate_mx_ip_match_unknown_txt'] = 'Mail domains MX check unknown.';
+$wb['monitor_serverstate_mx_ip_match_note_txt'] = 'note: If your using an external smtp service for e.g. spam filtering then add that name in the Server Config -> Mail -> Additional smtp hostnames to keep them out of this list.';
?>
diff --git a/interface/web/monitor/lib/lang/fr.lng b/interface/web/monitor/lib/lang/fr.lng
index 53124875e9f730e56d85fc5af7522bb3c62a2e11..c9e7599393209f4ea76061043cb25701689f9930 100644
--- a/interface/web/monitor/lib/lang/fr.lng
+++ b/interface/web/monitor/lib/lang/fr.lng
@@ -166,4 +166,10 @@ $wb['monitor_title_mongodb_txt'] = 'MongoDB Log';
$wb['Data Log History'] = 'Data Log History';
$wb['Database size'] = 'Database size';
$wb['MySQL Database size'] = 'MySQL Database size';
+$wb['monitor_title_mx_ip_match_txt'] = 'MX record to server IP match';
+$wb['monitor_serverstate_mx_ip_match_nodata_txt'] = 'No MX record check data present';
+$wb['monitor_serverstate_mx_ip_match_warning_txt'] = 'Not all DNS MX records match the server IP';
+$wb['monitor_serverstate_mx_ip_match_ok_txt'] = 'All mail domains match up with DNS.';
+$wb['monitor_serverstate_mx_ip_match_unknown_txt'] = 'Mail domains MX check unknown.';
+$wb['monitor_serverstate_mx_ip_match_note_txt'] = 'note: If your using an external smtp service for e.g. spam filtering then add that name in the Server Config -> Mail -> Additional smtp hostnames to keep them out of this list.';
?>
diff --git a/interface/web/monitor/lib/lang/hr.lng b/interface/web/monitor/lib/lang/hr.lng
index 357527b4ecb366604b622947efc2e0d420e6edb1..d1fcb74a94ac4573f3be1cb0232f5fcac39a5091 100644
--- a/interface/web/monitor/lib/lang/hr.lng
+++ b/interface/web/monitor/lib/lang/hr.lng
@@ -166,4 +166,10 @@ $wb['monitor_title_mongodb_txt'] = 'MongoDB Log';
$wb['Data Log History'] = 'Data Log History';
$wb['Database size'] = 'Database size';
$wb['MySQL Database size'] = 'MySQL Database size';
+$wb['monitor_title_mx_ip_match_txt'] = 'MX record to server IP match';
+$wb['monitor_serverstate_mx_ip_match_nodata_txt'] = 'No MX record check data present';
+$wb['monitor_serverstate_mx_ip_match_warning_txt'] = 'Not all DNS MX records match the server IP';
+$wb['monitor_serverstate_mx_ip_match_ok_txt'] = 'All mail domains match up with DNS.';
+$wb['monitor_serverstate_mx_ip_match_unknown_txt'] = 'Mail domains MX check unknown.';
+$wb['monitor_serverstate_mx_ip_match_note_txt'] = 'note: If your using an external smtp service for e.g. spam filtering then add that name in the Server Config -> Mail -> Additional smtp hostnames to keep them out of this list.';
?>
diff --git a/interface/web/monitor/lib/lang/hu.lng b/interface/web/monitor/lib/lang/hu.lng
index fe80c1dbb18212bc8b03de90e9a5bde72323eefb..61bd32bf2b6b77cf0a78aad0a353b354c5c43dbc 100644
--- a/interface/web/monitor/lib/lang/hu.lng
+++ b/interface/web/monitor/lib/lang/hu.lng
@@ -166,4 +166,10 @@ $wb['monitor_title_mongodb_txt'] = 'MongoDB Log';
$wb['Data Log History'] = 'Data Log History';
$wb['Database size'] = 'Database size';
$wb['MySQL Database size'] = 'MySQL Database size';
+$wb['monitor_title_mx_ip_match_txt'] = 'MX record to server IP match';
+$wb['monitor_serverstate_mx_ip_match_nodata_txt'] = 'No MX record check data present';
+$wb['monitor_serverstate_mx_ip_match_warning_txt'] = 'Not all DNS MX records match the server IP';
+$wb['monitor_serverstate_mx_ip_match_ok_txt'] = 'All mail domains match up with DNS.';
+$wb['monitor_serverstate_mx_ip_match_unknown_txt'] = 'Mail domains MX check unknown.';
+$wb['monitor_serverstate_mx_ip_match_note_txt'] = 'note: If your using an external smtp service for e.g. spam filtering then add that name in the Server Config -> Mail -> Additional smtp hostnames to keep them out of this list.';
?>
diff --git a/interface/web/monitor/lib/lang/id.lng b/interface/web/monitor/lib/lang/id.lng
index f36c9df9dd5a6a9520db7dac20c56585e6bff717..b160943867a1dea806a3b8c2e287f88766e0e33a 100644
--- a/interface/web/monitor/lib/lang/id.lng
+++ b/interface/web/monitor/lib/lang/id.lng
@@ -166,4 +166,10 @@ $wb['monitor_title_mongodb_txt'] = 'MongoDB Log';
$wb['Data Log History'] = 'Data Log History';
$wb['Database size'] = 'Database size';
$wb['MySQL Database size'] = 'MySQL Database size';
+$wb['monitor_title_mx_ip_match_txt'] = 'MX record to server IP match';
+$wb['monitor_serverstate_mx_ip_match_nodata_txt'] = 'No MX record check data present';
+$wb['monitor_serverstate_mx_ip_match_warning_txt'] = 'Not all DNS MX records match the server IP';
+$wb['monitor_serverstate_mx_ip_match_ok_txt'] = 'All mail domains match up with DNS.';
+$wb['monitor_serverstate_mx_ip_match_unknown_txt'] = 'Mail domains MX check unknown.';
+$wb['monitor_serverstate_mx_ip_match_note_txt'] = 'note: If your using an external smtp service for e.g. spam filtering then add that name in the Server Config -> Mail -> Additional smtp hostnames to keep them out of this list.';
?>
diff --git a/interface/web/monitor/lib/lang/it.lng b/interface/web/monitor/lib/lang/it.lng
index ddcabc45e773408a3dce4fccc7ee70e046ee324a..354d2b7600305967df425ee1f462ebd97d0acc31 100644
--- a/interface/web/monitor/lib/lang/it.lng
+++ b/interface/web/monitor/lib/lang/it.lng
@@ -166,4 +166,10 @@ $wb['monitor_title_mongodb_txt'] = 'MongoDB Log';
$wb['Data Log History'] = 'Data Log History';
$wb['Database size'] = 'Database size';
$wb['MySQL Database size'] = 'MySQL Database size';
+$wb['monitor_title_mx_ip_match_txt'] = 'MX record to server IP match';
+$wb['monitor_serverstate_mx_ip_match_nodata_txt'] = 'No MX record check data present';
+$wb['monitor_serverstate_mx_ip_match_warning_txt'] = 'Not all DNS MX records match the server IP';
+$wb['monitor_serverstate_mx_ip_match_ok_txt'] = 'All mail domains match up with DNS.';
+$wb['monitor_serverstate_mx_ip_match_unknown_txt'] = 'Mail domains MX check unknown.';
+$wb['monitor_serverstate_mx_ip_match_note_txt'] = 'note: If your using an external smtp service for e.g. spam filtering then add that name in the Server Config -> Mail -> Additional smtp hostnames to keep them out of this list.';
?>
diff --git a/interface/web/monitor/lib/lang/ja.lng b/interface/web/monitor/lib/lang/ja.lng
index 266a81f3c3eeb07b795de2626ad4a9f67f3f7426..a29f7e60f6bc3d08cf13c33259fe0babb3960992 100644
--- a/interface/web/monitor/lib/lang/ja.lng
+++ b/interface/web/monitor/lib/lang/ja.lng
@@ -166,4 +166,10 @@ $wb['monitor_title_mongodb_txt'] = 'MongoDB Log';
$wb['Data Log History'] = 'Data Log History';
$wb['Database size'] = 'Database size';
$wb['MySQL Database size'] = 'MySQL Database size';
+$wb['monitor_title_mx_ip_match_txt'] = 'MX record to server IP match';
+$wb['monitor_serverstate_mx_ip_match_nodata_txt'] = 'No MX record check data present';
+$wb['monitor_serverstate_mx_ip_match_warning_txt'] = 'Not all DNS MX records match the server IP';
+$wb['monitor_serverstate_mx_ip_match_ok_txt'] = 'All mail domains match up with DNS.';
+$wb['monitor_serverstate_mx_ip_match_unknown_txt'] = 'Mail domains MX check unknown.';
+$wb['monitor_serverstate_mx_ip_match_note_txt'] = 'note: If your using an external smtp service for e.g. spam filtering then add that name in the Server Config -> Mail -> Additional smtp hostnames to keep them out of this list.';
?>
diff --git a/interface/web/monitor/lib/lang/nl.lng b/interface/web/monitor/lib/lang/nl.lng
index 095a45090add0ab452758a28240d066a200704b5..326d1dffc6b7ec326847fdc454acc9f246c6f1d9 100644
--- a/interface/web/monitor/lib/lang/nl.lng
+++ b/interface/web/monitor/lib/lang/nl.lng
@@ -166,4 +166,10 @@ $wb['monitor_title_mongodb_txt'] = 'MongoDB Log';
$wb['Data Log History'] = 'Data Log History';
$wb['Database size'] = 'Database size';
$wb['MySQL Database size'] = 'MySQL Database size';
+$wb['monitor_title_mx_ip_match_txt'] = 'MX record to server IP match';
+$wb['monitor_serverstate_mx_ip_match_nodata_txt'] = 'Geen MX record controle data beschikbaar';
+$wb['monitor_serverstate_mx_ip_match_warning_txt'] = 'Niet alle DNS MX records komen overeen met het server IP';
+$wb['monitor_serverstate_mx_ip_match_ok_txt'] = 'Alle mail domeinen kloppen met de DNS.';
+$wb['monitor_serverstate_mx_ip_match_unknown_txt'] = 'Mail domeinen MX check onbekend.';
+$wb['monitor_serverstate_mx_ip_match_note_txt'] = 'note: If your using an external smtp service for e.g. spam filtering then add that name in the Server Config -> Mail -> Additional smtp hostnames to keep them out of this list.';
?>
diff --git a/interface/web/monitor/lib/lang/pl.lng b/interface/web/monitor/lib/lang/pl.lng
index 59f012cfa3acc136ffc088ae2394549ded8812fe..76c9c1b7de40f3851b01b7e3fd6b0c25a359883f 100644
--- a/interface/web/monitor/lib/lang/pl.lng
+++ b/interface/web/monitor/lib/lang/pl.lng
@@ -166,4 +166,10 @@ $wb['monitor_title_mongodb_txt'] = 'MongoDB Log';
$wb['Data Log History'] = 'Data Log History';
$wb['Database size'] = 'Database size';
$wb['MySQL Database size'] = 'Pokaż rozmiar baz danych MySQL';
+$wb['monitor_title_mx_ip_match_txt'] = 'MX record to server IP match';
+$wb['monitor_serverstate_mx_ip_match_nodata_txt'] = 'No MX record check data present';
+$wb['monitor_serverstate_mx_ip_match_warning_txt'] = 'Not all DNS MX records match the server IP';
+$wb['monitor_serverstate_mx_ip_match_ok_txt'] = 'All mail domains match up with DNS.';
+$wb['monitor_serverstate_mx_ip_match_unknown_txt'] = 'Mail domains MX check unknown.';
+$wb['monitor_serverstate_mx_ip_match_note_txt'] = 'note: If your using an external smtp service for e.g. spam filtering then add that name in the Server Config -> Mail -> Additional smtp hostnames to keep them out of this list.';
?>
diff --git a/interface/web/monitor/lib/lang/pt.lng b/interface/web/monitor/lib/lang/pt.lng
index b8ad5e533ef0d450ab59a787389fc02d8743c87b..3d0ebdfb0cab721be220e0bb03750489ac2aff4e 100644
--- a/interface/web/monitor/lib/lang/pt.lng
+++ b/interface/web/monitor/lib/lang/pt.lng
@@ -166,4 +166,10 @@ $wb['monitor_title_mongodb_txt'] = 'MongoDB Log';
$wb['Data Log History'] = 'Data Log History';
$wb['Database size'] = 'Database size';
$wb['MySQL Database size'] = 'MySQL Database size';
+$wb['monitor_title_mx_ip_match_txt'] = 'MX record to server IP match';
+$wb['monitor_serverstate_mx_ip_match_nodata_txt'] = 'No MX record check data present';
+$wb['monitor_serverstate_mx_ip_match_warning_txt'] = 'Not all DNS MX records match the server IP';
+$wb['monitor_serverstate_mx_ip_match_ok_txt'] = 'All mail domains match up with DNS.';
+$wb['monitor_serverstate_mx_ip_match_unknown_txt'] = 'Mail domains MX check unknown.';
+$wb['monitor_serverstate_mx_ip_match_note_txt'] = 'note: If your using an external smtp service for e.g. spam filtering then add that name in the Server Config -> Mail -> Additional smtp hostnames to keep them out of this list.';
?>
diff --git a/interface/web/monitor/lib/lang/ro.lng b/interface/web/monitor/lib/lang/ro.lng
index 9ca3234362f98a524d17caf325a60a5ff97cee43..1a74d7b06429985df20f164dd70f7db64f4ba02d 100644
--- a/interface/web/monitor/lib/lang/ro.lng
+++ b/interface/web/monitor/lib/lang/ro.lng
@@ -166,4 +166,10 @@ $wb['monitor_title_mongodb_txt'] = 'MongoDB Log';
$wb['Data Log History'] = 'Data Log History';
$wb['Database size'] = 'Database size';
$wb['MySQL Database size'] = 'MySQL Database size';
+$wb['monitor_title_mx_ip_match_txt'] = 'MX record to server IP match';
+$wb['monitor_serverstate_mx_ip_match_nodata_txt'] = 'No MX record check data present';
+$wb['monitor_serverstate_mx_ip_match_warning_txt'] = 'Not all DNS MX records match the server IP';
+$wb['monitor_serverstate_mx_ip_match_ok_txt'] = 'All mail domains match up with DNS.';
+$wb['monitor_serverstate_mx_ip_match_unknown_txt'] = 'Mail domains MX check unknown.';
+$wb['monitor_serverstate_mx_ip_match_note_txt'] = 'note: If your using an external smtp service for e.g. spam filtering then add that name in the Server Config -> Mail -> Additional smtp hostnames to keep them out of this list.';
?>
diff --git a/interface/web/monitor/lib/lang/ru.lng b/interface/web/monitor/lib/lang/ru.lng
index b5469fa1744fd64f72a0586534da20b7678ce9df..d0af54b0481e07254251667d7c87215765e8fd6b 100644
--- a/interface/web/monitor/lib/lang/ru.lng
+++ b/interface/web/monitor/lib/lang/ru.lng
@@ -166,4 +166,10 @@ $wb['monitor_title_mongodb_txt'] = 'Журнал MongoDB';
$wb['Data Log History'] = 'Data Log History';
$wb['Database size'] = 'Database size';
$wb['MySQL Database size'] = 'MySQL Database size';
+$wb['monitor_title_mx_ip_match_txt'] = 'MX record to server IP match';
+$wb['monitor_serverstate_mx_ip_match_nodata_txt'] = 'No MX record check data present';
+$wb['monitor_serverstate_mx_ip_match_warning_txt'] = 'Not all DNS MX records match the server IP';
+$wb['monitor_serverstate_mx_ip_match_ok_txt'] = 'All mail domains match up with DNS.';
+$wb['monitor_serverstate_mx_ip_match_unknown_txt'] = 'Mail domains MX check unknown.';
+$wb['monitor_serverstate_mx_ip_match_note_txt'] = 'note: If your using an external smtp service for e.g. spam filtering then add that name in the Server Config -> Mail -> Additional smtp hostnames to keep them out of this list.';
?>
diff --git a/interface/web/monitor/lib/lang/se.lng b/interface/web/monitor/lib/lang/se.lng
index 9093fb960075104156a4d362513fa4faf5d8129d..d7235389a9cc0493bf69ee13577f0e28cad2d3fb 100644
--- a/interface/web/monitor/lib/lang/se.lng
+++ b/interface/web/monitor/lib/lang/se.lng
@@ -166,4 +166,10 @@ $wb['monitor_title_mongodb_txt'] = 'MongoDB Log';
$wb['Data Log History'] = 'Data Log History';
$wb['Database size'] = 'Database size';
$wb['MySQL Database size'] = 'MySQL Database size';
+$wb['monitor_title_mx_ip_match_txt'] = 'MX record to server IP match';
+$wb['monitor_serverstate_mx_ip_match_nodata_txt'] = 'No MX record check data present';
+$wb['monitor_serverstate_mx_ip_match_warning_txt'] = 'Not all DNS MX records match the server IP';
+$wb['monitor_serverstate_mx_ip_match_ok_txt'] = 'All mail domains match up with DNS.';
+$wb['monitor_serverstate_mx_ip_match_unknown_txt'] = 'Mail domains MX check unknown.';
+$wb['monitor_serverstate_mx_ip_match_note_txt'] = 'note: If your using an external smtp service for e.g. spam filtering then add that name in the Server Config -> Mail -> Additional smtp hostnames to keep them out of this list.';
?>
diff --git a/interface/web/monitor/lib/lang/sk.lng b/interface/web/monitor/lib/lang/sk.lng
index 7b23b8c716c4db8f553d2f614d07c895a773ff9b..70dd16d3257e4e560b1aef5a1c5d3c023b66b4b0 100644
--- a/interface/web/monitor/lib/lang/sk.lng
+++ b/interface/web/monitor/lib/lang/sk.lng
@@ -166,4 +166,10 @@ $wb['monitor_title_mongodb_txt'] = 'MongoDB Log';
$wb['Data Log History'] = 'Data Log History';
$wb['Database size'] = 'Database size';
$wb['MySQL Database size'] = 'MySQL Database size';
+$wb['monitor_title_mx_ip_match_txt'] = 'MX record to server IP match';
+$wb['monitor_serverstate_mx_ip_match_nodata_txt'] = 'No MX record check data present';
+$wb['monitor_serverstate_mx_ip_match_warning_txt'] = 'Not all DNS MX records match the server IP';
+$wb['monitor_serverstate_mx_ip_match_ok_txt'] = 'All mail domains match up with DNS.';
+$wb['monitor_serverstate_mx_ip_match_unknown_txt'] = 'Mail domains MX check unknown.';
+$wb['monitor_serverstate_mx_ip_match_note_txt'] = 'note: If your using an external smtp service for e.g. spam filtering then add that name in the Server Config -> Mail -> Additional smtp hostnames to keep them out of this list.';
?>
diff --git a/interface/web/monitor/lib/lang/tr.lng b/interface/web/monitor/lib/lang/tr.lng
index 90d96b5e3932842e31e44ff1bcdc9993aea9ebe0..352b34923477ac12c174bc856ea819dfb05ff9b7 100644
--- a/interface/web/monitor/lib/lang/tr.lng
+++ b/interface/web/monitor/lib/lang/tr.lng
@@ -165,4 +165,10 @@ $wb['no_munin_url_defined_txt'] = 'Munin adresi belirtilmemiş.';
$wb['no_permissions_to_view_munin_txt'] = 'Munin erişimi izniniz yok.';
$wb['Database size'] = 'Database size';
$wb['MySQL Database size'] = 'MySQL Database size';
+$wb['monitor_title_mx_ip_match_txt'] = 'MX record to server IP match';
+$wb['monitor_serverstate_mx_ip_match_nodata_txt'] = 'No MX record check data present';
+$wb['monitor_serverstate_mx_ip_match_warning_txt'] = 'Not all DNS MX records match the server IP';
+$wb['monitor_serverstate_mx_ip_match_ok_txt'] = 'All mail domains match up with DNS.';
+$wb['monitor_serverstate_mx_ip_match_unknown_txt'] = 'Mail domains MX check unknown.';
+$wb['monitor_serverstate_mx_ip_match_note_txt'] = 'note: If your using an external smtp service for e.g. spam filtering then add that name in the Server Config -> Mail -> Additional smtp hostnames to keep them out of this list.';
?>
diff --git a/interface/web/monitor/show_data.php b/interface/web/monitor/show_data.php
index 80f246ee2dcec04b6a255c1c5d9bec58adbd5420..13258398413030a45ee9633ad89fa1510fe87fea 100644
--- a/interface/web/monitor/show_data.php
+++ b/interface/web/monitor/show_data.php
@@ -114,6 +114,14 @@ case 'mailq':
$description = '';
$add_padding = true;
break;
+case 'mx_ip_match':
+ $template = 'templates/show_data.htm';
+ $output .= $app->tools_monitor->showMx_ip_match();
+ $time = $app->tools_monitor->getDataTime('mx_ip_match');
+ $title = $app->lng("monitor_title_mx_ip_match_txt"). ' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+ $description = '';
+ $add_padding = true;
+ break;
case 'raid_state':
$template = 'templates/show_data.htm';
$output .= $app->tools_monitor->showRaidState();
diff --git a/interface/web/monitor/show_sys_state.php b/interface/web/monitor/show_sys_state.php
index 9e70496a81927067e59eed5f60909d4f5fe709c3..8f977239049418c93f2e2ea2ef91b11e46e10f16 100644
--- a/interface/web/monitor/show_sys_state.php
+++ b/interface/web/monitor/show_sys_state.php
@@ -557,6 +557,21 @@ function _processDbState($type, $serverId, $serverState, $messages) {
break;
}
}
+ if ($type == 'mx_ip_match') {
+ switch ($record['state']) {
+ case 'ok':
+ $messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_mx_ip_match_ok_txt");
+ break;
+ case 'warning':
+ $messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_mx_ip_match_warning_txt") . ' ' .
+ "[" . $app->lng("monitor_serverstate_more_txt") . "]";
+ break;
+ default:
+ $messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_mx_ip_match_unknown_txt") . ' ' .
+ "[" . $app->lng("monitor_serverstate_more_txt") . "]";
+ break;
+ }
+ }
if ($type == 'sys_log') {
switch ($record['state']) {
diff --git a/server/lib/classes/cron.d/100-monitor_domain_mx.inc.php b/server/lib/classes/cron.d/100-monitor_domain_mx.inc.php
new file mode 100755
index 0000000000000000000000000000000000000000..14d7b2442e2ee858ae5b31ebd04dd05afaf83248
--- /dev/null
+++ b/server/lib/classes/cron.d/100-monitor_domain_mx.inc.php
@@ -0,0 +1,185 @@
+uses('getconf,functions');
+ $smtpin_ips = gethostbynamel($hostname);
+ $smtpin_ips_v6 = $app->functions->gethostbynamel6($hostname);
+ if ($smtpin_ips_v6) {
+ $smtpin_ips = array_merge($smtpin_ips, $smtpin_ips_v6);
+ }
+ return $smtpin_ips;
+ }
+
+ public function onRunJob() {
+ global $app, $conf;
+
+ $app->uses('getconf,functions');
+ $mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
+
+ /* used for all monitor cronjobs */
+ $app->load('monitor_tools');
+ $this->_tools = new monitor_tools();
+ /* end global section for monitor cronjobs */
+
+ // Initialize data array
+ $data = array();
+ $state = 'no_state';
+
+ // the id of the server as int
+ $server_id = intval($conf['server_id']);
+
+ $hostname = $app->system->hostname();
+ $smtpin_ips = $this->_resolveHostnameBoth46($hostname);
+ if (empty($smtpin_ips)) {
+ $app->log('Our hostname['. $hostname . '] doet not resolve.', LOGLEVEL_WARN);
+ }
+
+ # Add additional IP's, e.g. an extrernal spamfilter/proxy.
+ if (!empty($mail_config['additional_smtp_hostnames'])) {
+ $additional_smtp_hostnames = explode(',', $mail_config['additional_smtp_hostnames']);
+ foreach ($additional_smtp_hostnames as $hostname) {
+ $extra = $this->_resolveHostnameBoth46($hostname);
+ if ($extra) {
+ $smtpin_ips = array_merge($smtpin_ips, $extra);
+ }
+ }
+ }
+
+ # Add additional IP's , e.g. for secondary IP on the same box or a proxy.
+ if (!empty($mail_config['additional_smtp_ips'])) {
+ $smtpin_ips = array_merge($smtpin_ips, explode(',', $mail_config['additional_smtp_ips']));
+ }
+
+ $maildomains = $app->db->queryAllRecords("SELECT domain, active FROM mail_domain WHERE server_id = ?", $server_id);
+ if(is_array($maildomains)) {
+ $state = 'ok';
+ foreach ($maildomains as $maildomain) {
+ $mx_records = array();
+ $mx_weight = array();
+ $found_mx = getmxrr($maildomain['domain'], $mx_records, $mx_weight) ;
+
+ $mx_sorted = array();
+
+ // Merge records and weight into a single array to sort on priority.
+ // ignore multiple mx's at the same weight
+ foreach ($mx_records as $key => $name) {
+ $mx_sorted[$mx_weight[$key]] = $mx_records[$key];
+ }
+ ksort ($mx_sorted, SORT_NUMERIC);
+ reset ($mx_sorted);
+
+ $first_mx = array_shift($mx_sorted);
+ if (!empty($first_mx)) {
+ $mx_ip = gethostbyname($first_mx);
+ }
+
+ if (empty($mx_ip) || !in_array( $mx_ip, $smtpin_ips)) {
+ if ($maildomain['active'] == 'y') {
+ $str = 'Domain is active but the DNS does not match our IP.';
+ if ($first_mx) {
+ $str .= ' (points to ' . $first_mx . ' on ' . $mx_ip . ')';
+ }
+ else {
+ $str .= ' (no mx record found)';
+ }
+ $app->log('Mail domain[' . $maildomain['domain'] . ']: ' . $str, LOGLEVEL_WARN);
+ $state = 'warning';
+ $data[$maildomain['domain']] = $str;
+ } else {
+
+ $app->log('Good, the mail domain[' . $maildomain['domain'] . '] is not active and DNS is not pointing to us.', LOGLEVEL_DEBUG);
+ }
+ }
+ else {
+ if ($maildomain['active'] == 'n') {
+ $app->log('DNS points to our IP but the mail domain[' . $maildomain['domain'] . '] is not active.', LOGLEVEL_WARN);
+ $state = 'warning';
+ $data[$maildomain['domain']] = 'DNS points to our IP but the mail domain is not active.';
+ }
+ else {
+ // DNS OK.
+ }
+ }
+ }
+ }
+
+ $res = array();
+ $res['server_id'] = $server_id;
+ $res['type'] = 'mx_ip_match';
+ $res['data'] = $data;
+ $res['state'] = $state;
+
+ /**
+ * Insert the data into the database
+ */
+ $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
+ 'VALUES (?, ?, UNIX_TIMESTAMP(), ?, ?)';
+ $app->dbmaster->query($sql, $res['server_id'], $res['type'], serialize($res['data']), $res['state']);
+
+ // The new data is written, now we can delete the old one.
+ $this->_tools->delOldRecords($res['type'], $res['server_id']);
+
+ parent::onRunJob();
+ }
+
+ /* this function is optional if it contains no custom code */
+ public function onAfterRun() {
+ global $app;
+
+ parent::onAfterRun();
+ }
+
+}
+
+?>
diff --git a/server/lib/classes/functions.inc.php b/server/lib/classes/functions.inc.php
index f7a44a82c0993b16450e9a54b8ffa32e527edf6f..d9350ec465a93ffdbb2f7cc8e56daf0de5015838 100644
--- a/server/lib/classes/functions.inc.php
+++ b/server/lib/classes/functions.inc.php
@@ -483,6 +483,63 @@ class functions {
}
}
+ /**
+ * From https://www.php.net/manual/en/function.gethostbyname.php#70936
+ */
+ public function gethostbyname6($host, $try_a = false) {
+ // get AAAA record for $host
+ // if $try_a is true, if AAAA fails, it tries for A
+ // the first match found is returned
+ // otherwise returns false
+
+ $dns = gethostbynamel6($host, $try_a);
+ if ($dns == false) { return false; }
+ else { return $dns[0]; }
+ }
+
+ /**
+ * From https://www.php.net/manual/en/function.gethostbyname.php#70936
+ */
+ public function gethostbynamel6($host, $try_a = false) {
+ // get AAAA records for $host,
+ // if $try_a is true, if AAAA fails, it tries for A
+ // results are returned in an array of ips found matching type
+ // otherwise returns false
+
+ $dns6 = dns_get_record($host, DNS_AAAA);
+ if ($try_a == true) {
+ $dns4 = dns_get_record($host, DNS_A);
+ $dns = array_merge($dns4, $dns6);
+ }
+ else { $dns = $dns6; }
+ $ip6 = array();
+ $ip4 = array();
+ foreach ($dns as $record) {
+ if ($record["type"] == "A") {
+ $ip4[] = $record["ip"];
+ }
+ if ($record["type"] == "AAAA") {
+ $ip6[] = $record["ipv6"];
+ }
+ }
+ if (count($ip6) < 1) {
+ if ($try_a == true) {
+ if (count($ip4) < 1) {
+ return false;
+ }
+ else {
+ return $ip4;
+ }
+ }
+ else {
+ return false;
+ }
+ }
+ else {
+ return $ip6;
+ }
+ }
+
}
?>