Bug #2506
closedfilestore v1: with stream-depth not null, files are never truncated
Description
Using suricata 4.1 beta2 (top of git - May 30 2018), and http session with this yaml:
- file-store:
enabled: yes # set to yes to enable
log-dir: files # directory to store the files
force-magic: no # force logging magic on all stored files
force-hash: [md5]
force-filestore: yes # force storing of all files
stream-depth: 1
whatever size of attached files within HTTP session, stored files are never truncated despite stream-depth is set at a fixed small value.
Example: stream-depth set to 1, we still have meta file like:
more file.8.meta
TIME: 05/30/2018-21:58:02.767116
SRC IP: 192.168.0.26
DST IP: 212.95.74.42
PROTO: 6
SRC PORT: 54303
DST PORT: 80
APP PROTO: http
HTTP URI: /async/articles/flashs
HTTP HOST: www.lefigaro.fr
HTTP REFERER: http://www.lefigaro.fr/
HTTP USER AGENT: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0
FILENAME: /async/articles/flashs
MAGIC: <unknown>
STATE: CLOSED
SIZE: 55545
{"timestamp":"2018-05-30T21:58:02.848356+0200","flow_id":1136624478607845,"in_iface":"wlan0","event_type":"fileinfo","src_ip":"212.95.74.42","src_port":80,"dest_ip":"192.168.0.26","dest_port":54303,"proto":"TCP","http":{"hostname":"www.lefigaro.fr","url":"/async/articles/flashs","http_user_agent":"Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0","http_content_type":"application/json","http_refer":"http://www.lefigaro.fr/","http_method":"GET","protocol":"HTTP/1.1","status":200,"length":14626},"app_proto":"http","fileinfo":{"filename":"/async/articles/flashs","gaps":false,"state":"CLOSED","stored":true,"file_id":8,"size":55545,"tx_id":0}}
I do think this is not the expected behavior.