Trying to use uppercase names in Postfix.

2008-12-29 Thread Xn Nooby
I am using Postfix to replace an existing  email system, and I am
inheriting usernames that are in uppercase. Apparently Postfix
converts all email addresses to lowercase, so I cannot receive mail to
the accounts that are in uppercase. This surprised me, because the
linux user accounts are in uppercase.


After googling around, it looks like I need to use a canonical map,
which I have not been able to get working properly.



I added this to my /etc/postfix/main.cf:

   canonical_maps = dbm:/etc/postfix/canonical


Then I created the /etc/postfix/canonical file:

   sudo vi /etc/postfix/canonical

 jim123 JIM123


Then I generated the map:

   sudo postmap /etc/postfix/canonical


Then restarted postfix:

   sudo /etc/init.d/postfix restart



When I email JIM123, or replay to an email sent by JIM123, it does not
get back to JIM123. Different things happen as I try different
solutions, usually the emails bounce back to the sender. Othertimes
they disappear.

I am mostly curious if my above approach is the correct one. My users
are use to using to the uppercase names, so I would like them to be
able to log in to squirrelmail using uppercase names, and send/receive
emails with uppercase names. I am assuming making the underlying linux
account uppercase is the right thing to do.

Any suggestions? (I'm new to Postfix)


Re: Trying to use uppercase names in Postfix.

2008-12-29 Thread Wietse Venema
Xn Nooby:
 I am using Postfix to replace an existing  email system, and I am
 inheriting usernames that are in uppercase. Apparently Postfix
 converts all email addresses to lowercase, so I cannot receive mail to
 the accounts that are in uppercase. This surprised me, because the
 linux user accounts are in uppercase.

The local(8) delivery agent always case-folds names to lowercase.
This is currently not configurable. Ditto for the virtual(8) daemon.

It's easy enough to delete the lowercase() call from local(8),
but that would not be a general solution.

The pipe(8) delivery agent has configurable case folding, and that
code would have to be moved into a Postfix library module, so that
it can be used by other Postfix delivery agents.

Wietse


Re: Trying to use uppercase names in Postfix.

2008-12-29 Thread Xn Nooby
On Mon, Dec 29, 2008 at 3:02 PM, Wietse Venema wie...@porcupine.org wrote:
 Xn Nooby:
 I am using Postfix to replace an existing  email system, and I am
 inheriting usernames that are in uppercase. Apparently Postfix
 converts all email addresses to lowercase, so I cannot receive mail to
 the accounts that are in uppercase. This surprised me, because the
 linux user accounts are in uppercase.

 The local(8) delivery agent always case-folds names to lowercase.
 This is currently not configurable. Ditto for the virtual(8) daemon.

 It's easy enough to delete the lowercase() call from local(8),
 but that would not be a general solution.

 The pipe(8) delivery agent has configurable case folding, and that
 code would have to be moved into a Postfix library module, so that
 it can be used by other Postfix delivery agents.

Wietse


Hi Wietse, thank you for responding. I've seen many of your posts, and
know you are a postfix expert. I am still very new, and was not able
to understand your suggestions.

It sounded like you were suggesting that what I am attempting may no
be possible, which would be unfortunate for me.  I lobbied to be able
to use Postfix instead of Qmail, so hopefully I will find a way to get
uppercase names to work.


In the hopes of forcing Postfix to use the uppercase local account
names, I tried adding this line to my /etc/postfix/main.cf, though it
is still not working:

   local_recipients_maps = unix:passwd.byname


I thought there at least two ways to use uppercase names, from what I
have found on Google. The first way is t use the canonical_maps to
switch the lowercase name back to uppercase.  The second way is to use
local_recipient_maps to force Postfix to use the local accounts,
without ever converting to lowercase. Clearly I am wrong about one or
both of these options.


Re: Trying to use uppercase names in Postfix.

2008-12-29 Thread Bryan Irvine
On Mon, Dec 29, 2008 at 11:12 AM, Xn Nooby xno...@gmail.com wrote:
 I am using Postfix to replace an existing  email system, and I am
 inheriting usernames that are in uppercase. Apparently Postfix
 converts all email addresses to lowercase, so I cannot receive mail to
 the accounts that are in uppercase. This surprised me, because the
 linux user accounts are in uppercase.

Probably the easiest solution would be to write a script to create
aliases in lower case.

-Bryan


Re: Trying to use uppercase names in Postfix.

2008-12-29 Thread Noel Jones

Bryan Irvine wrote:

On Mon, Dec 29, 2008 at 11:12 AM, Xn Nooby xno...@gmail.com wrote:

I am using Postfix to replace an existing  email system, and I am
inheriting usernames that are in uppercase. Apparently Postfix
converts all email addresses to lowercase, so I cannot receive mail to
the accounts that are in uppercase. This surprised me, because the
linux user accounts are in uppercase.


Probably the easiest solution would be to write a script to create
aliases in lower case.

-Bryan



No, that won't fix the problem.

The best solution is to not use upper-case usernames.

If that's not possible, the other solutions are:
a) patch postfix local delivery agent to not force lowercase 
during delivery.
b) use something other than the postfix local delivery agent. 
 Maybe maildrop or procmail...


--
Noel Jones


Re: Trying to use uppercase names in Postfix.

2008-12-29 Thread Xn Nooby
On Mon, Dec 29, 2008 at 3:51 PM, Noel Jones njo...@megan.vbhcs.org wrote:
 Bryan Irvine wrote:

 On Mon, Dec 29, 2008 at 11:12 AM, Xn Nooby xno...@gmail.com wrote:

 I am using Postfix to replace an existing  email system, and I am
 inheriting usernames that are in uppercase. Apparently Postfix
 converts all email addresses to lowercase, so I cannot receive mail to
 the accounts that are in uppercase. This surprised me, because the
 linux user accounts are in uppercase.

 Probably the easiest solution would be to write a script to create
 aliases in lower case.

 -Bryan


 No, that won't fix the problem.

 The best solution is to not use upper-case usernames.

 If that's not possible, the other solutions are:
 a) patch postfix local delivery agent to not force lowercase during
 delivery.
 b) use something other than the postfix local delivery agent.  Maybe
 maildrop or procmail...

 --
 Noel Jones


I created an /etc/postfix/aliases file containing:
   jim123: JIM123

Then I ran newaliases, but it did not seem to work.

I can try procmail, but I am also new to procmail. Yesterday I used
procmail for the first time, and was able to divert  mailing list
emails in to subfolders.  This required me to create a .procmailrc in
my user account.  Are you suggesting a global procmail script that
would put the emails in to their appropriate user directories?  I
assume I could not use local procmail scripts, since my problem is I
cannot resolve the lowercase username.

One good thing is, this is for a closed internal system that will
rarely change. The users are going to access their email using
Squirrelmail w/Dovecot on Ubuntu. Since the existing users are use to
seeing there names in uppercase, I want to preserver that throughout
the system.


Re: Trying to use uppercase names in Postfix.

2008-12-29 Thread Wietse Venema
Xn Nooby:
[ Charset ISO-8859-1 unsupported, converting... ]
 On Mon, Dec 29, 2008 at 3:02 PM, Wietse Venema wie...@porcupine.org wrote:
  Xn Nooby:
  I am using Postfix to replace an existing  email system, and I am
  inheriting usernames that are in uppercase. Apparently Postfix
  converts all email addresses to lowercase, so I cannot receive mail to
  the accounts that are in uppercase. This surprised me, because the
  linux user accounts are in uppercase.
 
  The local(8) delivery agent always case-folds names to lowercase.
  This is currently not configurable. Ditto for the virtual(8) daemon.
 
  It's easy enough to delete the lowercase() call from local(8),
  but that would not be a general solution.
 
  The pipe(8) delivery agent has configurable case folding, and that
  code would have to be moved into a Postfix library module, so that
  it can be used by other Postfix delivery agents.
 
 Wietse
 
 
 Hi Wietse, thank you for responding. I've seen many of your posts, and
 know you are a postfix expert. I am still very new, and was not able
 to understand your suggestions.

Your options are:

1) Create lower-case UNIX password file entries with the same
numerical UID and GID fields as the upper-case names, and with a
* password.

2) Do not use Postfix local(8).

3) Modify Postfix local(8) as described in my previous posting.

Wietse

 It sounded like you were suggesting that what I am attempting may no
 be possible, which would be unfortunate for me.  I lobbied to be able
 to use Postfix instead of Qmail, so hopefully I will find a way to get
 uppercase names to work.
 
 
 In the hopes of forcing Postfix to use the uppercase local account
 names, I tried adding this line to my /etc/postfix/main.cf, though it
 is still not working:
 
local_recipients_maps = unix:passwd.byname
 
 
 I thought there at least two ways to use uppercase names, from what I
 have found on Google. The first way is t use the canonical_maps to
 switch the lowercase name back to uppercase.  The second way is to use
 local_recipient_maps to force Postfix to use the local accounts,
 without ever converting to lowercase. Clearly I am wrong about one or
 both of these options.
 
 



Re: Trying to use uppercase names in Postfix.

2008-12-29 Thread Noel Jones

Xn Nooby wrote:

On Mon, Dec 29, 2008 at 3:51 PM, Noel Jones njo...@megan.vbhcs.org wrote:

Bryan Irvine wrote:

On Mon, Dec 29, 2008 at 11:12 AM, Xn Nooby xno...@gmail.com wrote:

I am using Postfix to replace an existing  email system, and I am
inheriting usernames that are in uppercase. Apparently Postfix
converts all email addresses to lowercase, so I cannot receive mail to
the accounts that are in uppercase. This surprised me, because the
linux user accounts are in uppercase.

Probably the easiest solution would be to write a script to create
aliases in lower case.

-Bryan


No, that won't fix the problem.

The best solution is to not use upper-case usernames.

If that's not possible, the other solutions are:
a) patch postfix local delivery agent to not force lowercase during
delivery.
b) use something other than the postfix local delivery agent.  Maybe
maildrop or procmail...

--
Noel Jones



I created an /etc/postfix/aliases file containing:
   jim123: JIM123

Then I ran newaliases, but it did not seem to work.


Right.



I can try procmail, but I am also new to procmail. Yesterday I used
procmail for the first time, and was able to divert  mailing list
emails in to subfolders.  This required me to create a .procmailrc in
my user account.  Are you suggesting a global procmail script that
would put the emails in to their appropriate user directories?  I
assume I could not use local procmail scripts, since my problem is I
cannot resolve the lowercase username.


Sorry, I don't use procmail, so I can't guide you there.
Since you're using dovecot, you also might be able to use the 
dovecot deliver delivery agent.


Here's some documentation intended for maildrop, but the same 
general setup should work with other delivery agents.

http://www.postfix.org/MAILDROP_README.html#direct



One good thing is, this is for a closed internal system that will
rarely change. The users are going to access their email using
Squirrelmail w/Dovecot on Ubuntu. Since the existing users are use to
seeing there names in uppercase, I want to preserver that throughout
the system.


Upper case user names are evil.  You will be forever haunted 
by them.  Switch now.


I see that Wietse has suggested:

1) Create lower-case UNIX password file entries with the same
numerical UID and GID fields as the upper-case names, and with a
* password.

This may be a workable option for you.



--
Noel Jones


Re: Trying to use uppercase names in Postfix.

2008-12-29 Thread Sahil Tandon
Xn Nooby wrote:

  Probably the easiest solution would be to write a script to create
  aliases in lower case.
 
  -Bryan
 
  No, that won't fix the problem.
 
  The best solution is to not use upper-case usernames.
 
  If that's not possible, the other solutions are:
  a) patch postfix local delivery agent to not force lowercase during
  delivery.
  b) use something other than the postfix local delivery agent.  Maybe
  maildrop or procmail...
 
 I created an /etc/postfix/aliases file containing:
jim123: JIM123
 
 Then I ran newaliases, but it did not seem to work.

Is /etc/postfix/aliases appropriately defined in your main.cf?  Please
show the output of 'postconf -n' and read:
http://www.postfix.org/DEBUG_README.html#mail

-- 
Sahil Tandon sa...@tandon.net


Re: Trying to use uppercase names in Postfix.

2008-12-29 Thread Xn Nooby
Hi Sahil,

I am looking in to how to create the duplicate passwd file entries, I
am assuming I cannot just edit the file without corrupting it. Below
is my main.cf and aliases file.  Also, should I post my replies to
emails at the top or the bottom? (a few years ago some people got
really mad at me, but now I can't remember which was correct)

I noticed the main.cf referred to /etc/aliases while I had edited
/etc/postfix/aliases, so I also put my JIM123 entry in to /etc/aliases
and ran sudo newaliases, but still isn't working. Should I be using
/etc/aliases instead of /etc/postfix/aliases? A few hours ago I got
The Book of Postfix from No Starch Press, and they said
/etc/postfix/aliases (but I suspect that is wrong).


theu...@vcorpmail:~$ cat /etc/postfix/main.cf
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
home_mailbox = Maildir/
inet_interfaces = all
inet_protocols = ipv4
mailbox_size_limit = 4096
message_size_limit = 1024
mime_header_checks = regexp:/etc/postfix/mime_header_checks.regexp
mydestination = corpremote.local, localhost
myhostname = vcorpmail.corpremote.local
mynetworks = 127.0.0.0/8 [:::127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost = 192.168.1.16
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_recipient_restrictions = check_sender_access
regexp:/etc/postfix/check_sender_access.regexp, check_recipient_access
regexp:/etc/postfix/check_recipient_access.regexp,
check_relay_domains, reject_unauth_destination
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes



theu...@vcorpmail:~$ cat /etc/postfix/aliases
jim123: JIM123
theu...@vcorpmail:~$





On Mon, Dec 29, 2008 at 4:32 PM, Sahil Tandon sa...@tandon.net wrote:
 Xn Nooby wrote:

  Probably the easiest solution would be to write a script to create
  aliases in lower case.
 
  -Bryan
 
  No, that won't fix the problem.
 
  The best solution is to not use upper-case usernames.
 
  If that's not possible, the other solutions are:
  a) patch postfix local delivery agent to not force lowercase during
  delivery.
  b) use something other than the postfix local delivery agent.  Maybe
  maildrop or procmail...

 I created an /etc/postfix/aliases file containing:
jim123: JIM123

 Then I ran newaliases, but it did not seem to work.

 Is /etc/postfix/aliases appropriately defined in your main.cf?  Please
 show the output of 'postconf -n' and read:
 http://www.postfix.org/DEBUG_README.html#mail

 --
 Sahil Tandon sa...@tandon.net



Re: Trying to use uppercase names in Postfix.

2008-12-29 Thread Xn Nooby
 Your options are:

 1) Create lower-case UNIX password file entries with the same
 numerical UID and GID fields as the upper-case names, and with a
 * password.

I was able to resolve my problem by creating the duplicate entry in
the /etc/passwd file, I will  use this method.

I might uses aliases if I can get them to work, but at least I know
the passwd file is guaranteed to solve my problem.

thanks!


Re: Trying to use uppercase names in Postfix.

2008-12-29 Thread mouss
Xn Nooby a écrit :
 Hi Sahil,
 
 I am looking in to how to create the duplicate passwd file entries, I
 am assuming I cannot just edit the file without corrupting it.



you forgot to tell us which OS you run. let's assume your sudo ... as
a hint ;-p

- save the following as doit.sh

#!/bin/sh
IFS=:
cat /etc/passwd | while read user _x uid gid gecos home shell; do
user=`echo $user | tr [A-Z] [a-z]`
grep -q ^${user}: /etc/passwd
if [ $? -ne 0 ]; then
echo adduser --disabled-password --uid $uid --gid $gid --gecos $gecos
--home $home --shell $shell $user;
fi
done

- run it: sh doit.sh  lowerpass.sh

- edit lowerpass.sh and remove all lines but the ones that create the
users you want to create.




 Below
 is my main.cf and aliases file.  Also, should I post my replies to
 emails at the top or the bottom? (a few years ago some people got
 really mad at me, but now I can't remember which was correct)
 

put your replies at the bottom. if you don't know why, search for top
posting.

 I noticed the main.cf referred to /etc/aliases while I had edited
 /etc/postfix/aliases, so I also put my JIM123 entry in to /etc/aliases
 and ran sudo newaliases, but still isn't working. 

what is not working? As you have already been told, postfix local will
lowercase the address, so alias_maps don't help.

 Should I be using
 /etc/aliases instead of /etc/postfix/aliases? A few hours ago I got
 The Book of Postfix from No Starch Press, and they said
 /etc/postfix/aliases (but I suspect that is wrong).


This is system dependent. for postfix, the only thing that really
matters is that the path be the one specified in alias_maps and
alias_database.


Re: Trying to use uppercase names in Postfix.

2008-12-29 Thread Wietse Venema
Xn Nooby:
  Your options are:
 
  1) Create lower-case UNIX password file entries with the same
  numerical UID and GID fields as the upper-case names, and with a
  * password.
 
 I was able to resolve my problem by creating the duplicate entry in
 the /etc/passwd file, I will  use this method.

Good. Now, consider that this question was asked here for 10 years,
before I came up with this answer.

I may have posted this solution before but then everyone
including me gas forgotten it.

 I might uses aliases if I can get them to work, but at least I know
 the passwd file is guaranteed to solve my problem.

The aliases solution cannot work, because Postfix local(8) case-folds
all recipient addresses.

Wietse