# HOWTO: qmail+courier-imap-4+vmailmgr+mailfront+omail-admin

## tecknojunky

From the vmailmgr howto: *Quote:*   

>  3.4 VMailMgr IMAP support
> 
> VMailMgr supports Courier-IMAP, but Courier-IMAP does not come with an authentication module for VMailMgr. This means that some minor work is required for making the two work together.
> 
> The steps are:
> ...

 With vmailmgr-0.97, there is no more authvmailmgr because of the new way courier-imap-4 has implmented authentication.

In bugs.gentoo.org, I've found the bug entry for the new vmailmgr-0.97: *comment #1 wrote:*   

> i have removed the block on >=courier-imap-4*, since you can still run it using
> 
> imapfront-auth from the mailfront package...
> 
> the right thing to do, is probably to test, whether courier-imap-4 is installed
> ...

  *comment #2 wrote:*   

> version bumped with following changes:
> 
>  - removed !>=courier-imap-4* from dependencies; it has been replaced with a
> 
> warning message about courier-authlib incompatibility with vmailmgr.
> ...

 

So, it seem this imapfront-auth can do the job, but I can't figure how to use them.  These modules seems more fit to be used by qmail. http://untroubled.org/mailfront/imapfront.html

Anyone has a pointer for me while I sleep.

Thanks.

----------

## tecknojunky

Man,  :Sad:  am I the only one in the whole wide world using vmailmgr to create virtual user mail accounts?

So far, this thread as been the most enlightening

----------

## tecknojunky

Gee.  It is true what they say... a software is as good as it's documentation.   :Sad:  I'm documenting this here mainly for myself and surely for at least one other person in the world who will stumble on the same problems I had.

So far, I think I figured a couple of things.  Qmail, vmailmgr and omail-admin all works and are integrated together.  The hard part is now making courier-imap-4 capable of authenticate users against vmailmgr.

It seems it can work if using Bruce Guenter's Mailfront package, but it is poorly documented (technical, but no practical examples).  SO, this is what I've done so far:

I edited /service/vmailmgrd/run:

```
#!/bin/sh

umask 0

[ -s /etc/vmailmgr/socket-file ] && socket_file="`head -n 1 /etc/vmailmgr/socket-file`"

[ "socket-file" ] || socket_file=/tmp/.vmailmgrd

exec unixserver -v -- $socket_file vmailmgrd -D -V 2>&1
```

The main thing is to know how vmailmgr communicates.  This shows it communicate thrue a socket file define in /etc/vmailmgr/socket-file.  If the file does not exist or is empty, the socket file will be /tmp/.vmailmgrd.

I then transposed the same code logic inside /usr/lib/courier-imap/gentoo-imapd.rc, at the very end:

```
...

[ -s /etc/vmailmgr/socket-file ] && socket_file="`head -n 1 /etc/vmailmgr/socket-file`"

[ "socket-file" ] || socket_file=/tmp/.vmailmgrd

CVM_SASL_PLAIN=cvm-local:$socket-file

export CVM_SASL_PLAIN

eval $PRERUN \

/usr/lib/courier-imap/couriertcpd -address=$ADDRESS \

        -stderrlogger=/usr/lib/courier-imap/courierlogger \

        -stderrloggername=imapd \

        -maxprocs=$MAXDAEMONS -maxperip=$MAXPERIP \

        -pid=$PIDFILE $TCPDOPTS \

        $PORT /var/qmail/bin/imapfront-auth \

                /usr/sbin/courier-imapd ${MAILDIR}
```

The vmailmgr Mailfront module should then be able to identify the proper socket file to communicate with vmailmgrd.

I also modified the /etc/init.d/courier-imap init script to replace the dependency on courier-authlib by svscan.  This last thing is kosher stuff.  I think that ideally, courier-imap should also be started thrue a daemontools supervised script.

Anyhow, it still does not work, as the log inside /var/log/mail.log shows when I try to connect to the imap account with evolution:

```
Jan 10 12:33:04 manitou imapd: imapfront-auth[24712]: SASL AUTH CRAM-MD5 failed

Jan 10 12:33:04 manitou imapd: imapfront-auth[24712]: B00009 NO AUTHENTICATE failed: Unrecognized authentication mechanism.
```

So, I guess someone along the chain is not speaking the right crypting language.

That's where I'm at at this moment.  Any help is more than welcome.

----------

## tecknojunky

Thanks for the overwhelming help.  Truly, I don't know what I would do without Gentoo's forums (I'm sarcastic, in case you did not notice).

So, now the virtual user is authentified.  What seems to happen is that courier-imap seems to stall when it tries to display the imap folders inside Evolution.

The logs reads like this:

```
@4000000043cc7b6a00a26c14 tcpserver: status: 1/150

@4000000043cc7b6a00a2b264 tcpserver: pid 25545 from 192.168.1.2

@4000000043cc7b6a00a2be1c tcpserver: ok 25545 manitou.inet:::ffff:192.168.1.11:143 :::ffff:192.168.1.2::47291

@4000000043cc7b6a00a2d58c imapfront-auth[25545]: * OK imapfront ready.

@4000000043cc7b6a00a2e52c imapfront-auth[25545]: * CAPABILITY IMAP4rev1

@4000000043cc7b6a00a2f0e4 imapfront-auth[25545]: B00000 OK CAPABILITY completed

@4000000043cc7b6e012d5694 INFO: LOGIN, user=stephane, ip=[192.168.1.2], protocol=IMAP

@4000000043cc7b981502a3a4 INFO: DISCONNECTED, user=stephane, ip=[192.168.1.2], headers=0, body=0, time=42

@4000000043cc7b9815030934 tcpserver: end 25545 status 0

@4000000043cc7b98150314ec tcpserver: status: 0/150
```

What I find odd is the user= which don't have the trailing @domain to it.  This is a vmailmgr virtual user account.  I'm unable to verify if this is normal or not.

Can someone, at least, tell me this.  :Rolling Eyes:  If not, I'm clearly in the wrong forums, either doing things really too weirdo (which I don't think I am) for a bunch of green noobs (which I don't think you are..., at least not all of you), or I've been using the wrong distribution for the last 3 years (which I'm starting to think I have) with the dodgy Qmail implementation and lack of support. 

an that  felt good saying all of this... time to let the steam build up again.

----------

## chuckbrady

I'm not sure if anyone else is still working on this or now, but I am  :Smile: 

I have been able to get sqwebmail authenticating to courier-imap (haven't tried ssl yet) through imapfront-auth and cvm-vmailmgr.

The current problem I am having is this:

# cvm-testclient cvm-vmailmgr blah rxxxxx.com xxxxxx

user name:        blah

user ID:          510

group ID:         510

real name:        (null)

directory:        /store/md0/home/r01/users/blah

shell:            (null)

group name:       (null)

system user name: r01

system directory: /store/md0/home/r01

domain:           rxxxxx.com

mailbox path:     /store/md0/home/r01/users/blah

qmail delivers to the mailbox path. Courier-imap tries to read from directory/Maildir. At this point I can receive and authenticate without a problem, but I am not able to retrieve properly. Any one else see similar behaviour?

Chuck

----------

## tecknojunky

omg!   :Shocked:  Finally, an answer.   :Very Happy: 

Could you elaborate your setup more.  Mainly, what are the supervise scripts that you have?  I have stuff that I gathered from ledt and right on the web but I'm unsure if everything is stiched together proper.  :Confused: 

----------

## chuckbrady

Ok, here's a little more detail about my setup and outputs. This is going to be a migration from an existing setup (non-Gentoo) that has been running for several years. Some of the things I've done on the new Gentoo build are a little hacked together as I try to get things working, so bear with me.

cat /service/courier-imap/run:

export CVM_SASL_PLAIN="cvm-local:/tmp/.cvm-vmailmgr"

exec 2>&1

exec /usr/bin/tcpserver -HRv -c 150 0 143 \

     /var/qmail/bin/imapfront-auth \

     /usr/sbin/courier-imapd

cat /service/cvm-vmailmgr/run

#!/bin/sh

exec /usr/bin/softlimit -m 9000000 \

 /usr/local/bin/cvm-vmailmgr-local /tmp/.cvm-vmailmgr 2>&1

cat /service/vmailmgrd/run

#!/bin/sh

umask 0

if [ -s /etc/vmailmgr/socket-file ]; then

  socket_file="`head -1 /etc/vmailmgr/socket-file`"

else

  socket_file=/tmp/.vmailmgrd

fi

exec unixserver -v -- $socket_file vmailmgrd -D -V 2>&1

Other files (/var/qmail/control/virtualdomains) is setup as expected. The output from cvm-testclient is show above. Mail does get delieverd to: /store/md0/home/r01/users/blah/new as it should.

Output from sqwebmail login (courier-imap) with r01/users/blah/Maildir created.

tail /var/log/qmail/courier-imap/current:

@400000004436c16732a84cc4 tcpserver: status: 1/150

@400000004436c16732a85494 tcpserver: pid 29104 from 127.0.0.1

@400000004436c167333bd264 tcpserver: ok 29104 localhost:::ffff:127.0.0.1:143 :::ffff:127.0.0.1::44456

@400000004436c167334432ec imapfront-auth[29104]: * OK imapfront ready.

@400000004436c167336514e4 INFO: LOGIN, user=brady, ip=[127.0.0.1], protocol=IMAP@400000004436c167337783a4 INFO: LOGOUT, user=blah, ip=[127.0.0.1], headers=0, body=0, time=0

@400000004436c16733778f5c tcpserver: end 29104 status 0

@400000004436c16733779344 tcpserver: status: 0/150

@400000004436c16802f86dec tcpserver: status: 1/150

@400000004436c16802f875bc tcpserver: pid 29105 from 127.0.0.1

@400000004436c168038a2a84 tcpserver: ok 29105 localhost:::ffff:127.0.0.1:143 :::ffff:127.0.0.1::44457

@400000004436c1680392c5a4 imapfront-auth[29105]: * OK imapfront ready.

@400000004436c16803b35594 INFO: LOGIN, user=blah, ip=[127.0.0.1], protocol=IMAP@400000004436c1680447062c INFO: LOGOUT, user=blah, ip=[127.0.0.1], headers=0, body=0, time=0

@400000004436c168044711e4 tcpserver: end 29105 status 0

@400000004436c168044719b4 tcpserver: status: 0/150

@400000004436c1680719c1b4 tcpserver: status: 1/150

@400000004436c1680719c984 tcpserver: pid 29106 from 127.0.0.1

@400000004436c16807b46b74 tcpserver: ok 29106 localhost:::ffff:127.0.0.1:143 :::ffff:127.0.0.1::44458

@400000004436c16807bd0a7c imapfront-auth[29106]: * OK imapfront ready.

@400000004436c16807ddc564 INFO: LOGIN, user=blah, ip=[127.0.0.1], protocol=IMAP@400000004436c168083dc784 INFO: LOGOUT, user=blah, ip=[127.0.0.1], headers=0, body=0, time=0

@400000004436c16808522274 tcpserver: end 29106 status 0

@400000004436c16808522e2c tcpserver: status: 0/150

Obviously, I don't get any mail delivered there. The system tries to deliver to r01/users/blah/new, not r01/users/blah/Maildir/new as it did on the old server. This is the output if I don't have the blah/Maildir structure created:

tail /var/log/qmail/courier-imap/current:

@400000004436c27c27ad91e4 tcpserver: status: 1/150

@400000004436c27c27ad9d9c tcpserver: pid 29126 from 127.0.0.1

@400000004436c27c2895abdc tcpserver: ok 29126 localhost:::ffff:127.0.0.1:143 :::ffff:127.0.0.1::58636

@400000004436c27c289e4ecc imapfront-auth[29126]: * OK imapfront ready.

@400000004436c27c28bd1d84 chdir ./Maildir: No such file or directory

@400000004436c27c28ec304c tcpserver: end 29126 status 256

@400000004436c27c28ec3c04 tcpserver: status: 0/150

The output /var/log/qmail/cvm-vmailmgr/current isn't very telling. It just shows that I authenticated. At this point, I have two paths to pursue. The first is to get courier-imap to look at users/blah/ like the older version with authvmailmgr did, instead of users/blah/Maildir.

The second is to get qmail to deliver the mail to users/blah/Maildir and move all the user's mail to that structure. I don't mind going with either solution.

If, as someone who hasn't done anything more than scripting in years, I were to take a guess, I think that imapfront-auth is either not passing the mailbox path that it is getting from cvm; or courier-imap is taking mailbox path or directory from cvm and appending the default Maildir. Maybe this weekend I'll dust off some of my old programming books if no one has an answer.

Chuck

----------

## tecknojunky

cat /service/courier-imap/run

```
#!/bin/sh

[ -s /etc/vmailmgr/socket-file ] && socket_file="`head -n 1 /etc/vmailmgr/socket-file`"

[ "$socket_file" ] || socket_file=/tmp/.vmailmgrd

CVM_SASL_PLAIN=cvm-local:$socket_file

export CVM_SASL_PLAIN

CVM_SASL_LOGIN=cvm-vmailmgr-local:$socket_file

export CVM_SASL_LOGIN

. /etc/courier-imap/imapd

export DEBUG=2

exec 2>&1

exec softlimit -m 3000000 \

        tcpserver -dHRvX \

        -c "30" \

        0 imap \

        /var/qmail/bin/imapfront-auth \

        /usr/sbin/courier-imapd
```

I don't have a supervised cvm-vmailmgr service.  I will try adding that.

cat /service/vmailmgrd/run

```
#!/bin/sh

umask 0

if [ -s /etc/vmailmgr/socket-file ]; then

  socket_file="`head -1 /etc/vmailmgr/socket-file`"

else

  socket_file=/tmp/.vmailmgrd

fi

exec unixserver -v -- $socket_file vmailmgrd -D -V 2>&1
```

tail /var/log/qmail/courier-imap/current

```
Jan 15 19:14:29 manitou imapd: imapfront-auth[5206]: B00001 NO LOGIN failed

Jan 15 22:07:55 manitou imapd: imapfront-auth[6919]: * OK imapfront ready.

Jan 15 22:07:55 manitou imapd: imapfront-auth[6919]: * CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE AUTH=PLAIN

Jan 15 22:07:55 manitou imapd: imapfront-auth[6919]: B00000 OK CAPABILITY completed

Jan 15 22:08:01 manitou imapd: imapfront-auth[6919]: B00001 NO LOGIN failed

Jan 16 00:30:06 manitou imapd: imapfront-auth[8141]: * OK imapfront ready.

Jan 16 00:30:06 manitou imapd: imapfront-auth[8141]: * CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE AUTH=PLAIN

Jan 16 00:30:06 manitou imapd: imapfront-auth[8141]: B00000 OK CAPABILITY completed

Jan 16 00:30:11 manitou imapd: imapfront-auth[8141]: B00001 NO LOGIN failed

Jan 16 00:30:18 manitou imapd: imapfront-auth[8141]: B00002 NO LOGIN failed
```

So, I can't even get to where you are apart the cvm-vmailmgr that is not running.

I will give it a shot tommorow because now I'm really super tired.  I'll post back result and hopefully get to where you are at and even more hopefully it will work and then we'll compare.

----------

## StupID

tecknojunky,

  Meet the one other user you where looking for.  I had upgraded to courier-imap 4 and then could not authenticate.  Saw you post and got severly depressed.  I am just glad I had quickpkg'ed courier-imap and vmailmgr before I tried the upgrade.  You seem to have put a lot of effort into it and still dont have it working.  Are you still trying to get it to work or have you migrated away from VMailMgr?

----------

## tecknojunky

I am still trying for the last 4 months.  :Rolling Eyes:  Back then I have migrated all of the services from one server to another, except the mail service.  Guess why.  So I since have two servers.  :Sad: 

I had luck when courier-imap hitted 4 because I was using either real users or aliases, so it kept working.  Why use vmailmgr you ask?  Well, now I have several domains that are not mine and I would really love to give each of them an account to control their mail users.

ok, this is not a diary, but I'll jut add that today is saterday and I have a couple of things I have to do today (beside getting up late  :Wink: ).  I will definitly add this on the task list of the day.  :Very Happy: 

Wellcome onboard.

----------

## chuckbrady

Well, I have Vmailmgr, courier-imap 4.01, cvm-vmailmgr, and squirrelmail all working together finally. I'm going to work on the pop3 and ssl-pop/imap next. It ain't pretty, but what I did was put a symbolic link "ln -s . Maildir" into the home directory so that courier-imap and qmail both deliver to and see the same directories. It's amazing what moments of clarity at a bar can bring you  :Smile: 

I'll post an update once I have everything working as it should, but I don't think I'll run into too many more problems not that webmail and imap are working. I would really like to find a cleaner solution than the symbolic link hack if anyone has any ideas...

Chuck

----------

## tecknojunky

I find it odd you have that kind of problem because for me I simply set .Maldir in both qmail and courier-imap setup files and it works as is.  All they both need is a well defined HOME, which is one of the things vmailmgr will redefine for a virtual user.

----------

## chuckbrady

It is possible I've had something wrong for quite a while. Local mail delivery goes to Maildir on my old server, but vmailmgr mail has always gotten delivered to r01/users/blah/new instead of r01/users/blah/Maildir/new. I just assumed that was the way vmailmgr worked when I set it up the first time a few years ago. I'll spend a little more time looking into it.

Brady

----------

## tecknojunky

I never had that kind of configuration.

```
# ls /home/vmailmgr/users/test/

cur/  new/  tmp/
```

While real users have a .maildir folder.

```
# ls /home/tecknojunky/.maildir/

courierimaphieracl/  courierimapkeywords/  courierimapsubscribed  courierimapuiddb  cur/  new/  tmp/
```

Maybe you want vmailmgr to behave differently than what it was meant to.

I'm really happy you have a working setup.  I really do.  I just would appreciate you stick around with your setup just to get mine going.  I promise I will make a howto for others to refer to once I get the hang of all the intricacies.

----------

## chuckbrady

Ok, it looks like our setups are pretty much the same. vmailmgr users don't have a maildir, real users do. What I'm doing now is passing a maildir value of . to courier-imapd and courier-pop3d. For some reason though, with authvmailmgr I didn't need to do that explicitly. Through supervise, I have both of them working now. I have been spending some time to try and get them working through rc scripts so it will be easier to get the ebuild to do it in the future.

I have been working on it on and off today so I haven't put in as much time as I'd like, but I'm not going anywhere until we both have a fully working environment for vmailmgr, courier, qmail and cvm. I still want to get relay-ctl, SpamAssassin and virus scanning like my old environment has before I say this is done. Then I have two more identical servers to build so I would be very much interested in helping you with the HOWTO or wiki for it.

Chuck

----------

## tecknojunky

I hear you loud and clear.  I'm on it right now.  Hold and behold, now evolution is asking for a password.  Woot!  :Very Happy:  But it does not authenticate.  I'm trying to get a log to the supervised cvm-vmailmgr service, but I dont know why it wont start it.  Probably something stupid... like I was wondering why I was getting [supervise] <defunct> for it, until I realized I forgot to chmod a+x the run script.   :Embarassed:    Gee.  :Rolling Eyes:  Berstein stuuf is so off compared to the rest of unix dialect, that once it's set you forget and when you thinker with it you have to relearn all over again.  :Laughing:  At least it's my case, even though I've been using qmail for close to 5 years now.

----------

## tecknojunky

Ok, there's a point I'm missing.  

Cvm-vmailmgr is started by listening to authentication requests from Courier-imap on the socket file /tmp/.cvm-vmailmgr, yet vmailmgrd is told to create a socket on whatever file is stated inside /etc/vmailmgr/socket-file which is /var/lib/supervise/vmailmgrd/socket (kinda pointless but that's how the ebuild author did things).

Now, how do cvm-vmailmgr and vmailmgrd get to talk to each other?  I mean, those sockets could be created anywhere inside the filesystem and yet neither cvm-vmailmgr nor vmailmgrd is set with the location of the other's socket.

Another thing I'm at odd with, why use tcpserver with cvm-vmailmgr when you use a socket file?  Should not unixserver be used in that case?

----------

## chuckbrady

Here is my understanding of how things are working. May or may not be accurate, but since no one seems to be around to correct me...  :Smile: 

vmailmgrd is run using unixserver to the socket file defined in /etc/vmailmgr/socketfile (/var/lib/supervise/vmailmgrd/socket)

cvm-vmailmgr-local is running to the /tmp/.cvm-vmailmgr. I'm guessing that cvm-vmailmgr-local knows to look at /etc/vmailmgr/socketfile to determine how to communicate with the vmailmgr daemon, and /tmp/.cvm-vmailmgr is specifying how other cvm agents can talk to cvm-vmailmgr-local

tcpserver is running courier-imap via imapfront-auth. Imapfront-auth knows to communicate with cvm-vmailmgr-local on /tmp/.cvm-vmailmgr by the export CVM_SASL_PLAIN="cvm-local:/tmp/.cvm-vmailmgr"  definition.

My guess is:

New connection -> imapfront-auth -> /tmp/.cvm-vmailmgr 

                                                      cvm-vmailmgr-local -> `cat /etc/vmailmgr/socketfile` -> vmailmgr

                            imapfront-auth -> courier-imapd

----------

## chuckbrady

I've learned with the supervise stuff to make sure I've created the run and log/run before ever linking it. If you create the log/run after linking, it doesn't seem to automatically start it, at least for me. The other thing I'll do is have multiple windows and just execute the run script by hand (without exec) so I can see the output as it scrolls by until I know I've got the run script finalized. It helped a lot with troubleshooting what was happening between Evolution and the server, and saved on svc -u/d commands.

----------

## grishnav

Hey tek,

(I'm still reading the thread.)

I'm also using vmailmgr... prefer it greatly to vpopmail. I filed a bug back when courier 4 came out and got a CANTFIX/WONTFIX back. I recommeded they block the new versions of courier with vmailmgr and issue a warning, but it never had happened (as far as I knew). I had blocked courier-imap at 3.0.whatever on my system with the nifty new (I think it was, at the time) /etc/portage/package.mask and just shelled it away so that hopefully if it got hacked nothing would be easily exposed.  I didn't count on vmailmgr suddenly stepping from 96 to 97 and removing the old auth modules!

And then, of course, since whatever brilliant Gentoo dev made it seem like the upgraded version worked just fine with couriper-imap 4 through this "imapauth" thingy, I went ahead and removed the block and started the upgrade, obliterating the rest of my mail setup.

Then I found your thread. Now I'm screwed, aren't I?  :Sad: 

Vmailmgr isn't used much any more because it's largely an abandoned project. Last update in 2005! And it was 2002 when Courier 4 came out... It's too bad, because I like the way it works much better than the flaky vpopmail. But oh well.

Anyway, just thought I'd let you all know you're not alone...

----------

## grishnav

 *chuckbrady wrote:*   

> vmailmgr users don't have a maildir, real users do. 

 

Yes they do, it's just not called "maildir".

A maildir is just a directory structured correctly for maildir delivery, ie. /maildir/cur, /maildir/new, /maildir/tmp... It can be called anything. In /home/user1/users/virtuser/ /virtusr is a maildir. It's just not called Maildir, maildir, .maildir,.Maildir, or any of the other variations...

----------

## grishnav

I can't even get cvm to install....

>>> Unpacking source...

>>> Unpacking cvm-0.32.tar.gz to /var/tmp/portage/cvm-0.32-r1/work

>>> Source unpacked.

( echo '#!/bin/sh'; \

  echo 'main="$1"; shift';\

  echo 'rm -f "$main"';\

  echo 'ar cr "$main" ${1+"$@"}';\

  echo 'ranlib "$main"';\

) >makelib

chmod 755 makelib

( bgincs=`head -n 1 conf-bgincs`; \

  echo '#!/bin/sh'; \

  echo 'source=$1; shift'; \

  echo 'base=`echo "$source" | sed -e s:\\\\.c$::`'; \

  echo exec `head -n 1 conf-cc` -I. "-I'${bgincs}'" '-o ${base}.o -c $source ${1+"$@"}'; \

) >compile

chmod 755 compile

./compile qmail-domains.c

qmail-domains.c:21:23: dict/dict.h: No such file or directory

qmail-domains.c:22:23: dict/load.h: No such file or directory

qmail-domains.c:23:21: str/str.h: No such file or directory

In file included from qmail-domains.c:25:

qmail.h:4:21: str/str.h: No such file or directory

In file included from qmail-domains.c:25:

qmail.h:8: error: syntax error before "str"

qmail.h:8: warning: no semicolon at end of struct or union

qmail.h:11: error: syntax error before "homedir"

qmail.h:11: warning: data definition has no type or storage class

qmail.h:13: error: syntax error before "ext"

qmail.h:13: warning: data definition has no type or storage class

qmail.h:23: error: syntax error before "str"

qmail.h:27: error: syntax error before "str"

qmail.h:33: error: syntax error before "str"

qmail-domains.c:27: error: syntax error before "vdomains"

qmail-domains.c:27: warning: data definition has no type or storage class

qmail-domains.c:29: error: syntax error before "vdomains_path"

qmail-domains.c:29: warning: data definition has no type or storage class

qmail-domains.c:31: error: syntax error before "locals"

qmail-domains.c:31: warning: data definition has no type or storage class

qmail-domains.c:33: error: syntax error before "locals_path"

qmail-domains.c:33: warning: data definition has no type or storage class

qmail-domains.c:35: error: syntax error before '*' token

qmail-domains.c: In function `map_lower':

qmail-domains.c:37: error: `s' undeclared (first use in this function)

qmail-domains.c:37: error: (Each undeclared identifier is reported only once

qmail-domains.c:37: error: for each function it appears in.)

qmail-domains.c: In function `load_vdomains':

qmail-domains.c:56: error: request for member `s' in something not a structure or union

qmail-domains.c:62: error: `dict_str_free' undeclared (first use in this function)

qmail-domains.c:63: error: request for member `s' in something not a structure or union

qmail-domains.c: In function `load_locals':

qmail-domains.c:69: error: request for member `s' in something not a structure or union

qmail-domains.c:76: error: request for member `s' in something not a structure or union

qmail-domains.c: At top level:

qmail-domains.c:101: error: syntax error before "str"

qmail-domains.c: In function `qmail_domains_lookup':

qmail-domains.c:103: error: `dict_entry' undeclared (first use in this function)

qmail-domains.c:103: error: `e' undeclared (first use in this function)

qmail-domains.c:105: error: `domain' undeclared (first use in this function)

qmail-domains.c:105: error: `d' undeclared (first use in this function)

qmail-domains.c:110: error: `prefix' undeclared (first use in this function)

qmail-domains.c:122: error: `str' undeclared (first use in this function)

qmail-domains.c:122: error: syntax error before ')' token

make: *** [qmail-domains.o] Error 1

!!! ERROR: net-libs/cvm-0.32-r1 failed.

!!! Function src_compile, Line 29, Exitcode 2

!!! (no error message)

!!! If you need support, post the topmost build error, NOT this status message.

----------

## grishnav

Got a new version of cvm to install, but now cvm-vmailmgr won't...

----------

## grishnav

Christ...

Well, found a packaged version of the old courier-imap that I still had lying around. Reloaded it and masked the new version of vmailmgr. Hopefully I'll be able to get my email back up for hnow. I'll be watching this thread and I'll try to help out when I have more time to mess with this. I'd love to get the new version of courier going. Keep it up guys!  :Smile: 

----------

## tecknojunky

Well, if you go up and down, left and right on Bruce Guenter's website untroubled.somthin, it seem vmailmgr, although maybe not maintained much anymore, is still supported/used.

What I like most out of it is the ability to have a distinct user for each domain. compared to vpopmail that, to my understanding, has only a single user to maintain all the domains.  That's why I'm trying to get it going, but before long, if it can't be made to work, if documentation will never be clear/complete, I'll have no other esort than to ditch it, to my greath sorrow.

----------

## chuckbrady

Sorry I missed this on previous posts. I had to install cvm-vmailmgr manually from latest downloaded source, and for anything dependent on it, I did an emerge --nodeps. As I've said, I have all the functionality of pop3, imap, and qmail working via supervise scripts. I still haven't gotten them into rc scripts, ssl portions, or relay-ctl working yet. Yesterday was too nice outside for me to put much time in. Tonight I will have a few hours.

----------

## chuckbrady

Ok, so now I have the gentoo-*.rc scripts working, including SSL support.

In the /etc/init.d/courier-* files:

  I changed the dependencies to no longer need courier-authlib

  I changed the start-stop-daemon line to remove the '/usr/bin/env -' from the start

In the /usr/lib/courier-imap/gentoo-imap*.rc files I made the following changes:

  CVM_SASL_PLAIN="cvm-local:/tmp/.cvm-vmailmgr"

  export CVM_SASL_PLAIN

  ...

  ...

  -pid=$PIDFILE $TCPDOPTS $PORT

  /var/qmail/bin/imapfront-auth \

  /usr/sbin/courier-imapd .

  #     $PORT ${exec_prefix}/sbin/imaplogin \

  #             /usr/sbin/courier-imapd ${MAILDIR}

In the /usr/lib/courier-pop3d*.rc files I made the following changes:

  /var/qmail/bin/pop3front-auth cvm-vmailmgr \

  /usr/sbin/courier-pop3d .

  #     ${exec_prefix}/sbin/pop3login \

  #             /usr/sbin/courier-pop3d ${MAILDIR}

The rest of my config looks like:

cat service/vmailmgrd/run

#!/bin/sh

umask 0

if [ -s /etc/vmailmgr/socket-file ]; then

  socket_file="`head -1 /etc/vmailmgr/socket-file`"

else

  socket_file=/tmp/.vmailmgrd

fi

exec unixserver -v -- $socket_file vmailmgrd -D -V 2>&1

cat service/cvm-vmailmgr/run

#!/bin/sh

exec /usr/bin/softlimit -m 9000000 \

 /usr/local/bin/cvm-vmailmgr-local /tmp/.cvm-vmailmgr 2>&1

I also compiled cvm-0.76 manually, and needed to emerge packages depending on cvm without dependencies. I am still working on refining the setup and have another server to build to test it fully. I would like to hear from anyone else if they are still working on this and able to get it working or not.

Next up is smtp-auth, clamav, and SpamAssassin. I'll post back once I have the complete stack working.

----------

## tecknojunky

```
 # cvm-testclient cvm-vmailmgr stephane@tecknojunky.com tecknojunky.com

cvm-testclient: Fatal: Authentication failed, error #100 (Credentials rejected)
```

So I guess this does not get the proper stuffs from vmailmgr.

My cvm-vmailmgr run script is rather simplistic.

```
/service/cvm-vmailmgr/run

#!/bin/sh

exec /usr/bin/softlimit -m 9000000 \

/usr/bin/cvm-vmailmgr-local /tmp/.cvm-vmailmgr 2>&1
```

And my courier-imapd run script:

```
#!/bin/sh

CVM_SASL_PLAIN=cvm-local:cvm-local:/tmp/.cvm-vmailmgr

export CVM_SASL_PLAIN

. /etc/courier-imap/imapd

export DEBUG=2

exec 2>&1

exec \

        tcpserver -dHRvX \

        -c "30" \

        0 imap \

        /var/qmail/bin/imapfront-auth \

        /usr/sbin/courier-imapd
```

Finally, I never posted my qmail's conf-imap:

```
# Configuration file for qmail-smtpd

# $Header: /var/cvsroot/gentoo-x86/mail-mta/qmail/files/conf-smtpd-r16,v 1.2 2005/08/14 11:01:44 hansmi Exp $

# Stuff to run before tcpserver

#QMAIL_TCPSERVER_PRE=""

# Stuff to run qmail-smtpd

#QMAIL_SMTP_PRE=""

# Stuff to after qmail-smtpd

#QMAIL_SMTP_POST=""

# this turns off the IDENT grab attempt on connecting

TCPSERVER_OPTS="${TCPSERVER_OPTS} -R"

# fixcrio inserts missing CRs at the ends of lines. See:

# http://cr.yp.to/ucspi-tcp/fixcrio.html

# http://cr.yp.to/docs/smtplf.html

# DO NOT enable this when you are using SSL/TLS (USE=ssl)!

#QMAIL_SMTP_PRE="${QMAIL_SMTP_PRE} fixcrio"

# You might want to use rblsmtpd with this, but you need to fill in a RBL

# server here first, see http://cr.yp.to/ucspi-tcp/rblsmtpd.html for more

# details

#QMAIL_SMTP_PRE="${QMAIL_SMTP_PRE} rblsmtpd -r RBL-SERVER"

# If you are interested in providing POP or IMAP before SMTP type relaying,

# emerge relay-ctrl, then uncomment the next 2 lines

#QMAIL_TCPSERVER_PRE="${QMAIL_TCPSERVER_PRE} envdir /etc/relay-ctrl relay-ctrl-chdir"

#QMAIL_SMTP_PRE="${QMAIL_SMTP_PRE} relay-ctrl-check"

# In /etc/courier-imap/authdaemonrc add the next line to the end:

#authmodulelist="${authmodulelist} relay-ctrl-allow"

# Then in /etc/courier-imap/{imapd,imapd-ssl,pop3d,pop3d-ssl}

# Add this at the end

#PRERUN="${PRERUN} envdir /etc/relay-ctrl relay-ctrl-chdir"

# This next block is for SMTP-AUTH

# WARNING: If you've installed qmail with USE=noauthcram, and you want to use

# the following programs, you proably need to install them.

# Example using cmd5checkpw

# See the manpage for cmd5checkpw for details on the passwords

#QMAIL_SMTP_CHECKPASSWORD="/bin/cmd5checkpw"

# Example for checkpassword-pam (emerge checkpassword-pam)

# Don't forget to make /usr/bin/checkpassword-pam sticky (see README.auth)

#QMAIL_SMTP_CHECKPASSWORD="/usr/bin/checkpassword-pam -s system-auth"

QMAIL_SMTP_CHECKPASSWORD="/usr/bin/checkvpw"

[[ -n "${QMAIL_SMTP_CHECKPASSWORD}" ]] && {

        [[ -z "${QMAIL_SMTP_POST}" ]] && QMAIL_SMTP_POST=/bin/true

        QMAIL_SMTP_POST="${QMAIL_SMTP_CHECKPASSWORD} ${QMAIL_SMTP_POST}"

}

```

In that last file, I'm wondering mostly about the MAIL_SMTP_CHECKPASSWORD setting.   But I'm guessing this is for authenticating on the smtp server, which I wish to leave open and controled by tcpserver.

Is there any other information would require to help me out?

----------

## chuckbrady

Ok, I now have everything working the way I want, minus a few tweaks around virus and spam.

Looking at your cvm-testclient, command, it looks like the sytanx is a little wrong. It is a little counter-intuitive, but you it should look more like the following line even though everywhere else the username is part of the domain:

cvm-testclient cvm-vmailmgr stephane tecknojunky.com XXPASSXX

See if that works for your setup.

I'm not really using the conf-imap files. I'm using the /etc/courier-imap files for most things.

For SMTP-AUTH, I added the following line to my conf-smtpd. This allows any user to use SMTP-AUTH via their normal IMAP/POP username/password. I'll work on the SSL/TLS SMTP as time allows.

REQUIRE_AUTH=true

And modified my /service/qmail-smtpd/run as follows:

CVM_SASL_PLAIN="cvm-local:/tmp/.cvm-vmailmgr"

export CVM_SASL_PLAIN

SERVICE=smtp

source /var/qmail/bin/qmail-config-system && \

exec /usr/bin/softlimit ${SOFTLIMIT_OPTS} \

    ${QMAIL_TCPSERVER_PRE} \

    /usr/bin/tcpserver ${TCPSERVER_OPTS} -x ${TCPSERVER_RULESCDB} \

    -c ${MAXCONN} -u ${QMAILDUID} -g ${NOFILESGID} \

    ${TCPSERVER_HOST} ${TCPSERVER_PORT} \

    ${QMAIL_SMTP_PRE} /var/qmail/bin/smtpfront-qmail \

    2>&1

#    ${QMAIL_SMTP_PRE} /var/qmail/bin/qmail-${SERVICE}d ${QMAIL_SMTP_POST} \

----------

## tecknojunky

 *chuckbrady wrote:*   

> Ok, I now have everything working the way I want, minus a few tweaks around virus and spam.
> 
> Looking at your cvm-testclient, command, it looks like the sytanx is a little wrong. It is a little counter-intuitive, but you it should look more like the following line even though everywhere else the username is part of the domain:
> 
> cvm-testclient cvm-vmailmgr stephane tecknojunky.com XXPASSXX
> ...

 

Yup.  Seem I was using it wrong:

```
# cvm-testclient cvm-vmailmgr stephane tecknojunky.com XXPASSXX

user name:        stephane

user ID:          11188

group ID:         100

real name:        (null)

directory:        /var/qmail/users/tecknojunky.com/users/stephane

shell:            (null)

group name:       (null)

system user name: tecknojunky_com

system directory: /var/qmail/users/tecknojunky.com

domain:           tecknojunky.com

mailbox path:     /var/qmail/users/tecknojunky.com/users/stephane
```

So, I don't get any log entries nowhere that would indicate me what's going wrong.  Evolution always ask for the password.

Here's the courier-imap configuration file.  I'd appreciate you compare it to yours. 

```
##VERSION: $Id: imapd.dist.in,v 1.32 2004/11/25 04:57:04 mrsam Exp $

#

# imapd created from imapd.dist by sysconftool

#

# Do not alter lines that begin with ##, they are used when upgrading

# this configuration.

#

#  Copyright 1998 - 2004 Double Precision, Inc.  See COPYING for

#  distribution information.

#

#  This configuration file sets various options for the Courier-IMAP server

#  when used with the couriertcpd server.

#  A lot of the stuff here is documented in the manual page for couriertcpd.

#

#  NOTE - do not use \ to split long variable contents on multiple lines.

#  This will break the default imapd.rc script, which parses this file.

#

##NAME: ADDRESS:0

#

#  Address to listen on, can be set to a single IP address.

#

# ADDRESS=127.0.0.1

ADDRESS=0

##NAME: PORT:1

#

#  Port numbers that connections are accepted on.  The default is 143,

#  the standard IMAP port.

#

#  Multiple port numbers can be separated by commas.  When multiple port

#  numbers are used it is possible to select a specific IP address for a

#  given port as "ip.port".  For example, "127.0.0.1.900,192.68.0.1.900"

#  accepts connections on port 900 on IP addresses 127.0.0.1 and 192.68.0.1

#  The previous ADDRESS setting is a default for ports that do not have

#  a specified IP address.

PORT=143

##NAME: AUTHSERVICE:0

#

#  It's possible to authenticate using a different 'service' parameter

#  depending on the connection's port.  This only works with authentication

#  modules that use the 'service' parameter, such as PAM.  Example:

#

#  AUTHSERVICE143=imap

#  AUTHSERVICE993=imaps

##NAME: MAXDAEMONS:0

#

#  Maximum number of IMAP servers started

#

MAXDAEMONS=40

##NAME: MAXPERIP:0

#

#  Maximum number of connections to accept from the same IP address

MAXPERIP=4

##NAME: PIDFILE:0

#

#  File where couriertcpd will save its process ID

#

PIDFILE=/var/run/imapd.pid

##NAME: TCPDOPTS:0

#

# Miscellaneous couriertcpd options that shouldn't be changed.

#

TCPDOPTS="-nodnslookup -noidentlookup"

##NAME: IMAP_CAPABILITY:1

#

# IMAP_CAPABILITY specifies what most of the response should be to the

# CAPABILITY command.

#

# If you have properly configured Courier to use CRAM-MD5 or CRAM-SHA1

# authentication (see INSTALL), set IMAP_CAPABILITY as follows:

#

# IMAP_CAPABILITY="IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=CRAM-MD5 AUTH=CRAM-SHA1 IDLE"

#

#IMAP_CAPABILITY="IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE AUTH=CRAM-MD5"

IMAP_CAPABILITY="IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE AUTH=PLAIN"

##NAME: KEYWORDS_CAPABILITY:0

#

# IMAP_KEYWORDS=1 enables custom IMAP keywords.  Set this option to 0 to

# disable custom keywords.

IMAP_KEYWORDS=1

##NAME: SMAP1_CAPABILITY:0

#

# EXPERIMENTAL

#

# To enable the experimental "Simple Mail Access Protocol" extensions,

# uncomment the following setting.

#

# SMAP_CAPABILITY=SMAP1

##NAME: IMAP_CAPABILITY_ORIG:1

#

# For use by webadmin

IMAP_CAPABILITY_ORIG="IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=CRAM-MD5 AUTH=CRAM-SHA1 IDLE"

##NAME: IMAP_PROXY:0

#

# Enable proxying.  See README.proxy

IMAP_PROXY=0

##NAME: IMAP_PROXY_FOREIGN:0

#

# Proxying to non-Courier servers.  Re-sends the CAPABILITY command after

# logging in to the remote server.  May not work with all IMAP clients.

IMAP_PROXY_FOREIGN=0

##NAME: IMAP_IDLE_TIMEOUT:0

#

# This setting controls how often

# the server polls for changes to the folder, in IDLE mode (in seconds).

IMAP_IDLE_TIMEOUT=60

##NAME: IMAP_CAPABILITY_TLS:0

#

# The following setting will advertise SASL PLAIN authentication after

# STARTTLS is established.  If you want to allow SASL PLAIN authentication

# with or without TLS then just comment this out, and add AUTH=PLAIN to

# IMAP_CAPABILITY

IMAP_CAPABILITY_TLS="$IMAP_CAPABILITY AUTH=PLAIN"

##NAME: IMAP_TLS_ORIG:0

#

# For use by webadmin

IMAP_CAPABILITY_TLS_ORIG="$IMAP_CAPABILITY_ORIG AUTH=PLAIN"

##NAME: IMAP_DISABLETHREADSORT:0

#

# Set IMAP_DISABLETHREADSORT to disable the THREAD and SORT commands -

# server side sorting and threading.

#

# Those capabilities will still be advertised, but the server will reject

# them.  Set this option if you want to disable all the extra load from

# server-side threading and sorting.  Not advertising those capabilities

# will simply result in the clients reading the entire folder, and sorting

# it on the client side.  That will still put some load on the server.

# advertising these capabilities, but rejecting the commands, will stop this

# silliness.

#

IMAP_DISABLETHREADSORT=0

##NAME: IMAP_CHECK_ALL_FOLDERS:0

#

# Set IMAP_CHECK_ALL_FOLDERS to 1 if you want the server to check for new

# mail in every folder.  Not all IMAP clients use the IMAP's new mail

# indicator, but some do.  Normally new mail is checked only in INBOX,

# because it is a comparatively time consuming operation, and it would be

# a complete waste of time unless mail filters are used to deliver

# mail directly to folders.

#

# When IMAP clients are used which support new mail indication, and when

# mail filters are used to sort incoming mail into folders, setting

# IMAP_CHECK_ALL_FOLDERS to 1 will allow IMAP clients to announce new

# mail in folders.  Note that this will result in slightly more load on the

# server.

#

IMAP_CHECK_ALL_FOLDERS=0

##NAME: IMAP_OBSOLETE_CLIENT:0

#

# Set IMAP_OBSOLETE_CLIENT if your IMAP client expects \\NoInferiors to mean

# what \\HasNoChildren really means.

IMAP_OBSOLETE_CLIENT=0

##NAME: IMAP_UMASK:0

#

# IMAP_UMASK sets the umask of the server process.  The value of IMAP_UMASK is

# simply passed to the "umask" command.  The default value is 022.

#

# This feature is mostly useful for shared folders, where the file permissions

# of the messages may be important.

IMAP_UMASK=022

##NAME: IMAP_ULIMITD:0

#

# IMAP_ULIMITD sets the maximum size of the data segment of the server

# process.  The value of IMAP_ULIMITD is simply passed to the "ulimit -d"

# command (or ulimit -v).  The argument to ulimi sets the upper limit on the

# size of the data segment of the server process, in kilobytes.  The default

# value of 65536 sets a very generous limit of 64 megabytes, which should

# be more than plenty for anyone.

#

# This feature is used as an additional safety check that should stop

# any potential denial-of-service attacks that exploit any kind of

# a memory leak to exhaust all the available memory on the server.

# It is theoretically possible that obscenely huge folders will also

# result in the server running out of memory when doing server-side

# sorting (by my calculations you have to have at least 100,000 messages

# in a single folder, for that to happen).

IMAP_ULIMITD=65536

##NAME: IMAP_USELOCKS:0

#

# Setting IMAP_USELOCKS to 1 will use dot-locking to support concurrent

# multiple access to the same folder.  This incurs slight additional

# overhead.  Concurrent multiple access will still work without this setting,

# however occasionally a minor race condition may result in an IMAP client

# downloading the same message twice, or a keyword update will fail.

#

# IMAP_USELOCKS=1 is strongly recommended when shared folders are used.

IMAP_USELOCKS=1

##NAME: IMAP_SHAREDINDEXFILE:0

#

# The index of all accessible folders.  Do not change this setting unless

# you know what you're doing.  See README.sharedfolders for additional

# information.

IMAP_SHAREDINDEXFILE=/etc/courier-imap/shared/index

##NAME: IMAP_ENHANCEDIDLE:0

#

# If Courier was compiled with the File Alteration Monitor, setting

# IMAP_ENHANCEDIDLE to 1 enables enhanced IDLE mode, where multiple

# clients may open the same folder concurrently, and receive updates to

# folder contents in realtime.  See the imapd(8) man page for additional

# information.

#

# IMPORTANT: IMAP_USELOCKS *MUST* also be set to 1, and IDLE must be included

# in the IMAP_CAPABILITY list.

#

IMAP_ENHANCEDIDLE=1

##NAME: IMAP_TRASHFOLDERNAME:0

#

# The name of the magic trash Folder.  For MSOE compatibility,

# you can set IMAP_TRASHFOLDERNAME="Deleted Items".

#

# IMPORTANT:  If you change this, you must also change IMAP_EMPTYTRASH

IMAP_TRASHFOLDERNAME=Poubelle

##NAME: IMAP_EMPTYTRASH:0

#

# The following setting is optional, and causes messages from the given

# folder to be automatically deleted after the given number of days.

# IMAP_EMPTYTRASH is a comma-separated list of folder:days.  The default

# setting, below, purges 7 day old messages from the Trash folder.

# Another useful setting would be:

#

# IMAP_EMPTYTRASH=Trash:7,Sent:30

#

# This would also delete messages from the Sent folder (presumably copies

# of sent mail) after 30 days.  This is a global setting that is applied to

# every mail account, and is probably useful in a controlled, corporate

# environment.

#

# Important: the purging is controlled by CTIME, not MTIME (the file time

# as shown by ls).  It is perfectly ordinary to see stuff in Trash that's

# a year old.  That's the file modification time, MTIME, that's displayed.

# This is generally when the message was originally delivered to this

# mailbox.  Purging is controlled by a different timestamp, CTIME, which is

# changed when the file is moved to the Trash folder (and at other times too).

#

# You might want to disable this setting in certain situations - it results

# in a stat() of every file in each folder, at login and logout.

#

IMAP_EMPTYTRASH=Poubelle:7

##NAME: IMAP_MOVE_EXPUNGE_TO_TRASH:0

#

# Set IMAP_MOVE_EXPUNGE_TO_TRASH to move expunged messages to Trash.  This

# effectively allows an undo of message deletion by fishing the deleted

# mail from trash.  Trash can be manually expunged as usually, and mail

# will get automatically expunged from Trash according to IMAP_EMPTYTRASH.

#

# NOTE: shared folders are still expunged as usual.  Shared folders are

# not affected.

#

IMAP_MOVE_EXPUNGE_TO_TRASH=1

##NAME: OUTBOX:0

#

# The next set of options deal with the "Outbox" enhancement.

# Uncomment the following setting to create a special folder, named

# INBOX.Outbox

#

# OUTBOX=.Outbox

##NAME: SENDMAIL:0

#

# If OUTBOX is defined, mail can be sent via the IMAP connection by copying

# a message to the INBOX.Outbox folder.  For all practical matters,

# INBOX.Outbox looks and behaves just like any other IMAP folder.  If this

# folder doesn't exist it must be created by the IMAP mail client, just

# like any other IMAP folder.  The kicker: any message copied or moved to

# this folder is will be E-mailed by the Courier-IMAP server, by running

# the SENDMAIL program.  Therefore, messages copied or moved to this

# folder must be well-formed RFC-2822 messages, with the recipient list

# specified in the To:, Cc:, and Bcc: headers.  Courier-IMAP relies on

# SENDMAIL to read the recipient list from these headers (and delete the Bcc:

# header) by running the command "$SENDMAIL -oi -t -f $SENDER", with the

# message piped on standard input.  $SENDER will be the return address

# of the message, which is set by the authentication module.

#

# DO NOT MODIFY SENDMAIL, below, unless you know what you're doing.

#

SENDMAIL=/usr/sbin/sendmail

##NAME: HEADERFROM:0

#

# For administrative and oversight purposes, the return address, $SENDER

# will also be saved in the X-IMAP-Sender mail header.  This header gets

# added to the sent E-mail (but it doesn't get saved in the copy of the

# message that's saved in the folder)

#

# WARNING - By enabling OUTBOX above, *every* IMAP mail client will receive

# the magic OUTBOX treatment.  Therefore advance LARTing is in order for

# _all_ of your lusers, until every one of them is aware of this.  Otherwise if

# OUTBOX is left at its default setting - a folder name that might be used

# accidentally - some people may be in for a rude surprise.  You can redefine

# the name of the magic folder by changing OUTBOX, above.  You should do that

# and pick a less-obvious name.  Perhaps brand it with your organizational

# name ( OUTBOX=.WidgetsAndSonsOutbox )

HEADERFROM=X-IMAP-Sender

##NAME: IMAPDSTART:0

#

# IMAPDSTART is not used directly.  Rather, this is a convenient flag to

# be read by your system startup script in /etc/rc.d, like this:

#

#  . /etc/courier-imap/imapd

#

#  case x$IMAPDSTART in

#  x[yY]*)

#        /usr/lib/courier-imap/imapd.rc start

#        ;;

#  esac

#

# The default setting is going to be NO, so you'll have to manually flip

# it to yes.

IMAPDSTART=NO

##NAME: MAILDIRPATH:0

#

# MAILDIRPATH - directory name of the maildir directory.

#

#MAILDIRPATH=Maildir

#Hardwire a value for ${MAILDIR}

#MAILDIR=Maildir

#MAILDIRPATH=.maildir

MAILDIR=.maildir

MAILDIRPATH=.maildir

#Put any program for ${PRERUN} here

PRERUN=
```

----------

## chuckbrady

Try modifying your imapd-run to have the last line look like:

        /usr/sbin/courier-imapd .

Yours currently looks like:

        /usr/sbin/courier-imapd

That trailing dot is crucial.

----------

## GrunkaLunka

That, and change:

```
CVM_SASL_PLAIN=cvm-local:cvm-local:/tmp/.cvm-vmailmgr 
```

to

```
CVM_SASL_PLAIN=cvm-local:/tmp/.cvm-vmailmgr
```

Don't you hate it when it's something so simple? Hope it helps.

Thanks to your tips I was able to get my install up and running in a few minutes. Now live up to the title of the thread and make it an acutal HOWTO.  :Very Happy: 

----------

## grishnav

Is someone willing to howtoize this? I'll post my steps and results when I get a chance to do it, but I have no idea when that will be.

Thanks for your hard work guys! I use vmailmgr for the same reason posted above (domain per user instead of one master user...). I hope to get the new version of everything working soon so I don't get haxed.  :Wink: 

----------

## tecknojunky

What seemed to be my problem is evolution that was hanging at "loading folders...".  Yesterday, I had to stupid idea to try to configure the account with Outlook Express and it worked.  Afterward, I could access it with Evolution.  In both case only the inbox was created.  I had no Trash, Sent nor the usual others.  Anyone had these issues?

Now I'm going to try to configure omail-admin and if it works, I'll howtolize this by redoing everything on a virtual box and noting every steps of the way and modify the initial post.

----------

## ivanh

 *tecknojunky wrote:*   

> Man,  am I the only one in the whole wide world using vmailmgr to create virtual user mail accounts?
> 
> 

 

Hi Man,

You're not alone !

I put some "fresh" infos on : http://gentoo.modulix.net/index.php/Mail

about our config (sorry in French only).

Before to make it work, we have read this tread many times  :Wink: 

Tx for all.

--

Ivan Havlicek

----------

## tecknojunky

 *ivanh wrote:*   

> ...sorry in French only.

 

Aucun problème.  :Wink: 

Merci et bravo.

----------

## grishnav

Hey guys,

I installed the Gentoo packages for CVM and bglibs. When using the cvm-testclient, I am able to authenticate to cvm-vmailmgr and cvm-unix (respectively).

However, when I set up courier imap to use imapfront-auth, I am not able to authenticate to anything. The error is 

Jan 22 13:04:25 [imapd-ssl] imapfront-auth[466]: 2 NO LOGIN failed

Doesn't really give a hint as to what is going wrong...

Here is my gentoo-imapd-ssl.rc... Any hints? Can you post your complete gentoo-imapd-ssl.rc file for me? (or at least your gentoo-imapd.rc?)

Thanks!

```

# cvm-testclient cvm-vmailmgr ryan yyy.net xxx

user name:        ryan

user ID:          10x2

group ID:         100

real name:        (null)

directory:        /home/xxx/users/ryan

shell:            (null)

group name:       (null)

system user name: xxx

system directory: /home/xxx

domain:           yyy.net

mailbox path:     /home/xxx/users/ryan
```

```
# $Id: courier-imap-4.0.1-r1-gentoo-imapd-ssl.rc,v 1.1 2005/02/11 15:34:49 robbat2 Exp $

#

# Copyright 1998 - 2000 Double Precision, Inc.

# See COPYING for distribution information.

prefix=/usr

exec_prefix=/usr

bindir=/usr/sbin

libexecdir=/usr/lib/courier-imap

CVM_SASL_PLAIN=cvm-local:/tmp/.cvm-vmailmgr

export CVM_SASL_PLAIN

source /etc/courier-imap/imapd

source /etc/courier-imap/imapd-ssl

# the new courier-authlib doesn't usee these settings.

#LIBAUTHMODULES=""

#for f in `echo $AUTHMODULES`

#do

#       LIBAUTHMODULES="$LIBAUTHMODULES /usr/lib/courier-imap/authlib/$f"

#done

ulimit -d $IMAP_ULIMITD

export IMAP_TLS=1

eval `sed -n '/^#/d;/=/p' </etc/courier-imap/imapd | \

        sed 's/=.*//;s/^/export /;s/$/;/'`

eval `sed -n '/^#/d;/=/p' </etc/courier-imap/imapd-ssl | \

        sed 's/=.*//;s/^/export /;s/$/;/'`

eval $PRERUN \

/usr/lib/courier-imap/couriertcpd -address=$SSLADDRESS \

        -stderrlogger=/usr/lib/courier-imap/courierlogger \

        -stderrloggername=imapd-ssl \

        -maxprocs=$MAXDAEMONS -maxperip=$MAXPERIP \

        -pid=$SSLPIDFILE $TCPDOPTS \

        $SSLPORT $COURIERTLS -server -tcpd \

        /var/qmail/bin/imapfront-auth \

                /usr/sbin/courier-imapd ${MAILDIR}

```

----------

## grishnav

Ok, I got it.

I upgraded all the packages to the latest (the latest are not in portage). That didn't seem to make any difference.

I had the CVM_SASL-whatever environment variable set in my environment for testing and I think it may have been accidentally overwriting my startup script. That's my best guess, anyway.  :Razz: 

I created another service in the same vain as cvm-vmailmgr for cvm-unix so that I could still authenticate against /etc/passwd (because I'm using it), and used the cvm-chain module to chain the authentication.

I could then authenticate to both a local and a virtual domain account, but the .maildir default was causing problems with the virtual domain, due to the fact that the user's maildir isn't called .maildir. Switching it to "." cured the virtual domain, but broke the locals.

Since cvm-testclient was able to figure out the correct location of all mailboxes (when used with cvm-vmailmgr and cvm-unix), I figured it *must* set an environment variable with the mailbox. So I removed the maildir argument altogether (and switched back to courier-imapd.indirect, just in case fixing virtuals was the purpose of that script... it's not), and lo and behold, all seems to work!

Final startup script below for virtual+local users on Courier Imap 4 w/ Vmailmgr:

```
# cat gentoo-imapd-ssl.rc

#!/bin/bash

# $Id: courier-imap-4.0.1-r1-gentoo-imapd-ssl.rc,v 1.1 2005/02/11 15:34:49 robbat2 Exp $

#

# Copyright 1998 - 2000 Double Precision, Inc.

# See COPYING for distribution information.

prefix=/usr

exec_prefix=/usr

bindir=/usr/sbin

libexecdir=/usr/lib/courier-imap

export CVM_SASL_PLAIN=cvm-chain

export CVM_CHAIN0="cvm-local:/tmp/.cvm-unix"

export CVM_CHAIN1="cvm-local:/tmp/.cvm-vmailmgr"

source /etc/courier-imap/imapd

source /etc/courier-imap/imapd-ssl

# the new courier-authlib doesn't usee these settings.

#LIBAUTHMODULES=""

#for f in `echo $AUTHMODULES`

#do

#       LIBAUTHMODULES="$LIBAUTHMODULES /usr/lib/courier-imap/authlib/$f"

#done

ulimit -d $IMAP_ULIMITD

export IMAP_TLS=1

eval `sed -n '/^#/d;/=/p' </etc/courier-imap/imapd | \

        sed 's/=.*//;s/^/export /;s/$/;/'`

eval `sed -n '/^#/d;/=/p' </etc/courier-imap/imapd-ssl | \

        sed 's/=.*//;s/^/export /;s/$/;/'`

eval $PRERUN \

/usr/lib/courier-imap/couriertcpd -address=$SSLADDRESS \

        -stderrlogger=/usr/lib/courier-imap/courierlogger \

        -stderrloggername=imapd-ssl \

        -maxprocs=$MAXDAEMONS -maxperip=$MAXPERIP \

        -pid=$SSLPIDFILE $TCPDOPTS \

        $SSLPORT $COURIERTLS -server -tcpd \

        /usr/bin/imapfront-auth \

        /usr/lib/courier-imap/courier-imapd.indirect

```

----------

