87 Commits

Author SHA1 Message Date
yrutschle
5b93e4ab55 abstracted collection management to its own file 2021-03-21 16:42:37 +01:00
yrutschle
1c63b06cc8 refactor: move collection handling towards a foreach construct 2021-03-21 14:01:12 +01:00
yrutschle
71c617050d fix collection extension 2021-03-17 21:16:08 +01:00
yrutschle
7e63dedca3 refactor: abstract connection list management to a new 'collection' type 2021-03-03 14:38:24 +01:00
yrutschle
be4e126f3a refactor: move all read process code to its own function 2021-02-28 18:19:18 +01:00
yrutschle
34bcc2bbc8 refactor: move probing actions to its own function 2021-02-28 10:46:17 +01:00
yrutschle
90975fd6c3 refactor: move all file descriptor info for select to its own struct 2021-02-28 10:12:13 +01:00
yrutschle
f91f16d753 make local functions static 2021-02-27 15:33:41 +01:00
yrutschle
dae8101a50 remove redundant macro definition 2021-02-27 15:20:15 +01:00
yrutschle
52a9356c35 fix typo 2021-01-09 15:34:09 +01:00
yrutschle
f3230b4a94 abstract listening sockets so we have protocol information alongside the socket -- echosrv and sslh-select 2020-11-07 22:44:37 +01:00
yrutschle
3aa245efa5 separate connection information creationg from log emission 2019-09-05 15:48:33 +02:00
yrutschle
d5baed3f18 Fix fd2fd return value which should not be -1 on error 2019-05-13 15:21:22 +02:00
yrutschle
e7ce929020 config file now read to struct with c2s; command line no longer works 2018-11-29 11:56:33 +01:00
Michael Santos
8ce2b2ea05 Check memory allocations succeed 2018-06-18 10:35:28 -04:00
Michael Santos
cfd0163a5b main_loop: initialize in_socket
in_socket may be used uninitialized if no addresses are available.

~~~
sslh-select.c:415:8: warning: Function call argument is an uninitialized value
                            check_access_rights(in_socket, cnx[i].proto->service)) {
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
2018-06-18 10:35:28 -04:00
Yves Rutschlé
3ab2acdafa fix fork failure handling 2018-01-11 14:45:32 +00:00
Yves Rutschlé
9a85efded5 log error message in case fork fails 2018-01-08 18:54:01 +00:00
yrutschle
d26eab728c
Merge pull request #143 from astiob/select-fork
sslh-select: support forking for particular protocols
2018-01-02 22:26:58 +01:00
Yves Rutschle
b36fc73b7a log timeouts 2017-12-17 14:57:45 +01:00
Oleg Oshmyan
2a70470f13 sslh-select: reduce CPU and memory usage in forked processes 2017-10-28 23:27:10 +03:00
Oleg Oshmyan
2544f20bdf sslh-select: support forking for particular protocols
To keep the code simple, use the same event loop in the child process
as in the parent process but close all irrelevant file descriptors.
2017-10-28 23:27:06 +03:00
Oleg Oshmyan
b7fafb5039 sslh-select: invoke FD_CLR on fd before closing fd
POSIX requires the fd argument to any FD_ macro to be valid.
2017-10-28 23:13:28 +03:00
Oleg Oshmyan
b56f302b85 sslh-select: simplify some code 2017-10-28 23:13:28 +03:00
Oleg Oshmyan
684c9afcc6 sslh-select: actually close socket on error in accept_new_connection
Previously, it was leaked (and the client was left waiting for a timeout).
2017-10-28 23:13:28 +03:00
Oleg Oshmyan
a3df50f31f sslh-select: fix connections with deferred data after connect_queue
Previously, if some data was still deferred after the connect_queue
call, the server side of the connection would never start being
monitored for reads, while the client side kept being monitored
and new data from the client could be sent to the server before
the previously deferred data.
2017-10-28 23:13:28 +03:00
Ondrej Kuzník
025545aee3 Fix typos and type warnings 2013-09-28 20:49:46 +02:00
Ondřej Kuzník
e4fb8b8496 defered -> deferred 2013-09-28 20:42:04 +02:00
Ondřej Kuzník
d7bbec0dc7 Simplify function signatures 2013-09-28 20:21:48 +02:00
Ondřej Kuzník
dbafd6510d Allow probes to say they cannot decide yet 2013-09-28 20:21:47 +02:00
Yves Rutschle
e3159409c0 check fd < FD_SETSIZE 2013-07-25 21:35:27 +02:00
Yves Rutschle
2781c75ff9 Added tranparent proyxing 2013-07-21 13:46:45 +02:00
Yves Rutschle
d02ffcd154 Fixed bug in sslh-select: if socket dropped while defered_data was present, sslh-select would crash. 2013-07-20 00:45:33 +02:00
Yves Rutschle
9bcb2cdd7a v1.12: 08MAY2012
Added support for configuration file.

	New protocol probes can be defined using regular
	expressions that match the first packet sent by the
	client.

	sslh now connects timed out connections to the first
	configured protocol instead of 'ssh' (just make sure
	ssh is the first defined protocol).

	sslh now tries protocols in the order in which they
	are defined (just make sure sslh is the last defined
	protocol).
2013-07-10 23:15:38 +02:00
Yves Rutschle
ae008179f0 v1.10:
Fixed calls referring to sockaddr length so they work
	with FreeBSD.

	Try target addresses in turn until one works if
	there are several (e.g. "localhost:22" resolves to
	an IPv6 address and an IPv4 address and sshd does
	not listen on IPv6).

	Fixed sslh-fork so killing the head process kills
	the listener processes.

	Heavily cleaned up test suite. Added stress test
	t_load script. Added coverage (requires lcov).

	Support for XMPP (Arnaud Gendre).

	Updated README.MacOSX (Aaron Madlon-Kay).
2013-07-10 23:14:15 +02:00
Yves Rutschle
a9c9941988 v1.9: 02AUG2011
WARNING: Options changed, you'll need to update your
	start-up scripts! Log format changed, you'll need to
	update log processing scripts!

	Now supports IPv6 throughout (both on listening and
	forwarding)

	Logs now contain IPv6 addresses, local forwarding
	address, and resolves names (unless --numeric is
	specified).

	Introduced long options.

	Options -l, -s and -o replaced by their long
	counterparts.

	Defaults for SSL and SSH options suppressed (it's
	legitimate to want to use sslh to mux OpenVPN and
	tinc while not caring about SSH nor SSL).

	Bind to multiple addresses with multiple -p options.

	Support for tinc VPN (experimental).

	Numeric logging option.
2013-07-10 23:13:32 +02:00
Yves Rutschle
80f76c6fc5 v1.8:
Changed log format to make it possible to link
	connections to subsequent logs from other services.

	Updated CentOS init.d script (Andre Krajnik).

	Fixed zombie issue with OpenBSD (The SA_NOCLDWAIT flag is not
	propagated to the child process, so we set up signals after
	the fork.) (François FRITZ)

	Added -o "OpenVPN" and OpenVPN probing and support.

	Added single-threaded, select(2)-based version.

	Added support for "Bold" SSH clients (clients that speak first)
	Thanks to Guillaume Ricaud for spotting a regression
	bug.

	Added -f "foreground" option.

	Added test suite. (only tests connexions. No test for libwrap,
	setsid, setuid and so on) and corresponding 'make
	test' target.

	Added README.MacOSX (thanks Aaron Madlon-Kay)

	Documented use with proxytunnel and corkscrew in
	README.
2013-07-10 23:12:42 +02:00