Commit Graph

1120 Commits

Author SHA1 Message Date
Joris Vink 1465eb2982 slight change in wording 2017-06-28 10:20:14 +02:00
bhesmans a2d78179a4 Small fix in video stream example (#195) 2017-06-25 11:46:32 +02:00
Joris Vink 19b7f75b90 change up a comment that is wrong. 2017-06-01 10:10:54 +02:00
Joris Vink ae9694fb1d Fix build with libressl again.
LibreSSL defines OPENSSL_VERSION_NUMBER as 0x20000000L but does not have
the 1.1.0 API so we have to carefully check for LIBRESSL_VERSION_TEXT as
well before using that new API.
2017-05-27 11:57:46 +02:00
Joris Vink 584ef47c4f update README 2017-05-22 14:36:55 +02:00
Joris Vink 95daf3a62b Add support for openssl 1.1.0 release line.
Eventually I will phase out 1.0.2 down the line to get rid of the
nightmare that is the 2 different APIs.

This commit adds full support for building kore with 1.1.0e while
retaining the privsep keymanager support.

based on excellent work done by @hiwk.
2017-05-22 14:31:38 +02:00
Stanislav Yudin b73343aea4 add HTTP_METHOD_OPTIONS as another supported http method. (#186) 2017-04-04 09:37:19 +02:00
Joris Vink aed1a63c38 be more clear about openssl releases. 2017-03-30 09:40:13 +02:00
Joris Vink c545a922a1 Preserve the full host header under req->host.
Additionally make this header available via http_request_header().

prompted by #184
2017-03-30 09:38:23 +02:00
Joris Vink a3ed3bf7eb Convert pgsql-sync example after pgsql changes.
Only check if we bound something if we're asynchronous.
2017-03-24 13:00:05 +01:00
Joris Vink 59f7e85f45 Decouple pgsql from the http layer.
When the pgsql layer was introduced it was tightly coupled with the
http layer in order to make async work fluently.

The time has come to split these up and follow the same method we
used for tasks, allowing either http requests to be tied to a pgsql
data structure or a simple callback function.

This also reworks the internal queueing of pgsql requests until
connections to the db are available again.

The following API functions were changes:
	- kore_pgsql_query_init() -> kore_pgsql_setup()
		no longer takes an http_request parameter.
	- NEW kore_pgsql_init()
		must be called before operating on an kore_pgsql structure.
	- NEW kore_pgsql_bind_request()
		binds an http_request to a kore_pgsql data structure.
	- NEW kore_pgsql_bind_callback()
		binds a callback to a kore_pgsql data structure.

With all of this you can now build kore with PGSQL=1 NOHTTP=1.

The pgsql/ example has been updated to reflect these changes and
new features.
2017-03-24 12:53:07 +01:00
Joris Vink add6d724e3 expose connection address to python. 2017-03-24 12:42:40 +01:00
Joris Vink ed9a34ce95 cleanup net layer a bit.
this change was long overdue and finally gets rid of the legacy crap
we had laying around to appease openssl's read/write functions.
2017-03-16 09:54:46 +01:00
Joris Vink 3fdc1113c3 formatting 2017-03-15 09:24:29 +01:00
Joris Vink fb8035297d Allow workers to listen on different ports.
This commit allows worker processes to have individual listeners
not configured by the kore configuration.

If you do the following:
	- do not configure listeners in your .conf file
	- call kore_server_bind() in kore_worker_configure()

the workers will no longer fight over accept locks as the configured
ports no longer conflict with each other.

This allows me to create X amount of instances of a worker process that
are each individually accessible via unique ports.
2017-03-13 15:32:04 +01:00
Joris Vink 3b5d4a2b03 update example 2017-03-13 13:31:36 +01:00
Joris Vink ffbabed7d6 Move websocket_send() to pyconnection.
While here convert all instances of y* for incoming binary data to y#
since we won't be changing it at all and avoids some unneeded copying.
2017-03-13 13:30:57 +01:00
Joris Vink 4a56424842 Improve python websocket handling a bit.
Convert the data parameter to a string if the op was WEBSOCKET_OP_TEXT
or convert to bytes if op was WEBSOCKET_OP_BINARY so the callee does
not have to do this anymore.
2017-03-13 12:29:42 +01:00
Joris Vink 0b84a9c1d4 expose c.disconnect() and c.fd to Python. 2017-03-13 12:22:50 +01:00
Joris Vink af899f15e0 Set error if http_body_rewind() fails. 2017-03-13 11:19:58 +01:00
Joris Vink ec901d0339 Make http_body_rewind() public.
Also let this function reset offset and lengths for http_body_read().

Make sure of this function in the python code so req.body can be called
multiple times in succession.
2017-03-13 11:17:55 +01:00
Joris Vink 1f4aec43d9 toread is unsigned, it won't ever fall < 0. 2017-03-13 11:02:46 +01:00
Joris Vink 3ae9bb7ae9 change type of maxage. 2017-03-10 14:36:51 +01:00
Joris Vink 4db51d7846 screw it, rework interface for cookies.
The only reason you would want to directly modify the cookie
after creating it should be to unset the HTTPONLY or SECURE flags
if that is what you *really* want to do.

Change http_response_cookie() to take all required parameters instead
of having to marshall those in yourself after.

Now you set a sane default cookie in one shot:

http_response_cookie(req, "key", "value", "/", 0, -1, NULL);

Which would create a session cookie key=value for / under the current domain.
2017-03-10 14:31:08 +01:00
Joris Vink 3d24b65268 Change default http_cookie behaviour.
We now default to httponly & secure for newly created cookies.

This should've been the default all along.

The http_response_cookie() no longer returns a pointer to http_cookie
but rather takes it as a parameter and will populate the pointer with
the newly created http_cookie if not NULL.

Additionally http_response_cookie() automatically sets the domain
based on the http_request passed into the function.
2017-03-10 14:20:40 +01:00
Joris Vink c87a9286b4 reword a bit 2017-03-09 16:59:14 +01:00
Joris Vink 0ca08114bb unbreak flavor cflags 2017-03-09 16:55:04 +01:00
Joris Vink edd7a10773 move static assets to use asset_serve_* in generic.
note that certain browsers change their caching behaviour when you
are connecting over TLS using self-signed certificates.

reminded by #179
2017-03-08 10:20:53 +01:00
Joris Vink 175b2e2c9b kore flavor -> kodev flavor 2017-03-06 23:18:16 +01:00
Joris Vink 41924d0262 make sure len isn't 0 from cli_file_read(). 2017-03-06 23:16:59 +01:00
Joris Vink 56d451ebcf bump 2017-03-06 22:49:26 +01:00
Joris Vink f8c9e736e2 don't depend on \n for NUL-terminating, just do it. 2017-03-06 22:48:19 +01:00
Joris Vink 509142e100 note that the rand_file must be inside chroot. 2017-03-06 16:58:51 +01:00
Joris Vink 529b474991 update README 2017-03-06 14:28:06 +01:00
Joris Vink f1d33ab91b kore -> kodev where appropriate 2017-03-06 11:00:53 +01:00
Joris Vink 0364cc893c Write new rand_file immediately at startup. 2017-03-06 10:55:25 +01:00
Joris Vink 8aaf7866c8 Do not unlink assets.h after building.
as per suggestion in #175
2017-03-06 10:42:07 +01:00
Joris Vink 7ec26a8c30 switch asset checksum to SHA256.
while here constify the asset modified time, contents and length.
2017-03-06 10:33:44 +01:00
Joris Vink c136c5ffc5 python_calloc() no longer needs manual memset. 2017-02-27 21:34:26 -08:00
Joris Vink 73fc58163d add warning + RAND_poll() to callback. 2017-02-27 21:31:09 -08:00
Joris Vink f57ca7dcc2 Let workers fetch entropy from keymgr.
At bootup and every 1800 seconds after that the worker processes will
ask the keymgr for new entropy that they will seed into their PRNG.

Additionally once received the worker calls RAND_poll() to grab
more entropy from the system to be mixed in.
2017-02-27 21:28:35 -08:00
Joris Vink 60a3f60a92 Allow MSG framework to pass 0 byte messages. 2017-02-27 21:27:50 -08:00
Joris Vink 0fe570ef41 cleanse any intermediate buffers for keymgr. 2017-02-27 21:05:56 -08:00
Joris Vink 6ba7390cc9 Add rand_file configuration option for keymgr.
This option allows the user to specify a file to be used for
seeding the PRNG initially and to write random bytes at exit.

The option is only available if kore has TLS enabled (by default).

If you enable this option Kore will refuse to start if there is
a problem with the file specified (not found, not a file, invalid size, etc).

While here let the keymgr process call RAND_poll() every half hour
to grab more system entropy and seed it into the PRNG.
2017-02-27 20:58:04 -08:00
Joris Vink 27da1dd741 fix semantics for kore_calloc().
We were not returning zeroed out memory from kore_calloc() which goes
against what calloc() does. Skip performance for now and simply just
memset() the returned pointer from kore_malloc().

This should be sufficient enough for now.
2017-02-27 19:50:06 -08:00
Joris Vink 3e84502235 Adjust examples after recent changes.
- New kodev tool generates config with server.pem/key.pem.
- Use proper formats for kore_log().
- Update to new websocket api.
2017-02-25 17:02:39 -08:00
Joris Vink 7f11e37161 Add kore_sockopt().
Use it where we before were using setsockopt().
2017-02-22 13:23:30 -08:00
Joris Vink edc356ca60 no need for -rdynamic in kodev. 2017-02-22 13:01:53 -08:00
Joris Vink 00ce970efe Be less noisy about module reloading.
No longer show "not reloading foo" if timestamps didn't change.
Be more clear about a module forcing us to not reload it.
2017-02-22 12:48:06 -08:00
Joris Vink d09eb5e107 bump copyright 2017-02-22 21:37:14 +01:00