Change the permissions of the notify listener socket to rwx for everyone

When runc is started as a `Type=notify` systemd service,
runc opens up its own listening socket inside the container
to act as a proxy between the container and systemd for passing
notify messages.

The domain socket that runc creates is only writeable by the user
running runc however, so if the container has a different UID/GID
then nothing inside the container will be able to write to the socket.

The fix is to change the permissions of the notify listener socket to 0777.

Signed-off-by: Joe Burianek <joe.burianek@pantheon.io>
This commit is contained in:
Joe Burianek
2019-05-07 11:28:49 -05:00
parent 70bc4cd847
commit 7a9ffa897f
+7
View File
@@ -6,6 +6,7 @@ import (
"bytes"
"fmt"
"net"
"os"
"path/filepath"
"github.com/opencontainers/runtime-spec/specs-go"
@@ -60,6 +61,12 @@ func (s *notifySocket) setupSocket() error {
return err
}
err = os.Chmod(s.socketPath, 0777)
if err != nil {
socket.Close()
return err
}
s.socket = socket
return nil
}