[lxc-devel] [lxd/master] device/proxy: Implements default listen file mode of 0755

tomponline on Github lxc-bot at linuxcontainers.org
Wed Aug 7 16:44:23 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 683 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190807/e351289b/attachment.bin>
-------------- next part --------------
From aa1013b11e131b9ada63f0bb7d5e846d8fa72486 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Wed, 7 Aug 2019 17:41:48 +0100
Subject: [PATCH] device/proxy: Implements default listen file mode of 0755

The documentation states that the default listen file mode is 0755 if not supplied.

However the mode argument was currently being passed to forkproxy as empty string if not supplied.

There was also no mention of 755 or umask in forkproxy itself, leading me to think the default as documented was not implemented.

Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
 lxd/device/proxy.go | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lxd/device/proxy.go b/lxd/device/proxy.go
index c9e9d5a789..9d87e31801 100644
--- a/lxd/device/proxy.go
+++ b/lxd/device/proxy.go
@@ -410,6 +410,11 @@ func (d *proxy) setupProxyProcInfo() (*proxyProcInfo, error) {
 		return nil, fmt.Errorf("Invalid binding side given. Must be \"host\" or \"guest\"")
 	}
 
+	listenAddrMode := "0755"
+	if d.config["mode"] != "" {
+		listenAddrMode = d.config["mode"]
+	}
+
 	p := &proxyProcInfo{
 		listenPid:      listenPid,
 		connectPid:     connectPid,
@@ -417,7 +422,7 @@ func (d *proxy) setupProxyProcInfo() (*proxyProcInfo, error) {
 		listenAddr:     listenAddr,
 		listenAddrGID:  d.config["gid"],
 		listenAddrUID:  d.config["uid"],
-		listenAddrMode: d.config["mode"],
+		listenAddrMode: listenAddrMode,
 		securityGID:    d.config["security.gid"],
 		securityUID:    d.config["security.uid"],
 		proxyProtocol:  d.config["proxy_protocol"],


More information about the lxc-devel mailing list