LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Postfix MailServer Unknown User Error (https://www.linuxquestions.org/questions/linux-server-73/postfix-mailserver-unknown-user-error-4175420287/)

Ch405 08-03-2012 10:59 PM

Postfix MailServer Unknown User Error
 
I have been working on Postfix for a few days now, and I seem to have very little luck. I got it to work internally at one point, but I could receive mail from an external email provider. The current error I'm getting is unknown user.

Here's from telnet, as you can see, it doesn't give me an error message:
Code:

MAIL FROM: <root@My-Domain.org>
250 2.1.0 Ok
RCPT TO: <chaos@My-Domain.org>
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
wat
.
250 2.0.0 Ok: queued as 70CFB161C4D

And here's from my mail.log:
Code:

Aug  4 00:53:31 iPwn postfix/cleanup[22284]: 18A57161C4D: message-id=<20120804035323.18A57161C4D@mail.My-Domain.org>
Aug  4 00:53:31 iPwn postfix/qmgr[21194]: 18A57161C4D: from=<root@My-Domain.org>, size=380, nrcpt=1 (queue active)
Aug  4 00:53:31 iPwn amavis[16869]: (16869-14) ESMTP::10024 /var/lib/amavis/tmp/amavis-20120803T195430-16869: <root@My-Domain.org> -> <chaos@My-Domain.org> SIZE=380 Received: from mail.My-Domain.org ([127.0.0.1]) by localhost (My-Domain.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP for <chaos@My-Domain.org>; Sat,  4 Aug 2012 00:53:31 -0300 (ADT)
Aug  4 00:53:31 iPwn amavis[16869]: (16869-14) Checking: ZSJepbE12+ZJ [127.0.0.1] <root@My-Domain.org> -> <chaos@My-Domain.org>
Aug  4 00:53:31 iPwn amavis[16869]: (16869-14) cached fd3699e3996aae66a10e26887750d467 from <root@My-Domain.org> (0,0)
Aug  4 00:53:31 iPwn amavis[16869]: (16869-14) p001 1 Content-Type: text/plain, size: 4 B, name:
Aug  4 00:53:31 iPwn postfix/smtpd[22291]: connect from localhost[127.0.0.1]
Aug  4 00:53:31 iPwn postfix/smtpd[22291]: 34B31161C51: client=localhost[127.0.0.1]
Aug  4 00:53:31 iPwn postfix/cleanup[22284]: 34B31161C51: message-id=<20120804035323.18A57161C4D@mail.My-Domain.org>
Aug  4 00:53:31 iPwn postfix/qmgr[21194]: 34B31161C51: from=<root@My-Domain.org>, size=826, nrcpt=1 (queue active)
Aug  4 00:53:31 iPwn amavis[16869]: (16869-14) FWD via SMTP: <root@My-Domain.org> -> <chaos@My-Domain.org>,BODY=7BIT 250 2.0.0 from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as 34B31161C51
Aug  4 00:53:31 iPwn postfix/smtpd[22291]: disconnect from localhost[127.0.0.1]
Aug  4 00:53:31 iPwn amavis[16869]: (16869-14) Passed CLEAN, LOCAL [127.0.0.1] [127.0.0.1] <root@My-Domain.org> -> <chaos@My-Domain.org>, Message-ID: <20120804035323.18A57161C4D@mail.My-Domain.org>, mail_id: ZSJepbE12+ZJ, Hits: -, size: 380, queued_as: 34B31161C51, 134 ms
Aug  4 00:53:31 iPwn postfix/smtp[22289]: 18A57161C4D: to=<chaos@My-Domain.org>, relay=127.0.0.1[127.0.0.1]:10024, delay=24, delays=23/0.02/0.01/0.13, dsn=2.0.0, status=sent (250 2.0.0 from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as 34B31161C51)
Aug  4 00:53:31 iPwn postfix/qmgr[21194]: 18A57161C4D: removed
Aug  4 00:53:31 iPwn amavis[16869]: (16869-14) TIMING [total 140 ms] - SMTP greeting: 4 (3%)3, SMTP EHLO: 2 (2%)5, SMTP pre-MAIL: 2 (1%)6, SMTP pre-DATA-flush: 5 (4%)10, SMTP DATA: 31 (22%)32, check_init: 1 (1%)33, digest_hdr: 2 (1%)34, digest_body_dkim: 1 (0%)35, gen_mail_id: 2 (1%)36, mime_decode: 17 (12%)48, get-file-type1: 20 (15%)63, parts_decode: 0 (0%)63, check_header: 1 (1%)64, update_cache: 2 (1%)65, decide_mail_destiny: 1 (0%)66, fwd-connect: 20 (14%)80, fwd-mail-pip: 6 (4%)85, fwd-rcpt-pip: 0 (0%)85, fwd-data-chkpnt: 0 (0%)85, write-header: 1 (0%)85, fwd-data-contents: 0 (0%)85, fwd-end-chkpnt: 7 (5%)90, prepare-dsn: 1 (1%)91, main_log_entry: 9 (6%)97, update_snmp: 2 (1%)98, SMTP pre-response: 0 (0%)99, SMTP response: 1 (1%)99, unlink-1-files: 0 (0%)99, rundown: 1 (1%)100
Aug  4 00:53:31 iPwn postfix/local[22292]: 34B31161C51: to=<chaos@My-Domain.org>, relay=local, delay=0.03, delays=0.01/0.02/0/0.01, dsn=5.1.1, status=bounced (unknown user: "chaos")
Aug  4 00:53:31 iPwn postfix/cleanup[22284]: 3C6CF161C53: message-id=<20120804035331.3C6CF161C53@mail.My-Domain.org>
Aug  4 00:53:31 iPwn postfix/qmgr[21194]: 3C6CF161C53: from=<>, size=2858, nrcpt=1 (queue active)
Aug  4 00:53:31 iPwn postfix/bounce[22293]: 34B31161C51: sender non-delivery notification: 3C6CF161C53
Aug  4 00:53:31 iPwn postfix/qmgr[21194]: 34B31161C51: removed
Aug  4 00:53:31 iPwn postfix/local[22292]: 3C6CF161C53: to=<root@My-Domain.org>, relay=local, delay=0.02, delays=0.01/0/0/0.01, dsn=2.0.0, status=sent (delivered to mailbox)
Aug  4 00:53:31 iPwn postfix/qmgr[21194]: 3C6CF161C53: removed

And here is my main.cf:
Code:

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# 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 II Mail $mail_name
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
smtpd_recipient_restrictions = reject_unauth_pipelining, permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_destination, check_policy_service inet:127.0.0.1:10023, permit

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

myhostname = mail.My-Domain.org
alias_maps = hash:/etc/postfix/aliases
alias_database = hash:/etc/postfix/aliases
mydomain = My-Domain.org
myorigin = $mydomain
mydestination = /etc/postfix/local-host-names
# relayhost =
mynetworks = 127.0.0.0/8 192.168.1.0/24
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
mynetworks_style = host
# masquerade_domains = mail.My-Domain.org www.My-Domain.org
local_recipient_maps =

# how long if undelivered before sending warning update to sender               
delay_warning_time = 2h
# will it be a permanent error or temporary
unknown_local_recipient_reject_code = 450
# how long to keep message on queue before return as failed.
# some have 3 days, I have 16 days as I am backup server for some people
# whom go on holiday with their server switched off.
maximal_queue_lifetime = 3d
# max and min time in seconds between retries if connection failed
minimal_backoff_time = 1000s
maximal_backoff_time = 8000s
# how long to wait when servers connect before receiving rest of data
smtp_helo_timeout = 60s
# how many address can be used in one message.
# effective stopper to mass spammers, accidental copy in whole address list
# but may restrict intentional mail shots.
smtpd_recipient_limit = 16
# how many error before back off.
smtpd_soft_error_limit = 3
# how many max errors before blocking it.
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_pipelining, permit
# Requirements for the connecting server
smtpd_client_restrictions = reject_rbl_client sbl.spamhaus.org, reject_rbl_client blackholes.easynet.nl, reject_rbl_client dnsbl.njabl.org
# Requirement for the recipient address
smtpd_recipient_restrictions = reject_unauth_pipelining, permit_mynetworks, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_destination, permit
smtpd_data_restrictions = reject_unauth_pipelining

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

# not sure of the difference of the next two
# but they are needed for local aliasing
alias_database = hash:/etc/postfix/aliases
# 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

content_filter = amavis:[127.0.0.1]:10024

And local-host-names for good measure:
Code:

localhost
My-Domain.org
localhost.My-Domain.org

I tried to post all relevant files that would be needed go get assistance. If anything else is required, just ask.

Note: Obv. My-Domain is in place of my /actual/ domain. :3

lithos 08-05-2012 12:56 PM

but where is your user mailbox for "<chaos@My-Domain.org>" defined ?

Code:

main.cf
virtual_alias_maps = mysql:/etc/postfix/mysql_alias.cf

this is yours config and it shows to MySQL database !
Do you have configured "/etc/postfix/mysql_alias.cf" to work with postfix ?

Check your "mysql_alias.cf" it seems that postfix doesn't find the user "<chaos@My-Domain.org>" defined in database.

Ch405 08-05-2012 07:13 PM

I found the problem as I was waiting for this thread to get approved. I thought having the user defined in the users table would be enough, but I had to define aliases in order for it to work properly.


All times are GMT -5. The time now is 09:41 AM.