0

I recently installed postfix on Ubuntu Natty. I'm having a problem with the configuration.

Firstly here is my postfix configuration file:

# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

mydomain = $myorigin
myhostname = mail.nairanode.com

alias_maps = hash:/etc/postfix/aliases
alias_database = hash:/etc/postfix/aliases
# this specifies where the virtual mailbox folders will be located
virtual_mailbox_base = /var/spool/mail/virtual
# this specifies where the virtual mailbox folders will be located
virtual_mailbox_base = /var/spool/mail/virtual
# this is for the mailbox location for each user
virtual_mailbox_maps = mysql:/etc/postfix/mysql_mailbox.cf
# and this is for aliases
virtual_alias_maps = mysql:/etc/postfix/mysql_alias.cf
# and this is for domain lookups
virtual_mailbox_domains = mysql:/etc/postfix/mysql_domains.cf
# this is how to connect to the domains (all virtual, but the option is there)
# not used yet
# transport_maps = mysql:/etc/postfix/mysql_transport.cf
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000

mydestination = $myorigin, $myhostname, localhost.localdomain, , localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
#mynetworks_style = host

# ADDITIONAL
unknown_local_recipient_reject_code = 550
maximal_queue_lifetime = 7d
minimal_backoff_time = 1000s
maximal_backoff_time = 8000s
smtp_helo_timeout = 60s
smtpd_recipient_limit = 16
smtpd_soft_error_limit = 3
smtpd_hard_error_limit = 12

# Requirements for the HELO statement
smtpd_helo_restrictions = permit_mynetworks, warn_if_reject reject_non_fqdn_hostname, reject_invalid_hostname, permit
# Requirements for the sender details
smtpd_sender_restrictions = permit_mynetworks, warn_if_reject reject_non_fqdn_sender, reject_unknown_sender_domain, reject_unauth_$
# Requirements for the connecting server
smtpd_client_restrictions = reject_rbl_client sbl.spamhaus.org, reject_rbl_client blackholes.easynet.nl, reject_rbl_client dnsbl.n$
# Requirement for the recipient address
smtpd_recipient_restrictions = reject_unauth_pipelining, permit_mynetworks, reject_non_fqdn_recipient, reject_unknown_recipient_do$

# require proper helo at connections
smtpd_helo_required = yes
# waste spammers time before rejecting them
smtpd_delay_reject = yes
disable_vrfy_command = yes

Here is also my /etc/postfix/aliases:

# See man 5 aliases for format
postmaster:    root

Here is also my /etc/mailname:

nairanode.com

I've also updated my hostname to nairanode.com

However, when I run postalias /etc/postfix/aliases I get the following :

postalias: warning: valid_hostname: invalid character 47(decimal): /etc/mailname
postalias: fatal: file /etc/postfix/main.cf: parameter mydomain: bad parameter value: /etc/mailname

Is there something I'm doing wrong?! I noticed that when I replace myorigin = /etc/mailname with myorigin = nairanode.com in my postfix config, I don't see any errors anymore after calling postalias. Is this a bug or something?!

3
  • 1
    You may have encoding problem or invisible characters in the file /etc/mailname. Try to see its contents using cat -A /etc/mailname. You can also try to remove the file and recreate it again.
    – Khaled
    Dec 30, 2011 at 17:54
  • @Khaled Here's what I get when I use the cat operation you listed nairanode.com$. Is that a problem?
    – Obi Hill
    Dec 30, 2011 at 19:05
  • No, it should be fine. Did you try to remove/recreate the file?
    – Khaled
    Dec 30, 2011 at 20:04

1 Answer 1

2

You are not allowed to specify

mydomain = $myorigin

You can do either remove the setting completely or specify a valid entry like mail.nairanode.com. But you are not allowed to use variables like $myorigin!

If you want it to be "dynamic" configurable by an external file, then you have to remove mydomain and myhostname completely. In this case the domain will be extracted from the hostname and the hostname will be extracted from /etc/hosts (better: by the gethostname() system call)


See the first three lines of your main.cf why you now experience a Debian-Postfix "bug". But Debian/Ubuntu intentionally hack Postfix to allow this stupid things. But they didn't think about the consequences of using this hack via Postfix $variables. Complain at Debian, not Postfix!

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .