Commit Graph

40 Commits

Author SHA1 Message Date
Landon Fuller
8350b1deb0 Plumb user/group/path information through the logging API. 2014-10-18 14:35:49 -06:00
Landon Fuller
5ed49c4985 Implement user and group name lookup. 2014-10-18 14:16:50 -06:00
Landon Fuller
52d979e29d Add a standard API for fetching process name, uid, and gid. 2014-10-18 13:46:44 -06:00
Landon Fuller
9204418c80 Thread pid lookup support through the NAT API.
This exposes the pid lookup code as a standard attribute
of NAT lookup -- if a matching process cannot be found,
or if pid lookup isn't supported by the NAT backend,
a pid of -1 is returned.

This also adds the local_pid to the pxyconn context; this
will be used to populate log strings.
2014-10-18 13:16:02 -06:00
Daniel Roethlisberger
ac98c2d9cc Fix segmentation fault when using -t without a CA
The key type checks which are used to optimize the loading of DH and
ECDH parameters should check the type of the supplied server key, not
the global options key.
2014-01-30 22:21:08 +01:00
Daniel Roethlisberger
e1d8a2a965 Lint fix: define some variables in smaller scope 2014-01-14 17:37:57 +01:00
Daniel Roethlisberger
716139b169 Suppress SPDY/QUIC by removing Alternate-Protocol headers 2014-01-14 17:35:56 +01:00
Daniel Roethlisberger
2235e1aad9 Fix memory leak in fake cert generation code
The code in pxy_ossl_servername_cb() which generated the forged
certificates did not call SSL_CTX_free() on the newly allocated SSL_CTX
struct after associating it with the SSL struct, which increments the
reference count internally.  Also add some comments explaining OpenSSL
reference counting behaviour to be more explicit on what happens to the
instances that OpenSSL keeps track of.
2014-01-13 23:56:59 +01:00
Daniel Roethlisberger
05410fe9b3 Enable SSL_MODE_RELEASE_BUFFERS by default 2014-01-13 23:33:31 +01:00
Daniel Roethlisberger
56842b2f63 Fix file descriptor leak in passthrough mode (-P)
When using passthrough mode, if a connection to a server fails with an
SSL error, sslsplit falls back to plain TCP passthrough.  When
reconnecting with plain TCP, the SSL context was freed, but the file
descriptor was never closed.  The fix remedies that by calling the
proper cleanup function for the dst bev before reconnecting.

Reported by:	Peter Haag
2014-01-11 19:12:00 +01:00
Daniel Roethlisberger
e129041c1c Add some OpenSSL refcounting comments 2014-01-11 19:03:15 +01:00
Daniel Roethlisberger
e7ba15f184 Remove unused variable 2014-01-11 17:55:01 +01:00
Daniel Roethlisberger
4849a9738b Set ssl fields to NULL after freeing 2014-01-11 17:35:36 +01:00
Daniel Roethlisberger
7b09128ead Fix double free of SSL_CTX
Remove a superfluous call to SSL_CTX_free() which caused SSL_CTX
structures to be free'd twice under some circumstances.

Issue:		#16
Reported by:	Amit Chowdhary
2014-01-11 17:30:06 +01:00
Daniel Roethlisberger
b82ca9b414 Print status of free'd SSL structs in debug mode 2014-01-11 17:28:41 +01:00
Daniel Roethlisberger
de27f40b04 Fix two typos in comments 2014-01-11 15:17:31 +01:00
Daniel Roethlisberger
bccbdbf1cc Free SSL_CTX directly after calling SSL_new()
Since SSL_new() increments the refcount of the passed SSL_CTX, free it
directly after handing it to SSL_new() instead of later after SSL_free().
2014-01-11 00:39:28 +01:00
Daniel Roethlisberger
cfa5b15223 Fix dst bufferevent BEV_EVENT_CONNECTED handler
This removes the spurious "Unknown bufferevent 0x80" debug message but
does not have any change in functionality, since return would have been
called anyway after falling down the debug message.

While here, remove the useless "ignoring event" debug message unless
DEBUG_PROXY is defined, and also print the timeout flag in debug mode.
2014-01-10 12:08:26 +01:00
Daniel Roethlisberger
06a02f946a Always explicitly name the non-null arguments
Always explicitly name which arguments are non-null, even if all
arguments are non-null.  This is to avoid bugs where newly added
arguments are automatically non-null by accident, possibly leading to
optimisation errors.

This also fixes a few potential errors related to non-null arguments;
specifically it prevents the compiler optimising away a test for sni
being NULL in cachedsess_mkkey().

Issue:		#14
Reported by:	kythyria
2014-01-06 14:28:33 +01:00
Daniel Roethlisberger
ca923ee7f1 Update copyright notices to 2014 2014-01-06 14:09:18 +01:00
Daniel Roethlisberger
a94dbc8c3a Refactor event handler for clarity 2013-08-23 15:07:07 +02:00
Daniel Roethlisberger
38280818f8 Add HTTP content-length to connect log 2013-06-29 22:50:39 +02:00
Daniel Roethlisberger
b746a6f6bb Add HTTP response header filtering
Filter response headers in order to remove HPKP headers.  As an added
benefit, parse the HTTP status code and add it to the connection log.
2013-06-29 22:35:51 +02:00
Daniel Roethlisberger
2a4a9c8b23 Fix fallback to passthrough when no cert present
Properly reset connection state when reconnecting the dst part of the
connection.  This fixes the fallback to passthrough when no certficates
are present which can be used to split the SSL.

Issue:          #9
Reported by:    ceear
2013-05-27 00:22:45 +02:00
Daniel Roethlisberger
9f23fb31aa Log new bev connections to debug log 2013-05-27 00:03:05 +02:00
Daniel Roethlisberger
c972501063 Update copyright notices 2013-04-24 20:36:38 +02:00
Daniel Roethlisberger
146188b750 Improve SNI peek debugging 2013-04-03 18:12:52 +02:00
Daniel Roethlisberger
bb15224d11 Flush error queue prior to exiting
Reorganize the cleanup code after detaching from the TTY in order to be
able to flush the error queue before calling exit().  Addresses issue #6
2012-10-23 21:30:11 +02:00
Daniel Roethlisberger
457c2621b8 Fix warning when SSLv2 session cache is enabled 2012-05-13 15:29:39 +02:00
Daniel Roethlisberger
8eb5165760 Optimize debug branching using __builtin_expect() 2012-05-13 15:24:50 +02:00
Daniel Roethlisberger
38d22415af Generic EC loading, new default curve 'secp160r2' 2012-05-11 17:39:12 +02:00
Daniel Roethlisberger
a592f7149c Improve error handling for no origcrt situations 2012-05-02 15:37:47 +02:00
Daniel Roethlisberger
605c1ab6e6 Improve error recovery under low memory conditions 2012-05-02 15:02:59 +02:00
Daniel Roethlisberger
3fd9084fe1 Quickly decide on GET URIs obviously not OCSP 2012-04-22 21:55:19 +02:00
Daniel Roethlisberger
ee98c04b29 Add generic OCSP denial 2012-04-22 19:12:38 +02:00
Daniel Roethlisberger
9f40fbc473 Replace empty strings with dash when logging 2012-04-22 13:36:44 +02:00
Daniel Roethlisberger
07d591fccf Skip whitespace when parsing HTTP headers 2012-04-22 13:35:08 +02:00
Daniel Roethlisberger
083b02d78d Minor reformatting 2012-04-22 12:43:23 +02:00
Daniel Roethlisberger
d4be8c3e38 Refactor ssl_x509_names_to_str() for maintainability 2012-04-17 23:35:43 +02:00
Daniel Roethlisberger
4cfdef405a Initial import of sslsplit-0.4.2 2012-04-13 14:47:30 +02:00