Add support for listening on unix domain sockets#488
Conversation
|
@squalus thanks for your contributions. Both of these PRs are of interest. That said, could you please read the README. I see some items worthy of discussion here. |
d8ba628 to
52cdede
Compare
|
Added an issue, changelog entry, and unit test |
main_test.go
Outdated
| config := &cfg.Config{ | ||
| Listen: fmt.Sprintf("unix:%s", socketFile), | ||
| } | ||
| lis, cleanupFn, err := listen(config) |
There was a problem hiding this comment.
instead of contructing a config object, please create and consume a config file in config/testing and then use a setup function similar to...
https://github.com/vouch/vouch-proxy/blob/master/pkg/cfg/cfg_test.go#L23-L26
please also add config examples in config/config.yml_example and config/config.yml_example_listen_unix_socket
There was a problem hiding this comment.
- Updated test to use testing config files instead of constructing a config object
- Added config examples to
config/config.yml_example. I didn't add another standalone one, because it would just be an exact duplicate of another one of the other files with one extra line.
main.go
Outdated
|
|
||
| } | ||
|
|
||
| func listen(config *cfg.Config) (lis net.Listener, cleanupFn func(), err error) { |
There was a problem hiding this comment.
for consistency, instead of passing config *cfg.Config please just use cfg.Cfg.___ and leave the signature as listen(). Config isn't meant to be passed around, just plucked from the ether as a global.
There was a problem hiding this comment.
Updated the listen function to use the global configuration object
|
@squalus thanks for the fine addition to VP I've left a few comments inline to the code. Please do also ensure that the unix socket can be configured via environmental variables and adjust this test accordingly.. Cheers! |
|
One other good addition would be to add a check to the Perhaps In general, VP tries to catch configuration errors and offer clear logging in hopes of helping fellow admins find their way quickly, and avoid support tickets showing up here. |
Updated |
|
|
@squalus sorry for the delay in reviewing this PR I've set a default of socket perms to https://serverfault.com/questions/437077/what-should-be-proper-permission-of-unix-socket Thanks again for the fine PR, I'm going to merge and ship |
Added unix domain socket support for the listen setting.
Added
socket_modesetting to change socket permissions.Example configuration: