Zimbra Client Host Rejected: 4 Easy Fixes for Access Denied
The Zimbra client host rejected error means that the Postfix MTA of Zimbra refused an SMTP connection from a client at the very first step, before any mail was sent. The log shows "554 5.7.1 Client host rejected: Access denied" and the connection is closed. The cause is almost always that the client address is not in the list of networks the server trusts. This guide shows the log line of a real case, the fix with zimbraMtaMyNetworks and the change in master.cf.in that worked, and what to check so that the fix does not turn your server into an open relay.
Contents
- The Zimbra client host rejected error in the log
- Why the Zimbra client host rejected message appears
- Step 1: fix Zimbra client host rejected with zimbraMtaMyNetworks
- Step 2: set the client and relay restrictions in master.cf.in
- Step 3: test that Zimbra client host rejected is gone
- Do not open a relay: safe use of mynetworks
- FAQ
- Does the error mean the password is wrong?
- Do I have to restart Zimbra after changing zimbraMtaMyNetworks?
- What else can I read?
The Zimbra client host rejected error in the log
The messages appear in /var/log/zimbra.log on the MTA. The client with the address 192.168.1.113 connects and is rejected at CONNECT:
Dec 19 01:21:28 mail postfix/amavisd/smtpd[5106]: NOQUEUE: reject: CONNECT from unknown[192.168.1.113]: 554 5.7.1 <unknown[192.168.1.113]>: Client host rejected: Access denied; proto=SMTP
Dec 19 01:21:28 mail postfix/amavisd/smtpd[5106]: lost connection after CONNECT from unknown[192.168.1.113]
Dec 19 01:21:28 mail postfix/amavisd/smtpd[5106]: disconnect from unknown[192.168.1.113]

Read the line from the left. NOQUEUE: reject: CONNECT says that no message was accepted, 554 5.7.1 is a permanent policy rejection, and Client host rejected: Access denied is Postfix's text for a client that failed the smtpd_client_restrictions list. The restriction is checked at connect time, so the sender, the recipient and the password of the user are never looked at. The name "unknown" means that the reverse DNS lookup of the client address did not return a host name, which is not the reason for the rejection but shows that the client has no PTR record.
Why the Zimbra client host rejected message appears
The Administrator Guide states that the ZCS configuration allows relaying only for the local network, and that you can configure trusted networks that are allowed to relay mail. Postfix uses the list mynetworks for this and Zimbra fills it from the LDAP attribute zimbraMtaMyNetworks. A restriction such as permit_mynetworks,permit_sasl_authenticated,reject works like this:
- A client whose address is inside a trusted network is allowed (
permit_mynetworks). - A client that logs in with SMTP authentication is allowed (
permit_sasl_authenticated). - Every other client is rejected (
reject), and the log shows the Zimbra client host rejected error.
So with this setup Zimbra client host rejected is expected for every unknown address. A new subnet, a new application server or a printer that sends mail without a login gets the error until its address is trusted or it uses authentication. The Postfix documentation describes these restriction lists in the SMTPD access restrictions guide.
Step 1: fix Zimbra client host rejected with zimbraMtaMyNetworks
First read the current value, so that you do not drop an existing network. Then set the new value for the MTA server; the attribute takes the whole list, separated by spaces:
zmprov gs `zmhostname` zimbraMtaMyNetworks
zmprov ms `zmhostname` zimbraMtaMyNetworks "127.0.0.0/8 192.168.1.0/24 [::1]/128 [fe80::]/64"
In this case the network 192.168.1.0/24 of the client host was added to the loopback networks. You can set the same list in the Administration Console: Home, Configure, Global Settings, MTA, Network, as a global setting, or as a server setting that overrides the global one (according to the Administrator Guide). The MTA configuration is stored in LDAP, and the zmconfigd process polls LDAP every two minutes and updates the Postfix files, so the change takes effect within a few minutes.
Step 2: set the client and relay restrictions in master.cf.in
If the connection is made to a service that has its own restriction list, for example the submission service, edit the template of the Postfix master.cf as the zimbra user. The file is a template, so Zimbra regenerates master.cf from it:
vim /opt/zimbra/postfix/conf/master.cf.in
In the service block the case uses these options (the other lines of the block stay as they are):
%%uncomment SERVICE:opendkim%% -o content_filter=scan:[%%zimbraLocalBindAddress%%]:10030
-o smtpd_etrn_restrictions=reject
-o smtpd_sasl_auth_enable=%%zimbraMtaSaslAuthEnable%%
-o smtpd_tls_security_level=%%zimbraMtaTlsSecurityLevel%%
-o smtpd_client_restrictions=permit_mynetworks,permit_sasl_authenticated,reject
-o smtpd_data_restrictions=
-o smtpd_helo_restrictions=
-o smtpd_recipient_restrictions=
-o smtpd_relay_restrictions=permit_mynetworks,permit_sasl_authenticated,reject
-o syslog_name=postfix/submission
-o milter_macro_daemon_name=ORIGINATING
The two lines that matter are smtpd_client_restrictions and smtpd_relay_restrictions: both allow the trusted networks and authenticated users and reject everybody else. After the edit restart the MTA so that the new master.cf is generated and read; the Administrator Guide lists zmmtactl as the tool to start, stop or check the status of the MTA:
zmmtactl restart
Step 3: test that Zimbra client host rejected is gone
From the client, open an SMTP session to the server (for example with telnet mail.example.com 25 or openssl s_client -starttls smtp -connect mail.example.com:587) and watch /var/log/zimbra.log on the server at the same time. A connection that was rejected before now gets the SMTP banner, and the line with Client host rejected no longer appears for that address.
Do not open a relay: safe use of mynetworks
- When you fix Zimbra client host rejected, add only the networks that you control, as narrow as possible. A /24 such as 192.168.1.0/24 is fine; never add 0.0.0.0/0 or a whole public range.
- Prefer SMTP authentication for people and applications that can log in, and trust networks only for devices that cannot (old printers, scanners).
- Check the list with
zmprov gs `zmhostname` zimbraMtaMyNetworksafter every change. - Anyone in a trusted network can relay mail through the server, so a compromised host in that network can send spam as your server.
FAQ
Does the error mean the password is wrong?
No. The Zimbra client host rejected message is produced at CONNECT, before the login. A wrong password gives an authentication error, not this rejection.
Do I have to restart Zimbra after changing zimbraMtaMyNetworks?
Not always: zmconfigd picks up LDAP changes every two minutes according to the Administrator Guide. If you want the change at once, restart the MTA with zmmtactl restart.
What else can I read?
See the posts on the 451 4.3.5 server configuration problem and the Zimbra some services are not running message, and the Zimbra Administrator Guide.
The fix for Zimbra client host rejected is to trust the client network in zimbraMtaMyNetworks (or make the client authenticate), keep the restriction lists ending in reject, and restart the MTA.
Comments
Post a Comment