Support accepting socket from system manager instead of managing own socket
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 9.2k
- Forks
- 1.3k
- Avg merge
- 12h 58m
- Merged PRs (30d)
- 56
Description
Currently, the Keybase service insists on managing its socket itself; when passed an existing file, it attempts to delete the “stale” socket, and exits if that fails.
In the interest of managing Keybase with systemd (comments in run_keybase as well as in this issue tracker indicate that this is intended to be supported at some point), the service should also have an option to accept an open socket from the system manager (systemd). The best documentation for adding socket support to a program seems to be these two blog posts (systemd.socket(5) and systemd.service(5) focus more on the unit file, not on what the service has to do). In C, this seems to be the gist of it:
#include "sd-daemon.h"
int fd;
assert (sd_listen_fds(0) == 1);
fd = SD_LISTEN_FDS_START + 0;
assert (sd_is_socket(fd, AF_UNSPEC, SOCK_STREAM, 1));
There also appears to be a Go systemd binding, including an example for socket-based activation.
Note: macOS’ launchd apparently also supports socket-based activation. I’m not sure how similar the mechanism is.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the socket-management comments in run_keybase, then read the linked socket-activation documentation and the Go systemd activation example. Determine where the Keybase service receives and validates its socket; done means it can accept an existing manager-provided socket without trying to remove it or exiting on failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, linux
- Domain
- backend, operating-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100