Commit Graph

31 Commits (dfb783d7ba187187453b44f316a849b789c4f7e6)

Author SHA1 Message Date
Soner Tari dfb783d7ba Release v0.9.5
Bump version to 0.9.5
Update copyright year to 2024
Update NEWS
3 months ago
Soner Tari 01d0b156d6 Decouple autossl code handling underlying bufs
And clean up redundant child callbacks
2 years ago
Soner Tari 76ea48f2d0 Remove srvdst_xferred flag
Setting srvdst.bev to NULL can be used as a flag to indicate that we
have reused the srvdst of the parent as the dst of the first child conn.
This also prevents access to srvdst.bev after we do the xfer, without
any extra flag.
2 years ago
Soner Tari dc40f74c13 Update copyright year to 2022 2 years ago
Soner Tari 722c2f59d2 Disable srvdst events asap when xferring to child and in split mode
This is the correct implementation. And disabling later on is
problematic while terminating, and can even cause a crash.
2 years ago
Soner Tari 2e8e677bac Discard underlying bufs while closing, sending errors, and denying ocsp
Also refactor for code reuse.
Since we are closing in all such cases, performance is not important.
2 years ago
Soner Tari 7143102efa Create callback functions for set/unset watermark
Watermarking for underlying bevs is for autossl only. The other
protocols should not waste time with it.
2 years ago
Soner Tari 18fb6f4dd7 Apply dstip filter before ssl server conn setup
So that we can replace the SSL/TLS configuration of the conn with the
one in the matching filtering rule. Otherwise, once the server conn is
established, we cannot change the SSL config, or would risk confusing
the SSL routines.
3 years ago
Soner Tari ac3607a841 Add deferred pass and block actions
We should defer pass and/or block actions as long as possible, because a
higher precedence rule in SSL filter should be able to override (cancel)
deferred pass and block actions taken by a lower precedence rule in Dst
Host filter. And in HTTP filter the same applies to deferred block
actions taken by Dst Host and SSL filters.

Also, thanks to this new deferred actions, now HTTP filter can keep
enabled divert and split modes. In other words, a higher precedence HTTP
filter rule can cancel a deferred block action set by a lower precedence
rule earlier, which was not possible before without deferred actions and
rule precedence.

And other improvements.
3 years ago
Soner Tari 99c852972e Implement filter actions
- SSL and Dst Host filters can take all of the actions.

- HTTP filter can only take block action, not divert, split, or pass.
Because, we cannot tear a conn down and reconnect its src, after the
processing of HTTP request header is complete, e.g. SSLproxy line has
already been added to its dst buffer. Also, any change in child conns
would affect listening programs too.

- The precedence of filters is as Dst Host > SSL > HTTP.

- The precedence of actions is as Divert > Split > Pass > Block. This is
only for the same type of filter.

- The precedence of match sites is as sni > cn for ssl filter and host >
uri for http filter.

For example, pass action of dst host filter is taken before split action
of ssl filter, due to the precedence order of filters.

For example, pass action of sni site is taken before split action of cn,
due to the precedence order of sites.

We now create src ssl before enabling src to be able to take divert or
split actions of SSL filter. Otherwise, we wouldn't be able to switch
between divert and split while enabling src, only pass or block action
could be taken at that stage.

Also, refactor and clean up.
3 years ago
Soner Tari 85fb1bd214 Add new data structure for general filtering rules
Now PassSite rules are considered as pass rule and added to the new data
structure. PassSite option will be deprecated in the future.
3 years ago
Soner Tari f2d4ef61c9 Add support for passsite substring match
Now the site field in PassSite option can have an '*' suffix to search
for a match anywhere in sni or common names. Note that this is not a
regex or wildcard search.

Previously, we only supported exact matches in sni and between slashes
in common names. This change makes it possible to cover multiple sites
in one PassSite option. In fact, without this change, certain sites
could not be added as passsite, because it was impossible to know their
subdomain names beforehand, for example *.fbcdn.net, which may have many
subdomain names in place of asterisk.

So to use substring match, append an '*' to a site name in PassSite
option (the asterisk is removed before substring search). For example,
use ".fbcdn.net*" to match all subdomains of fbcdn.net, notice the
asterisk at the end.

We also add a warning log starting with "Closing on ssl error without
passsite match" to report sites that can be added as passsite, which is
expected to help in writing PassSite rules.

Also, we now set dstaddr_str earlier in conn handling, so we can print
it in debug logs. This also helps in IDLE and EXPIRED conn logs.
3 years ago
Soner Tari d26c3fd079 Fix passsite in split mode
We should identify conn user before setting dst up in split mode.
Because in split mode dst setup also sets src up too, which tries to
apply passsite rules and switch to passthrough mode. But since user
identification has not run yet, we don't know the user owner of the
conn, which fails passsite rules.
3 years ago
Soner Tari 74cf3800f2 Fix passthrough in split mode 3 years ago
Soner Tari 9123732739 Fix possible segfaults with srvdst_xferred, autossl and passthrough
- Fix segfault introduced in previous commit to prevent extra eof event.
We should NULL srvdst.bev after terminating child dst xferred from
srvdst of parent, so that we don't try to access srvdst.bev. This
happens if child conn with dst xferred from parent srvdst is terminated
before parent conn.

- Fix autossl crash trying to engage passthrough mode. We cannot engage
passthrough mode in autossl, because src is already enabled. But we
shouldn't crash either. These changes are expected to fix other possible
segfaults if passthrough is engaged on eventcb of a child conn.
3 years ago
Soner Tari 596aebb2f3 Update version to 0.8.3 and copyright year to 2021 3 years ago
Soner Tari 65b7fb9847 Reduce code for user lists 3 years ago
Soner Tari 80d10a94c3 Move classify_user into identify_user
Otherwise, we cannot classify user if we need to issue identify_user
events, in case database is busy or locked. We should call classify_user
callback right after the user is identified.
So we introduce classify_user callback to achieve that, which fixes the
classify_user behavior for autssl proto too.

Return void in pxy_userauth
Fix typo in clasify
4 years ago
Soner Tari 4f3ce763ac Add DivertUsers and PassUsers options
Update documentation
4 years ago
Soner Tari 6f5a7ceeb1 Add WITHOUT_USERAUTH switch 4 years ago
Soner Tari 3fe0e5f1eb Move tmp global opts vars to new tmp struct
The global opts strings in this new tmp struct are used while cloning
global opts into proxyspec opts. A var of this type is passed around as
a flag to indicate if these opts are global (if non-NULL), so should be
stored in that struct and used as such, or proxyspec specific (if NULL),
so should not be used as global. This var is temporary, hence freed
immediately after configuration is complete.
Also improve and clean up.
4 years ago
Soner Tari 98cda54c47 Reduce and improve debug logs 4 years ago
Soner Tari 033cb732ac Decouple conn init from fd readcb 4 years ago
Soner Tari 191109951d Switch from thrmgr to connection handling thread asap
This prevents possible multithreading issues between thrmgr and conn
handling threads. So we can remove and clean up the code and comments
related with such possible issues now. For example, we can add the conn
to its thread list earlier, and we can handle errors immediately, thanks
to this early switch to conn handling threads. This also helps achieve
cleaner code.
4 years ago
Soner Tari 554fd3bd3a Improve code reuse, reduce code, clean up whitespace 4 years ago
Soner Tari 5c2ac6d1bf Remove writecb for srvdst except for passthrough, remove srvdst_connected and dst_connected flags, clean up autossl
We don't do anything in srvdst writecb except for passhtrough mode.
We handle srvdst and dst connect tasks in connectcb for them by
arranging connect events correctly, so we don't need any extra flags.
Correct connect ordering helps us remove code checking if bev exists.
There were a lot of unnecessary code in autossl. Tcp and ssl code are
decoupled now.
4 years ago
Soner Tari a24ac850b4 Fix readcb and writecb before connected
Do not enable srvdst readcb until connected
Enable read and write callbacks only after connected
4 years ago
Soner Tari 64c0078ecb Update comments about writecb before connected 4 years ago
Soner Tari a0d74baa43 Update copyright year to 2020 4 years ago
Soner Tari 3af16b3228 Improve verbose debug logs using common header fields to better identify connections
Create function macros for fine* debug logs
Fix a few memory leaks when DEBUG_PROXY enabled
Add main.mk to MKFS list
Put a few function params within DEBUG_PROXY directives
Check retval of a snprintf() call
Fix segfault with -w/-W options if no ssl proxyspec specified, also fixed in sslsplit develop: https://github.com/droe/sslsplit/issues/271
Various clean-up
4 years ago
Soner Tari 8eab8d1da8 Restructure source tree, create src and tests folders, move files accordingly
Remove docker
4 years ago