Re: Allowing logins like [email protected] into cyrus
Pedro Algarvio <[email protected]> Wed, 31 May 2006 22:11:33 +0100
| Newsgroups | gmane.comp.isp.ispman.devel |
|---|---|
| Message-ID | <[email protected]> |
Quoting Pedro Algarvio <[email protected]>: > After fidling with some cyrus options, I was able to log in into > cyrus > with [email protected] without the need for perdition (yes, I know we > must think of perdition as a way to separate mail for several mail > servers, still, I'd like the option not to use perdition). > > ISPMan already creates a [email protected], so part of the job is > done. > The next part is to instruct saslauthd to pass the realms(add -r to > options), this will make saslauthd pass [email protected] and not > just username or username_domain_tld. > > After that, add to /etc/imapd.conf: > virtdomains: on > > Now we get into more trouble because cyrus does not have that > mailbox, but, if we create the apropriate mailbox, it will work. > > cm [email protected] > > Bellow is the patch to correcly create the mailbox from the console: > ------------------------------------------------------------------------------- > diff -Naur ispman.createMailbox.sav ispman.createMailbox > --- ispman.createMailbox.sav 2006-05-31 01:32:26.000000000 +0100 > +++ ispman.createMailbox 2006-05-31 02:14:07.000000000 +0100 > @@ -27,8 +27,8 @@ > my $str = shift; > ( $uid, $domain ) = split( '@', $str ); > if ($domain) { > - $domain =~ s/\./_/g; > - $str = join '_', ( $uid, $domain ); > + $domain =~ s/\./\\./g; > + $str = join '\@', ( $uid, $domain ); > } > return $str; > } > ------------------------------------------------------------------------------- > > Couldn't get the rest going because I dont know where ISPMan set's > the > mailbox to username_domain_tld, which should become > [email protected], else, it will always fail from the web > interface. > If I know this part, maybe I can get to the bottom of the rest. > > P.S.: Thanks derjohn, we'll continue patching/debugging this subject > when both of us have had some sleep :) > > P.S. 2: Oh, and joerg, please, please, please.... ;) > Ok, it's finaly working, here are the patches I remember to have done :) ------------------------------------------------------------------------------- --- lib/ISPMan/UserMan.pm.sav 2006-05-31 21:46:04.000000000 +0100 +++ lib/ISPMan/UserMan.pm 2006-05-31 21:48:46.000000000 +0100 @@ -586,11 +586,12 @@ # If you don't want this behaviour and just wasn't uid uncomment the next line; # return $userId; - $domain =~ s/\./_/g; - $userId =~ s/\./_/g; +# $domain =~ s/\./_/g; +# $userId =~ s/\./_/g; unless ( $userId =~ /$domain$/ ) { - $userId = join "_", ( $userId, $domain ); + $userId = join "@", ( $userId, $domain ); +# $userId = join "_", ( $userId, $domain ); } return $userId; } ------------------------------------------------------------------------------- --- bin/ispman.createMailbox.sav 2006-05-31 01:32:26.000000000 +0100 +++ bin/ispman.createMailbox 2006-05-31 02:14:07.000000000 +0100 @@ -27,8 +27,8 @@ my $str = shift; ( $uid, $domain ) = split( '@', $str ); if ($domain) { - $domain =~ s/\./_/g; - $str = join '_', ( $uid, $domain ); + $domain =~ s/\./\\./g; + $str = join '\@', ( $uid, $domain ); } return $str; } ------------------------------------------------------------------------------- --- bin/ispman.deleteUser.sav 2006-05-31 19:46:39.000000000 +0100 +++ bin/ispman.deleteUser 2006-05-31 19:46:57.000000000 +0100 @@ -20,8 +20,8 @@ ( $user, $domain ) = split( '@', $ARGV[0] ); $ispmanDomain = $domain; -$domain =~ s/\./_/g; -$uid = join '_', ( $user, $domain ); +$domain =~ s/\./\\./g; +$uid = join '\@', ( $user, $domain ); my $dn = $ispman->getUserDN( $ispmanDomain, $uid ); if ( $ispman->entryExists($dn) ) { ------------------------------------------------------------------------------- --- bin/ispman.setMailboxQuota.sav 2006-05-31 02:19:34.000000000 +0100 +++ bin/ispman.setMailboxQuota 2006-05-31 02:41:43.000000000 +0100 @@ -11,7 +11,18 @@ } require "cyrusadmin.pm"; -$mailbox = join "", ( $mailbox_prefix, $ARGV[0] ); +sub email2uid { + my $str = shift; + ( $uid, $domain ) = split( '@', $str ); + if ($domain) { + $domain =~ s/\./\\./g; + $str = join '\@', ( $uid, $domain ); + } + return $str; +} + + +$mailbox = join "", ( $mailbox_prefix, email2uid($ARGV[0]) ); $quota = $ARGV[1]; try( $imap->set_quota( $mailbox, $quota ) ); ------------------------------------------------------------------------------- You MUST, have one of 'virtdomains: on'/'virtdomains: userid' on /etc/imap.conf, and you also MUST include '-r' on the options of the init script of saslauthd. A funny thing though, after being able to login with that test user, and saving a draft, here are the mailboxes created: [email protected] (\HasNoChildren) [email protected] (\HasChildren) Is this the normal behaviour? Thanks! -- Pedro Algarvio __ ___ ___ _______ ___ __ | Y .' _| _ .-----.' _| |_ .-----.----.-----. |. | | _| 1___| _ | _| _|__| _ | _| _ | |. | |__| |____ |_____|__| |____|__|_____|__| |___ | |: 1 | |: 1 | |_____| |::.. . | |::.. . | [email protected] `-------' `-------' [email protected] ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. ------------------------------------------------------- All the advantages of Linux Managed Hosting--Without the Cost and Risk! Fully trained technicians. The highest number of Red Hat certifications in the hosting industry. Fanatical Support. Click to learn more http://sel.as-us.falkag.net/sel?cmd=lnk&kid7521&bid$8729&dat1642