File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed
intelmq/bots/collectors/api Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 54
54
#### Parsers
55
55
56
56
#### Experts
57
+ - ` intelmq.bots.experts.jinja ` (PR #2417 by Mikk Margus Möll):
58
+ - Add optional ` socket_perms ` and ` socket_group ` parameters to change
59
+ file permissions on socket file, if it is in use.
57
60
58
61
#### Outputs
59
62
- ` intelmq.bots.outputs.stomp.output ` (PR #2408 by Jan Kaliszewski):
Original file line number Diff line number Diff line change @@ -259,6 +259,14 @@ used. Requires the [tornado](https://pypi.org/project/tornado/) library.
259
259
260
260
(optional, string) Location of the socket. Defaults to ` /tmp/imq_api_default_socket ` .
261
261
262
+ ** ` socket_perms ` **
263
+
264
+ (optional, octal integer) Unix permissions to grant to the socket file. Default: ` 600 `
265
+
266
+ ** ` socket_group ` **
267
+
268
+ (optional, string) Name of group to change group ownership of socket file to.
269
+
262
270
---
263
271
264
272
### Generic URL Fetcher <div id =" intelmq.bots.collectors.http.collector_http " />
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