|
|
@@ -49,8 +49,9 @@ var currentUID = func() uint32 { return uint32(os.Geteuid()) }
|
|
|
// socket file on every unix we build for. The control socket is 0600 and adds the peer
|
|
|
// check the server applies on accept, unless a group shares it, in which case it is
|
|
|
// 0660 with that group and the kernel's check is the whole of it; the info socket is
|
|
|
-// whatever the operator configured, since opening it to others is its purpose. The directory is not part of that, and is never
|
|
|
-// chmoded: a directory a service manager made for us is served from at whatever mode it
|
|
|
+// whatever the operator configured, since opening it to others is its purpose.
|
|
|
+//
|
|
|
+// The directory is not part of that, and is never chmoded: a directory a service manager made for us is served from at whatever mode it
|
|
|
// came with (systemd's RuntimeDirectoryMode= is 0755 by default), and one an operator
|
|
|
// pointed us into keeps whatever else it holds readable. The one we make ourselves is
|
|
|
// 0755, searchable by everyone, so that a nebula ctl run as another user reaches the
|
|
|
@@ -69,11 +70,8 @@ func listen(path string, acc Access) (net.Listener, error) {
|
|
|
// exists, and an operator who names a deeper path creates it; a missing parent is a
|
|
|
// mistake to report, not a tree to build. A directory made here stays when the
|
|
|
// socket goes: an empty one costs nothing, and the next start wants it again.
|
|
|
- //
|
|
|
- // 0755 gives nothing away: the socket's own mode is the access control. What it
|
|
|
- // gives is a directory others can look into, which is what a client that is not the
|
|
|
- // daemon's user needs to reach the socket. Mkdir applies the umask, so the mode is
|
|
|
- // pinned afterwards, as the socket's is; only on a directory this call created.
|
|
|
+ // Mkdir applies the umask, so the 0755 is pinned afterwards, as the socket's mode
|
|
|
+ // is; only on a directory this call created.
|
|
|
switch err := os.Mkdir(dir, 0755); {
|
|
|
case err == nil:
|
|
|
if err := os.Chmod(dir, 0755); err != nil {
|
|
|
@@ -283,7 +281,7 @@ func clearStale(path string) error {
|
|
|
//
|
|
|
// Only the node id names is removed. One that replaced it is another daemon's, bound
|
|
|
// after ours was taken from under us, and is left where it is. A zero id, a node that
|
|
|
-// could not be identified when it was bound, is removed as it always was.
|
|
|
+// could not be identified when it was bound, is removed.
|
|
|
func removeSocket(path string, id socketID) {
|
|
|
if cur, ok := identifySocket(path); ok && id != (socketID{}) && cur != id {
|
|
|
return
|