Commit Briefs

Stefan Sperling

drop privileges in all parts of gotd other than the main process

ok thomas_adam


Thomas Adam

split gotd/session.c into session_read.c and session_write.c

This makes it easier to tweak the read/write code paths separately.


Thomas Adam

get rid of gotd client_id field where it is not needed

This ID was necessary back when session and repo processes supported connections from multiple clients. Nowadays, these processes run per connection and exit once a single client session has been served. The other processes already identify the client via the session/repo file descriptor which has sent an imsg.


Thomas Adam

portable: enable got-notify-email

Now that gotd has the start of helpers, got-notify-email is the first. This is still behind the --enable-gotd flag.


Thomas Adam

add initial support for commit notifications to gotd(8)

At present only email notifications are implemented. Code for HTTP notifications is not yet finished, hence HTTP-related documentation remains hidden for now. This adds a new 'notify' process which has an "exec" pledge. It runs helper programs which implement the notification transport layer, such as got-notify-email which speaks SMTP. This design avoids having to link all of gotd with network libraries and related crypto libraries. Notification content is generated by the 'repo_write' process. Commit log messages and diffstats are written to a file which the 'notify' process will pass on to its helpers on stdin. The default output looks similar to 'got log -d'. If too many new commits are present the output looks similar to 'got log -s' instead. Tags always look like 'got tag -l'. The session process coordinates generation of notifications. It maintains a notification queue which holds one notification per updated reference, and passes notification requests from this queue to the 'repo_write' process for notification content creation and then to the 'notify' process for notification delivery. Only one notification can be in flight at a time to avoid file descriptor starvation if many references get updated in a single client session. ok op@


Thomas Adam

convert to use imsg_get_fd()

While here also fix a fd leak in got-read-pack. We were dup'ing imsg.fd without closing imsg.fd later; instead just use imsg_get_fd() to extract the file descriptor. Tested by falsifian and Kyle Ackerman, thanks! 'go ahead' stsp@



Thomas Adam

make the gotd auth process provide the user's account name for later use

with tweaks from + ok op@


Thomas Adam

portable: add back drop_privs


Thomas Adam

allow gotd repo read/write processes to max out data-size resource limits

Proccessing large pack files can easily result in out-of-memory errors if the datasize limit is too conservative.


Thomas Adam

portable: gotd: re-enable chroot

Reads (git clone) are working but writes (git push) run into an error


Thomas Adam

portable: gotd/gitwrapper: update for libs

Bring gotd and gitwrapper closer to how libraries are detected.


Thomas Adam

portable: gotd: listen

Include listen.c; make it portable.


Thomas Adam

portable: enable compiling gotd

This enables gotd -- for now, this is opt-in at compile-time, via: ./configure --enable-gotd



Thomas Adam

fix typo in a comment


Thomas Adam

make gitwrapper ignore 'permission denied' for repository paths

We recommend that gotsh users should not have direct filesystem access to repositories served by gotd. Which means admins will be setting things up as follows if public read-access should be denied: chown _gotd /git chmod 700 /git su -m _gotd -c 'gotadmin init /git/repo.git" However, gitwrapper would error out when repositories listed in gotd.conf were inaccessible to the user invoking gitwrapper: git-upload-pack: /etc/gotd.conf:2: realpath /git/repo.git: Permission denied Make gitwrapper ignore such errors as they are expected in this situation. While here, add a PROC_GITWRAPPER process ID for use as a global variable parse.y can check while special-casing any specific behaviour required by gitwrapper. (The worse alternative would have been adding a new global variable to parse.y just to control the behaviour on realpath errors.) ok op@


Thomas Adam

gotd: wait asynchronously for children termination

Instead of the current kill() + waitpid(WNOHANG), manage the subprocesses in a separate queue and handle SIGCHLD. A timer is installed to ensure that misbehaving subprocesses are still killed. Fixes the current "child PID 0 terminated" logs due to races with waitpid(). Issue initially reported by Josiah Frentsos. ok + tweaks stsp@


Thomas Adam

add kill_repo_proc() similarly to the other kill_*_proc()

ok stsp@


Thomas Adam

missing semicolon... sigh

I can't assume I can blindly add one simple line.


Thomas Adam

move gotd_child_proc to gotd.c

make it opaque since it's unused outside of gotd.c. While here, drop the unused `nhelpers' field. ok/tweak stsp@


Thomas Adam

update gotd_proc_names after session process unveil changes

fixes "proc (null)" appearing in gotd logs



Thomas Adam

gotd: return early after disconnect on auth event error

This fixes a segv reported by Mikhail. In this path, any error is already logged, client freed, and event_del() called so we don't need to cleanup in done. ok stsp@