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

[Questions and Support] The server.py does not raise if I define an ip in UDP_ADDRESS #19246

Closed
gabrielbasetti opened this issue Mar 17, 2024 · 6 comments

Comments

@gabrielbasetti
Copy link

Question
The server.py does not raise if I define an ip in UDP_ADDRESS

Support
Hi folks, I'm trying to configure maltrail with the docker image to have multiple sensors sending data to a maltrail server (docker too).
Following the guide at https://github.com/stamparm/maltrail/wiki/Miscellaneous, I can't get it to work.
I have observed the following:

  1. server.py throws on /var/log/maltrail/error.log
[!] session abruptly terminated
[?] (hint: "https://stackoverflow.com/a/20997655")
  1. Other issues commenting on the same thing, but none of them mention the solution and yet they have been closed:: 19201 19202

  2. From the remote sensor, communication with the server is effective:
    image

@MikhailKasimov
Copy link
Collaborator

@Chelito4 Hello! Please, take a look on point 2. You've mentioned in #19202 (comment) , that solved, Please, put a hint how it was solved. Thank you!

@Chelito4
Copy link

@Chelito4 Hello! Please, take a look on point 2. You've mentioned in #19202 (comment) , that solved, Please, put a hint how it was solved. Thank you!

Hi Mikhail i solved it by installing as an maltrail as application not in a container.

@MikhailKasimov
Copy link
Collaborator

@Chelito4 Hello! Please, take a look on point 2. You've mentioned in #19202 (comment) , that solved, Please, put a hint how it was solved. Thank you!

Hi Mikhail i solved it by installing as an maltrail as application not in a container.

OK, thank you for the info!

@stamparm
Copy link
Owner

@gabrielbasetti you are most probably running it wrong. please post your "Dockerfile" here

also, I don't see what does the UDP_ADDRESS have to do with that error. have you tried to run your maltrail configuration file (with maltrail) outside of the Docker container?

in #19202, guy said "I solved", so I guess that in your case you should try to properly configure environment too? We have zero useful information here

p.s.:
image

you can try the following:

instead of (https://github.com/stamparm/maltrail/blob/master/sensor.py#L1305-L1307):

    except IOError:
        log_error("\n\n[!] session abruptly terminated\n[?] (hint: \"https://stackoverflow.com/a/20997655\")")
        code = 1

use

    except IOError as err:
        log_error("\n\n[!] session abruptly terminated\n[?] (%s)" % err)
        code = 1

@gabrielbasetti
Copy link
Author

Thank you very much for your help.
I have found the problem.
I was trying to configure the multi-sensor feature with containers and was blaming docker and NAT, but the problem was that the container where the server is, was not receiving information on udp port 8337
The command to run the container does not expose port 8337 correctly, as it should be UDP and not TCP.

docker run -d --name maltrail-docker --privileged -p 8337:8337/udp -p 8338:8338 -v /var/log/maltrail/:/var/log/maltrail/ maltrail
image

MikhailKasimov added a commit that referenced this issue Mar 20, 2024
Update due to #19246
@MikhailKasimov
Copy link
Collaborator

The command to run the container does not expose port 8337 correctly, as it should be UDP and not TCP.

437fd5d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants