Commit Briefs

be288a59f4 Thomas Adam

rename lib/sha1.c to lib/hash.c

It will soon grow functions to deal with sha256 too. stsp@ agrees.


588a8092bc Thomas Adam

include sha2.h too where sha1.h is included

In preparation for wide sha256 support; stsp@ agrees. Change done mechanically with find . -iname \*.[cy] -exec sam {} + X ,x/<sha1\.h>/i/\n#include <sha2.h>


52939b686a Thomas Adam

fix gotd segfault in libevent while disconnecting clients

Sending a DISCONNECT message to the repo process and then killing it and freeing its structure won't work. The message ends up on internal libevent queues and will soon crash because we have freed the memory for the event structre. Sending that message is a leftover from the times when the repo procs were persistent.


96d694ac3b Thomas Adam

fix gotd and gotsh usage() function declaration

"function declaration isn't a prototype" should fix the error seen by tracey@ on sparc64


b7acbe65b9 Thomas Adam

make gotd parent dispatch handlers more robust during teardown

We have observed gotd exiting after "cannot find client for fd N" errors. If this occurs then we are likely in the process of disconnecting a client session while processing an event from a child process. Treat the above error as non-fatal and stop processing more events from the child process.


e17294f7d5 Thomas Adam

remove \n from log message


1f1613cf29 Thomas Adam

make gotd store own PID after daemon(3), and avoid calling daemon(3) needlessly

ok op, jamsek


f5f71a0483 Thomas Adam

gotd: disconnect on client EOF too

Otherwise gotd keeps the (client-closed) sockets around and may prevent new connections from being established since they still count for the limits. ok jamsek, stsp


c855c9f037 Thomas Adam

document the gotd -n option


7348ded8f8 Thomas Adam

gotd: move socket path check to parse.y and error from the main process

It's handy to have a "bad unix socket path" error being reported directly from the main process since can get caught by `gotd -n'. ok jamsek stsp


4d24b1fdb7 Thomas Adam

gotd: move nrepos check to parse_config

ok jamsek stsp


b4b04e8813 Thomas Adam

gotd: print configuration errors without -d

Defer the absolute path check on argv[0] and log_init so that it becomes possible to run `gotd -n' to check the configuration file and get errors without specifying -d. Erorrs in the configuration now are actually always printed regardless of -d. While here also tweak an error message and print 'configuration OK' if -n ok stsp@


27b11d77ad Thomas Adam

use just one pointer variable to keep track of a client's repo process

ok op@


7b1db75e88 Thomas Adam

update client state tracking in the gotd parent process

The session process takes over the old state definitions under a new name ("session state"). The parent only needs to keep track of whether a client has been granted access, so it only uses two states: NEW, and ACCCESS_GRANTED which is set as soon as the auth process has granted repository access and before the session and repo_read/repo_write children are started. Because 'gotctl info' can no longer observe the session state remove support code for printing it. ok op@


c115f13dfe Thomas Adam

remove support for showing client capabilities in 'gotctl info'

The gotd parent process has lost access to client capabilities. Take the easy way out and remove related code. If needed, client capabilities can still be found in the debug log with 'gotd -v'. ok op, jamsek


3c726c8451 Thomas Adam

remove now unused fields from struct gotd_client


62ee7d9474 Thomas Adam

add a gotd session process, split off from the parent process

The new session process is able to manipulate files in the repository and keeps track of the read/write client session state. The parent process now restricts its view of the filesystem to the absolute path stored in argv[0], and combines this with unveil "x" on this path. As a result the parent process can only re-exec itself. small tweaks + ok op@


fe6a898867 Thomas Adam

call realpath() during early startup in gotd's parse.y

This ensures that all repositories exist when the process is first started. It will also help to avoid an "rpath" pledge promise in a future gotd which uses a separate session process, by avoiding realpath() calls while starting new processes.



0d26b72c23 Thomas Adam

gotd: delete unreachable code after gotd_shutdown()


d4940d4006 Thomas Adam

revoke filesystem access in gotd listen process via unveil(2)

This should avoid involuntary use of bind(2) with arbitrary socket paths. ok op@


c8cf682107 Thomas Adam

expose 'gotctl info' output only to the root user

Now that anyone can connect to the socket, it is probably safer to expose information about currently connected clients only to root.


f2fc8ce0a3 Thomas Adam

remove the gotsh group requirement from gotd; any user can now connect

Repository access is now controlled by access rules in gotd.conf, and concurrent connections to the gotd socket by local users are limited by the listen process. We should keep refining our anti-DoS measures in the future, but at least we have something in place now. ok jamsek, op


0781db0e24 Thomas Adam

introduce connection options to gotd.conf

Allow administrators to tweak the default authentication and request timeouts if needed, and to tweak the limit of concurrent connections for specific user accounts. with several tweaks from and ok op@


1637335630 Thomas Adam

fmt