Commit Graph

22 Commits (master)

Author SHA1 Message Date
Soner Tari dfb783d7ba Release v0.9.5
Bump version to 0.9.5
Update copyright year to 2024
Update NEWS
4 months ago
Soner Tari dc40f74c13 Update copyright year to 2022 2 years ago
Soner Tari 79bacaeff3 Fix definitely lost memleaks reported by valgrind
Fix a major memset() mistake leaking memory and possibly breaking CA
chains for proxyspecs and struct filtering rules.
Fix wrong memset size.
Fix redundant WUNRES attrib, MALLOC attrib has WUNRES already.
And fix param names.
3 years ago
Soner Tari d07606b586 Add support for multi-site struct filtering rules
Now we can specify multiple sites in one struct rule: SNI, CN, Host,
URI, and DstIp destination sites. We create a new rule for each
destination site type specified. Struct rules can be complicated and
long, so this is expected to help with rule reuse.
3 years ago
Soner Tari 45a4015707 Add checks for multiple or not allowed specs in struct filtering rules 3 years ago
Soner Tari add8bcda09 Add line_num to filtering rules with DEBUG_PROXY
Error out unit tests if DEBUG_PROXY enabled, because we debug print
line_num if DEBUG_PROXY enabled. We cannot support line_num in expected
debug output, it would make things complicated with very little benefit.
3 years ago
Soner Tari 77df635afa Change line_num type to unsigned int 3 years ago
Soner Tari a3c89fc931 Set conn_opts only if struct filtering rule specifies any conn option
Otherwise, we use the global or proxyspec conn options, so we should not
waste memory for duplicate conn_opts structs.
3 years ago
Soner Tari 1485fa1dfb Fix copying of SSL options in tmp_opts
And clean up whitspace
3 years ago
Soner Tari 6c988b0f4a Add structured filtering rules to specify conn options
Now all connection oriented proxy options possible to specify
per-proxyspec or globally can be specified in structured filtering rules
to be selectively applied to connections too. One line filtering rules
can specify filter and log actions only.

For example, we can enable/disable user authentication, protocol
validation, server ssl verification, and many other options
per-connection, or configure SSL/TLS connection options per-connection.

So, now we replace the conn_opts struct of a connection's ctx with the
conn_opts struct of the matching structured filtering rule. (One line
filtering rules have a NULL conn_opts, so we first check if the
conn_opts is not NULL.)
3 years ago
Soner Tari 14c8d417c9 Move connection oriented options to a new conn_opts struct 3 years ago
Soner Tari 42d84629f3 Add support for inline comments with #
Just trim the char # onwards from the start of value. So values cannot
have the char # in them.
3 years ago
Soner Tari f056f699c1 Add port option to all site specs, fix precedences in filtering rules
Now, all of the 'to' site fields in filtering rules can specify a port,
not just the dstip sites.

Fix the precedence of sites in the same type of rules. For example, if
we find a match with an sni site, we should not stop searching for a
match in cn, because a matching cn site may have a higher precedence
than the matching sni site. We should apply the action of the cn site,
although sni rules have precedence over cn. The same applies to http
host and uri rules too.

Fix the precedence of dstip rules.

Improve and update unit and e2e tests accordingly.
3 years ago
Soner Tari 017f0f8631 Improve and clean up code and documentation 3 years ago
Soner Tari 9d2e523cd0 Use Aho-Corasick machines for substring matching
Now, the filter uses B-trees for exact string matching and Aho-Corasick
machines for substring matching. B-trees and AC machines are exported to
linked lists for debug logging only.

Also,
- Separate all_sites and all_ports filters from substring filters. They
are not related with substring filters actually, and ACM keywords cannot
be empty strings anyway. So now they should be handled separately too.
- Improve debug logging of filtering rules.
- Update unit tests accordingly, and improve.
- Fix pxyconn_filter(), keep searching for a match in substring filters
if exact match does not have a matching site rule.
- Increase common names max len and tokens. weather.gov has 73 tokens.
- Rename keyword to desc.
- Update documentation.
- Clean up.
3 years ago
Soner Tari 96ba8557d6 Add unit tests for substring 'from' fields in filtering rules
Also, improve code
3 years ago
Soner Tari f6e6b25221 Never pass NULL as rule param to filter_set() 3 years ago
Soner Tari e654ca4e2c Fix memory leaks in filter
Add attributes
Update documentation
3 years ago
Soner Tari 4f36a21c78 Use kbtree BST for exact match in site and port 'to' fields
So, for 'to' fields too, we use two separate data structures: binary
search trees (BST) for exact match and linked lists for substring match.

Now all 'from' and 'to' fields in filtering rules use these two data
structures.

To repeat, filtering rules should be written with exact matches instead
of substring matches, as much as possible. Because BST search must be
much faster than substring search over linked lists.

To repeat, we have modifed kbtree to support complex data structures in
from fields.

Also, update the unit tests accordingly.
3 years ago
Soner Tari 15991dfb93 Use kbtree BST for exact match in user, keyword, and ip 'from' fields
So, now we use two separate data structures: binary search trees (BST)
for exact match and linked lists for substring match.

Currently, only user, keyword, and ip 'from' fields in filtering rules
use these two data structures. This also means that now we support exact
and substring matches in 'from' fields.

Filtering rules should be written with exact matches instead of
substring matches, as much as possible. Because BST search must be much
faster than substring search over linked lists.

We have modifed kbtree to support complex data structures in from
fields.
3 years ago
Soner Tari 66f7a88374 Move DivertUsers/PassUsers options to filter.c
The DivertUsers and PassUsers options will be deprecated in favor of
filtering rules in the future.
3 years ago
Soner Tari fd6c852355 Move filtering rules to filter.c/h
Also, fix certain and possible memory leaks in debug printing
And improve code
3 years ago