Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: AMQP support #1179

Merged
32 commits merged into from
Apr 3, 2019
Merged

WIP: AMQP support #1179

32 commits merged into from
Apr 3, 2019

Conversation

ghost
Copy link

@ghost ghost commented Feb 1, 2018

AMQP support is feature-complete, needs still to be tested on development machines and some unittests are needed.

  • All features for intelmqctl
  • Unit tests
  • Documentation
  • real world tests
  • clearing queues
  • paths
  • lazy queues

@ghost ghost added feature Indicates new feature requests or new features component: core labels Feb 1, 2018
@ghost ghost added this to the 1.1.0 milestone Feb 1, 2018
@ghost ghost self-assigned this Feb 1, 2018
@codecov-io
Copy link

codecov-io commented Feb 2, 2018

Codecov Report

Merging #1179 into develop will decrease coverage by 0.03%.
The diff coverage is 21.01%.

@@             Coverage Diff             @@
##           develop    #1179      +/-   ##
===========================================
- Coverage    75.11%   75.08%   -0.04%     
===========================================
  Files          318      288      -30     
  Lines        14402    13267    -1135     
  Branches      1911     1793     -118     
===========================================
- Hits         10818     9961     -857     
+ Misses        3137     2909     -228     
+ Partials       447      397      -50
Impacted Files Coverage Δ
intelmq/lib/pipeline.py 48.16% <22.58%> (-19.59%) ⬇️
intelmq/bin/intelmqctl.py 9.86% <7.14%> (-0.18%) ⬇️
intelmq/bots/parsers/zoneh/parser.py 28.57% <0%> (-71.43%) ⬇️
intelmq/bots/parsers/shodan/parser.py 19.64% <0%> (-70.53%) ⬇️
intelmq/bots/parsers/calidog/parser_certstream.py 36% <0%> (-40%) ⬇️
...q/bots/collectors/microsoft/collector_interflow.py 27.41% <0%> (-19.5%) ⬇️
intelmq/bots/parsers/n6/parser_n6stomp.py 62.1% <0%> (-14.43%) ⬇️
...sts/bots/parsers/webinspektor/test_webinspektor.py 91.3% <0%> (-8.7%) ⬇️
...q/tests/bots/parsers/malwareurl/test_malwareurl.py 91.3% <0%> (-8.7%) ⬇️
...tests/bots/parsers/threatminer/test_threatminer.py 91.3% <0%> (-8.7%) ⬇️
... and 150 more

@ghost ghost mentioned this pull request Jun 18, 2018
2 tasks
@ghost
Copy link
Author

ghost commented Jun 21, 2018

There are speed problems and problems with unacked messages. Postponing this

@ghost ghost modified the milestones: 1.1.0, 1.2.0 Jun 21, 2018
@ghost
Copy link
Author

ghost commented Aug 15, 2018

  File "/home/sebastianw/intelmq/intelmq/lib/pipeline.py", line 293, in __init__
    raise exceptions.ConfigurationError("To use AMQP you must install the 'pika' library.")
TypeError: __init__() missing 1 required positional argument: 'argument'

@SYNchroACK
Copy link
Contributor

SYNchroACK commented Sep 12, 2018

@wagner-certat what do you think about using "lazy queues" feature?
https://www.rabbitmq.com/lazy-queues.html

I think is something that we miss a lot due a lot of messages that stuck on experts (like cymru-whois, gethostbyname and deduplicator).

I think (not sure), we only need to pass the x-queue-mode value inside the args parameter here: https://pika.readthedocs.io/en/latest/modules/channel.html?highlight=channel#pika.channel.Channel.queue_declare

@SYNchroACK
Copy link
Contributor

SYNchroACK commented Sep 12, 2018

$ cat /opt/intelmq/etc/defaults.conf 
{
    "destination_pipeline_broker": "Amqp",
    "destination_pipeline_db": 2,
    "destination_pipeline_host": "127.0.0.1",
    "destination_pipeline_password": null,
    "destination_pipeline_port": 5672,

  ....

    "source_pipeline_broker": "Amqp",
    "source_pipeline_db": 2,
    "source_pipeline_host": "127.0.0.1",
    "source_pipeline_password": null,
    "source_pipeline_port": 5672
}
$ intelmqctl list queues
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/redis/connection.py", line 174, in _read_from_socket
    data = recv(self._sock, socket_read_size)
  File "/usr/lib/python3/dist-packages/redis/_compat.py", line 79, in recv
    return sock.recv(*args, **kwargs)
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/redis/client.py", line 667, in execute_command
    connection.send_command(*args)
  File "/usr/lib/python3/dist-packages/redis/connection.py", line 610, in send_command
    self.send_packed_command(self.pack_command(*args))
  File "/usr/lib/python3/dist-packages/redis/connection.py", line 585, in send_packed_command
    self.connect()
  File "/usr/lib/python3/dist-packages/redis/connection.py", line 493, in connect
    self.on_connect()
  File "/usr/lib/python3/dist-packages/redis/connection.py", line 567, in on_connect
    if nativestr(self.read_response()) != 'OK':
  File "/usr/lib/python3/dist-packages/redis/connection.py", line 624, in read_response
    response = self._parser.read_response()
  File "/usr/lib/python3/dist-packages/redis/connection.py", line 284, in read_response
    response = self._buffer.readline()
  File "/usr/lib/python3/dist-packages/redis/connection.py", line 216, in readline
    self._read_from_socket()
  File "/usr/lib/python3/dist-packages/redis/connection.py", line 191, in _read_from_socket
    (e.args,))
redis.exceptions.ConnectionError: Error while reading from socket: (104, 'Connection reset by peer')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/redis/connection.py", line 174, in _read_from_socket
    data = recv(self._sock, socket_read_size)
  File "/usr/lib/python3/dist-packages/redis/_compat.py", line 79, in recv
    return sock.recv(*args, **kwargs)
ConnectionResetError: [Errno 104] Connection reset by peer

On this line (https://github.com/certtools/intelmq/blob/dev-amqp/intelmq/lib/pipeline.py#L39) it seems that we need to add .title()

Also, on this line (https://github.com/certtools/intelmq/blob/dev-amqp/intelmq/lib/pipeline.py#L41) it seems now we have three broker options, and I guess the one on line 41 will be required by intelmqctl

@ghost
Copy link
Author

ghost commented Sep 13, 2018

Ad lazy queues: Thanks for the pointer, definitely

On this line (https://github.com/certtools/intelmq/blob/dev-amqp/intelmq/lib/pipeline.py#L39) it seems that we need to add .title()

yes, thanks.

Also, on this line (https://github.com/certtools/intelmq/blob/dev-amqp/intelmq/lib/pipeline.py#L41) it seems now we have three broker options, and I guess the one on line 41 will be required by intelmqctl

What do you mean?

@ghost ghost force-pushed the dev-amqp branch 2 times, most recently from fa4224d to f905831 Compare April 3, 2019 14:42
@ghost ghost merged commit 4294d85 into develop Apr 3, 2019
@ghost ghost modified the milestones: 1.2.0, 2.0.0 Apr 9, 2019
@ghost ghost deleted the dev-amqp branch March 23, 2020 14:39
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: core feature Indicates new feature requests or new features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants