# Postfix setup [SOLVED]

## rshadow

Giving up on Qmail as of recently has led me to give postfix a shot.  I have been following the Gentoo guide at http://www.gentoo.org/doc/en/virt-mail-howto.xml . I however have a few questions that I hope somebody can help me with.

1. I don't want any local delivery.  I wan't everything delivered virtualy.  Currently this isn't working so that leads to number 2.

2. right now I have the mysql tables setup so that my main domain is is a "virtual" delivery however mail is being delivered to the local inbox, this leads to two problems.  One the user who checks via pop3/imap never gets there mail and two the /home/vmail/domain/user/.maildir is never created because the mail is never delivered there.

3.  Would it be difficult to change from clear text to crypt text for all passwords? Is there a guide, howto, or example of how to do this?

4. If I add a domain I have to add it to both the mysql database and the postfix main.cf file?

Any help would be appreciated.  Thanks!Last edited by rshadow on Mon Apr 24, 2006 4:42 am; edited 1 time in total

----------

## TheRAt

You might like to browse through HOWTO Email: A Complete Virtual System at the Gentoo Wiki

----------

## rshadow

That howto is very nice, but its basicly the same thing that the '"official" gentoo guide is, only not using MySQL (which in my case, I want to use).  Any other postfix wizards out there?

----------

## rshadow

after further investigation I have come to the following conclusion.

 Local mail is working as expected.  I can ssh into an account and send and receive mail with the outside world via mutt or another CLI mail reader.

However there is no way for an outside client to connect and download the mail because of the reasons that I stated before.  It is impossible to send mail as well because this apparently checks for the existance of the the .maildir for the user (which of course doesn't exist)

TLS also has problems.  When I attempt to connected with TLS the response is "STARTTLS is not an options" however if I telnet to port 25 I and issue a EHLO command STARTTLS is listed, so I decided to give it the STARTTLS command the response was

```

250-PIPELINING

250-SIZE 10240000

250-VRFY

250-ETRN

250-STARTTLS

250-AUTH LOGIN PLAIN

250-AUTH=LOGIN PLAIN

250 8BITMIME

STARTTLS

454 TLS not available due to local problem

```

I don't have any clue where to start to try and figure this one out

log of a connection attempt

```

Apr 18 08:11:30 zues pop3d-ssl: Connection, ip=[211.205.214.78]

Apr 18 08:11:31 zues authdaemond: received auth request, service=pop3, authtype=login

Apr 18 08:11:31 zues authdaemond: authmysql: trying this module

Apr 18 08:11:31 zues authdaemond: SQL query: SELECT email, "", clear, uid, gid, homedir., maildir, "", name, "" FROM users WHERE email = "sbunn@rougesoftware.net"

Apr 18 08:11:31 zues pop3d-ssl: chdir /home/vmail/rougesoftware.net/sbunn/.maildir: No such file or directory

Apr 18 08:11:31 zues authdaemond: authmysql: sysusername=<null>, sysuserid=XXXX, sysgroupid=XXXX, homedir=/home/vmail, address=sbunn@rougesoftware.net, fullname=my test user, maildir=/home/vmail/rougesoftware.net/sbunn/.maildir, quota=<null>, options=<null>

Apr 18 08:11:31 zues authdaemond: authmysql: clearpasswd=XXXXXX, passwd=<null>

Apr 18 08:11:31 zues authdaemond: Authenticated: sysusername=<null>, sysuserid=1003, sysgroupid=1003, homedir=/home/vmail, address=sbunn@rougesoftware.net, fullname=my test user, maildir=/home/vmail/rougesoftware.net/sbunn/.maildir, quota=<null>, options=<null>

Apr 18 08:11:31 zues authdaemond: Authenticated: clearpasswd=XXXXXX, passwd=<null>

Apr 18 08:12:06 zues pop3d-ssl: Connection, ip=[211.205.214.78]

Apr 18 08:12:07 zues authdaemond: received auth request, service=pop3, authtype=login

Apr 18 08:12:07 zues authdaemond: authmysql: trying this module

Apr 18 08:12:07 zues authdaemond: SQL query: SELECT email, "", clear, uid, gid, homedir., maildir, "", name, "" FROM users WHERE email = "sbunn@rougesoftware.net"

Apr 18 08:12:07 zues authdaemond: authmysql: sysusername=<null>, sysuserid=XXXX, sysgroupid=XXXX, homedir=/home/vmail, address=sbunn@rougesoftware.net, fullname=my test user, maildir=/home/vmail/rougesoftware.net/sbunn/.maildir, quota=<null>, options=<null>

Apr 18 08:12:07 zues authdaemond: authmysql: clearpasswd=XXXXX, passwd=<null>

Apr 18 08:12:07 zues authdaemond: Authenticated: sysusername=<null>, sysuserid=XXXX, sysgroupid=XXXX, homedir=/home/vmail, address=sbunn@rougesoftware.net, fullname=my test user, maildir=/home/vmail/rougesoftware.net/sbunn/.maildir, quota=<null>, options=<null>

Apr 18 08:12:07 zues authdaemond: Authenticated: clearpasswd=XXXXX, passwd=<null>

Apr 18 08:12:07 zues pop3d-ssl: chdir /home/vmail/rougesoftware.net/sbunn/.maildir: No such file or directory

```

So I now have 3 show-stopping questions.

1. How do I make my "real" domainname act as a virtual domain as far as postfix is concerned

2. How to make the clearpasswd into cryptpasswd 

3. How to fix my STARTTLS problem.

Any help or advice on where to start to look for a solution would be greatly appreciated.  Thanks.

----------

## DaveArb

I'm severely not a Postfix expert, but I've been working with it some in hopes of becoming comfortable enough with it to replace my (employer's) sendmail system with it.

On the maildir delivery problem, does the `maildir` field in the users table end with a slash (/)? That's seemingly the indication to the virtual delivery agent  to use maildirs.

My wild guess (based on my experience and shortcomings) on your TLS problem is that your certs aren't correct. Like I say, that's because I had a very hard time getting it all exactly correct on my sendmail system. I'd recommend revisiting that part of the howto.

Also:

```
Apr 18 08:11:31 zues authdaemond: SQL query: SELECT email, "", clear, uid, gid, homedir., maildir, "", name, "" FROM users WHERE email = "sbunn@rougesoftware.net"
```

Is that dot after "homedir" really supposed to be there?

----------

## rshadow

Thanks for the reply, I will revisit the cert section of the howto after work and see if I made any mistakes there.  Yes there is a trailing slash in the user portion of the directory, but there is no trailing slash in the "homedir" portion (its just /home/vmail) I will try adding a trailing slash and see if that resolves the problem.

As for the dot after homedir isn't that comming internaly from authdaemond? I don't remember setting that up anywhere.

----------

## DaveArb

 *rshadow wrote:*   

> As for the dot after homedir isn't that comming internaly from authdaemond? I don't remember setting that up anywhere.

 

I don't know why it would arbitrarily add a dot, only after the homedir field. Check /etc/courier/authlib/authmysqlrc for the line starting "MYSQL_HOME_FIELD" and see if a dot accidentally snuck in there.

I think this could be part of your problem because if I execute that exact SQL query against my mail table, it errors. Taking out the dot, it succeeds.

----------

## luker0

Which IMAP server are you using and is Postfix configured to use that delivery agent?

I.e. for Cyrus Imap, Postfix needs to be told to use the deliver program.   For Sendmail we used to use procmail.  Etc...

Looks like you mail delivery agent is not accepting email from your mail transfer agent.

----------

## rshadow

I'll check for the dot again, its very possibly I did that (which could be the reason why local mail is delivered fine and virutal mail isn't working).  As for the IMAP server I'm using courier-imap.  I'll post an update tonight when I get home and can check for the homedir.  However the problem still remains as to how to make change my default domain from local to virtual.  Once I get virtual mail working I still need to figure out how to change my actual domain to virtual.  Thanks for all the help thus far.

----------

## magic919

Leaving aside TLS for a moment...  Don't get too diverted by the Mail Delivery Agent (MDA) as this is just part of Postfix.  In this case the MDA is Virtual.  This is the Postfix MDA for virtual domains.  Local is the Local Delivery Agent (LDA) and in time you'll probably want to switch this off by the sound of things.  Your Transport table is the bit controlling Local and Virtual as far as I can see.

----------

## rshadow

Well I followed the guide that theRAT suggested at the Gentoo Wiki and just changed all the pg stuff to mysql.  But the solution to my problem was to simply comment out $mydestination in main.cf

----------

