Author Topic: Not functioning include_host_config  (Read 6539 times)

Offline ricardo777

  • Jr. Member
  • **
  • Posts: 23
Re: Not functioning include_host_config
« Reply #15 on: February 21, 2016, 05:39:44 AM »
Another reply

I have changed name to fname and it looks for the ip as hostname:

Code: [Select]
[21-Feb-2016 11:36:42 +0100]: mail.domain.nl.inc.php
[21-Feb-2016 11:36:42 +0100]: NULL
[21-Feb-2016 11:36:42 +0100]: IPofrounducbeinstallation.inc.php

Is this something I have in my config file that it looks for the IP or Hostname of the roundcubeinstallation? the domain I am using is not on the roundcube installation.

Here is my configfile:

Code: [Select]
<?php
/* Local configuration for Roundcube Webmail */

// PEAR database DSN for read/write operations
// format is db_provider://user:password@host/database 
// For examples see http://pear.php.net/manual/en/package.database.mdb2.intro-dsn.php
// currently supported db_providers: mysql, mysqli, pgsql, sqlite, mssql or sqlsrv
$config['db_dsnw'] = '';

$config['include_host_config'] = array(
  
'mail.domain.nl' => 'mail.domain.inc.php',
  
'domain.nl' => 'mail.domain.inc.php',
  
'h1.domain.nl' => 'mail.domain.inc.php'
);

$config['include_host_config'] = true;

// ----------------------------------
// USER PREFERENCES
// ----------------------------------

// Use this charset as fallback for message decoding
$config['default_charset'] = 'ISO-8859-1';

// skin name: folder from skins/
$config['skin'] = 'outlook';

// use this timezone to display date/time
// valid timezone identifers are listed here: php.net/manual/en/timezones.php
// 'auto' will use the browser's timezone settings
$config['timezone'] = 'auto';

// prefer displaying HTML messages
$config['prefer_html'] = true;

// display remote inline images
// 0 - Never, always ask
// 1 - Ask if sender is not in address book
// 2 - Always show inline images
$config['show_images'] = 1;

// save copies of compose messages in the browser's local storage
// for recovery in case of browser crashes and session timeout.
$config['compose_save_localstorage'] = true;

// ----------------------------------
// IMAP
// ----------------------------------
// The mail host chosen to perform the log-in.
// Leave blank to show a textbox at login, give a list of hosts
// to display a pulldown menu or set one host as string.
// To use SSL/TLS connection, enter hostname with prefix ssl:// or tls://
// Supported replacement variables:
// %n - hostname ($_SERVER['SERVER_NAME'])
// %t - hostname without the first part
// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
// %s - domain name after the '@' from e-mail address provided at login screen
// For example %n = mail.domain.tld, %t = domain.tld
// WARNING: After hostname change update of mail_host column in users table is
//          required to match old user data records with the new host.
$config['default_host'] = 'mail.%s';

// ----------------------------------
// SMTP
// ----------------------------------
// SMTP server host (for sending mails).
// To use SSL/TLS connection, enter hostname with prefix ssl:// or tls://
// If left blank, the PHP mail() function is used
// Supported replacement variables:
// %h - user's IMAP hostname
// %n - hostname ($_SERVER['SERVER_NAME'])
// %t - hostname without the first part
// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
// %z - IMAP domain (IMAP hostname without the first part)
// For example %n = mail.domain.tld, %t = domain.tld
//$config['smtp_server'] = 'tls://%h';
$config['smtp_server'] = '%h';

// SMTP username (if required) if you use %u as the username Roundcube
// will use the current username for login
$config['smtp_user'] = '%u';

// SMTP password (if required) if you use %p as the password Roundcube
// will use the current user's password for login
$config['smtp_pass'] = '%p';

// SMTP port (default is 25; use 587 for STARTTLS or 465 for the
// deprecated SSL over SMTP (aka SMTPS))
//$config['smtp_port'] = 587;

// provide an URL where a user can get support for this Roundcube installation
// PLEASE DO NOT LINK TO THE ROUNDCUBE.NET WEBSITE HERE!
$config['support_url'] = 'http://domain.nl/support';

// replace Roundcube logo with this image
// specify an URL relative to the document root of this Roundcube installation
$config['skin_logo'] = 'https://domain.nl/images/logo/domain_RC_2.png';

// use this folder to store log files (must be writeable for apache user)
// This is used by the 'file' log driver.
$config['log_dir'] = '/home/domainmail/domains/domain.nl/public_html/logs/';

// use this folder to store temp files (must be writeable for apache user)
$config['temp_dir'] = '/home/domainmail/domains/domain.nl/public_html/temp';

// enforce connections over https
// with this option enabled, all non-secure connections will be redirected.
// set the port for the ssl connection as value of this option if it differs from the default 443
$config['force_https'] = true;

// Session lifetime in minutes
$config['session_lifetime'] = 15;

// Session domain: .example.org
$config['session_domain'] = 'mail.domain.nl';

// Session name. Default: 'roundcube_sessid'
$config['session_name'] = 'maildomain_sessid';

// Session authentication cookie name. Default: 'roundcube_sessauth'
$config['session_auth_name'] = 'maildomain_sessauth';

// Session path. Defaults to PHP session.cookie_path setting.
$config['session_path'] = null;

// Backend to use for session storage. Can either be 'db' (default), 'memcache' or 'php'
// If set to 'memcache', a list of servers need to be specified in 'memcache_hosts'
// Make sure the Memcache extension (http://pecl.php.net/package/memcache) version >= 2.0.0 is installed
// Setting this value to 'php' will use the default session save handler configured in PHP
$config['session_storage'] = 'db';

// e.g. array( 'localhost:11211', '192.168.1.12:11211', 'unix:///var/tmp/memcached.sock' );
// check client IP in session athorization
$config['ip_check'] = true;

// this key is used to encrypt the users imap password which is stored
// in the session record (and the client cookie if remember password is enabled).
// please provide a string of exactly 24 chars.
$config['des_key'] = '';

// use this name to compose page titles
$config['product_name'] = 'domain Webmail';

// ----------------------------------
// PLUGINS
// ----------------------------------
// List of active plugins (in plugins/ directory)

$config['plugins'] = array('contextmenu''persistent_login''archive','attachment_reminder''managesieve''markasjunk''password');

// the default locale setting (leave empty for auto-detection)
// RFC1766 formatted language name like en_US, de_DE, de_CH, fr_FR, pt_BR
$config['language'] = 'nl';

//Custom
$config['quota_zero_as_unlimited'] = true;

// compose html formatted messages by default
// 0 - never, 1 - always, 2 - on reply to HTML message, 3 - on forward or reply to HTML message
$config['htmleditor'] = 1;

// save compose message every 300 seconds (5min)
$config['draft_autosave'] = 60;

// default setting if preview pane is enabled
$config['preview_pane'] = true;

// Encoding of long/non-ascii attachment names:
// 0 - Full RFC 2231 compatible
// 1 - RFC 2047 for 'name' and RFC 2231 for 'filename' parameter (Thunderbird's default)
// 2 - Full 2047 compatible
$config['mime_param_folding'] = 0;

// lifetime of message cache
// possible units: s, m, h, d, w
$config['message_cache_lifetime'] = '10d';

// ----------------------------------
// LOGGING/DEBUGGING
// ----------------------------------

// system error reporting, sum of: 1 = log; 4 = show, 8 = trace
$config['debug_level'] = 1;

// log driver:  'syslog' or 'file'.
$config['log_driver'] = 'file';

// date format for log entries
// (read http://php.net/manual/en/function.date.php for all format characters)  
$config['log_date_format'] = 'd-M-Y H:i:s O';

// Syslog ident string to use, if using the 'syslog' log driver.
$config['syslog_id'] = 'roundcube';

// Syslog facility to use, if using the 'syslog' log driver.
// For possible values see installer or http://php.net/manual/en/function.openlog.php
$config['syslog_facility'] = LOG_USER;

// Activate this option if logs should be written to per-user directories.
// Data will only be logged if a directry <log_dir>/<username>/ exists and is writable.
$config['per_user_logging'] = false;

// Log sent messages to <log_dir>/sendmail or to syslog
$config['smtp_log'] = true;

// Log successful/failed logins to <log_dir>/userlogins or to syslog
$config['log_logins'] = true;

// Log session authentication errors to <log_dir>/session or to syslog
$config['log_session'] = false;

// Log SQL queries to <log_dir>/sql or to syslog
$config['sql_debug'] = false;

// Log IMAP conversation to <log_dir>/imap or to syslog
$config['imap_debug'] = false;

// Log LDAP conversation to <log_dir>/ldap or to syslog
$config['ldap_debug'] = false;

// Log SMTP conversation to <log_dir>/smtp or to syslog
$config['smtp_debug'] = true;

// IMAP AUTH type (DIGEST-MD5, CRAM-MD5, LOGIN, PLAIN or null to use
// best server supported one)
$config['imap_auth_type'] = null;

// display these folders separately in the mailbox list.
// these folders will also be displayed with localized names
$rcmail_config['default_folders'] = array('INBOX''INBOX.Drafts''INBOX.Sent''INBOX.Trash''INBOX.Archive');

// automatically create the above listed default folders on login
$rcmail_config['create_default_folders'] = true;

// protect the default folders from renames, deletes, and subscription changes
$config['protect_default_folders'] = true;

//Custom special folders// store draft message is this mailbox

// leave blank if draft messages should not be stored
// NOTE: Use folder names with namespace prefix (INBOX. on Courier-IMAP)
$config['drafts_mbox'] = 'INBOX.Drafts';

// store spam messages in this mailbox
// NOTE: Use folder names with namespace prefix (INBOX. on Courier-IMAP)
$config['junk_mbox'] = 'INBOX.spam';

// store sent message is this mailbox
// leave blank if sent messages should not be stored
// NOTE: Use folder names with namespace prefix (INBOX. on Courier-IMAP)
$config['sent_mbox'] = 'INBOX.Sent';

// move messages to this folder when deleting them
// leave blank if they should be deleted directly
// NOTE: Use folder names with namespace prefix (INBOX. on Courier-IMAP)
$config['trash_mbox'] = 'INBOX.Trash';

// archief mailbox voor plugin archive
$config['archive_mbox'] = 'INBOX.archive';

// Type of IMAP indexes cache. Supported values: 'db', 'apc' and 'memcache'.
$config['imap_cache'] = 'db';

// Enables messages cache. Only 'db' cache is supported.
// This requires an IMAP server that supports QRESYNC and CONDSTORE
// extensions (RFC7162). See synchronize() in program/lib/Roundcube/rcube_imap_cache.php
// for further info, or if you experience syncing problems.
$config['messages_cache'] = true;

// Lifetime of IMAP indexes cache. Possible units: s, m, h, d, w
$config['imap_cache_ttl'] = '10d';

// Lifetime of messages cache. Possible units: s, m, h, d, w
$config['messages_cache_ttl'] = '10d';

// Maximum cached message size in kilobytes.
// Note: On MySQL this should be less than (max_allowed_packet - 30%)
$config['messages_cache_threshold'] = 50;

$rcmail_config['quota_zero_as_unlimited'] = true;

// default messages sort column. Use empty value for default server's sorting, 
// or 'arrival', 'date', 'subject', 'from', 'to', 'fromto', 'size', 'cc'
$config['message_sort_col'] = '';

// Make use of the built-in spell checker. It is based on GoogieSpell.
// Since Google only accepts connections over https your PHP installatation
// requires to be compiled with Open SSL support
$config['enable_spellcheck'] = true;

// Enables spellchecker exceptions dictionary.
// Setting it to 'shared' will make the dictionary shared by all users.
$config['spellcheck_dictionary'] = false;

// Set the spell checking engine. Possible values:
// - 'googie'  - the default (also used for connecting to Nox Spell Server, see 'spellcheck_uri' setting)
// - 'pspell'  - requires the PHP Pspell module and aspell installed
// - 'enchant' - requires the PHP Enchant module
// - 'atd'     - install your own After the Deadline server or check with the people at http://www.afterthedeadline.com before using their API
// Since Google shut down their public spell checking service, the default settings
// connect to http://spell.roundcube.net which is a hosted service provided by Roundcube.
// You can connect to any other googie-compliant service by setting 'spellcheck_uri' accordingly.
$config['spellcheck_engine'] = 'googie';

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,261
Re: Not functioning include_host_config
« Reply #16 on: February 21, 2016, 05:42:12 AM »
great so in your main roundcube config file you should have a line like this:
Code: [Select]
$config['include_host_config'] = array('mail.roundcubeinstallation.nl' => 'test.inc.php');assuming you always use the url to access Roundcube then you do not need to add an entry for the IP as well.

Then in test.inc.php you put your alt value for default_host.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline ricardo777

  • Jr. Member
  • **
  • Posts: 23
Re: Not functioning include_host_config
« Reply #17 on: February 21, 2016, 05:47:04 AM »
Ok now it works for the domain and all other.

How can I for example use the config file for 1 domain like

domain1.com for the hostname config, that would connect to an external ssl server via a set hostname in the domain1.inc.php config file.

Al the other domains like domain.com needs to connect to the roundcubeinstallation server.

The option:
Code: [Select]
$config['include_host_config'] = array('mail.roundcubeinstallation.nl' => 'test.inc.php');
will set that all the domain use the config file not domain1.com only.

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,261
Re: Not functioning include_host_config
« Reply #18 on: February 21, 2016, 05:57:44 AM »
When you say domain what exactly are you referring to as domain?

The include_host_config option works based on the host name used to access roundcube, eg. mail.roundcubeinstallation.nl
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline ricardo777

  • Jr. Member
  • **
  • Posts: 23
Re: Not functioning include_host_config
« Reply #19 on: February 21, 2016, 06:23:17 AM »
When you say domain what exactly are you referring to as domain?

The include_host_config option works based on the host name used to access roundcube, eg. mail.roundcubeinstallation.nl

Ah you say include_host_config is based on the website used? Then I misunderstand the function.

I thought it was based on the hostname of the username not the roundcube access url.

What I am looking for, it that imap and smtp connect to the server hostname (what is in the ssl certificate) and not the domain mail.domain.com

Or I need include_host based on the username login, not the website. I use 1 website for all the logins.

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,261
Re: Not functioning include_host_config
« Reply #20 on: February 21, 2016, 06:34:07 AM »
Quote
Ah you say include_host_config is based on the website used?
that's correct.

There are some macros in the config file for things based on all or part of the username but as you found they are limited in how much they can change the config. Changing config based on individual usernames is not something roundcube is built for.

If you can setup a second address for the website just for testing then you could use the include_host_config option. Without that then I think you'd have to write a plugin. There are hooks for imap connect and smtp connect and you could change what it does based on the username But you said that you PHP skills are not great. So if possible I would think that setting up a test url would be better. You do not need a separate roundcube installation just an alias to your existing site.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline ricardo777

  • Jr. Member
  • **
  • Posts: 23
Re: Not functioning include_host_config
« Reply #21 on: February 21, 2016, 06:49:41 AM »
Ok thank you, for all the help and information.

Can you write a plugin and how many will it costs? if you have interest you can PM me.

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,261
Re: Not functioning include_host_config
« Reply #22 on: February 22, 2016, 11:49:17 AM »
I'm not really into making plugins to order but I might be able to give you a few pointers. I'll PM you. I don't want to post half working code in public space.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline noface0711

  • Newbie
  • *
  • Posts: 7
Re: Not functioning include_host_config
« Reply #23 on: March 11, 2016, 05:44:53 AM »
I think then you have to go back to the code in rcube_config and add some debug lines to identify why your host config file is not being read. You can use `rcube::write_log('debug', 'my message...');`

Offline ricardo777

  • Jr. Member
  • **
  • Posts: 23
Re: Not functioning include_host_config
« Reply #24 on: March 11, 2016, 09:41:24 AM »
I have a solution thanks to: JohnDoh :)