a little bit of help with aliases

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

a little bit of help with aliases

toneeedavis
Hi,

I wonder if anyone can help with what will probably be a very simple problem.

I have setup postfix and am now just trying to setup my system so that all emails to root get redirected to an external address, this is done in teh aliases file ine /etc/

i have then ran newalises and all seems to be fine.

If i then send an email to root it gets sent to [hidden email] rather than [hidden email]. So it just sits in the queue, not knowing where to be delivered.

can anyone point me in the direction of the bit of config that has to be changed please?

Hope someone can help.

Kind Regards

Tony
Reply | Threaded
Open this post in threaded view
|

Re: a little bit of help with aliases

Ansgar Wiechers
On 2010-01-14 [hidden email] wrote:

> I have setup postfix and am now just trying to setup my system so that
> all emails to root get redirected to an external address, this is done
> in teh aliases file ine /etc/
>
> i have then ran newalises and all seems to be fine.
>
> If i then send an email to root it gets sent to
> [hidden email] than [hidden email] it just sits in
> the queue, not knowing where to be delivered.
>
> can anyone point me in the direction of the bit of config that has to
> be changed please?

Please post the output of "postconf -n" and "grep ^root /etc/aliases".

Regards
Ansgar Wiechers
--
"Abstractions save us time working, but they don't save us time learning."
--Joel Spolsky
Reply | Threaded
Open this post in threaded view
|

Re: a little bit of help with aliases

Daniel V. Reinhardt
In reply to this post by toneeedavis




>
>From: "[hidden email]" <[hidden email]>
>To: [hidden email]
>Sent: Thu, January 14, 2010 2:46:47 PM
>Subject: a little bit of help with aliases
>
>Hi,
>
>I wonder if anyone can help with what will probably be a very simple problem.
>
>I have setup postfix and am now just trying to setup my system so that all emails to root get redirected to an external address, this is done in teh aliases file ine /etc/
>
>i have then ran newalises and all seems to be fine.
>
>If i then send an email to root it gets sent to [hidden email] rather than [hidden email]. So it just sits in the queue, not knowing where to be delivered.
>
>can anyone point me in the direction of the bit of config that has to be changed please?

In the aliases file put this:

root: user@domain1, user2@domain2

Save the file, then run newaliases.

Thanks,
 Daniel Reinhardt
Website: www.cryptodan.com
Email: [hidden email]
Junior Network Security Engineer


>
>Hope someone can help.
>
>Kind Regards
>
>Tony
>


     
Reply | Threaded
Open this post in threaded view
|

Re: a little bit of help with aliases

mouss-4
In reply to this post by toneeedavis
[hidden email] a écrit :

> Hi,
>
> I wonder if anyone can help with what will probably be a very simple
> problem.
>
> I have setup postfix and am now just trying to setup my system so that
> all emails to root get redirected to an external address, this is done
> in teh aliases file ine /etc/
>
> i have then ran newalises and all seems to be fine.
>
> If i then send an email to root it gets sent to [hidden email]
> rather than [hidden email]. So it just sits in the queue, not knowing
> where to be delivered.

The way you state it, it's not possible...

- when you send mail to <joe>, it gets sent to <joe@$myorigin>. you can set:
myorigin = $mydomain
this way, <root> become <[hidden email]> (without the host part).

more on this in the ADDRESS REWRITE README (if you don't know where this
is, google will bring you there).

if this doesn't solve your problem, please be more precise:
- explain exactly what you want and what happens (try to be as precise
as you can. don't forget that what may be "natural" for you is not
natural for others...)
- show the output of 'postconf -n'.

more advice is found in the DEBUG README.

>
> can anyone point me in the direction of the bit of config that has to be
> changed please?
>
> Hope someone can help.
>
> Kind Regards
>
> Tony

Reply | Threaded
Open this post in threaded view
|

Re: a little bit of help with aliases

toneeedavis
Hi,

Thanks for the help. Ok here is a little more detail...

Postconf -n output

address_verify_map = btree:/var/lib/postfix/address_verify
alias_database = hash:/etc/aliases
bounce_queue_lifetime = 2d
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
disable_vrfy_command = yes
html_directory = no
inet_interfaces = all
invalid_hostname_reject_code = 450
mail_owner = postfix
mailq_path = /usr/bin/mailq
manpage_directory = /usr/local/man
maps_rbl_reject_code = 450
maximal_queue_lifetime = 2d
mydestination = localhost.$mydomain, localhost
mydomain = domain.tld
myhostname = mail.domain.tld
mynetworks = 127.0.0.0/8 172.16.1.0/16
newaliases_path = /usr/bin/newaliases
non_fqdn_reject_code = 450
queue_directory = /var/spool/postfix
readme_directory = no
sample_directory = /etc/postfix
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
smtp_helo_timeout = 120s
smtp_mail_timeout = 120s
smtp_rcpt_timeout = 120s
smtp_starttls_timeout = 120s
smtp_tls_CAfile = /etc/pki/tls/cert.pem
smtp_tls_cert_file = /etc/pki/dovecot/certs/dovecot.pem
smtp_tls_key_file = /etc/pki/dovecot/private/dovecot.pem
smtp_tls_loglevel = 1
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:/var/lib/postfix/smtp_tls_session_cache
smtpd_client_connection_count_limit = 5
        permit_multi_recipient_bounce,h_pipelining,
smtpd_helo_required = yes
        permit_unauth_destinationrmit_mynetworks
smtpd_sasl_auth_enable = yes
smtpd_sasl_exceptions_networks = $mynetworks
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_starttls_timeout = 120s
smtpd_tls_CAfile = /etc/pki/tls/cert.pem
smtpd_tls_ask_ccert = yes
smtpd_tls_cert_file = /etc/pki/dovecot/certs/dovecot.pem
smtpd_tls_dh1024_param_file = $config_directory/dh_1024.pem
smtpd_tls_dh512_param_file = $config_directory/dh_512.pem
smtpd_tls_key_file = /etc/pki/dovecot/private/dovecot.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:/var/lib/postfix/smtpd_tls_session_cache
tls_random_source = dev:/dev/urandom
virtual_alias_maps = proxy:mysql:$config_directory/mysql/mysql_virtual_alias_maps.cf
virtual_gid_maps = static:12
virtual_mailbox_base = /ml/vmail
virtual_mailbox_domains = proxy:mysql:$config_directory/mysql/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = proxy:mysql:$config_directory/mysql/mysql_virtual_mailbox_maps.cf
virtual_minimum_uid = 5000
virtual_transport = dovecot
virtual_uid_maps = static:5000


so i am running a virtual setup using mysql for maps. when i try to send an email to root it gets sent to [hidden email], this email address doesnt exist, it is a local root account, so i have setup an alias in /etc/aliases which is root:     [hidden email] but this doesnt seem to be working. the mails just sit in  the mail queue not being delivered to the local account. I hope this is enough information for people to help me.

Hope someone can show me the error of my ways :) Thankyou in advance.

Kind Regards

Tony

On Thu, Jan 14, 2010 at 11:26 PM, mouss <[hidden email]> wrote:
[hidden email] a écrit :
> Hi,
>
> I wonder if anyone can help with what will probably be a very simple
> problem.
>
> I have setup postfix and am now just trying to setup my system so that
> all emails to root get redirected to an external address, this is done
> in teh aliases file ine /etc/
>
> i have then ran newalises and all seems to be fine.
>
> If i then send an email to root it gets sent to [hidden email]
> rather than [hidden email]. So it just sits in the queue, not knowing
> where to be delivered.

The way you state it, it's not possible...

- when you send mail to <joe>, it gets sent to <joe@$myorigin>. you can set:
myorigin = $mydomain
this way, <root> become <[hidden email]> (without the host part).

more on this in the ADDRESS REWRITE README (if you don't know where this
is, google will bring you there).

if this doesn't solve your problem, please be more precise:
- explain exactly what you want and what happens (try to be as precise
as you can. don't forget that what may be "natural" for you is not
natural for others...)
- show the output of 'postconf -n'.

more advice is found in the DEBUG README.

>
> can anyone point me in the direction of the bit of config that has to be
> changed please?
>
> Hope someone can help.
>
> Kind Regards
>
> Tony


Reply | Threaded
Open this post in threaded view
|

Re: a little bit of help with aliases

Barney Desmond
2010/1/15  <[hidden email]>:

> Postconf -n output
>
> mydestination = localhost.$mydomain, localhost
> mydomain = domain.tld
> myhostname = mail.domain.tld
> mynetworks = 127.0.0.0/8 172.16.1.0/16
> virtual_alias_maps =
> proxy:mysql:$config_directory/mysql/mysql_virtual_alias_maps.cf
> virtual_gid_maps = static:12
> virtual_mailbox_base = /ml/vmail
> virtual_mailbox_domains =
> proxy:mysql:$config_directory/mysql/mysql_virtual_domains_maps.cf
> virtual_mailbox_maps =
> proxy:mysql:$config_directory/mysql/mysql_virtual_mailbox_maps.cf
> virtual_minimum_uid = 5000
> virtual_transport = dovecot
> virtual_uid_maps = static:5000
>
>
> so i am running a virtual setup using mysql for maps. when i try to send an
> email to root it gets sent to [hidden email], this email address
> doesnt exist, it is a local root account, so i have setup an alias in
> /etc/aliases which is root:     [hidden email] but this doesnt
> seem to be working. the mails just sit in  the mail queue not being
> delivered to the local account. I hope this is enough information for people
> to help me.

I'm not 100% confident in my reading of your config, but this is what
I think is happening:
1. Mail is submitted for "root"
2. This isn't a qualified email address, so Postfix appends
"@$myorigin" (see
http://www.postfix.org/postconf.5.html#append_at_myorigin)
3. $myorigin = $myhostname by default, so the recipient address is now
[hidden email]
4. /etc/aliases is only good for local deliveries, not virtual aliased
addresses or virtual mailbox addresses. "Local" addresses are anything
at $mydestination.
5. It should be evident that [hidden email] isn't considered a
local address now. Postfix now has to figure out what Address Class it
belongs in, and handle it accordingly.

All about address classes: http://www.postfix.org/ADDRESS_CLASS_README.html

Now, I don't know what your mysql says about mail.domain.tld as a
domain, so I don't know if it'd be treated as a virtual-alias or
virtual-mailbox domain - I'm not really sure why it's stuck in the
queue. If you want to pass this mail off to an external address, I
think you can:

1. Add $myhostname to $mydestination, I believe this is the default
configuration (ie. your changes to main.cf caused this breakage).
/etc/aliases will then be effective
yoshino:~# postconf mydestination  # the effective value
mydestination = $myhostname, localhost.$mydomain, localhost
yoshino:~# postconf -d mydestination    # matches the default value
mydestination = $myhostname, localhost.$mydomain, localhost

2. Or I think you could add an entry to virtual_alias_maps for
[hidden email] -> [hidden email]. I'm not sure if
you'd have to specify mail.domain.tld as a virtual_alias_domain first.
Reply | Threaded
Open this post in threaded view
|

Re: a little bit of help with aliases

mouss-4
In reply to this post by toneeedavis
[hidden email] a écrit :
> Hi,
>

Please do not top post. put your replies after the text you reply to.

>[snip]
>
>
> so i am running a virtual setup using mysql for maps. when i try to send
> an email to root it gets sent to [hidden email],

since <root> doesn't have a domain part, postfix adds @$myorigin. by
default:
myorigin = $myhostname

If you set
myorigin = $mydomain,
the <root> will become <[hidden email]>


> this email
> address doesnt exist, it is a local root account, so i have setup an
> alias in /etc/aliases which is root:     [hidden email] but
> this doesnt seem to be working.

mail.domain.tld ($myhostname) is not listed in mydestination, so the
mail won't be delivered locally, and thus /etc/aliases is not used in
this case.

Instead of using /etc/aliases, use virtual_alias_maps:

[hidden email] [hidden email]

for safety, add also:
[hidden email] [hidden email]

(so that if you set myorigin=$mydomain, things will continue to work).

PS. virtual_alias_maps apply to _all_ mail (whether local, virtual,
relay and even mail destined to external domains).


> [snip]