sending mail with attachments always fails (FreeBSD/pf)

Victor Lyapunov fullblaststorm at gmail.com
Sat Nov 21 18:07:16 UTC 2009


Thanks for your answer, olli.

As i send mail not from my freebsd server, but rather from the clients
on the local network, so here's what i did:

my pf.conf:
set loginterface pflog0
set block-policy drop
set skip on lo0
block drop log on em0 all
pass log inet proto tcp from 192.168.0.0/24 to any port {smtp, pop3,
imap, smtps, pop3s} flags S/SA keep state
pass log proto udp from any to any port = domain keep state


# tcpdump -net -i pflog0
Now i went to a windows computer and tried to send an email with
attachment to gmail.com (sending failed at 2%)

here's what i got in my pflog:

rule 4/0(match): pass in on em0: (tos 0x0, ttl 128, id 19860, offset
0, flags [DF], proto TCP (6), length 48) 192.168.0.5.1822 >
209.85.129.111.465: [|tcp]
rule 4/0(match): pass out on em0: (tos 0x0, ttl 127, id 19860, offset
0, flags [DF], proto TCP (6), length 48) 192.168.0.5.1822 >
209.85.129.111.465:  tcp 28 [bad hdr length 0 - too short, < 20]

2 packets captured
2 packets received by filter
0 packets dropped by kernel

Again, everything works just fine when pf is disabled.
And there's no problems for incoming traffic, only outgoing traffic
gets corrupted( that is, dropped in the middle of transmitting data).
Any ideas?

2009/11/21 olli hauer <ohauer at gmx.de>:
> Victor Lyapunov wrote:
>>
>> Hi all,
>>
>> I have production network with FreeBSD box acting as firewall. The
>> problem emerge as soon as users send mail with attachments. (Sending
>> mail without attachments always succeeds). Basically, when a user
>> tries to send a message, only part of it transmitted before connection
>> is interrupted and sending fails. The problem persists only when pf is
>> enabled.
>>
>> My ruleset:
>> scrub in all fragment reassemble
>> block drop on em0 all
>> pass inet proto tcp from 192.168.0.0/24 to any port = smtp flags S/SA keep
>> state
>> pass inet proto tcp from 192.168.0.0/24 to any port = pop3 flags S/SA keep
>> state
>> pass inet proto tcp from 192.168.0.0/24 to any port = imap flags S/SA keep
>> state
>> pass inet proto tcp from 192.168.0.0/24 to any port = smtps flags S/SA
>> keep state
>> pass inet proto tcp from 192.168.0.0/24 to any port = pop3s flags S/SA
>> keep state
>> pass proto udp from any to any port = domain keep state
>>
>
> [...]
>
> Is this only for client submitting (imap) or even for incoming mails from
> outside via smtp?
>
> What about outgoing traffic from the machine?
>
> Try the following in pf.conf to see why this happens
>
> set loginterface pflog0
> set block-policy drop
> set skip on lo0
>
> block drop in log on em0 all
> pass out log on em0 all
>
> Now use tcpdump to see which rule drops the traffic
> #> tcpdump -net -i pflog0
>
> --
> olli
>


More information about the freebsd-pf mailing list