<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Bug: Network blocklist also drops replies to the server's own outbound connections (DNS, SPF temperror)]]></title><description><![CDATA[<p dir="auto">We use the network blocklist (Network → Firewall → Blocklist, filled through <code>/api/v1/network/blocklist</code>) with a country block plus some public lists. While looking into why SPF checks on incoming mail ended in <code>temperror</code> for a few percent of all messages, we found that the blocklist does not only stop incoming connections: it also drops the replies to connections the server itself opens.</p>
<h2>What happens</h2>
<p dir="auto">Cloudron 10.1.5. In <code>setup/start/cloudron-firewall.sh</code> the blocklist DROP is appended to the <code>CLOUDRON</code> chain before the rules that accept established traffic:</p>
<pre><code>$iptables -t filter -A CLOUDRON -m set --match-set cloudron_blocklist src -j DROP            # line 36
ipxtables -t filter -A CLOUDRON -m state --state RELATED,ESTABLISHED -j ACCEPT                # line 44
ipxtables -t filter -A CLOUDRON -p udp --sport 53 -j ACCEPT                                    # line 114
</code></pre>
<p dir="auto">and in <code>DOCKER-USER</code> (and <code>FORWARD</code> for IPv6) it is inserted at position 1 without any state check. So any packet from a blocklisted IP is dropped, including the answer to a request the server or an app sent itself.</p>
<p dir="auto">The visible effect for us was DNS. The nameservers of <code>.br</code> (<a href="http://a.dns.br" target="_blank" rel="noopener noreferrer nofollow ugc">a.dns.br</a>, <a href="http://b.dns.br" target="_blank" rel="noopener noreferrer nofollow ugc">b.dns.br</a>, <a href="http://c.dns.br" target="_blank" rel="noopener noreferrer nofollow ugc">c.dns.br</a>) fall inside a blocked range, so unbound can no longer resolve anything under <code>.br</code>:</p>
<pre><code>dig +tries=1 +time=4 @127.0.0.150 TXT &lt;any-domain&gt;.gov.br    -&gt; timed out
dig +tries=1 +time=4 @1.1.1.1     TXT &lt;any-domain&gt;.gov.br    -&gt; NOERROR
</code></pre>
<p dir="auto">Haraka then records <code>spf=temperror</code> and DMARC is not applied. That is harmless for Brazilian spam, but the same mechanism hits any domain whose nameservers (or SPF includes, DKIM keys, DNSBL zones) sit in a blocked range. We had two forged messages pretending to come from a well-known Dutch public register (whose domain has <code>-all</code> and a DMARC quarantine policy) land in an inbox with <code>spf=temperror</code>. Over the last months 2–12 % of incoming mail on one server had an SPF temperror; on the other two servers it was lower. The same applies to outbound connections from apps (for example delivering mail to an MX in a blocked range), although we did not measure that separately.</p>
<h2>Workaround we use now</h2>
<p dir="auto">A rule above the blocklist DROP in all four chains, re-added every few minutes by a systemd timer (because the chains are rebuilt on platform updates and docker restarts):</p>
<pre><code>iptables  -I CLOUDRON    1 -m conntrack --ctstate ESTABLISHED,RELATED --ctdir REPLY -j ACCEPT
iptables  -I DOCKER-USER 1 -m conntrack --ctstate ESTABLISHED,RELATED --ctdir REPLY -j ACCEPT
ip6tables -I CLOUDRON    1 -m conntrack --ctstate ESTABLISHED,RELATED --ctdir REPLY -j ACCEPT
ip6tables -I FORWARD     1 -m conntrack --ctstate ESTABLISHED,RELATED --ctdir REPLY -j ACCEPT
</code></pre>
<p dir="auto"><code>--ctdir REPLY</code> only matches the reply direction of a connection that originated on the server, so anything a blocklisted IP starts itself (new or already running) still hits the DROP. After adding it, <code>.br</code> resolves again on all three servers and the blocklist DROP counters keep rising as before.</p>
<h2>Suggestion</h2>
<p dir="auto">Put an <code>ESTABLISHED,RELATED --ctdir REPLY</code> accept (or simply the existing <code>RELATED,ESTABLISHED</code> accept) above the blocklist DROP in <code>cloudron-firewall.sh</code>, for both IPv4 and IPv6 and in both the host and the container chains. The blocklist is meant to keep unwanted visitors out; it should not cut the server off from DNS servers, MX hosts or APIs that happen to sit in a blocked range. The existing <code>--sport 53</code> accept suggests DNS replies were meant to pass anyway.</p>
<p dir="auto">Happy to test a fix.</p>
]]></description><link>https://forum.cloudron.io/topic/16175/bug-network-blocklist-also-drops-replies-to-the-server-s-own-outbound-connections-dns-spf-temperror</link><generator>RSS for Node</generator><lastBuildDate>Sun, 01 Nov 2026 04:09:46 GMT</lastBuildDate><atom:link href="https://forum.cloudron.io/topic/16175.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 22 Oct 2026 08:05:48 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Bug: Network blocklist also drops replies to the server's own outbound connections (DNS, SPF temperror) on Mon, 26 Oct 2026 17:42:05 GMT]]></title><description><![CDATA[<p dir="auto">OK, I have changed the behavior of the firewall. The blocked list applies primarily to incoming connections and outbound is still allowed (it seems ufw, fail2ban have similar behavior). Fixed for next release.</p>
]]></description><link>https://forum.cloudron.io/post/131943</link><guid isPermaLink="true">https://forum.cloudron.io/post/131943</guid><dc:creator><![CDATA[girish]]></dc:creator><pubDate>Mon, 26 Oct 2026 17:42:05 GMT</pubDate></item><item><title><![CDATA[Reply to Bug: Network blocklist also drops replies to the server's own outbound connections (DNS, SPF temperror) on Sat, 24 Oct 2026 10:31:37 GMT]]></title><description><![CDATA[<p dir="auto">we will catch up on things, but have to recover a bit from the recent incidents which were quite a lot of work</p>
]]></description><link>https://forum.cloudron.io/post/131813</link><guid isPermaLink="true">https://forum.cloudron.io/post/131813</guid><dc:creator><![CDATA[nebulon]]></dc:creator><pubDate>Sat, 24 Oct 2026 10:31:37 GMT</pubDate></item><item><title><![CDATA[Reply to Bug: Network blocklist also drops replies to the server's own outbound connections (DNS, SPF temperror) on Sat, 24 Oct 2026 10:11:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/girish" aria-label="Profile: girish">@<bdi>girish</bdi></a> ?</p>
]]></description><link>https://forum.cloudron.io/post/131811</link><guid isPermaLink="true">https://forum.cloudron.io/post/131811</guid><dc:creator><![CDATA[imc67]]></dc:creator><pubDate>Sat, 24 Oct 2026 10:11:57 GMT</pubDate></item></channel></rss>