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 6363#### Parsers
6464
6565#### Experts
66+ - ` intelmq.bots.experts.jinja ` (PR #2417 by Mikk Margus Möll):
67+ - Add optional ` socket_perms ` and ` socket_group ` parameters to change
68+ file permissions on socket file, if it is in use.
6669
6770#### Outputs
6871- ` intelmq.bots.outputs.stomp.output ` (PR #2408 and PR #2414 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.
259259
260260(optional, string) Location of the socket. Defaults to ` /tmp/imq_api_default_socket ` .
261261
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+
262270---
263271
264272### Generic URL Fetcher <div id =" intelmq.bots.collectors.http.collector_http " />
Original file line number Diff line number Diff line change 88"""
99from threading import Thread
1010from typing import Optional
11+ import grp
1112import os
1213import socket
1314
@@ -42,6 +43,8 @@ class APICollectorBot(CollectorBot):
4243 _is_multithreadable : bool = False
4344 use_socket = False
4445 socket_path = '/tmp/imq_api_default_socket'
46+ socket_perms = '600'
47+ socket_group = ''
4548 _server : Optional ['HTTPServer' ] = None
4649 _unix_socket : Optional [socket .socket ] = None
4750 _eventLoopThread : Optional [Thread ] = None
@@ -56,7 +59,12 @@ def init(self):
5659
5760 if self .use_socket :
5861 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+
6068 self .server .add_socket (self ._unix_socket )
6169 else :
6270 self .server = app .listen (self .port )
You can’t perform that action at this time.
0 commit comments