Skip to content

ftp: fixups for firewall mode - v1 - #15656

Closed
jasonish wants to merge 2 commits into
OISF:mainfrom
jasonish:firewall-ftp-stage1/v1
Closed

ftp: fixups for firewall mode - v1#15656
jasonish wants to merge 2 commits into
OISF:mainfrom
jasonish:firewall-ftp-stage1/v1

Conversation

@jasonish

Copy link
Copy Markdown
Member

Ticket: https://redmine.openinfosecfoundation.org/issues/8663
Ticket: https://redmine.openinfosecfoundation.org/issues/8662

SV_BRANCH=OISF/suricata-verify#3167

First round of fixups for FTP in firewall mode.

First, allow the the first, to-client only transaction to pass so we can move
onto other transactions.

Second, remove the directionality of the ftpdata_command keyword. In firewall
mode, the request hooks never evaluation in passive mode, and the response
hooks never evaluate in active mode. And this data is information on the state
anyways, not really directional so I made the choice to just remove direction.
To be discussed here if not ideal.

jasonish added 2 commits June 16, 2026 10:41
In FTP, the first transaction is a banner from the server. Skip TS
inspection on this transaction.

Allows firewall mode to get past this transaction and onto the next.

Ticket: OISF#8662
The ftpdata_command would never match a RETR in the to_server direction,
or a STOR in the to_client direction, this effectively makes the
ftpdata_command applicable to passive mode only.

Instead, remove the directionality on the ftpdata_command. Its "meta"
information passed from the control channel and isn't really
directional. I think the idea was to abstract away active/passive from
the rule writer, but unfortunately doesn't allow the ftpdata_command
keyword to work in the more strict firewll mode.

Ticket: OISF#8663
@jasonish
jasonish requested a review from victorjulien as a code owner June 16, 2026 16:54
@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.90%. Comparing base (28b10fb) to head (1fe9ddc).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15656      +/-   ##
==========================================
- Coverage   82.90%   82.90%   -0.01%     
==========================================
  Files        1006     1006              
  Lines      273648   273644       -4     
==========================================
- Hits       226869   226865       -4     
  Misses      46779    46779              
Flag Coverage Δ
fuzzcorpus 61.39% <66.66%> (+0.03%) ⬆️
livemode 18.42% <0.00%> (-0.01%) ⬇️
netns 22.80% <0.00%> (-0.03%) ⬇️
pcap 45.18% <66.66%> (-0.06%) ⬇️
suricata-verify 66.70% <100.00%> (-0.01%) ⬇️
unittests 58.53% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@suricata-qa

Copy link
Copy Markdown

Information: QA ran without warnings.

Pipeline = 32061

@victorjulien

Copy link
Copy Markdown
Member

Maybe I'm missing something, but what is (potentially) controversial about the ftpdata_command direction change?

@jasonish

Copy link
Copy Markdown
Member Author

Maybe I'm missing something, but what is (potentially) controversial about the ftpdata_command direction change?

It was probably added for a purpose and now I'm removing it. Is there a reason it was designed this way?

@victorjulien

victorjulien commented Jun 16, 2026

Copy link
Copy Markdown
Member

Maybe I'm missing something, but what is (potentially) controversial about the ftpdata_command direction change?

It was probably added for a purpose and now I'm removing it. Is there a reason it was designed this way?

I don't see an explanation for it git, so I think it's just not tested / developed against active mode. Do you remember @regit ?

@victorjulien victorjulien added this to the 9.0 milestone Jun 17, 2026
@regit

regit commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

I don't really remember the reason behind that. I tried to remember something that could be a risk linked to that but nothing rings a bell.

@victorjulien

Copy link
Copy Markdown
Member

Merged in #15663, thanks!

@jasonish
jasonish deleted the firewall-ftp-stage1/v1 branch June 18, 2026 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants