1297 Commits

Author SHA1 Message Date
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
Joris Vink
e89e644d10 call PyErr_Clear() before PyImport_ReloadModule(). 2017-02-22 20:54:57 +01:00
Joris Vink
93ab52dcf5 Add a reload command to the cli tool.
This will look at the kore.pid file in the current directory
and send a SIGHUP signal to it. It's mostly a handy shortcut
since you could of course do a kill -HUP `cat kore.pid` easily.
2017-02-22 20:38:24 +01:00
Joris Vink
970356a3e9 always write the pidfile even in foreground 2017-02-22 20:38:07 +01:00
Joris Vink
6e6d2f005d Remove leftover feature defines from kodev. 2017-02-22 20:13:59 +01:00
Joris Vink
ead0a4199c add little hint for kodev. 2017-02-22 20:09:11 +01:00
Joris Vink
541870c10a Improve keymgr_await_data().
Before this function would block client I/O and existing HTTP requests
until the keymgr process responsed with a result.

This commit changes that behaviour and makes this function call
the http_process() function if we end up waiting for the keymgr.

This means that while waiting for a response we at least start
making headway with existing HTTP requests if the response is
not immediate.
2017-02-22 18:30:50 +01:00
Joris Vink
c6ca68f3f2 export http_body_path via python 2017-02-22 17:52:57 +01:00
Joris Vink
2f670ce777 don't log failure if unlinking fails with ENOENT 2017-02-22 17:52:38 +01:00
Joris Vink
fc6b3bf740 Split up kore cli tools into new binary.
Having the create, build, run tools baked into the kore binary
made things harder then they had to be for multiple projects with
each different build flavors.

So move away this functionality into a new "kodev" (name may change)
binary that is installed next to kore.

The new build tools will automatically pick up the correct flavors
the kore binary it points to is installed with. Or for single builds
what flavors where enabled.

The new tool also will honor looking into PREFIX for the kore binary
when doing a `kodev run`.

Additionally add a new command "info" that shows some basic info
about your project and how it will be built. For example it will
show you the flavors of the kore binary installed on the system
or the flavors you configured for a single binary build.

Obligitory, hacking on a plane comment.
2017-02-19 00:52:29 -05:00
Joris Vink
a0c545884f even more ssl to tls terminology. 2017-02-11 21:33:09 +01:00
Joris Vink
98f0c41f38 more ssl -> tls wording 2017-02-11 21:30:38 +01:00
Joris Vink
9be3c22196 like other flavors, log if python is enabled. 2017-02-09 13:38:09 +01:00
Joris Vink
37443df6b0 Slightly change kore_parent_configure() again.
- Call it before loading configurations when built as single binaries.
- Call it right before forking workers when built as a dso.
2017-02-09 13:36:08 +01:00
Joris Vink
311e658d57 call to kore_parent_configure() before config. 2017-02-09 13:29:33 +01:00
Joris Vink
625d50b8dd use rootdir when making paths to features/ldflags. 2017-02-09 11:45:11 +01:00
Joris Vink
e895446dfa Improve single binary builds.
Allow kore build to pickup the required libraries for kore when
building single binaries so that you no longer have to manually
add them to ldflags.
2017-02-09 11:30:44 +01:00
Joris Vink
d2cfc2b554 shuffle headers around. 2017-02-07 23:21:18 +01:00
Joris Vink
a43d968f0f add little note on non mixables. 2017-02-07 23:18:05 +01:00
Joris Vink
4e9399d553 use SSL_OP_SINGLE_ECDH_USE. 2017-02-07 23:17:11 +01:00
Joris Vink
06ae4644e0 spacing & style 2017-02-07 23:04:24 +01:00
Joris Vink
e9b4f966c2 expose new cookie stuff to python.
req.populate_cookies()
value = req.cookie("name")
2017-02-07 22:54:42 +01:00
Joris Vink
b8c6cddc3d Revert "TAILQ_FOREACH_SAFE() exists so use it."
Because some asshole distributions claim to have a sane queue.h
implementation while they do not.
2017-02-07 22:44:20 +01:00
Joris Vink
0ea911140e TAILQ_FOREACH_SAFE() exists so use it. 2017-02-07 22:35:09 +01:00