Issue with vlogin + secure_login and allVirtualDomainsAreUnderOneHost

View: New views
3 Messages — Rating Filter:   Alert me  

Issue with vlogin + secure_login and allVirtualDomainsAreUnderOneHost

by Brett Johnson-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I am using SM 1.4.19 and I am having an issue with the vlogin 3.10.1
plugin in conjunction with the secure_login 1.4 plugin using the
allVirtualDomainsAreUnderOneHost setting. I'm not sure if the behavior I
am seeing is normal or not. My goal is when a user accesses a SM virtual
domain, they are redirected to a single SSL domain login page. The user
only enters their username (without @domain) to login. Vlogin should
append the virtual domain to the username. What I see is vlogin always
appends the SSL domain name to the username.

Here are my configuration files:

secure_login/config.php
=======================
$change_back_to_http_after_login = 0;
$remain_in_https_if_logged_in_using_https = 0;
$allVirtualDomainsUnderOneSSLHost =
'https://secure.tld/###DOMAIN######PATH###';
$entryPointDomainPattern = '';
$entryPointPathPattern   = '';
$entryPointQueryPattern  = '';
$nonStandardHttpPort = '';
$sl_obey_x_forwarded_headers = 0;
$sl_debug = 0;

vlogin/data/config.php
======================
$useSessionBased = 0;
$virtualDomains = array(
'virt1' => array(
'domain'     => 'virt1.tld',
'org_name'   => 'Virtual One',
'org_title'  => '(isset($_SESSION["username"]) ? $_SESSION["username"] .
" - Mail" : "Mail")',
'settingsWithEmbeddedPHP' => array( 'org_title',),
),
'virt2' => array(
'domain'     => 'virt2.tld',
'org_name'   => 'Virtual Two',
'org_title'  => '(isset($_SESSION["username"]) ? $_SESSION["username"] .
" - Mail" : "Mail")',
'settingsWithEmbeddedPHP' => array( 'org_title',),
),
'virt3' => array(
'domain'     => 'virt3.tld',
'org_name'   => 'Virtual Three',
'org_title'  => '(isset($_SESSION["username"]) ? $_SESSION["username"] .
" - Mail" : "Mail")',
'settingsWithEmbeddedPHP' => array( 'org_title',),
),
'virt4' => array(
'domain'     => 'virt4.tld',
'org_name'   => 'Virtual Four',
'org_title'  => '(isset($_SESSION["username"]) ? $_SESSION["username"] .
" - Mail" : "Mail")',
'settingsWithEmbeddedPHP' => array( 'org_title',),
),
'virt5' => array(
'domain'     => 'virt5.tld',
'org_name'   => 'Virtual Five',
'org_title'  => '(isset($_SESSION["username"]) ? $_SESSION["username"] .
" - Mail" : "Mail")',
'settingsWithEmbeddedPHP' => array( 'org_title',),
),
);
$useDomainFromVirtDomainsArray = 1;
$useDomainFromServerEnvironment = '';
$reverseDotSectionOrder = 0;
$numberOfDotSections = 2;
$removeFromFront = 1;
$checkByExcludeList = 1;
$notPartOfDomainName = array('www','mail','mail2','webmail');
$always_prepend = '';
$always_append = '';
$chopOffDotSectionsFromLeft = 0;
$chopOffDotSectionsFromRight = 0;
$at = '@';
$dot = '.';
$atConversion = array();
$forceLowercase = 0;
$replacements = array(
);
$alwaysAddHostName = 0;
$putHostNameOnFrontOfUsername = 0;
$dontUseHostName = 0;
$dontUseHostNameUserList = array(
);
$smHostIsDomainThatUserLoggedInWith = 1;
$removeDomainIfGiven = 0;
$usernameDomainIsHost = 0;
$rawLoginIsOutgoingEmailAddress = 0;
$appendDomainToOutgoingEmailAddress = 0;
$virtualDomainDataDir = '';
$allVirtualDomainsAreUnderOneHost = '/[\/]*(.*?)(\/|$)/';
$securePort = 443;
$stripDomainFromUserSubstitution = 0;
$usernameReplacements = array(
);
$sendmailVirtualUserTable = '';
$virtualUserTableDBFlavor = '';
$postProcessingPattern = '';
$postProcessingReplacement = '';
$translateHostnameTable = '';
$pathToQmail = '';
$default_org_logo = '';
$perUserSettingsFile = '';
$IMAPServerRules = array(
);
$SMTPServerRules = array(
);
$serviceLevelBackend = 0;
$internalServiceLevelFile =
'/path/to/squirrelmail/plugins/vlogin/data/service_levels.php';
$sqlServiceLevelQuery = 'SELECT service_level FROM users WHERE username
= "%1"';
$SQLDatabaseDomainLookup = '';
$SQLDatabaseUserLookup = '';
$SQLDatabaseServiceLevelLookup = '';
$vlogin_dsn = 'mysql://user:password@localhost/email_users';
$override_config_during_login = 1;
$vlogin_debug = 1;

Here is the vlogin debug output:

Your original username was:
test
>
> ______________________________________________________________________
Your IMAP login was resolved to:
test@...
>
> ______________________________________________________________________
$hostname is secure.tld

PHP_SELF is /webmail.virt1.tld/src/redirect.php

________________________________________________________________________
IMAP server: localhost


The PHP_SELF variable contains the correct virtual domain but the IMAP
login gets constructed with the SSL domain.

After playing around with the plugin a bit, I was able to get the plugin
to append the virtual domain by removing "$hostname ." from the
preg_match call in the determine_user_hostname function in
functions.php:

--- functions.orig      2009-09-24 08:46:22.000000000 -0400
+++ functions.php       2009-09-24 08:47:46.000000000 -0400
@@ -1025,7 +1025,7 @@
       //
       // run pattern match against full URI starting after the protocol
(http(s)://)
       //
-      preg_match($allVirtualDomainsAreUnderOneHost, $hostname .
(strpos($_SERVER['PHP_SELF'], '/') === 0 ? '' : '/') .
$_SERVER['PHP_SELF'] . (empty($_SERVER['QUERY_STRING']) ? '' :
(strpos($_SERVER['QUERY_STRING'], '?') === 0 ? '' : '?') .
$_SERVER['QUERY_STRING']), $matches);
+      preg_match($allVirtualDomainsAreUnderOneHost,
(strpos($_SERVER['PHP_SELF'], '/') === 0 ? '' : '/') .
$_SERVER['PHP_SELF'] . (empty($_SERVER['QUERY_STRING']) ? '' :
(strpos($_SERVER['QUERY_STRING'], '?') === 0 ? '' : '?') .
$_SERVER['QUERY_STRING']), $matches);
       $hostname = $matches[1];
 
    }

Here is the debug output after making the change defined above:

Your original username was:
test

________________________________________________________________________
Your IMAP login was resolved to:
test@...

________________________________________________________________________
$hostname is virt1.tld

PHP_SELF is /webmail.vitr1.tld/src/redirect.php

________________________________________________________________________
IMAP server: localhost

I am wondering if there is something wrong in my configuration or if
this behavior is a bug. If this behavior is incorrect, is the code
change I made above the correct solution, or is a better solution?

--
Regards,

Brett Johnson

CONFIDENTIAL NOTICE - The contents of this message, including any
attachments, are confidential and are intended solely for the use of the
person or entity to whom the message was addressed.  If you are not the
intended recipient of this message, please be advised that any
dissemination, distribution, or use of the contents of this message is
strictly prohibited. If you received this message in error, please
notify the sender. Please also permanently delete all copies of the
original message and any attached documentation. Thank you.




------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
-----
squirrelmail-plugins mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: squirrelmail-plugins@...
List archives: http://news.gmane.org/gmane.mail.squirrelmail.plugins
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-plugins

Server Side Filter

by Derek Piazza-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

When trying to use the "Server Side Filter" For procmail... I get these error message on my log file...

 

[Thu Sep 24 12:23:03 2009] [error] [client 216.171.129.224] PHP Notice:  Undefined offset:  2 in /var/www/html/webmail/plugins/compatibility/functions.php on line 121, referer: http://www.hotmallo.com/src/options.php
[Thu Sep 24 12:23:03 2009] [error] [client 216.171.129.224] PHP Notice:  Undefined offset:  1 in /var/www/html/webmail/plugins/compatibility/functions.php on line 121, referer: http://www.hotmallo.com/src/options.php
[Thu Sep 24 12:23:03 2009] [error] [client 216.171.129.224] PHP Notice:  Undefined offset:  2 in /var/www/html/webmail/plugins/compatibility/functions.php on line 121, referer: http://www.hotmallo.com/src/options.php
[Thu Sep 24 12:23:03 2009] [error] [client 216.171.129.224] PHP Notice:  Undefined offset:  1 in /var/www/html/webmail/plugins/compatibility/functions.php on line 121, referer: http://www.hotmallo.com/src/options.php
[Thu Sep 24 12:23:03 2009] [error] [client 216.171.129.224] PHP Notice:  Undefined offset:  2 in /var/www/html/webmail/plugins/compatibility/functions.php on line 121, referer: http://www.hotmallo.com/src/options.php
[Thu Sep 24 12:23:03 2009] [error] [client 216.171.129.224] PHP Notice:  Undefined offset:  1 in /var/www/html/webmail/plugins/compatibility/functions.php on line 121, referer: http://www.hotmallo.com/src/options.php
[Thu Sep 24 12:23:03 2009] [error] [client 216.171.129.224] PHP Notice:  Undefined offset:  2 in /var/www/html/webmail/plugins/compatibility/functions.php on line 121, referer: http://www.hotmallo.com/src/options.php
[Thu Sep 24 12:23:03 2009] [error] [client 216.171.129.224] PHP Notice:  Undefined offset:  1 in /var/www/html/webmail/plugins/compatibility/functions.php on line 121, referer: http://www.hotmallo.com/src/options.php
[Thu Sep 24 12:23:03 2009] [error] [client 216.171.129.224] PHP Fatal error:  Call to undefined function sqgetGlobalVar() in /var/www/html/webmail/plugins/compatibility/includes/1.5.2/global.php on line 942, referer: http://www.hotmallo.com/src/options.php
 


------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
-----
squirrelmail-plugins mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: squirrelmail-plugins@...
List archives: http://news.gmane.org/gmane.mail.squirrelmail.plugins
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-plugins

Re: Issue with vlogin + secure_login and allVirtualDomainsAreUnderOneHost

by Paul Lesniewski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Very sorry for the long delay.  Thank you for your thorough posting.  See below.

On Thu, Sep 24, 2009 at 6:08 AM, Brett Johnson <brett@...> wrote:

> Hello,
>
> I am using SM 1.4.19 and I am having an issue with the vlogin 3.10.1
> plugin in conjunction with the secure_login 1.4 plugin using the
> allVirtualDomainsAreUnderOneHost setting. I'm not sure if the behavior I
> am seeing is normal or not. My goal is when a user accesses a SM virtual
> domain, they are redirected to a single SSL domain login page. The user
> only enters their username (without @domain) to login. Vlogin should
> append the virtual domain to the username. What I see is vlogin always
> appends the SSL domain name to the username.
>
> Here are my configuration files:
>
> secure_login/config.php
> =======================
> $change_back_to_http_after_login = 0;
> $remain_in_https_if_logged_in_using_https = 0;
> $allVirtualDomainsUnderOneSSLHost =
> 'https://secure.tld/###DOMAIN######PATH###';
> $entryPointDomainPattern = '';
> $entryPointPathPattern   = '';
> $entryPointQueryPattern  = '';
> $nonStandardHttpPort = '';
> $sl_obey_x_forwarded_headers = 0;
> $sl_debug = 0;
>
> vlogin/data/config.php
> ======================
> $useSessionBased = 0;
> $virtualDomains = array(
> 'virt1' => array(
> 'domain'     => 'virt1.tld',
> 'org_name'   => 'Virtual One',
> 'org_title'  => '(isset($_SESSION["username"]) ? $_SESSION["username"] .
> " - Mail" : "Mail")',
> 'settingsWithEmbeddedPHP' => array( 'org_title',),
> ),
> 'virt2' => array(
> 'domain'     => 'virt2.tld',
> 'org_name'   => 'Virtual Two',
> 'org_title'  => '(isset($_SESSION["username"]) ? $_SESSION["username"] .
> " - Mail" : "Mail")',
> 'settingsWithEmbeddedPHP' => array( 'org_title',),
> ),
> 'virt3' => array(
> 'domain'     => 'virt3.tld',
> 'org_name'   => 'Virtual Three',
> 'org_title'  => '(isset($_SESSION["username"]) ? $_SESSION["username"] .
> " - Mail" : "Mail")',
> 'settingsWithEmbeddedPHP' => array( 'org_title',),
> ),
> 'virt4' => array(
> 'domain'     => 'virt4.tld',
> 'org_name'   => 'Virtual Four',
> 'org_title'  => '(isset($_SESSION["username"]) ? $_SESSION["username"] .
> " - Mail" : "Mail")',
> 'settingsWithEmbeddedPHP' => array( 'org_title',),
> ),
> 'virt5' => array(
> 'domain'     => 'virt5.tld',
> 'org_name'   => 'Virtual Five',
> 'org_title'  => '(isset($_SESSION["username"]) ? $_SESSION["username"] .
> " - Mail" : "Mail")',
> 'settingsWithEmbeddedPHP' => array( 'org_title',),
> ),
> );
> $useDomainFromVirtDomainsArray = 1;
> $useDomainFromServerEnvironment = '';
> $reverseDotSectionOrder = 0;
> $numberOfDotSections = 2;
> $removeFromFront = 1;
> $checkByExcludeList = 1;
> $notPartOfDomainName = array('www','mail','mail2','webmail');
> $always_prepend = '';
> $always_append = '';
> $chopOffDotSectionsFromLeft = 0;
> $chopOffDotSectionsFromRight = 0;
> $at = '@';
> $dot = '.';
> $atConversion = array();
> $forceLowercase = 0;
> $replacements = array(
> );
> $alwaysAddHostName = 0;
> $putHostNameOnFrontOfUsername = 0;
> $dontUseHostName = 0;
> $dontUseHostNameUserList = array(
> );
> $smHostIsDomainThatUserLoggedInWith = 1;
> $removeDomainIfGiven = 0;
> $usernameDomainIsHost = 0;
> $rawLoginIsOutgoingEmailAddress = 0;
> $appendDomainToOutgoingEmailAddress = 0;
> $virtualDomainDataDir = '';
> $allVirtualDomainsAreUnderOneHost = '/[\/]*(.*?)(\/|$)/';

>From the information below, it looks like the redirect is correctly going to:

secure.tld/webmail.virt1.tld/src/redirect.php

Is that correct (with "https://" pre-pended, of course)?

The $allVirtualDomainsAreUnderOneHost pattern above is intended to
take the part of that address string that comes after the first slash
and before the 2nd one.  So if it's instead grabbing "secure.tld" my
guess is that the pattern needs to use the + quantifier rather than *.
 Can you please UNDO your patch and try this change to the
$allVirtualDomainsAreUnderOneHost pattern instead?

$allVirtualDomainsAreUnderOneHost = '/[\/]+(.*?)(\/|$)/';

Thank you

> $securePort = 443;
> $stripDomainFromUserSubstitution = 0;
> $usernameReplacements = array(
> );
> $sendmailVirtualUserTable = '';
> $virtualUserTableDBFlavor = '';
> $postProcessingPattern = '';
> $postProcessingReplacement = '';
> $translateHostnameTable = '';
> $pathToQmail = '';
> $default_org_logo = '';
> $perUserSettingsFile = '';
> $IMAPServerRules = array(
> );
> $SMTPServerRules = array(
> );
> $serviceLevelBackend = 0;
> $internalServiceLevelFile =
> '/path/to/squirrelmail/plugins/vlogin/data/service_levels.php';
> $sqlServiceLevelQuery = 'SELECT service_level FROM users WHERE username
> = "%1"';
> $SQLDatabaseDomainLookup = '';
> $SQLDatabaseUserLookup = '';
> $SQLDatabaseServiceLevelLookup = '';
> $vlogin_dsn = 'mysql://user:password@localhost/email_users';
> $override_config_during_login = 1;
> $vlogin_debug = 1;
>
> Here is the vlogin debug output:
>
> Your original username was:
> test
>>
>> ______________________________________________________________________
> Your IMAP login was resolved to:
> test@...
>>
>> ______________________________________________________________________
> $hostname is secure.tld
>
> PHP_SELF is /webmail.virt1.tld/src/redirect.php
>
> ________________________________________________________________________
> IMAP server: localhost
>
>
> The PHP_SELF variable contains the correct virtual domain but the IMAP
> login gets constructed with the SSL domain.
>
> After playing around with the plugin a bit, I was able to get the plugin
> to append the virtual domain by removing "$hostname ." from the
> preg_match call in the determine_user_hostname function in
> functions.php:
>
> --- functions.orig      2009-09-24 08:46:22.000000000 -0400
> +++ functions.php       2009-09-24 08:47:46.000000000 -0400
> @@ -1025,7 +1025,7 @@
>       //
>       // run pattern match against full URI starting after the protocol
> (http(s)://)
>       //
> -      preg_match($allVirtualDomainsAreUnderOneHost, $hostname .
> (strpos($_SERVER['PHP_SELF'], '/') === 0 ? '' : '/') .
> $_SERVER['PHP_SELF'] . (empty($_SERVER['QUERY_STRING']) ? '' :
> (strpos($_SERVER['QUERY_STRING'], '?') === 0 ? '' : '?') .
> $_SERVER['QUERY_STRING']), $matches);
> +      preg_match($allVirtualDomainsAreUnderOneHost,
> (strpos($_SERVER['PHP_SELF'], '/') === 0 ? '' : '/') .
> $_SERVER['PHP_SELF'] . (empty($_SERVER['QUERY_STRING']) ? '' :
> (strpos($_SERVER['QUERY_STRING'], '?') === 0 ? '' : '?') .
> $_SERVER['QUERY_STRING']), $matches);
>       $hostname = $matches[1];
>
>    }
>
> Here is the debug output after making the change defined above:
>
> Your original username was:
> test
>
> ________________________________________________________________________
> Your IMAP login was resolved to:
> test@...
>
> ________________________________________________________________________
> $hostname is virt1.tld
>
> PHP_SELF is /webmail.vitr1.tld/src/redirect.php
>
> ________________________________________________________________________
> IMAP server: localhost
>
> I am wondering if there is something wrong in my configuration or if
> this behavior is a bug. If this behavior is incorrect, is the code
> change I made above the correct solution, or is a better solution?
>
> --
> Regards,
>
> Brett Johnson


--
Paul Lesniewski
SquirrelMail Team
Please support Open Source Software by donating to SquirrelMail!
http://squirrelmail.org/donate_paul_lesniewski.php

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
-----
squirrelmail-plugins mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: squirrelmail-plugins@...
List archives: http://news.gmane.org/gmane.mail.squirrelmail.plugins
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-plugins