Commit Graph

1223 Commits

Author SHA1 Message Date
Omar Polo
f5c8360ade fix previous 2023-06-08 19:24:37 +00:00
Omar Polo
ca84625a7f remove foreground / verbose from config
set them as global vars; rename foreground -> debug
2023-06-08 17:29:08 +00:00
Omar Polo
85a575a444 remove forgotten include of logger.h 2023-06-08 17:28:33 +00:00
Omar Polo
cbb7f9fc28 move logger() prototype to gmid.h and delete logger.h 2023-06-08 17:03:13 +00:00
Omar Polo
797c4609a9 make ge work again 2023-06-08 16:22:03 +00:00
Omar Polo
3886afceec make server_init and server_configure_done 'public'
server_configure_done is the code we ran in IMSG_RECONF_END splitted
in a separate functions.

This is all needed for ge.c which doesn't do privsep but needs to
bootstrap the server process.
2023-06-08 16:21:31 +00:00
Omar Polo
47b0ff105a move log_request to gmid.c
so that ge can provide its own log_request without requiring a
separate logger process.
2023-06-08 16:16:14 +00:00
Omar Polo
4f4937f06a move make_socket to config.c and make it private 2023-06-08 16:07:01 +00:00
Omar Polo
fc9cc497e0 move some new_* functions from parse.y to utils.c 2023-06-08 15:59:53 +00:00
Omar Polo
e69e1151f6 drop now unused dispatch_imsg 2023-06-08 15:57:11 +00:00
Omar Polo
2b4ef796d7 remove debug code 2023-06-08 15:47:03 +00:00
Omar Polo
61febd28af remove now unused ibuf variable 2023-06-08 15:44:34 +00:00
Omar Polo
846842e138 sync DISTFILES 2023-06-08 15:41:47 +00:00
Omar Polo
68e38f49b2 use -MMD if the compiler supports it
it's better than the previous Makefile.depend approach since this
automatically adapts to the included headers without requiring
manual intervention to regen the list.
2023-06-08 14:43:29 +00:00
Omar Polo
3483609593 remove Makefile.depend 2023-06-08 14:37:29 +00:00
Omar Polo
c727f8dd75 reformat 2023-06-08 14:36:29 +00:00
Omar Polo
c26f2460e4 rework the daemon to do fork+exec
It uses the 'common' proc.c from various OpenBSD-daemons.

gmid grew organically bit by bit and it was also the first place where I
tried to implement privsep.  It wasn't done very well, in fact the
parent process (that retains root privileges) just fork()s a generation
of servers, all sharing *exactly* the same address space.  No good!

Now, we fork() and re-exec() ourselves, so that each process has a fresh
address space.

Some features (require client ca for example) are temporarly disabled,
will be fixed in subsequent commits.  The "ge" program is also
temporarly disabled as it needs tweaks to do privsep too.
2023-06-08 13:59:31 +00:00
Omar Polo
99f1fbb0c7 regress: use -P with an absolute path 2023-06-08 13:56:09 +00:00
Omar Polo
f1f13cb7dc absolutify the path to the pid file 2023-06-08 13:56:09 +00:00
Omar Polo
9b1750057c add missing include of gmid.h 2023-06-06 11:57:33 +00:00
Omar Polo
2dd5994ae1 use fatal() in code used in the daemon 2023-06-06 11:52:43 +00:00
Omar Polo
bc525c73db fix asprintf failure check 2023-06-06 11:48:02 +00:00
Omar Polo
eae52ad493 switch to the more usual log.c 2023-06-06 11:46:40 +00:00
Omar Polo
58fae4ea90 use memchr instead of rolling a custom one 2023-06-06 10:46:44 +00:00
Omar Polo
281a8852b3 rename log.[ch] to logger.[ch] 2023-06-06 08:50:54 +00:00
Omar Polo
3dd89fbb44 predeclare struct client 2023-06-06 08:34:54 +00:00
Omar Polo
3a8c76eab2 rename PROC_MAX to PREFORK_MAX 2023-06-06 08:34:31 +00:00
Omar Polo
4267093e37 nitpick: fix snprintf check 2023-06-06 08:22:18 +00:00
Omar Polo
f057c92622 adjust comments 2023-06-06 08:20:09 +00:00
Omar Polo
c68baad22a move config-related code to config.c
reuse it in ge too.
2023-06-06 08:18:57 +00:00
Omar Polo
0046c1fe9c call setlocale() 2023-06-06 08:11:30 +00:00
Omar Polo
bb595bff79 remove unused define 2023-06-05 21:11:40 +00:00
Omar Polo
070b32952c move and dedup the tls initalization in server.c 2023-06-05 21:10:18 +00:00
Omar Polo
114e9a4206 fix off-by-one in recent fatal change 2023-06-05 20:45:28 +00:00
Omar Polo
0ac785a6fa revert aae8f6bf2b
it's just not worth it to inflict this breaking change to the users.
2023-06-05 20:35:12 +00:00
Omar Polo
e1e04caa4f +log.h 2023-06-05 20:27:27 +00:00
Omar Polo
df5058c919 provide a more usual fatal
fatal usually appends the error string.  Add 'fatalx' that doesn't.
Fix callers and move the prototypes to log.h
2023-06-05 17:07:52 +00:00
Omar Polo
a01a91db06 move some server-related code to server.c 2023-06-05 16:18:57 +00:00
Omar Polo
9a821f8c0f fold long lines 2023-06-05 15:07:24 +00:00
Omar Polo
ac9f55ba32 gencert: add -e flag to generate a cert using an EC key 2023-06-05 14:35:23 +00:00
Omar Polo
34886b1e55 add tags target 2023-05-08 10:30:00 +00:00
Omar Polo
1e0b974519 send capsicum/landlock/seccomp hack to Valhalla 2023-05-08 10:27:32 +00:00
Omar Polo
0b62f4842d drop landlock/seccomp and capsicum support
it reached a point where this stuff is not maintenable.  I'd like
to move forward with gmid, but the restriction of capsicum and the
linux environment at large that make landlock unusable (how can you
resolve DNS portably when under landlock?) -and don't get me started
on seccomp- makes it impossible for me to do any work.

So, I prefer removing the crap, resuming working on gmid by cleaning
stuff and consolidating the features, improving various things
etc... and then eventually see how to introduce some sandboxing
again on other systems.  Patches to resume sandboxing are, as always,
welcome!
2023-05-08 10:27:32 +00:00
Anna “CyberTailor”
c9e97a6ecb include grp.h for setgroup(2) on linux 2022-12-24 08:41:09 +00:00
Omar Polo
837156014c add a disclaimer 2022-12-02 15:37:49 +00:00
Omar Polo
195f32d3a4 update the site for 1.8.6 2022-12-02 15:21:20 +00:00
Omar Polo
bd8683d0fd add tests and compat for setresuid and setresgid 2022-12-02 11:53:35 +00:00
Omar Polo
06035a0237 more is*() unsigned char cast
continuation of 6130e0eeac
2022-11-29 23:03:55 +00:00
Omar Polo
97b306cbee add an implicit fastcgi parameter: GEMINI_SEARCH_STRING
it’s the QUERY_STRING decoded if it’s a search-string (i.e. not a
key-value pair.)  It’s useful for scripts to avoid percent-decoding
the querystring in the most common case of a query, because in Gemini
querystrings key-value paired are not common.

Idea from a discussion with Allen Sobot.
2022-11-27 15:35:10 +00:00
Omar Polo
77718c121f correction: QUERY_STRING is *not* urldecoded.
RFC3875 § 4.1.7 states that "the QUERY_STRING variable contains a
URL-encoded search or parameter string".
2022-11-27 12:52:17 +00:00