mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user