PDA

View Full Version : Virtual Hosting with Postfix


alexej
27th April 2005, 17:48
I found the "Virtual Hosting with Postfix" howto very interesting. Unfortunately I'm using sendmail so I'd like to know if this is also possible with sendmail?

Alexej

joe
27th April 2005, 18:58
Hi,

I'm glad you found the articles interesting!

I've never liked sendmail so I've never even attempted to try it. However, this (http://www.sendmail.org/virtual-hosting.html) page seems to cover virtual hosting with sendmail pretty well. You can still use dovecot with sendmail but you would have to tune it to how you set sendmail up.

Good luck!

mike
28th April 2005, 13:18
Hey Joe,

nice howto you've written there. Thanks a lot! :)

Michael

intars
22nd September 2005, 15:43
bash: adduser: command not found
Can any help me?

linuxfast
22nd September 2005, 15:47
Are you logged in as root ?
try su - root if you previously used su root

also try useradd instead of adduser


btw: nice work joe, just checked out your unixmages pdf, very well written !
I wish this kind of material was around when I started out !

intars
23rd September 2005, 09:34
Hi, linuxfast!
I cannot create a new e-mail account. The command adduser is not working. I use SUSE 9.3, postfix mail server and have logged in as root.
Maybe there are other ways how to create an e-mail account?
Thank you!

till
23rd September 2005, 09:35
Have you tried the "adduser" command?

falko
23rd September 2005, 10:20
Hi, linuxfast!
I cannot create a new e-mail account. The command adduser is not working. I use SUSE 9.3, postfix mail server and have logged in as root.
Maybe there are other ways how to create an e-mail account?
Thank you!
What's which adduser showing? And what echo $PATH?

intars
23rd September 2005, 14:31
/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/jvm/jre/bin

matehortua
12th October 2005, 20:49
on my suse 9.3 box i work with: useradd and i dont have adduser.
remember that YAST exists and i create users like this:
empty home and /bin/false login.

hope it helps

dulaus
17th March 2006, 22:08
http://www.howtoforge.com/linux_postfix_virtual_hosting

I have followed these instructions but on page two of this tutorial I am not certain what to do below:

Tutorial instructions:

This is exactly what we set up in Part One. OK, so now we've got dovecot taking the user to the correct mail directory, now we still need to authenticate them. Line 23 tells us we want to support two types of authentication methods: plain and digest-md5. Plain is what every client under the sun supports, so we'll go with that. The digest portion doesn't harm anything sitting there and if your client supports it, then by all means, use it!

Finally, on lines 24 and 25 we see a userdb file and passdb file. Think of these as a second /etc/passwd and /etc/shadow file. The format of these files goes like this:

userdb
joe@domain1.com::1000:1000::/var/spool/vmail/domain1.com/:/bin/false::

passdb
joe@domain1.com:$1$G/FqlOG5$Vj0xmc9fKY.UVr8OWr/7C1

That encrypted password is an MD5 hash of the word 'test'. mkpasswd is a great utility for generating MD5 passwords. The 1000:1000 corresponds to the uid and gid of the "virtual" user we created in Part One. The home directory includes everything but the word before the @ in the email address.

My confusion is what to call these files and are they just plain *.txt files. I am using Mandrake 9.2 so I will be using the Apache password utility to generate passwords.

See URL below for the tutorial page 2.

Thanks

http://www.howtoforge.com/linux_postfix_virtual_hosting_2

falko
18th March 2006, 11:07
My confusion is what to call these files and are they just plain *.txt files.
It's mentioned in the tutorial:

24 auth_userdb = passwd-file /etc/dovecot/users
25 auth_passdb = passwd-file /etc/dovecot/passwd
So the user file is called /etc/dovecot/users, and the password file /etc/dovecot/passwd. They are plain-text files.

pradtf
26th March 2006, 10:24
passdb
joe@domain1.com:$1$G/FqlOG5$Vj0xmc9fKY.UVr8OWr/7C1

That encrypted password is an MD5 hash of the word 'test'. mkpasswd is a great utility for generating MD5 passwords.

great howto joe!
having set-up a mailserver with mysql and amavis, i really appreciate the simplicity here.

i'm stuck though on the password thing. you say that

$1$G/FqlOG5$Vj0xmc9fKY.UVr[/email]8OWr/7C1

is an MD5 hash of the word 'test' .... and it works for my login too!

however, when i generate this myself on mysql or php or here for instance:

http://www.spywire.net/password-encryption.php

i get this for 'test'

098f6bcd4621d373cade4e832627b4f6

and this doesn't let me log in.

i tried to find mkpasswd without success on freebsd and openbsd, but i'd like to know just what the MD5 hashes are that i am generating and how they relate to the hash that does work.

in friendship,
prad

falko
26th March 2006, 11:14
i'm stuck though on the password thing. you say that

$1$G/FqlOG5$Vj0xmc9fKY.UVr[/email]8OWr/7C1

is an MD5 hash of the word 'test' .... and it works for my login too!

I think it's a little bug in the tutorial: this doesn't look like an MD5 to me; it's rather a crypt.

pradtf
26th March 2006, 19:48
I think it's a little bug in the tutorial: this doesn't look like an MD5 to me; it's rather a crypt. great forum and nice pics on your site too!

thanks for the revelation!

the question then is how do i generate passwords to put in the passwd file? the site i mentioned earlier for instance produces 2 other formats

eg DES - test - $1$Y/wu9geZ$1o9WII91o1ApO6nWpBlUG/

which looks closer but of course close isn't good enough :D

what is there to create passwords that the authentication system will accept?
i do have mcrypt, but i haven't succeeded in generating the correct password.

falko
26th March 2006, 20:40
Do you have the passwd command? It should produce the correct passwords.

pradtf
26th March 2006, 21:19
Do you have the passwd command? It should produce the correct passwords.
yes but how do i get at the passwords? they show up in the /etc/passwd file as just '*'? i would be curious to know if we can access this any other way so you can see more than just the asterisk.

i just solved my difficulty another way though.

the md5 command (or any of the other stuff i listed earlier) are generated in what it turns out is a PLAIN-MD5 scheme. there is in fact a whole list of these schemes on the dovecot site:
http://wiki.dovecot.org/Authentication

so i just generated test using this on my freebsd system (any of the aforementioned ones give the same thing):
md5 -s test

got this as output:
MD5 ("test") = 098f6bcd4621d373cade4e832627b4f6

and put it in according to their instructions in the passwd file like this:
prad@yourcybercourt.info:{PLAIN-MD5}098f6bcd4621d373cade4e832627b4f6

so using {SCHEME} you can use a variety of password generation schemes like SHA or DES etc

the dovecot site is pretty helpful - i should have realized this before wandering over half the internet :D :D

(but i'm glad i found this place in the process)

falko
27th March 2006, 14:42
yes but how do i get at the passwords? they show up in the /etc/passwd file as just '*'? i would be curious to know if we can access this any other way so you can see more than just the asterisk.

The passwords are stored in /etc/shadow.

davestroy
4th May 2006, 18:59
I am running a dedicated server with SUSE 10.0 and have completed all steps on this great tutorial. Even changing the password ;-)

What I do not get answered in the tutorial are following:

1. How do I find out the smtp and pop server for the virtual domain (a domain i am hosting)? I expect them to be pop.domain.com and smtp.domain.com

2. I noticed that port 25 is not accessable (110 is) when I try to telnet, how can I correct that.

I am stuck on the point where I try to configure the mail account in my mail client (ex Outlook). The pop server test is passed but not the smtp test.

And when I send mail to this address, no mail is received. I have noticed that some folders have beed created in the users mail dir. one is .INBOX containing other folders, so something is going on.

My question is, Is there some very fundamental thing missing on my server to get the mail account up and running or how should I proceed?

Thanks for any help
David

djtremors
5th May 2006, 11:31
Is it just me or is adduser suppose to be useradd which is why it's not there?

falko
5th May 2006, 11:39
Is it just me or is adduser suppose to be useradd which is why it's not there?
adduser is the old command; you should use useradd now.

davestroy
14th May 2006, 02:08
I have been able to open up port 25 and dovecot runs as expected. I think it is something else going wrong. This is to read in /var/log/mail.err after reloading postfix:

May 14 02:00:18 suse10064lamp postfix/smtpd[25290]: fatal: open database /etc/postfix/vmaps.db: Invalid argument

and in /var/logs/mail:

May 14 02:07:25 suse10064lamp postfix/smtpd[25307]: private/proxymap socket: wanted attribute: (list terminator)
May 14 02:07:25 suse10064lamp postfix/smtpd[25307]: input attribute name: (end)
May 14 02:07:25 suse10064lamp postfix/smtpd[25307]: dict_proxy_open: connect to map=unix:passwd.byname status=0 server_flags=0120
May 14 02:07:25 suse10064lamp postfix/smtpd[25307]: dict_open: proxy:unix:passwd.byname
May 14 02:07:25 suse10064lamp postfix/smtpd[25307]: dict_open: hash:/etc/aliases
May 14 02:07:25 suse10064lamp postfix/smtpd[25307]: dict_open: hash:/etc/postfix/canonical
May 14 02:07:25 suse10064lamp postfix/smtpd[25307]: dict_open: hash:/etc/postfix/valias
May 14 02:07:25 suse10064lamp postfix/smtpd[25307]: fatal: open database /etc/postfix/vmaps.db: Invalid argument
May 14 02:07:26 suse10064lamp postfix/master[24736]: warning: process /usr/lib/postfix/smtpd pid 25307 exit status 1
May 14 02:07:26 suse10064lamp postfix/master[24736]: warning: /usr/lib/postfix/smtpd: bad command startup -- throttling

My main.cf looks like this (at the bottom)

readme_directory = /usr/share/doc/packages/postfix/README_FILES
inet_protocols = all
biff = no
mail_spool_directory = /var/mail
canonical_maps = hash:/etc/postfix/canonical
virtual_maps = hash:/etc/postfix/virtual
relocated_maps = hash:/etc/postfix/relocated
transport_maps = hash:/etc/postfix/transport
sender_canonical_maps = hash:/etc/postfix/sender_canonical
masquerade_exceptions = root
masquerade_classes = envelope_sender, header_sender, header_recipient
myhostname = suse10064lamp.site
program_directory = /usr/lib/postfix
masquerade_domains =
mydestination = $myhostname, localhost.$mydomain
defer_transports =
disable_dns_lookups = no
mailbox_command =
mailbox_transport =
strict_8bitmime = no
disable_mime_output_conversion = no
smtpd_sender_restrictions = hash:/etc/postfix/access
smtpd_client_restrictions =
smtpd_helo_required = no
smtpd_helo_restrictions =
strict_rfc821_envelopes = no
smtpd_recipient_restrictions = permit_mynetworks,reject_unauth_destination
smtp_sasl_auth_enable = no
smtpd_sasl_auth_enable = no
#smtpd_sasl_local_domain =
smtpd_use_tls = no
smtp_use_tls = no
alias_maps = hash:/etc/aliases
mailbox_size_limit = 0
message_size_limit = 10240000

virtual_mailbox_domains = /etc/postfix/vhosts
virtual_mailbox_base = /var/spool/vmail
virtual_mailbox_maps = hash:/etc/postfix/vmaps
virtual_uid_maps = static:1000
virtual_gid_maps = static:1000
virtual_alias_maps = hash:/etc/postfix/valias


Can anyone tell something from this?

/ David

davestroy
14th May 2006, 10:50
The las errors had to do with some misconfiguration when i tried to use gid 1000 because that id is used by ftp on my server.

virtual_uid_maps = static:1000
virtual_gid_maps = static:1000

So I am able to use mailaccounts that I alias to some other mail. If I remove alias mails sent to accounts on my server are bounced saying that the user does not exist:

[HTML]<<< 550 <user@domain.com>: Recipient address rejected: User unknown in local recipient table
550 5.1.1 <user@domain.com>... User unknown
<<< 554 Error: no valid recipients
Reporting-MTA: dns; mail.domain.com

falko
14th May 2006, 16:04
Did you follow this tutorial: http://www.howtoforge.com/linux_postfix_virtual_hosting to the letter? Because I don't use /etc/postfix/vmaps.db in that tutorial, so I guess you made some changes.
However, run
postmap /etc/postfix/vmaps
and restart Postfix to get rid of the /etc/postfix/vmaps.db error.

DCLoppy
26th May 2006, 05:42
I too am trying to follow this tutorial but seem have made a basic error and would appreciate any pointers:

Thhe configuration file stops loading at the lines

24 auth_userdb = passwd-file /etc/dovecot/users
25 auth_passdb = passwd-file /etc/dovecot/passwd

message is "error in config file .....: Unknown setting: userdb

Dovecot version is 1.0beta 3 running under FreeBSD 6.0

Thanks

falko
26th May 2006, 16:20
Maybe you're missing a module for dovecot?
What's the exact error message?

DCLoppy
27th May 2006, 05:46
I solved ( or worked around) the problem I had earlier - see a few messages ago - by using a different format


userdb passwd-file {
args = /etc/dovecot/users
}


instead of the style used in the tutorial. Or maybe I changed something else and fixed another problem ??? Anyway everything is now working.