File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
intelmq/bots/collectors/api Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 8
8
"""
9
9
from threading import Thread
10
10
from typing import Optional
11
+ import grp
11
12
import os
12
13
import socket
13
14
@@ -42,6 +43,8 @@ class APICollectorBot(CollectorBot):
42
43
_is_multithreadable : bool = False
43
44
use_socket = False
44
45
socket_path = '/tmp/imq_api_default_socket'
46
+ socket_perms = '600'
47
+ socket_group = ''
45
48
_server : Optional ['HTTPServer' ] = None
46
49
_unix_socket : Optional [socket .socket ] = None
47
50
_eventLoopThread : Optional [Thread ] = None
@@ -56,7 +59,12 @@ def init(self):
56
59
57
60
if self .use_socket :
58
61
self .server = HTTPServer (app )
59
- self ._unix_socket = bind_unix_socket (self .socket_path )
62
+ self ._unix_socket = bind_unix_socket (self .socket_path , mode = int (self .socket_perms , 8 ))
63
+ if self .socket_group :
64
+ group = grp .getgrnam (self .socket_group )
65
+ gid = group .gr_gid
66
+ os .chown (self .socket_path , - 1 , gid )
67
+
60
68
self .server .add_socket (self ._unix_socket )
61
69
else :
62
70
self .server = app .listen (self .port )
You can’t perform that action at this time.
0 commit comments