Omar Polo
ce79c944bc
simplify flow when SNI is missing
...
this also gives a chance for users to use the default host even if SNI
is missing.
2021-01-21 08:46:07 +00:00
Omar Polo
0ab65593e2
don't crash on wrong vhost or missing SNI
...
the new logging code was crashing if the client didn't support SNI or
if required an unknown vhost: this because we short-circuit in
handle_handshake to an error, so c->iri isn't populated yet (we don't
even read the request).
fixes #1
2021-01-21 08:26:21 +00:00
Omar Polo
0be51733ef
improve logs
...
now we log the full IRI requested (before was only the path) and the
response line (even for CGI).
2021-01-20 18:54:44 +00:00
Omar Polo
61f8d630c8
fmt
2021-01-20 16:22:35 +00:00
Omar Polo
f2b3a5193f
allow clock_gettime and a bit of fmt
...
alpine on amd64 (under OpenBSD vmd) tries to do a clock_gettime. I
don't know why, but it doesn't seem a problem to allow it.
2021-01-20 16:19:54 +00:00
Omar Polo
3c0375e405
fix BPF
2021-01-20 16:09:04 +00:00
Omar Polo
de4f713184
tighten the rules for fcntl
...
allow only the F_GETFL and F_SETFL commands
2021-01-20 15:54:26 +00:00
Omar Polo
298e4b96dc
explain the poll mess
2021-01-20 15:44:11 +00:00
Omar Polo
2debfe2b1f
drop useless field
...
was probably added to distinguish between AF_INET and AF_INET6, to use
different functions for logging. But it wasn't really used, and now
we use getnameinfo anyway.
2021-01-19 18:49:36 +00:00
Omar Polo
710a71b2bb
don't leak file descriptors
2021-01-19 18:16:09 +00:00
Omar Polo
6119e13e8a
moving "default type" from global options to server options
2021-01-19 11:28:41 +00:00
Omar Polo
df79b4c1d5
rename reason to meta
2021-01-19 11:00:06 +00:00
Omar Polo
05c23a54ea
add "lang" server option
2021-01-19 10:58:29 +00:00
Omar Polo
17b09e3cb7
add a dockerfile
2021-01-18 23:15:45 +00:00
Omar Polo
94a79035ec
__NR_poll doesn't seem to be defined on aarch64
2021-01-18 23:08:16 +00:00
Omar Polo
5bc29bc915
remove README.md target
...
leftover from when README.md was generated by gmid.1
2021-01-18 22:52:13 +00:00
Omar Polo
d89aa7630d
typo
2021-01-18 22:09:17 +00:00
Omar Polo
e7ecf9a528
sync
2021-01-18 21:53:36 +00:00
Omar Polo
eb6997835a
trying to get the man on par with the recent changes
2021-01-18 21:52:01 +00:00
Omar Polo
a010b0ddc5
move mimes into the struct config
2021-01-18 18:48:37 +00:00
Omar Polo
982069a120
add "mime" and "default type" option for the configuration
2021-01-18 18:43:47 +00:00
Omar Polo
0fbe79b33c
improve mime handling
...
we still have an hardcoded list, but this implements the API needed to
modify the mappings.
2021-01-18 18:18:57 +00:00
Omar Polo
132cae8c6f
removing err/warn functions with our fatal
...
err/warn is not available on some systems (unfortunately!) and in any
case don't play well with our daemon mode (that closes std{in,out,err}).
Use our fatal that is daemon-aware.
2021-01-18 18:15:58 +00:00
Omar Polo
568a09c220
fix requri construction
...
when we switched from one process to two, I introduced a small
optimisation: empty string are not send, so we receive NULL.
Constructing requri we need to make sure that relpath is not null.
2021-01-18 15:25:49 +00:00
Omar Polo
f87bf597ea
removing O_CLOEXEC
...
we don't fork anymore in that process, so the flag is extra.
2021-01-17 23:25:59 +00:00
Omar Polo
c0224a266c
removed
2021-01-17 23:24:26 +00:00
Omar Polo
d3a08f4d17
reorganize: move bunch of functions to server.c
...
cgi.c wasn't really needed; it better to group all the server related
functions together, cgi or not. Now gmid.c contains only startup and
utility code.
2021-01-17 23:23:58 +00:00
Omar Polo
5f564d23e9
mention libretls
2021-01-17 13:53:08 +00:00
Omar Polo
65fba1d570
[seccomp] allow also poll
...
on the latest fedora we glibc uses poll. On the other linux distro I
tried (void), musl is probably providing poll as a ppoll wrapper.
2021-01-17 13:51:09 +00:00
Omar Polo
771d8f281b
build docs + install and static targets
2021-01-17 12:12:37 +00:00
Omar Polo
0170ba023f
re-enable daemon mode
...
with the split into two process, the call to daemon was lost
2021-01-17 11:56:50 +00:00
Omar Polo
b3927be446
fix runtime test on linux
2021-01-17 11:49:32 +00:00
Omar Polo
364f10dbcd
add runtime tests for the server
2021-01-17 11:34:06 +00:00
Omar Polo
76fd55f437
grammar
2021-01-17 10:06:52 +00:00
Omar Polo
7a11e8a5d3
sync changes
2021-01-17 09:43:29 +00:00
Omar Polo
ea58dab1a7
update readme
2021-01-17 09:42:10 +00:00
Omar Polo
c2e39fcfed
we don't need to check for CGI anymore
2021-01-17 09:37:44 +00:00
Omar Polo
71b7eb2f8c
initial seccomp support
2021-01-17 09:34:27 +00:00
Omar Polo
7146dd552f
missing break
2021-01-17 09:34:06 +00:00
Omar Polo
d939d0f09e
switch to getcwd
2021-01-17 09:33:45 +00:00
Omar Polo
881dc835d0
wording
2021-01-16 20:14:02 +00:00
Omar Polo
881a9dd9c2
split into two processes: listener and executor
...
this way, we can sandbox the listener with seccomp (todo) or capsicum
(already done) and still have CGI scripts. When we want to exec, we
tell the executor what to do, the executor executes the scripts and
send the fd backt to the listener.
2021-01-16 19:41:34 +00:00
Omar Polo
bd726b55be
set SERVER_NAME to the vhost when executing CGI scripts
2021-01-15 19:23:43 +00:00
Omar Polo
98c8f038ac
drop inet_ntop leftovers
...
we switched to getnameinfo some time ago, but that call to inet_ntop
remained. Fortunately, it doesn't harm, since what i wrote is
overwritten by getnameinfo and the provided buffer should be large
enough.
2021-01-15 19:15:13 +00:00
Omar Polo
7edc455ab4
move cgi stuff to its own file
2021-01-15 19:08:28 +00:00
Omar Polo
5bc3c98ed4
add protocols to the config
2021-01-15 18:55:05 +00:00
Omar Polo
8696c5ea24
sync changes
2021-01-15 18:24:58 +00:00
Omar Polo
b777bf4b2b
check also that the port number matches
2021-01-15 18:24:24 +00:00
Omar Polo
f7b816dc39
style
2021-01-15 15:21:51 +00:00
Omar Polo
dafb57b8af
sandbox also on FreeBSD with capsicum
2021-01-15 14:03:45 +00:00