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 netstat_poller #68

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add netstat_poller #68

wants to merge 2 commits into from

Conversation

aaronorosen
Copy link

@aaronorosen aaronorosen commented Apr 22, 2022

This PR introduces a new poller which aggregates netstat connection information.

image

Copy link
Member

@alexmarnell alexmarnell left a comment

Choose a reason for hiding this comment

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

Looking good. Just left one comment.

Comment on lines +39 to +52
fields := map[string]int{
"tcp_established": counts["ESTABLISHED"],
"tcp_syn_sent": counts["SYN_SENT"],
"tcp_syn_recv": counts["SYN_RECV"],
"tcp_fin_wait1": counts["FIN_WAIT1"],
"tcp_fin_wait2": counts["FIN_WAIT2"],
"tcp_time_wait": counts["TIME_WAIT"],
"tcp_close": counts["CLOSE"],
"tcp_close_wait": counts["CLOSE_WAIT"],
"tcp_last_ack": counts["LAST_ACK"],
"tcp_listen": counts["LISTEN"],
"tcp_closing": counts["CLOSING"],
"tcp_none": counts["NONE"],
"udp_socket": counts["UDP"],
Copy link
Member

Choose a reason for hiding this comment

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

What happens if one of these counts[KEY_NAME] is not present on the map? Are we confident these headings are the same across different distros and/or OSes?

Copy link
Author

Choose a reason for hiding this comment

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

Good question, this library is providing this interface https://github.com/shirou/gopsutil - even if the value is 0 the count field and label is still there. These are all standard tcp connection state machine states so these should be consistent across all OSes and distros.

Copy link
Member

Choose a reason for hiding this comment

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

There does appear to be subtle differences between the different statuses as you go between Oses.

ref: windows
ref: linux

Copy link
Contributor

Choose a reason for hiding this comment

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

In my opinion, we can focus on linux and leave windows aside. If someone really wants to run shh on windows, they are my guest to fix it if the netstat poller would become a problem.

@ypaq
Copy link
Contributor

ypaq commented Apr 25, 2022

Is the snyk warning due to a GPL component that this PR introduced?

@aaronorosen
Copy link
Author

Hi Tilman, no this warning is occurring outside of this PR. I have created another PR to test and confirm which you can see here: https://github.com/heroku/shh/runs/6296402764?check_suite_focus=true

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.

3 participants