Issue connecting webapp to kopano-core (MAPI_E_NETWORK_ERROR)
-
Hey Guys,
I am trying to deploy a version of kopano where the webapp node and the mailbox node are on different machines.This is what I got:
On the mailbox node kopano has been setup properly. The services are running and the ldap server is configured.
On the port 236 there is the kopano-server process listening and that port has been opened using the firewall-cmd.[root@kopano-mailbox ~]$ netstat -plutan | grep kopano-server tcp 0 0 0.0.0.0:236 0.0.0.0:* LISTEN 9579/kopano-server tcp6 0 0 ::1:43318 ::1:389 ESTABLISHED 9579/kopano-server tcp6 0 0 ::1:43304 ::1:389 ESTABLISHED 9579/kopano-server tcp6 0 0 ::1:43314 ::1:389 ESTABLISHED 9579/kopano-server tcp6 0 0 ::1:43316 ::1:389 ESTABLISHED 9579/kopano-server
If I use telnet from the webapp node I am able to connect to the kopano-server:
[root@kopano-web-node]$ telnet kopano-mailbox 236 Trying xxx.185.113.122... Connected to kopano-mailbox. Escape character is '^]'.
In the web-app node I changed the
DEFAULT_SERVER
variable in the/etc/kopano/webapp/config.php
file. In order to point the server that I configureddefine("DEFAULT_SERVER", "http://mailbox-node.example.com:236/kopano");
But on the login page of kopano I always receive this error:
Cannot connect to Kopano Core.
I checked the logs and the source code and as far as I understood the error should be the following:
MAPI_E_NETWORK_ERROR
But I have no idea about how to solve this issue?
Any ideas?Thanks,
-
hi Genz,
is the name resolution also working with the fqdn?
In your telnet you only try the host name without domain and in the config the fqdn is inside.This guy here hat a similar Problem and it was only a typo anywhere
https://forums.zarafa.com/showthread.php?8624-Webaccess-on-different-server-via-SSL-Port-237Your Config looks good (https://doc.zarafa.com/trunk/Administrator_Manual/en-US/html/_setup_of_modules_on_different_servers.html )
best regards
-
Hey AnotherAndy,
Yes it is working also with the fqdn. Do you know a way to improve the log level?
I am pretty sure that is a very stupid error.Thanks
-
if I have installed on the same machine kopano-server and the webapp and I leave in the
/etc/kopano/webapp/config.php
:define("DEFAULT_SERVER", "default:");
everything works.
But when I try to change it and use any URL like this one:define("DEFAULT_SERVER", "http://localhost:236/kopano/");
I get this error in the log:
exception 'MAPIException' with message 'MAPI error ' in /usr/share/kopano-webapp/server/includes/core/class.mapisession.php:543 Stack trace: #0 /usr/share/kopano-webapp/server/includes/core/class.mapisession.php(543): mapi_openmsgstore(Resource id #56, '0') #1 /usr/share/kopano-webapp/server/includes/core/class.mapisession.php(504): MAPISession->openMessageStore(0, 'Public store') #2 /usr/share/kopano-webapp/server/includes/core/class.mapisession.php(515): MAPISession->getPublicMessageStore() #3 /usr/share/kopano-webapp/server/includes/modules/class.hierarchymodule.php(44): MAPISession->getAllMessageStores() #4 /usr/share/kopano-webapp/server/includes/modules/class.hierarchymodule.php(30): HierarchyModule->getEntryID() #5 /usr/share/kopano-webapp/server/includes/modules/class.module.php(59): HierarchyModule->createNotifiers() #6 /usr/share/kopano-webapp/server/includes/modules/class.hierarchymodule.php(21): Module->__construct('hierarchymodule...', Array) #7 /usr/share/kopano-webapp/server/includes/core/class.dispatcher.php(38): HierarchyModule->__construct('hierarchymodule...', Array) #8 /usr/share/kopano-webapp/server/includes/core/class.jsonrequest.php(50): Dispatcher->loadModule('hierarchymodule', 'hierarchymodule...', Array) #9 /usr/share/kopano-webapp/kopano.php(139): JSONRequest->execute('{"zarafa":{"hie...') #10 {main}, referer: http://m4-kopano-mailbox-test-connection.cern.ch/webapp/p/
There is something wrong with the function:
mapi_openmsgstore
-
The stack trace is probably due the public folder is not created yet (kopano-admin -s)
Can you post the complete config.php
-
Hey,
Thanks for the reply. This is myconfig.php
:<?php /* config.php The config file for the webapp. All possible web client settings can be set in this file. Some settings (language) can also be set per user or logon. */ // Comment next line to disable the config check (or set FALSE to log the config errors) define("CONFIG_CHECK", TRUE); // Use these options to optionally disable some PHP configuration checks. // WARNING: these checks will disable checks regarding the security of the WebApp site configuration, // only change them if you know the consequences - improper use will lead to an insecure installation! define("CONFIG_CHECK_COOKIES_HTTP", FALSE); define("CONFIG_CHECK_COOKIES_SSL", FALSE); // Depending on your setup, it might be advisable to change the lines below to one defined with your // default socket location. // Normally "default:" points to the default setting ("file:///var/run/kopano/server.sock") // Examples: define("DEFAULT_SERVER", "default:"); // define("DEFAULT_SERVER", "http://localhost:236/kopano"); // define("DEFAULT_SERVER", "https://localhost:237/kopano"); // define("DEFAULT_SERVER", "file:///var/run/kopano/server.sock"); //define("DEFAULT_SERVER", "default:"); define("DEFAULT_SERVER", "http://localhost:236/kopano"); // When using a single-signon system on your webserver, but Kopano Core is on another server // you can use https to access the Kopano server, and authenticate using an SSL certificate. define("SSLCERT_FILE", NULL); define("SSLCERT_PASS", NULL); // Set to true to disable login with Single Sign-On (SSO) on SSO environments. define('DISABLE_REMOTE_USER_LOGIN', false); // set to 'true' to strip domain from login name found from Single Sign-On webservers define("LOGINNAME_STRIP_DOMAIN", false); // Name of the cookie that is used for the session define("COOKIE_NAME", "KOPANO_WEBAPP"); // Set to 'true' to disable secure session cookies and to allow log-in without HTTPS. define("INSECURE_COOKIES", true); // Use Kopano Core for HTML filtering, introduced in 8.5.0 define("KC_FILTERED_BODY", false); // The timeout (in seconds) for the session. User will be logged out of WebApp // when he has not actively used the WebApp for this time. // Set to 0 (or remove) for no timeout during browser session. define('CLIENT_TIMEOUT', 0); // Defines the domains from which cross domain authentication requests // are allowed. E.g. if WebMeetings runs under a different domain than // the WebApp then add this domain here. Add http(s):// to the domains // and separate domains with spaces. // Set to empty string (default) to only allow authentication requests // from within the same domain. // Set to "*" to allow authentication requests from any domain. (not // recommended) define('CROSS_DOMAIN_AUTHENTICATION_ALLOWED_DOMAINS', ""); // Defines the domains to which redirection after login is allowed. // Add http(s):// to the domains and separate domains with spaces. // Note: The domain under which WebApp runs, is always allowed and does // not need to be added here. define('REDIRECT_ALLOWED_DOMAINS', ''); // Defines the base url and end with a slash. $base_url = dirname($_SERVER["PHP_SELF"]); if(substr($base_url,-1)!="/") $base_url .="/"; define("BASE_URL", $base_url); // Defines the temp path (absolute). Here uploaded attachments will be saved. // The web client doesn't work without this directory. define("TMP_PATH", "/var/lib/kopano-webapp/tmp"); // Define the path to the plugin directory (No slash at the end) define("PATH_PLUGIN_DIR", "plugins"); // Enable the plugins define("ENABLE_PLUGINS", true); // Define list of disabled plugins separated by semicolon define("DISABLED_PLUGINS_LIST", ''); // Define a list of plugins that cannot be disabled by users. // Plugins should be seperated by a semicolon (;). A wildcard (*) // can be used to identify multiple plugins. define("ALWAYS_ENABLED_PLUGINS_LIST", ''); // General WebApp theme. This will be loaded by default for every user // (if the theme is installed as a plugin) // Users can override the 'logged-in' theme in the settings. define("THEME", ''); // The title that will be shown in the title bar of the browser define("WEBAPP_TITLE", 'Kopano WebApp'); // Set addressbook for GAB not to show any users unless searching for a specific user define("DISABLE_FULL_GAB", false); // Set true to hide public contact folders in address-book folder list, // false will show public contact folders in address-book folder list. define("DISABLE_PUBLIC_CONTACT_FOLDERS", true); // Set true to show public folders in hierarchy, false will disable public folders in hierarchy. define('ENABLE_PUBLIC_FOLDERS', true); // Set true to hide shared contact folders in address-book folder list, // false will show shared contact folders in address-book folder list. define("DISABLE_SHARED_CONTACT_FOLDERS", true); // Set to true to give users the possiblity to edit, create, and delete mail filters on the store // of other users. The user needs owner permissions on the store of the other user. define('ENABLE_SHARED_RULES', false); // Booking method (true = direct booking, false = send meeting request) define('ENABLE_DIRECT_BOOKING', true); // Enable GZIP compression for responses define('ENABLE_RESPONSE_COMPRESSION', true); // When set to true this disables the welcome screen to be shown for first time users. define('DISABLE_WELCOME_SCREEN', false); // When set to false it will disable showing of advanced settings. define('ENABLE_ADVANCED_SETTINGS', false); // Freebusy start offset that will be used to load freebusy data in appointments, number is subtracted from current time define('FREEBUSY_LOAD_START_OFFSET', 7); // Freebusy end offset that will be used to load freebusy data in appointments, number is added to current time define('FREEBUSY_LOAD_END_OFFSET', 90); // Maximum eml files to be included in a single ZIP archive define('MAX_EML_FILES_IN_ZIP', 50); // Additional color schemes for the calendars can be added by uncommenting and editing the following define. // The format is the same as the format of COLOR_SCHEMES which is defined in default.php // To change the default colors, COLOR_SCHEMES can also be defined here. // Note: Every color should have a unique name, because it is used to identify the color // define('ADDITIONAL_COLOR_SCHEMES', json_encode(array( // array( // 'name' => 'pink', // 'displayName' => _('Pink'), // 'base' => '#ff0099' // ) // ))); // Additional categories can be added by uncommenting and editing the following define. // The format is the same as the format of DEFAULT_CATEGORIES which is defined in default.php // To change the default categories, DEFAULT_CATEGORIES can also be defined here. // Note: Every category should have a unique name, because it is used to identify the category // define('ADDITIONAL_CATEGORIES', json_encode(array( // array( // 'name' => _('Family'), // 'color' => '#000000', // 'quickAccess' => true, // 'sortIndex' => 10 // ) // ))); // Additional Prefix for the Contact name can be added by uncommenting and editing the following define. // define('CONTACT_PREFIX', json_encode(array( // array(_('Er.')), // array(_('Gr.')) // ))); // Additional Suffix for the Contact name can be added by uncommenting and editing the following define. // define('CONTACT_SUFFIX', json_encode(array( // array(_('A')), // array(_('B')) // ))); /**************************************\ * Memory usage and timeouts * \**************************************/ // This sets the maximum time in seconds that is allowed to run before it is terminated by the parser. ini_set('max_execution_time', 300); // 5 minutes // BLOCK_SIZE (in bytes) is used for attachments by mapi_stream_read/mapi_stream_write define('BLOCK_SIZE', 1048576); // Time that static files may exist in the client's cache (13 weeks) define('EXPIRES_TIME', 60*60*24*7*13); // Time that the state files are allowed to survive (in seconds) // For filesystems on which relatime is used, this value should be larger then the relatime_interval // for kernels 2.6.30 and above relatime is enabled by default, and the relatime_interval is set to // 24 hours. define('STATE_FILE_MAX_LIFETIME', 28*60*60); // Time that attachments are allowed to survive (in seconds) define('UPLOADED_ATTACHMENT_MAX_LIFETIME', 6*60*60); /**************************************\ * Languages * \**************************************/ // Location to the translations define("LANGUAGE_DIR", "server/language/"); // Defines the default interface language. This can be overriden by the user. if (isset($_ENV['LANG']) && $_ENV['LANG']!="C"){ define('LANG', $_ENV["LANG"]); // This means the server environment language determines the web client language. }else{ define('LANG', 'en_GB'); // default fallback language } // List of languages that should be enabled in the logon // screen's language drop down. Languages should be specified // using <languagecode>_<regioncode>[.UTF-8], and separated with // semicolon. A list of available languages can be found in // the manual or by looking at the list of directories in // /usr/share/kopano-webapp/server/language . define("ENABLED_LANGUAGES", "cs_CZ;da_DK;de_DE;en_GB;en_US;es_CA;es_ES;fi_FI;fr_FR;hu_HU;it_IT;ja_JP;nb_NO;nl_NL;pl_PL;pt_BR;ru_RU;sl_SI;tr_TR;zh_TW"); // Defines the default time zone, change e.g. to "Europe/London" when needed if(!ini_get('date.timezone')) { date_default_timezone_set('Europe/London'); } /**************************************\ * Powerpaste * \**************************************/ // Options for TinyMCE's powerpaste plugin, see https://www.tinymce.com/docs/enterprise/paste-from-word/#configurationoptions // for more details. define('POWERPASTE_WORD_IMPORT', 'merge'); define('POWERPASTE_HTML_IMPORT', 'merge'); define('POWERPASTE_ALLOW_LOCAL_IMAGES', true); /**************************************\ * Debugging * \**************************************/ // Do not log errors into stdout, since this generates faulty JSON responses. ini_set("display_errors", false); ini_set("log_errors", true); error_reporting(E_ERROR); if (file_exists('debug.php')){ include_once('debug.php'); }else{ // define empty dump function in case we still use it somewhere function dump(){} } ?>
-
This post is deleted! -
And with this config your are unable to connect to the kopano-server ?
With the first config i was indeed not able to connect to the kopano-server but the latest version should just be able to -
Hey,
No it is still not working. I restarted all the services but nothing changed.After I run
kopano-admin -s
theMAPIException
error disappeard from the httpd logs but I still get the errorCannot connect to Kopano Core
when try to access to the mailibox through the webapp.My
config.php
is the one that I posted and I did not change it.Could you tell me where the error logs for kopano are stored? I checked the folder
/var/log/kopano
but it’s empty.
Could you tell me also if there is a way to improve the quality of the logs?The webapp is throwing errors but there is no trace in the logs about those.
Thanks,
Riccardo -
You changed the DEFAULT_SERVER address it was first missing the port, but that doesn’t matter.
Per default the logging is handled bu systemd (journalctl -u kopano-server)
You can change that in the server.cfg aswell as the loglevel# Logging method (syslog, file), syslog facility is 'mail' log_method = file # Logfile (for log_method = file, '-' for stderr) log_file = /var/log/kopano/server.log # Loglevel (0(none), 1(crit), 2(err), 3(warn), 4(notice), 5(info), 6(debug)) log_level = 6
You can enable the debug logging in Webapp by downloading this file https://stash.kopano.io/projects/KW/repos/kopano-webapp/browse/debug.php.dist and rename it to debug.php and place that in /usr/share/kopano-webapp.
You also need to change one linedefine("DEBUG_LOADER", LOAD_RELEASE);
and create a debug.txt in /usr/share/kopano-webapp and make sure the webserver can write to that file.
-
Hi Riccardo,
Could you please use
define("DEFAULT_SERVER", "http://localhost:236/kopano");
and NOT
define("DEFAULT_SERVER", "http://localhost:236/kopano/");
Please notice the slash in the end.
Also regarding the Loglevels of Kopano, you can set various loglevels, I can recommend you to set the logging based on the variable log_level= directive in server.cfg (man kopano-server), as already mentioned by @robing .
- mike
-