0

I'm using fictional email address [email protected] for this case. testuser is a local account on my ubuntu Server 14.04.

I have a fully functional email server set up using postfix and dovecot by following this guide on ArsTechnica

I have a problem with certain locally sent messages. Most work (generated from user crontab i.e.), but the following won't. They will hang around in the queue and never get sent because of the following error:

Nov 14 10:32:36 mail dovecot: lda(testuser): Error: user testuser: Initialization failed: Namespace '': mkdir(/var/mail/vmail//testuser/mail) failed: Permission denied (euid=1000(testuser) egid=1000(testuser) missing +w perm: /var/mail/vmail/, dir owned by 5000:5000 mode=0755)

This includes test messages sent with sendmail -bv [email protected]

The queue looks like this:

79B4A812E1     2023 Fri Nov 14 10:17:46  MAILER-DAEMON
                                                       (temporary failure)
                                     [email protected]

I have a folder structure /var/mail/vmail/domainname.com/username/mail/

So dovecot doesn't use the domainname.com folder and also not the username folder. I've found a possible solution online using the setting mail_location in /etc/dovecot/conf.d/10-mail.conf, but i'm worried that this isn't a neat solution, since other local processes DO send mail to the correct address. This is also from userid 1000 (testuser)

When reading one of the messages in the queue with postqueue -q <MESSAGE_ID>, it does send the mail to a valid To: address. However, it tries to send it from userid 1000, maybe it should be trying to relay it to user vmail (uid gid 5000)?

This is the output of postconf -n

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
canonical_maps = hash:/etc/postfix/canonical
config_directory = /etc/postfix
default_destination_concurrency_limit = 5
disable_vrfy_command = yes
dovecot_destination_recipient_limit = 1
home_mailbox = Maildir/
inet_interfaces = all
mailbox_command = /usr/lib/dovecot/deliver -c /etc/dovecot/dovecot.conf -m "${EXTENSION}"
mailbox_size_limit = 0
message_size_limit = 104857600
milter_connect_macros = j {daemon_name} v {if_name} _
milter_default_action = accept
milter_protocol = 2
mydestination = localhost, localhost.localdomain, domainname.com
myhostname = domainname.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
non_smtpd_milters = $smtpd_milters
postscreen_access_list = permit_mynetworks
postscreen_dnsbl_action = enforce
postscreen_dnsbl_sites = zen.spamhaus.org, b.barracudacentral.org, bl.spamcop.net
postscreen_greet_action = enforce
readme_directory = no
recipient_delimiter = +
relay_destination_concurrency_limit = 1
relayhost =
smtp_tls_note_starttls_offer = yes
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_use_tls = yes
smtpd_banner = $myhostname ESMTP
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_non_fqdn_helo_hostname, reject_invalid_helo_hostname, reject_unknown_helo_hostname, permit
smtpd_milters = unix:/spamass/spamass.sock unix:/clamav/clamav-milter.ctl unix:/opendkim/opendkim.sock
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unknown_client_hostname, reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_unauth_pipelining, reject_unauth_destination, reject_invalid_hostname, reject_non_fqdn_sender
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_path = private/dovecot-auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sender_login_maps = $virtual_mailbox_maps
smtpd_sender_restrictions = reject_unknown_sender_domain, reject_sender_login_mismatch
smtpd_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtpd_tls_ask_ccert = yes
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/ssl/private/ssl-chain-mail-domainname.com.pem
smtpd_tls_ciphers = high
smtpd_tls_key_file = /etc/ssl/private/ssl-key-decrypted-mail-domainname.com.key
smtpd_tls_loglevel = 1
smtpd_tls_mandatory_ciphers = medium
smtpd_tls_mandatory_protocols = SSLv3, TLSv1
smtpd_tls_received_header = yes
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_tls_session_cache_timeout = 3600s
smtpd_use_tls = yes
tls_random_source = dev:/dev/urandom
virtual_alias_maps = hash:/etc/postfix/virtual
virtual_mailbox_domains = hash:/etc/postfix/virtual-mailbox-domains
virtual_mailbox_maps = hash:/etc/postfix/virtual-mailbox-users
virtual_transport = dovecot

1 Answer 1

1

I've solved this.

This was actually a crontab entry mailer which didn't work, the opposite of what I claimed in my question. The local user testuser wasn't defined in /etc/aliases with a real email address, so it would try to send from just the name of the account "testuser", which isn't valid.

the correct entry in /etc/aliases looks as follows:

testuser: [email protected]

You must log in to answer this question.

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