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

Add PCAP_OVER_IP support #8

Merged
merged 2 commits into from
Oct 21, 2024
Merged

Conversation

yunzheng
Copy link
Contributor

  • Added "Option C" example and pcap-broker stub to docker-compose.yml
  • Handle $PCAP_OVER_IP environment variable in suricata/entrypoint.sh

Closes #7

- Added "Option C" example and pcap-broker stub to docker-compose.yml
- Handle $PCAP_OVER_IP environment variable in suricata/entrypoint.sh

Closes ANSSI-FR#7
@yunzheng
Copy link
Contributor Author

Some explanation of the changes made in this PR,

Changes to suricata/entrypoint.sh

  • set -o pipefail ensures that if nc disconnects that suricata also exits immediately
  • changed to eval the suricata command so we don't have to duplicate commandline arguments
  • the PCAP_OVER_IP variable uses tr to convert : to so we can just define one argument for both hostname and port
  • nc uses -d argument, so netcat doesn't try to read from stdin (it has none).

Changes to docker-compose.yml:

  • added restart: always to all docker services to ensure it retries reconnecting/restarting
  • added pcap-broker stub which builds the container using an inline Dockerfile
  • the container_name is set to pcap-broker, which is then used in the "Option C" example in the PCAP_OVER_IP environment variable for connecting to it.
  • the PCAP_COMMAND example uses multiline docker arguments so you can easily change the BPF or commands. The example is based on a faustctf setup.

I'm also happy to update the documentation if needed or feel free to make changes in my PR branch.

Copy link
Contributor

@aiooss-anssi aiooss-anssi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Please fix the minor changes I requested and I will merge.

I plan to add later some documentation to also show how to pipe a remote interface to a pcap-over-ip endpoint with netcat, as an alternative to pcap-broker (I like the idea of giving to the user multiple choices).

docker-compose.yml Outdated Show resolved Hide resolved
docker-compose.yml Outdated Show resolved Hide resolved
suricata/entrypoint.sh Show resolved Hide resolved
@yunzheng yunzheng requested a review from aiooss-anssi October 21, 2024 13:17
Copy link
Contributor

@aiooss-anssi aiooss-anssi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks a lot!

@aiooss-anssi aiooss-anssi merged commit 7d41923 into ANSSI-FR:dev Oct 21, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants