From 9922afc6930d4ddf0422860bdfe23113648ca5db Mon Sep 17 00:00:00 2001
From: kroy-the-rabbit <kroy@kroy.io>
Date: Tue, 19 May 2020 20:44:28 -0500
Subject: T2465: Permissions on vyos-hostsd socket incorrect

The DHCP server is unable to apply entries to the hosts file because the permissions on the socket are getting created wrong.

```
$ ls -al /run/vyos-hostsd.sock
srwxrwxrwx 1 root vyattacfg 0 May 20 01:38 /run/vyos-hostsd.sock

```

This gives it the correct permissions so that the nobody/nobody user/group can change it.
---
 src/services/vyos-hostsd | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'src/services')

diff --git a/src/services/vyos-hostsd b/src/services/vyos-hostsd
index 647cbc8c1..6017cea82 100755
--- a/src/services/vyos-hostsd
+++ b/src/services/vyos-hostsd
@@ -278,7 +278,11 @@ if __name__ == '__main__':
 
     context = zmq.Context()
     socket = context.socket(zmq.REP)
+    
+    # Set the right permissions on the socket, then change it back
+    o_mask = os.umask(0)
     socket.bind(SOCKET_PATH)
+    os.umask(o_mask)
 
     while True:
         #  Wait for next request from client
-- 
cgit v1.2.3