Author Topic: virtuser_file doesn't seem to be read  (Read 5064 times)

Offline virtuser

  • Newbie
  • *
  • Posts: 4
virtuser_file doesn't seem to be read
« on: June 08, 2011, 03:03:56 AM »
Hi,

I am running a fresh install of roundcube. I am having trouble with virtuser_file. I will have about 10 users who will be using roundcube, and I need them to be able to log in with an alias instead of their actual e-mail address (this will be deployed for a group of not very tech savvy users). I have searched the forum, the official mailing lists, as well as google and tried every suggestion I can.

I created a users.txt file. I have checked and rechecked permissions. I have tried putting the file everywhere I can think of on the filesystem.

I have tried both with and without using $rcmail_config['username_domain'] thinking that it may be duplicating the domain name (doesn't appear to be the case.

This is the only plugin I am using. I currently have:
$rcmail_config['plugins'] = array('virtuser_file');

I have also tried
$rcmail_config['plugins'] = array(virtuser_file);

For my path in:
$rcmail_config['virtuser_file'] = '/vusers.txt';
I have tried using absolute paths, local directory paths, all reflecting the file's current location. I have literally tried moving the file and path to every level of directory structure from the root of the file system all the way to the public webserver and roundcube directories.

I have tried using the virtuser_file with and without a .txt extension.  For the actual file, I have tried emailname@domain.tldaliasname  as well as emailname@domain.tldaliasname. I have even tried every text/linebreak  format possible in my various text editors (UNIX, Windows, Macintosh) as well as unicode thinking that it may not be reading the file.

I know the virtuser_file is being read, because if I purpously rename or move it without updating my configuration, roundcube complains in the error log.

It appears that virtuser_file is just not being processed. When I try to log in, it just passes the username I enter straight to imap, even if it is defined in the virtuser_file.

I have literally spent hours trying different configurations of this attempting to make it work. Does anyone have any advice? This is the only thing holding me back from deploying roundcube.

Thank you for your time and assistance!

Offline ABerglund

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 673
virtuser_file doesn't seem to be read
« Reply #1 on: June 08, 2011, 11:54:58 AM »
I had to use an absolute path in mine, and actually declared the file path in main.inc.php, not in the plugin code.

Code: [Select]

// List of active plugins (in plugins/ directory)
$rcmail_config['plugins'] = array(
        'compose_addressbook',
        'contextmenu',
        'emoticons',
        'help',
        'jqueryui',
        'new_user_dialog',
        'password',
        'vacation',
        'virtuser_file'
);

// Added to get virtuser_file plugin to work
$rcmail_config['virtuser_file'] = '/usr/local/etc/rc-virtusers';


But I'm not certain that the plugin will do what you want it to do. I think all it does is to assist in matching a user account to an email address for creating the identity. At least, that's what I am using it for.

I'm assuming that your IMAP server requires full addresses on login? (Mine does not.) If so, have you looked at the 'username_domain' params in main.inc.php? If the username they use to login is the same as the user part of the address, this should work.

Code: [Select]

// Automatically add this domain to user names for login
// Only for IMAP servers that require full e-mail addresses for login
// Specify an array with 'host' => 'domain' values to support multiple hosts
// Supported replacement variables:
// %h - user's IMAP hostname
// %n - http hostname ($_SERVER['SERVER_NAME'])
// %d - domain (http hostname without the first part)
// %z - IMAP domain (IMAP hostname without the first part)
// For example %n = mail.domain.tld, %d = domain.tld
$rcmail_config['username_domain'] = '';
Arne Berglund
SysAdmin, Internet Services
Lane Education Service District
Eugene, OR, USA

Offline virtuser

  • Newbie
  • *
  • Posts: 4
virtuser_file doesn't seem to be read
« Reply #2 on: June 08, 2011, 06:30:40 PM »
Hi ABerglund, thanks for your reply.

Quote from: ABerglund;35212
I had to use an absolute path in mine, and actually declared the file path in main.inc.php, not in the plugin code.

Sorry for any confusion. I declared this in my main.inc.php as well, not the plugin.

Quote
I'm assuming that your IMAP server requires full addresses on login? (Mine does not.) If so, have you looked at the 'username_domain' params in main.inc.php? If the username they use to login is the same as the user part of the address, this should work.

Yes, the mail server I use does require full username@domain.tld. I have tried both with and without username_domain set. My thought was that by having this set, it would append the domain twice based on what was entered in the file (so that user@domain.tld from the virtuser file would be sent as user@domain.tld@domain.tld but this doesn't seem to be the case at all).

Quote
But I'm not certain that the plugin will do what you want it to do. I think all it does is to assist in matching a user account to an email address for creating the identity. At least, that's what I am using it for.

I hope I understand what the plugin is supposed to do. My understanding is that I can define an alias to an actual e-mail address in the file, and then at the webmail interface use the alias in the username box and the actual IMAP account password in the password box, and the plugin will send the actual username/email address in place of the alias. Whereas right now even though I have specified the alias and e-mail addresses in the virtuser file, it seems to just be ignoring this and sending along the alias that was typed in at the login form (and of course being rejected).

The reason I need to use aliases is that the e-mail addresses that will be used aren't very consistent and most of the users I have don't even know (or won't be able to remember) the full address, even without the domain. We primarily will be using this for internal communication based on address book entries (my plan is to use global address book plugin eventually). To be consistent with our other logon systems, I had planned on using the user's lastname as the alias. So basically, my virtuser file looks like this:

john.smith.depta@example.com smith
jack.g.brown@example.com brown
gsusanfox@example.com fox

From what I can tell in the error logs, if I log in with "brown" as the username and the IMAP password for jack.g.brown@example.com, instead of roundcube trying to authenticate to IMAP as jack.g.brown@example.com it is just sending "brown" (or "brown@example.com" depending on if I have the username_domain param set) as the username to IMAP and obviously failing a the user doesn't exist.

I know the solution would just be to re-do the email system with more consistent usernames, but unfortunately I do not have the option to make changes to the e-mail system at this time.

Thanks again!

Offline ABerglund

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 673
virtuser_file doesn't seem to be read
« Reply #3 on: June 08, 2011, 10:30:17 PM »
I was afraid that your environment would be messy, and I guess I was right.

I still don't think the virtuser_file will do what you need it to do. My understanding (from when I read the code some time ago) is that it is only invoked when a new user first logs in and their database entry is created. I'm not sure that there is an off the shelf solution to your need.
Arne Berglund
SysAdmin, Internet Services
Lane Education Service District
Eugene, OR, USA

Offline virtuser

  • Newbie
  • *
  • Posts: 4
virtuser_file doesn't seem to be read
« Reply #4 on: June 09, 2011, 08:15:07 AM »
Thanks for the info.  Hopefully I can figure out a workaround, I am really stumped as to what virtuser even does in it's current form.

I wish the wiki documentation would be updated to explain the virtuser feature a bit better, or someone here who works on the code could comment and explain exactly how the plugin is supposed to work in the current version.

Offline virtuser

  • Newbie
  • *
  • Posts: 4
virtuser_file doesn't seem to be read
« Reply #5 on: June 09, 2011, 08:30:52 AM »
Okay.. several minutes later I think I found my work around.

In the database itself there is an "alias" field for each user. I just set one as a test, tried to log in, and it worked. My guess is that the virtuser plugin is supposed to fill in that alias user on the first login when the user database entry is created, but for whatever reason in my situation it wasn't happening. Fortunately for me, I have a small set of users so I can set this manually for now and make it work.  Hopefully in the future some type of web management interface is introduced that will let me make changes like this without having to play with SQL.