Ensure umask is set appropriately for 'system service'

We need a umask of 0022 to ensure containers are created
correctly, but we set a different one prior to starting the
server (to ensure the unix socket has the right permissions).
Thus, we need to set the umask after the socket has been bound,
but before the server begins accepting requests.

Fixes #6787

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
Matthew Heon
2020-06-26 10:07:20 -04:00
parent 673116c063
commit f0ca17650e

View File

@ -173,6 +173,10 @@ func (s *APIServer) Serve() error {
}()
}
// Before we start serving, ensure umask is properly set for container
// creation.
_ = syscall.Umask(0022)
go func() {
err := s.Server.Serve(s.Listener)
if err != nil && err != http.ErrServerClosed {