Need help with virtual domain

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Need help with virtual domain

Carconni

Hi,

I've been racking my brain trying to get this to work and I know it shouldn't be this difficult but I just cant seem to get it right.  I need to set up a virtual domain and have all mail forwarded to a file.  I've tried creating virtual_mailbox files and virtual_aliases files, etc and I've encountered a number of errors.  Can someone tell me where I'm going wrong?

I've read so many how-to's that it's all muddled now:

My actual domain: mycompany.com

My virtual domain: virtualcompany.com (no mx, no dns)  There are no users in this domain and I want to forward [hidden email] to either a virtual mailbox or a file.

mailserver:/var/vmail/virtualcompany.com root# postconf -n
alias_maps = hash:/etc/postfix/lmail/mycompany.aliases,hash:/var/mailman/data/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
enable_server_options = yes
html_directory = no
inet_interfaces = all
mail_owner = postfix
mailbox_transport = cyrus
mailq_path = /usr/bin/mailq
manpage_directory = /usr/share/man
message_size_limit = 0
mydestination = $myhostname,localhost.$mydomain,localhost,mail.mycompany.com,sjc.mycompany.com,corp.mycompany.com,mail.corp.mycompany.com,mycompany.com,mycompany-wpa.net,lw-wpa.com,mycompany-wpa.com
mydomain = mycompany.com
mydomain_fallback = localhost
myhostname = mail.mycompany.com
mynetworks = 127.0.0.1/32,172.16.0.0/16,172.18.0.0/16,172.20.0.0/16,209.37.125.13,209.64.135.252,24.34.16.228,10.1.0.0/16,208.64.132.0/22,63.80.14.0/23,75.37.253.152/29
mynetworks_style = host
newaliases_path = /usr/bin/newaliases
queue_directory = /private/var/spool/postfix
readme_directory = /usr/share/doc/postfix
recipient_bcc_maps = hash:/etc/postfix/recipient_bcc
sample_directory = /usr/share/doc/postfix/examples
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
smtpd_client_restrictions = hash:/etc/postfix/smtpdreject
smtpd_enforce_tls = no
smtpd_pw_server_security_options = gssapi,cram-md5,login,plain
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination,permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = mycompany.com
smtpd_tls_CAfile = /etc/certificates/mail.mycompany.com.chcrt
smtpd_tls_cert_file = /etc/certificates/mail.mycompany.com.crt
smtpd_tls_key_file = /etc/certificates/mail.mycompany.com.key
smtpd_use_pw_server = yes
smtpd_use_tls = yes
soft_bounce = no
unknown_local_recipient_reject_code = 550
virtual_alias_domains = /etc/postfix/virtual_domains
virtual_alias_maps = hash:/etc/postfix/engineeringmaps,hash:/etc/postfix/virtual_alias
virtual_mailbox_base = /var/vmail
virtual_mailbox_maps = hash:/etc/postfix/virtual_mailbox
virtual_transport = lmtp:unix:/var/imap/socket/lmtp


mailserver:/var/vmail/virtualcompany.com root# cd /etc/postfix/
mailserver:/etc/postfix root# ls
LICENSE                 main.cf                 master.cf               post-install            relay_recipients        transport               virtual_domains.db
access                  main.cf.61307           master.orig             postfix-files           relay_recipients.db     virtual                 virtual_mailbox
aliases                 main.cf.default         engineeringmaps              postfix-script          relocated               virtual.orig            virtual_mailbox.db
canonical               main.cf052008           engineeringmaps.db           prng_exch               sample                  virtual_alias           vmail
header_checks           main.cf6707.2           engineeringmaps.old          recipient_bcc           smtpdreject             virtual_alias.db        vmail.orig
lmail                   main.cf820072           obsolete_files          recipient_bcc.db        smtpdreject.db          virtual_domains


mailserver:/etc/postfix root# vi virtual_alias

@virtualcompany.com /var/vmail/virtualcompany.com/catchall    


mailserver:/etc/postfix root# vi virtual_mailbox

@virtualcompany.com /var/vmail/virtualcompany.com/catchall


mailserver:/etc/postfix root# vi virtual_domains

# This file is auto-generated by the Server Admin:Mail
# backend plugin whenever mail settings are saved.
#
# *** Please do not edit. ***
#
# Last modified on: 2006-07-28 14:04:33 -0700

customer1.com     allow
blogs.mycompany.com     allow
media.mycompany.com     allow
corpblogs.mycompany.com         allow
virtualcompany.com    allow


corp-admin2:/etc/postfix/vmail root# ls -l /var/vmail/
total 0
drwxr-xr-x   2 cyrusima  mail   68 Dec 12 10:38 blogs.mycompany.com
drwxr-xr-x   2 cyrusima  mail   68 Dec 27 10:13 corpblogs.mycompany.com
drwxr-xr-x   2 cyrusima  mail   68 Dec 12 10:39 customer1.com
drwxr-xr-x   2 cyrusima  mail   68 Dec 12 10:39 media.mycompany.com
drwxr-xr-x   3 cyrusima  mail  102 May 20 00:58 virtualcompany.com







 

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Need help with virtual domain

mouss-2
carconni wrote:
>
> Hi,
>
> I've been racking my brain trying to get this to work and I know it
> shouldn't be this difficult but I just cant seem to get it right.  I
> need to set up a virtual domain and have all mail forwarded to a
> file.  I've tried creating virtual_mailbox files and virtual_aliases
> files, etc and I've encountered a number of errors.  Can someone tell
> me where I'm going wrong?

- the right hand of a virtual alias is an address to forward mail to,
not a pathname.
- one domain must be in a single class (either mydestination,
relay_domains, virtual_alias_domains, virtual_mailbox_domains). it must
not be in two classes
- a virtual alias domain has no mailboxes: addresses must be rewritten
to redirect to _another_ domain

>
> I've read so many how-to's that it's all muddled now:

Instead of reading howtos, read the documentation on the postfix site
    http://www.postfix.org/documentation.html

In particular,
    http://www.postfix.org/ADDRESS_CLASS_README.html
    http://www.postfix.org/ADDRESS_REWRITING_README.html
    http://www.postfix.org/VIRTUAL_README.html

> [snip]
> virtual_alias_domains = /etc/postfix/virtual_domains

replace the above with
virtual_mailbox_domains = /etc/postfix/virtual_domains

> virtual_alias_maps =
> hash:/etc/postfix/engineeringmaps,hash:/etc/postfix/virtual_alias
> virtual_mailbox_base = /var/vmail
> virtual_mailbox_maps = hash:/etc/postfix/virtual_mailbox
> virtual_transport = lmtp:unix:/var/imap/socket/lmtp
>
> [snip]
>
> mailserver:/etc/postfix root# vi virtual_alias
>
>     @virtualcompany.com /var/vmail/virtualcompany.com/catchall

replace the above with

@virtualcompany.com   [hidden email]

>
>
> mailserver:/etc/postfix root# vi virtual_mailbox
>
>     @virtualcompany.com /var/vmail/virtualcompany.com/catchall
replace the above with
[hidden email] /var/vmail/virtualcompany.com/catchall
>
>
> [snip]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Need help with virtual domain

Carconni
Thank you for taking the to help me with this.  I did make the suggested changes but I'm still getting errors in the log: (although it is a different error)

I have an old postfix manual and I've visited the postfix.org site and this looks right but it's still not working.  Should I set up a virtual_mailbox_map?

May 20 08:45:55 mailserver postfix/lmtp[3240]: 8A8DE5DAFC34: to=<[hidden email]>, orig_to=<[hidden email]>, relay=/var/imap/socket/lmtp[/var/imap/socket/lmtp], delay=1, status=bounced (host /var/imap/socket/lmtp[/var/imap/socket/lmtp] said: 550-Mailbox unknown.  Either there is no mailbox associated with this 550-name or you do not have authorization to see it. 550 5.1.1 User unknown (in reply to RCPT TO command))


The mailbox is there:

mailserver:/var/vmail/virtualcompany.com root# cd /var/vmail/
mailserver:/var/vmail root# ls -l
total 0
drwxr-xr-x   2 cyrusima  mail   68 Dec 12 10:38 blogs.mycompany.com
drwxr-xr-x   2 cyrusima  mail   68 Dec 27 10:13 corpblogs.mycompany.com
drwxr-xr-x   2 cyrusima  mail   68 Dec 12 10:39 customer1.com
drwxr-xr-x   2 cyrusima  mail   68 Dec 12 10:39 media.mycompany.com
drwxr-xr-x   3 cyrusima  mail  102 May 20 00:58 virtualcompany.com

mailserver:/var/vmail/virtualcompany.com root# ls -l
total 0
drwxr-xr-x   2 cyrusima  mail  68 May 20 00:58 catchall

mailserver:/var/vmail/virtualcompany.com root# postconf -n

alias_maps = hash:/etc/postfix/lmail/mycompany.aliases,hash:/var/mailman/data/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
enable_server_options = yes
html_directory = no
inet_interfaces = all
mail_owner = postfix
mailbox_transport = cyrus
mailq_path = /usr/bin/mailq
manpage_directory = /usr/share/man
message_size_limit = 0
mydestination = $myhostname,localhost.$mydomain,localhost,mail.mycompany.com,sjc.mycompany.com,corp.mycompany.com,mail.corp.mycompany.com,mycompany.com,mycompany-wpa.net,lw-wpa.com,mycompany-wpa.com
mydomain = mycompany.com
mydomain_fallback = localhost
myhostname = mail.mycompany.com
mynetworks = 127.0.0.1/32,172.16.0.0/16,172.18.0.0/16,172.20.0.0/16,209.37.125.13,209.64.135.252,24.34.16.228,10.1.0.0/16,208.64.132.0/22,63.80.14.0/23,75.37.253.152/29
mynetworks_style = host
newaliases_path = /usr/bin/newaliases
queue_directory = /private/var/spool/postfix
readme_directory = /usr/share/doc/postfix
recipient_bcc_maps = hash:/etc/postfix/recipient_bcc
sample_directory = /usr/share/doc/postfix/examples
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
smtpd_client_restrictions = hash:/etc/postfix/smtpdreject
smtpd_enforce_tls = no
smtpd_pw_server_security_options = gssapi,cram-md5,login,plain
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination,permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = mycompany.com
smtpd_tls_CAfile = /etc/certificates/mail.mycompany.com.chcrt
smtpd_tls_cert_file = /etc/certificates/mail.mycompany.com.crt
smtpd_tls_key_file = /etc/certificates/mail.mycompany.com.key
smtpd_use_pw_server = yes
smtpd_use_tls = yes
soft_bounce = no
unknown_local_recipient_reject_code = 550

virtual_alias_maps = hash:/etc/postfix/mobilemaps,hash:/etc/postfix/virtual_alias
virtual_mailbox_base = /var/vmail
virtual_mailbox_domains = /etc/postfix/virtual_domains
virtual_mailbox_maps = hash:/etc/postfix/virtual_mailbox
virtual_transport = lmtp:unix:/var/imap/socket/lmtp


and this kind of confuses me:

NEVER put a virtual MAILBOX wild-card in the virtual ALIAS file!!

mailserver:/etc/postfix root# vi virtual_alias

    @virtualcompany.com /var/vmail/virtualcompany.com/catchall

replace the above with

@virtualcompany.com   [hidden email]

Thank you again


On May 20, 2008, at 3:56 AM, mouss wrote:
carconni wrote:

Hi,

I've been racking my brain trying to get this to work and I know it shouldn't be this difficult but I just cant seem to get it right.  I need to set up a virtual domain and have all mail forwarded to a file.  I've tried creating virtual_mailbox files and virtual_aliases files, etc and I've encountered a number of errors.  Can someone tell me where I'm going wrong?

- the right hand of a virtual alias is an address to forward mail to, not a pathname.
- one domain must be in a single class (either mydestination, relay_domains, virtual_alias_domains, virtual_mailbox_domains). it must not be in two classes
- a virtual alias domain has no mailboxes: addresses must be rewritten to redirect to _another_ domain


I've read so many how-to's that it's all muddled now:

Instead of reading howtos, read the documentation on the postfix site

In particular,

[snip]
virtual_alias_domains = /etc/postfix/virtual_domains

replace the above with
virtual_mailbox_domains = /etc/postfix/virtual_domains

virtual_alias_maps = hash:/etc/postfix/engineeringmaps,hash:/etc/postfix/virtual_alias
virtual_mailbox_base = /var/vmail
virtual_mailbox_maps = hash:/etc/postfix/virtual_mailbox
virtual_transport = lmtp:unix:/var/imap/socket/lmtp

[snip]

mailserver:/etc/postfix root# vi virtual_alias

    @virtualcompany.com /var/vmail/virtualcompany.com/catchall

replace the above with

@virtualcompany.com   [hidden email]



mailserver:/etc/postfix root# vi virtual_mailbox

    @virtualcompany.com /var/vmail/virtualcompany.com/catchall
replace the above with
[hidden email] /var/vmail/virtualcompany.com/catchall


[snip]



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Need help with virtual domain

mouss-2
carconni wrote:

> Thank you for taking the to help me with this.  I did make the
> suggested changes but I'm still getting errors in the log: (although
> it is a different error)
>
> I have an old postfix manual and I've visited the postfix.org site and
> this looks right but it's still not working.  Should I set up a
> virtual_mailbox_map?
>
> May 20 08:45:55 mailserver postfix/lmtp[3240]: 8A8DE5DAFC34:
> to=<[hidden email]>, orig_to=<[hidden email]>,
> relay=/var/imap/socket/lmtp[/var/imap/socket/lmtp], delay=1,
> status=bounced (host /var/imap/socket/lmtp[/var/imap/socket/lmtp]
> said: 550-Mailbox unknown.  Either there is no mailbox associated with
> this 550-name or you do not have authorization to see it. 550 5.1.1
> User unknown (in reply to RCPT TO command))
>

your cyrus imap server doesn't like [hidden email]
(something is need to tell cyrus imap that this user exists).


> [snip]
>
> and this kind of confuses me:
>
> NEVER put a virtual MAILBOX wild-card in the virtual ALIAS file!!

This is a warning for people who do not use a catchall.

wildcard aliases break recipients, so postfix will accept all addresses
during the smtp transaction, but will bounce if it can't deliver (which
results in backscatter).

but if you use a catchall and get it to work, there is no
accept-then-bounce problem.
Loading...