Commit Graph

92 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 0e8e2c3727 Fix e2e tests with openssl 3 5 months ago
Soner Tari adf9a44d22 Fix possible double free of host and serv variables, thanks to @disaykin 1 year ago
Soner Tari fc7d57469d Fix double free, thanks to @disaykin
Bug found by Svace static analyzer
1 year ago
Soner Tari 30ed5b4200 Release v0.9.4 1 year ago
Soner Tari bd4123375d Update testproxy version to 0.0.5
The skip-test-harness option allows disabling the second test set in the
test harness: SSL config tests, which fails with the new versions of
OpenSSL.
TODO: We need more detailed tests and more detailed testproxy config
options.
1 year ago
Soner Tari 91fc80cb67 Fix warning for array subscript outside array bounds in function declaration
Thanks to gcc version 11.2.0
2 years ago
Soner Tari e456f56001 Release v0.9.3 2 years ago
Soner Tari 63a48308cd Fix autossl without STARTTLS in divert mode
In the previous implementation, the use case for autossl was assumed to
be STARTTLS with POP3 or SMTP. But there are users who use autossl with
HTTP too. The split mode was fine, but the divert mode was broken. This
change makes autossl a generic upgrade mechanism.
Also fix sslproxy line in autossl, change p to s if upgraded.
Add e2e tests for autossl in divert and split mode.
2 years ago
Soner Tari dc40f74c13 Update copyright year to 2022 2 years ago
Soner Tari c90f71f5ef Bump version to 0.9.2 3 years ago
Soner Tari 3e55d4820e Release v0.9.1 3 years ago
Soner Tari 9708225bb1 Rename LogAction to Log 3 years ago
Soner Tari 775ae774ea Set conn term flag only, do not free conn in eventcb
Rename reconnected_ssl flag to reconnected
Improve e2e tests
3 years ago
Soner Tari 8f63ec7f82 Add ReconnectSSL option to enforce SSL options in struct filtering rules
The ReconnectSSL option allows rule developers to write struct filtering
rules using SNI and CN SSL specifications to override the SSL
configuration of a connection.

Otherwise, without this new option, filtering rules cannot change SSL
options using SSL filtering fields to match connections (the SSL config
in the rule would not have any effect on the server side of the matching
connection). Without ReconnectSSL, only DstIP and DstPort fields can be
used to override the SSL config of a connection.

If the ReconnectSSL option in a struct filtering rule is set, we
disconnect and free the server side of the matching SSL connection, and
reconnect it with the SSL options in the matching struct filtering rule.
This enforces the SSL config in the rule.

Do not use the ReconnectSSL option if server disconnect is not desirable
or acceptable in your case.
3 years ago
Soner Tari 6c586bb4a4 Add e2e tests for struct filtering rules, and add -B EnableSSLProto option
The EnableSSLProto option is useful with structured proxyspecs and
filtering rules.
3 years ago
Soner Tari efc9f3175d Update version to 0.9.0 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 14f68457fb Fix the ordering of sites, ports, and macro values in filtering rules
all_sites and all_ports rules should be at the end of their lists, they
should be searched last, because they are the least specific rules in
their lists, hence have lower precedences.

Also, obey the order of rules in conf files by adding sites, ports, and
macro values to their lists in the same order they are in conf files.

Update the unit and e2e tests accordingly, and improve.
3 years ago
Soner Tari dc34bc1ccf Add e2e tests for filtering rules
End-to-end tests now require testproxy v0.0.4, which supports the new
Reconnect command for the Pass filtering rule.

Split mode with the -n option also supports filtering rules, so the
Divert rule can enable the divert mode even with the -n option. This is
because the purpose of the -n option is to convert sslproxy into an
sslsplit, and we want to support filtering rules in sslsplit-like
sslproxy too.
3 years ago
Soner Tari 8d752b4d31 Add documentation for filtering rules
Also bump version to 0.8.7
3 years ago
Soner Tari 982880ccfe Restructure passsite filter data structure
Now we don't go over all of the passsite rules in a linked list trying
to apply passsite to the sni or common names of a conn. Instead, we now
have user+keyword, keyword, ip, and all lists. For example, if we find
the conn user in the user+keyword list and a passsite in that list
matches, we don't look into other lists.

This change is expected to improve the performance of passsite
processing considerably, because in the earlier implementation we had to
go over all of the passsite rules trying to match passsite.

And this solution uses a correct data structure, even if not the best.
For example, each user or keyword in passsite rules is strdup()'ed only
once.

Note that a better solution could use, say, a hash table for users,
instead of a linked list. But hash tables are not suitable for keywords
or sites, because we search for substring matches with them, not exact
matches.

Also, this fixes passsite rules without any filters defined, i.e. to be
applied to all connections.

Also, now e2e tests error exit if WITHOUT_USERAUTH is enabled. E2e tests
require UserAuth enabled.
3 years ago
Soner Tari 69753b250c Add split mode of operation similar to SSLsplit
The -n command line option enables split mode for all proxyspecs,
effectively making sslproxy behave like sslsplit.
Divert option can be set/unset globally and per-proxyspec.
Add e2e tests for split mode, and update make file for tests
accordingly.
Update documentation accordingly.
Improve code reuse, remove duplicate functions.

This change deserves a release of its own, hence v0.8.4.
3 years ago
Soner Tari f8ada5100a Fix initialization of content logging in lp (issue #30)
readcb fires before connect eventcb, so we enable it in readcb now. But
perhaps lp should behave like sslproxy and not enable readcb until after
connect eventcb.

Note that there is no problem with sslproxy, it's just lp.
3 years ago
Soner Tari 596aebb2f3 Update version to 0.8.3 and copyright year to 2021 3 years ago
Soner Tari aded848043 Release v0.8.2 4 years ago
Soner Tari 6c0b981831 Update version to 0.8.1
Update TLS 1.3 documentation.
4 years ago
Soner Tari 6f5a7ceeb1 Add WITHOUT_USERAUTH switch 4 years ago
Soner Tari ca79405769 Fix doc for MaxSSLProto default as tls13 4 years ago
Soner Tari af27340889 Add -U CipherSuites option 4 years ago
Soner Tari fade72ec0d Move main.mk under Mk folder and improve make files 4 years ago
Soner Tari 2f89a27551 Use Testproxy v0.0.3 4 years ago
Soner Tari 8989873332 Add sni assertions to testproxy e2e tests for tls12 and tls13 4 years ago
Soner Tari 1403c4eda1 Fix travis for ssl libs without tls13, add no_tls13 e2e tests 4 years ago
Soner Tari ee41c72666 Add tls13 support
Add e2e tests for tls13 too
4 years ago
Soner Tari 9da7437919 Release v0.8.0 4 years ago
Soner Tari 826b612c1e Fix build version
Improve documentation
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 e3b0ba94d8 Accept space, tab, cr, and nl chars after POP3 and SMTP commands
POP3 clients may and do append CRLF to commands.
So use the new util_get_first_word_len() function.
4 years ago
Soner Tari ef2edff60a Improve string comparisons
We need case-insensitive comparison validating POP3 and SMTP commands.
Define macro function to check string equality.
4 years ago
Soner Tari ac4285cef1 Fix POP3 and SMTP protocol validation, thanks to the new testproxy e2e tests
Add testproxy e2e tests for POP3 and SMTP protocol validation.

We have detected that POP3 and SMTP protocol validation was broken
thanks to these new testproxy e2e tests. This is yet another example why
e2e tests are important.
4 years ago
Soner Tari 313da5cfca Add -A DefaultLeafCert option
Rename LeafCerts to LeafKey, TargetCertDir to LeafCertDir, CRL to
LeafCRLURL
4 years ago
Soner Tari aba07a53ee Disable conn ids unless debugging
We don't need parent or child ids unless debugging. IDLE and EXPIRED
conn logs do not need to report ids either. Ids are useful only in
detailed debug logs.
4 years ago
Soner Tari 5285b9e433 Fix valgrind REDIR warning about strncpy(), use memcpy() instead
REDIR: 0x562c100 (libc.so.6:__strncpy_ssse3) redirected to 0x4c32fb0
(strncpy)
The src strings are not NULL terminated at the correct positions.
4 years ago
Soner Tari be80523036 Use the new inline max() function instead of MAX() macro function in sslproxy
Do not pass pxy_thr_print_children() or bufferevent_getfd() to MAX() or
util_max() macro functions as params, or else they are called twice.
Since MAX() macro call duplicates params, do not call it nested either,
or else we get very long macro expansions.
4 years ago
Soner Tari e63d6dd3aa Remove BEV_OPT_THREADSAFE in lp too
thrmgr and conn handling threads in lp are cleanly decoupled now.
4 years ago
Soner Tari 8a96565d99 Zero out msg buf as in sslsplit
ce5f409dbe
("Zero all bytes when passing file descriptors over AF_UNIX sockets",
2018-11-12)

Also, bufferevent_getfd() returns -1 if no file descriptor is associated
with the bufferevent.
4 years ago
Soner Tari 128838c70f Fix -g flag for lp, use Mk/buildinfo.mk of sslproxy
This is necessary to detect the .git folder at the project root. So
remove Mk/buildinfo.mk of lp.
4 years ago
Soner Tari 3e706ea022 Fix leaks and errors reported by valgrind
Free vars.
Finalize sqlite3 statements.
Close sqlite3 db.
Init memory.
Do not close fd -1.

Some of these may be harmless, but we fix them anyway. Now valgrind
reports 0 "lost" memory, but some "still reachable", both for sslproxy
and lp.
4 years ago
Soner Tari 1d75bfb17f Fix a possible sync issue between thr load and conn children list on error
Refactor and rename functions, struct fields, and vars
Simplify if conditions and fix/improve logs
Clean up
4 years ago