Discussion:
[courier-users] virtual email
Tony Bibbs
2002-01-17 14:49:03 UTC
Permalink
I'm a Courier convert and I've dug around in the installation document
an can't seem to find how to configure Courier to use virtual email
accounts as opposed to creating valid system accounts (I'll be using
mysql authentication). Any points of reference, gotchas, etc would be
appreciated.

Thanks in advance,

--Tony
Peter C. Norton
2002-01-17 15:35:03 UTC
Permalink
You assign one real uid/gid combination(to own the maildirs, etc) and you
build a database (either userdb, ldap, postgres, mysql, or anything else you
want to program for) and use that database to authenticate users, with all
uid and gid set the the virtual user that you set up. Some schema examples
are in the authmysql and the authpostgres documentation.

-Peter
Post by Tony Bibbs
I'm a Courier convert and I've dug around in the installation document
an can't seem to find how to configure Courier to use virtual email
accounts as opposed to creating valid system accounts (I'll be using
mysql authentication). Any points of reference, gotchas, etc would be
appreciated.
Thanks in advance,
--Tony
_______________________________________________
courier-users mailing list
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
--
The 5 year plan:
In five years we'll make up another plan.
Or just re-use this one.
Tony Bibbs
2002-01-17 16:04:04 UTC
Permalink
Thanks Peter, that helps!

OK, so what I did was I created a user called courieruser and the
system, for example, give it a uid of 3 and a gid of 4. I did an alter
table on passwd so that the uid/gid default to those values and I did an
update on the table to apply those values to any existing records.

I'm assuming I need to do a maildirmake as that user to create the
maildir. My question (maybe this is more than I need to know) is how
does Courier use a single maildir for multiple users. Specifically, if I
insert a new user into the MySQL table, will the users virtual maildir
be created automatically?

--Tony
Post by Peter C. Norton
You assign one real uid/gid combination(to own the maildirs, etc) and you
build a database (either userdb, ldap, postgres, mysql, or anything else you
want to program for) and use that database to authenticate users, with all
uid and gid set the the virtual user that you set up. Some schema examples
are in the authmysql and the authpostgres documentation.
-Peter
Post by Tony Bibbs
I'm a Courier convert and I've dug around in the installation document
an can't seem to find how to configure Courier to use virtual email
accounts as opposed to creating valid system accounts (I'll be using
mysql authentication). Any points of reference, gotchas, etc would be
appreciated.
Thanks in advance,
--Tony
_______________________________________________
courier-users mailing list
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
--
In five years we'll make up another plan.
Or just re-use this one.
_______________________________________________
courier-users mailing list
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
Sysop
2002-01-17 16:25:14 UTC
Permalink
Post by Tony Bibbs
Thanks Peter, that helps!
OK, so what I did was I created a user called courieruser and the
system, for example, give it a uid of 3 and a gid of 4. I did an alter
table on passwd so that the uid/gid default to those values and I did an
update on the table to apply those values to any existing records.
I'm assuming I need to do a maildirmake as that user to create the
maildir. My question (maybe this is more than I need to know) is how
does Courier use a single maildir for multiple users. Specifically, if I
insert a new user into the MySQL table, will the users virtual maildir
be created automatically?
--Tony
Post by Peter C. Norton
You assign one real uid/gid combination(to own the maildirs, etc) and you
build a database (either userdb, ldap, postgres, mysql, or anything else you
want to program for) and use that database to authenticate users, with all
uid and gid set the the virtual user that you set up. Some schema examples
are in the authmysql and the authpostgres documentation.
-Peter
Post by Tony Bibbs
I'm a Courier convert and I've dug around in the installation document
an can't seem to find how to configure Courier to use virtual email
accounts as opposed to creating valid system accounts (I'll be using
mysql authentication). Any points of reference, gotchas, etc would be
appreciated.
Thanks in advance,
--Tony
_______________________________________________
courier-users mailing list
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
--
In five years we'll make up another plan.
Or just re-use this one.
_______________________________________________
courier-users mailing list
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
_______________________________________________
courier-users mailing list
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
No, you will have to make a new directory for each user. I put them all
in /home/mailusers.

So, for the addresses ***@j2solutions.net and ***@j2solutoins.net
I have the following directories:

/home/mailusers/***@j2solutions.net/
/home/mailusers/***@j2solutions.net/

each of which has it's own Maildir subdirectory, where mail gets
delivered to. You can easly script the addition of a user into the sql
database, and the directory creation though...
Sysop
2002-01-17 17:44:03 UTC
Permalink
Makes sense to use the domain name.
Ok, so I have this setup and I try testing this by creating a maildir
called couriertest and another called bounces. I then edit
.courier-test-default to have "./couriertest" and .courier to have
perftest1 1000 "couriertest-test-1 couriertest-test-2 ...
couriertest-test-5"
and I get nothing at all in /home/courierusers/couriertest/new nor in
/home/courierusers/bounces
How does one troubleshoot this (where does courier store it's log
files)?
Oh, and I just realized I'm did a reply instead of reply-all...oops.
--Tony
hmm, ok. That makes more sense to me.
id: hosting
crypt: foo
name: hosting
uid: 3
gid: 4
home: /home/mailusers
of course that's assuming the mailusers userid is 3 and groupid is 4.
Is that right?
Close, but I don't supply the maildir setting, just home directory.
Courier is smart enough to know to deliver to Maildir. Also, I give
You know, it's been too long since I've done a fresh install of courier,
I dont' remember what I did for the testing. Perhaps somebody on the
list will have that.
Peter C. Norton
2002-01-17 17:14:04 UTC
Permalink
Post by Tony Bibbs
I'm assuming I need to do a maildirmake as that user to create the
maildir.
Absolutely correct.
Post by Tony Bibbs
My question (maybe this is more than I need to know) is how
does Courier use a single maildir for multiple users. Specifically, if I
insert a new user into the MySQL table, will the users virtual maildir
be created automatically?
It doesn't. You make one maildir per user you add, and then you set that
virtual users' maildir field to that maildir.
--
The 5 year plan:
In five years we'll make up another plan.
Or just re-use this one.
Sysop
2002-01-17 16:06:14 UTC
Permalink
Post by Tony Bibbs
I'm a Courier convert and I've dug around in the installation document
an can't seem to find how to configure Courier to use virtual email
accounts as opposed to creating valid system accounts (I'll be using
mysql authentication). Any points of reference, gotchas, etc would be
appreciated.
Thanks in advance,
--Tony
_______________________________________________
courier-users mailing list
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
Just add your entries into a mysql database, as the instructions show, I
create a central mail directory area, all with the same uid/gid of a
user that doesn't have the ability to login.
c***@kaiserdigital.com
2002-01-17 16:41:05 UTC
Permalink
Hi

I'm trying to create a bash script that will parse certain log files for
errors and forward them to postmaster.

I can manage everything except the message delivery.

What command can I use to delivery an email message from a bash shell.

If possible, could you please provide an example of the usage of the
command.

Thank you
Peter C. Norton
2002-01-17 17:31:11 UTC
Permalink
You mean something like

# mail -s "my mail" ***@email.addr.com < /var/log/my_log

???
Post by c***@kaiserdigital.com
Hi
I'm trying to create a bash script that will parse certain log files for
errors and forward them to postmaster.
I can manage everything except the message delivery.
What command can I use to delivery an email message from a bash shell.
If possible, could you please provide an example of the usage of the
command.
Thank you
_______________________________________________
courier-users mailing list
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
--
The 5 year plan:
In five years we'll make up another plan.
Or just re-use this one.
Roland Schneider
2002-01-17 18:34:09 UTC
Permalink
Post by Peter C. Norton
You mean something like
???
Probably not, logs often contain 8bit-characters and they
need the proper encoding - at least with stock courier :)

#!/bin/sh

( echo "Subject: Whatever you want, 7bit-chars only
To: ***@your.dom
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
"; cat /var/log/my_log ) | sendmail ***@your.dom

Roland
Johannes Erdfelt
2002-01-17 18:59:44 UTC
Permalink
Post by Roland Schneider
Post by Peter C. Norton
You mean something like
???
Probably not, logs often contain 8bit-characters and they
need the proper encoding - at least with stock courier :)
#!/bin/sh
( echo "Subject: Whatever you want, 7bit-chars only
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Souldn't that be a function of 'mail'?

JE
c***@kaiserdigital.com
2002-01-17 19:09:04 UTC
Permalink
Hi

Sorry. I forgot to mention that the server has courier (POP/SMTP/IMAP)
installed (so sendmail was replaced and mail (mailx) does not work).

Is it still possible?


-----Original Message-----
From: courier-users-***@lists.sourceforge.net
[mailto:courier-users-***@lists.sourceforge.net] On Behalf Of Roland
Schneider
Sent: Thursday, January 17, 2002 12:26 PM
To: 'courier'
Subject: Re: [courier-users] Sending mail from the console
Post by Peter C. Norton
You mean something like
???
Probably not, logs often contain 8bit-characters and they
need the proper encoding - at least with stock courier :)

#!/bin/sh

( echo "Subject: Whatever you want, 7bit-chars only
To: ***@your.dom
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
"; cat /var/log/my_log ) | sendmail ***@your.dom

Roland
Rich Buggy
2002-01-17 21:33:03 UTC
Permalink
Post by c***@kaiserdigital.com
Sorry. I forgot to mention that the server has courier (POP/SMTP/IMAP)
installed (so sendmail was replaced and mail (mailx) does not work).
Is it still possible?
Yes. Just use sendmail (the version that comes with courier). It's not a
full version of sendmail but it will allow you to send messages from the
console. See the examply Roland sent earlier.

Rich
Sam Varshavchik
2002-01-17 21:48:03 UTC
Permalink
Post by c***@kaiserdigital.com
Hi
Sorry. I forgot to mention that the server has courier (POP/SMTP/IMAP)
installed (so sendmail was replaced and mail (mailx) does not work).
mail/mailx certainly works with Courier, as long as you feed it only 7-bit
data, as Roland mentioned.
Post by c***@kaiserdigital.com
Is it still possible?
Yes, and you can also run Courier's sendmail and feed it the complete
message, headers and all. Properly MIME-encoded, of course.
--
Sam
Randy Lewis (Kenneth R. Lewis)
2002-01-17 19:52:03 UTC
Permalink
Here is a little patch that allows for use of the "%" (percent),
or ":" (colon) chars as separators for the ***@domain.tld problem
for Netscape Messenger clients in a virtual domain(s) environment.

--- authmysqllib.c-save Thu Jan 17 11:41:41 2002
+++ authmysqllib.c Thu Jan 17 16:06:46 2002
@@ -191,10 +191,13 @@
static void append_username(char *p, const char *username,
const char *defdomain)
{
- for (strcpy(p, username); *p; p++)
+ for (strcpy(p, username); *p; p++)
if (*p == '"' || *p == '\\' ||
(int)(unsigned char)*p < ' ')
*p=' '; /* No funny business */
+
+ if (strchr(username, ':') != 0) return;
+ if (strchr(username, '%') != 0) return;
if (strchr(username, '@') == 0 && defdomain && *defdomain)
strcat(strcpy(p, "@"), defdomain);
}

I have MySQL passwd table entries that contain entries for:

***@somedomain.com, user2%somedomain.com, user3:somedomain.com and
localuser (with no @defaultdomain) all work properly.

The Netscape Messenger clients enter their e-mail account names with
either a ":" (colon) or "%" (percent) in place of a "@" (at sign)
but, of course, list their real e-mail address in the proper location
so that folks can replay to them, etc.

As delivered, authmysqllib.c would discover the missing "@" and assume
that it was a username for the 'DEFAULT_DOMAIN" (see authmysqlrc).

The patch (above) simply checks for the existence of either alternate
separator, and accepts it as a good username. It works equally well
for POP3 and IMAP (as you would expect). I have *not* even looked
at the authpgsqllib.c instance of this; but the idea is the same...




Randy Lewis
Roland Schneider
2002-01-17 21:01:05 UTC
Permalink
--Johannes Erdfelt wrote on 17.01.2002 15:58 -0500:
[...]
Post by Johannes Erdfelt
Post by Roland Schneider
#!/bin/sh
( echo "Subject: Whatever you want, 7bit-chars only
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Souldn't that be a function of 'mail'?
mail (and Mail which is a symlink) does not know anything
about mime, the only 'functionality' is wrapping the generated
headers after 72 characters and some checks if the connection
is above or below 1200bps... (current FreeBSD)

Its basically the same as of 6/6/93, and the first draft about
mime (rfc 1521) was published a few months later.

Roland
c***@kaiserdigital.com
2002-01-17 21:56:02 UTC
Permalink
Hi

I created a file called /tmp/a with the following lines

Subject: Test
To: ***@domain.com
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Test

I then run the following as root on Redhat 7.1

Cat /tmp/a | /usr/lib/courier/bin/sendmail ***@domain.com

The following was returned

/usr/lib/courier/bin/sendmail: Subject:: command not found
/usr/lib/courier/bin/sendmail: To:: command not found
/usr/lib/courier/bin/sendmail: Mime-Version:: command not found
/usr/lib/courier/bin/sendmail: Content-Type:: command not found
/usr/lib/courier/bin/sendmail: Content-Transfer-Encoding:: command not
found


Have I configured courier incorrectly?

Am I missing some dependency?

Any ideas?

Thanks

-----Original Message-----
From: courier-users-***@lists.sourceforge.net
[mailto:courier-users-***@lists.sourceforge.net] On Behalf Of Roland
Schneider
Sent: Thursday, January 17, 2002 2:51 PM
To: 'courier'
Subject: Re: [courier-users] Sending mail from the console


--Johannes Erdfelt wrote on 17.01.2002 15:58 -0500:
[...]
Post by Johannes Erdfelt
Post by Roland Schneider
#!/bin/sh
( echo "Subject: Whatever you want, 7bit-chars only
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Souldn't that be a function of 'mail'?
mail (and Mail which is a symlink) does not know anything
about mime, the only 'functionality' is wrapping the generated headers
after 72 characters and some checks if the connection is above or below
1200bps... (current FreeBSD)

Its basically the same as of 6/6/93, and the first draft about mime (rfc
1521) was published a few months later.

Roland
Roland Schneider
2002-01-18 11:32:05 UTC
Permalink
Post by c***@kaiserdigital.com
I created a file called /tmp/a with the following lines
Subject: Test
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Test
You always need an empty line between header and body or
everything will be considered as 'header'.
Also make shure the last line ends with a (invisible) newline.
Post by c***@kaiserdigital.com
I then run the following as root on Redhat 7.1
Dont know nothing about capital `Cat`, hope this was just a typo.
Maybe DeadRat has a binary or script with this name (and unknown
functionality) installed ?

This is also a good candidate for the 'useless use of cat', (see
http://www.ling.helsinki.fi/~reriksso/unix/award.html) one should
execute the example above as:

/usr/lib/courier/bin/sendmail ***@domain.com < /tmp/a

(dont abuse the 'domain.com', 'example.com' would be much better)
Post by c***@kaiserdigital.com
The following was returned
/usr/lib/courier/bin/sendmail: Subject:: command not found
/usr/lib/courier/bin/sendmail: To:: command not found
/usr/lib/courier/bin/sendmail: Mime-Version:: command not found
/usr/lib/courier/bin/sendmail: Content-Type:: command not found
/usr/lib/courier/bin/sendmail: Content-Transfer-Encoding:: command not
Your shell (or Cat) seems badly confused, and I am missing the
messages about Cat and Test: here. Makes the confusion complete.

Different shells have different behaviour, thats why the script in
my previous post starts with #!/bin/sh, the universally preferred
and recommended shell for scripting (avoid csh at any cost).
Depending on your shell commands will work differently in scripts.

To use /bin/sh simply type `sh`, and the prompt will change.
Post by c***@kaiserdigital.com
Have I configured courier incorrectly?
Courier's sendmail is not capable of such verbose messages, would
only say something like '...unexpected EOF from submit...' :)

Roland
Randy Lewis (Kenneth R. Lewis)
2002-01-18 12:47:11 UTC
Permalink
Here is a correct patch that allows for use of the "%" (percent),
or ":" (colon) chars as separators for the ***@domain.tld problem
for Netscape Messenger clients in a virtual domain(s) environment.

--- authmysql.c Wed Jun 20 21:44:30 2001
+++ authmysql.c-new Fri Jan 18 09:34:32 2002
@@ -25,15 +25,25 @@
int issession,
void (*callback_func)(struct authinfo *, void *), void *callback_arg)
{
-char *user, *pass;
+char *user, *pass, *charloc;
struct authmysqluserinfo *authinfo;

+const char usertmp[]=":%";
+
+ /* extract user name, e.g., ***@someplace.com
+ */
if ((user=strtok(authdata, "\n")) == 0 ||
(pass=strtok(0, "\n")) == 0)
{
errno=EPERM;
return (0);
}
+ /* munge (possibly) substituted chars from user name
+ * because Netscape 4.xx cannot send an '@' sign when
+ * requesting authentication
+ */
+
+ if( (charloc= strpbrk(user, usertmp))) *charloc= '@';

authinfo=auth_mysql_getuserinfo(user);


I have MySQL passwd table entries that contain entries for:

***@somedomain.com, ***@somedomain.com, ***@somedomain.com and
localuser (with no @defaultdomain) all work properly.

The Netscape Messenger clients enter their e-mail account names with
either a ":" (colon) or "%" (percent) in place of a "@" (at sign).
They still list their real e-mail address in the proper location
so that folks can replay to them, etc.

As delivered, authmysqllib.c would discover the missing "@" and assume
that it was a username for the 'DEFAULT_DOMAIN" (see authmysqlrc). This
behavior is correct for the case where there is just a username, and
no @domain...so authmysqllib.c's append_domain function tries to
append the domain name. This would result in something like:
user:***@defaultdomain.com


The patch (above) simply checks for the existence of either alternate
separator BEFORE any attempt to look it up in the MySQL databse and
then substitutes an '@' for the ":" or "%" that could be used by
Netscape 4.xx clients.

It works equally well for POP3 and IMAP (as you would expect).
I have *not* even looked at the authpgsqllib.c instance of this; but
the idea is the same...

My aplologies to the list for posting a lame patch previously.


Randy Lewis
Roland Schneider
2002-01-18 13:40:01 UTC
Permalink
Post by Randy Lewis (Kenneth R. Lewis)
Here is a correct patch that allows for use of the "%" (percent),
for Netscape Messenger clients in a virtual domain(s) environment.
You probably missed this one, allows both @ and % as delimiters,
and an independent alternative login in only one single record
per user:

http://www.tana.it/sw/authmysqllib-patch.html

The patch works without problems or changes since 08/2001 (0.35.0),
hope it will find a way into courier some day.

I still miss some functionality to limit the services for each
individual user (imap, pop3, webmail and smtp) like userdb does.

Roland
Randy Lewis (Kenneth R. Lewis)
2002-01-18 14:30:03 UTC
Permalink
Roland,

No, I didn't miss it - I just wanted one database entry to
work for a client regardless of the the MUA being used.

With my approach, an entry like: ***@someplace.com is
found normally when e-mail is being delivered from anywhere
outside the local e-mail system.

The issue was (and still is) that Netscape 4.xx Messenger clients
do not handle the ***@someplace.com, and create some kind
of garbage instead. Most folks use farbuckle:someplace.com,
or perhaps farbuckle%someplace.com in the account username
field.

My patch recognizes this fact, and rewrites the name BEFORE it
is passed into the MySql lookup. This results in ***@someplace.com
being properly recognized inside courier even though the Netscape
client sent farbuckle:someplace.com, or farbuckle%@someplace.com
to be authenticated.

There is NO change to the database structure required with my patch.
The DEFAULT_DOMAIN thingy still works as intended, and correctly
constructed names (like: ***@someplace.com) get passed into
the database lookup un-modified. Also, there is only ONE lookup
done with my approach. Finally, my patch is an embarrassingly
small two actual line of code (not that size matters..)

I hope this clarifies what I did.

Thanks for the dialogue.

Randy
Post by Roland Schneider
Post by Randy Lewis (Kenneth R. Lewis)
Here is a correct patch that allows for use of the "%" (percent),
for Netscape Messenger clients in a virtual domain(s) environment.
and an independent alternative login in only one single record
http://www.tana.it/sw/authmysqllib-patch.html
The patch works without problems or changes since 08/2001 (0.35.0),
hope it will find a way into courier some day.
I still miss some functionality to limit the services for each
individual user (imap, pop3, webmail and smtp) like userdb does.
Roland
_______________________________________________
courier-users mailing list
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
Continue reading on narkive:
Loading...