[IntelMQ-dev] Help for fixing configuration of intelmq-manager 3.0.1-1

Sebastian Wagner wagner at cert.at
Tue Nov 2 14:15:52 CET 2021


Hi,

On 11/2/21 1:38 PM, Mika Silander wrote:
>  Getting back to this anew. I've revised and rerevised all imaginable intelmq-manager configurations and problems remain. After debugging it looks like I still have issues
> with intelmq-manager's Configuration tab, all other tabs are ok. From within the Configuration tab https://ourimq/intelmq/v1/api/bots is accessed which in turn invokes (under the hood)
>
> sudo -u www-data -u intelmq intelmqctl --type json list bots
>
>  This, I gather, is for generating the list of bots available on the right-hand side of the Configuration tab. Running this command from the command line gives:
>
> Traceback (most recent call last):
>   File "/usr/bin/intelmqctl", line 11, in <module>
>     load_entry_point('intelmq==3.0.2', 'console_scripts', 'intelmqctl')()
>   File "/usr/lib/python3/dist-packages/intelmq/bin/intelmqctl.py", line 1909, in main
>     return x.run()
>   File "/usr/lib/python3/dist-packages/intelmq/bin/intelmqctl.py", line 1051, in run
>     print(json.dumps(results))
>   File "/usr/lib/python3.8/json/__init__.py", line 231, in dumps
>     return _default_encoder.encode(obj)
>   File "/usr/lib/python3.8/json/encoder.py", line 199, in encode
>     chunks = self.iterencode(o, _one_shot=True)
>   File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode
>     return _iterencode(o, 0)
>   File "/usr/lib/python3.8/json/encoder.py", line 179, in default
>     raise TypeError(f'Object of type {o.__class__.__name__} '
> TypeError: Object of type Pattern is not JSON serializable
>
>
>  I assume this is the reason why the Configuration tab in my instance is dysfunctional.
Yes.
> Any hints?

Do you have a custom bot which has a parameter that is of type
re.Pattern[0]? json.dumps fails serialzing this value. The solution is
to use a string as parameter type, then you are even able to configure
it :) You can compile the parameter's value at initialization.

Sebastian

[0]: https://docs.python.org/3/library/re.html#regular-expression-objects

-- 
// Sebastian Wagner <wagner at cert.at> - T: +43 676 898 298 7201
// CERT Austria - https://www.cert.at/
// Eine Initiative der nic.at GmbH - https://www.nic.at/
// Firmenbuchnummer 172568b, LG Salzburg


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.cert.at/pipermail/intelmq-dev/attachments/20211102/64af68eb/attachment-0001.sig>


More information about the IntelMQ-dev mailing list