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

Fix error logging to be less noisy for port scans #98

Open
david-watson opened this issue Nov 17, 2017 · 10 comments
Open

Fix error logging to be less noisy for port scans #98

david-watson opened this issue Nov 17, 2017 · 10 comments

Comments

@david-watson
Copy link

Deployed latest glutton on a Digital Ocean droplet (no docker) and ran basic nmap scan (all TCP ports). Would expect to see the results as all ports open, but some ports did not respond and many "use of closed network connection" errors were logged:

user@n.n.n.n:~$ nmap g.g.g.g

Starting Nmap 6.40 ( http://nmap.org ) at 2017-11-17 04:46 GMT
Nmap scan report for g.g.g.g
Host is up (0.18s latency).
PORT      STATE    SERVICE
1/tcp     open     tcpmux
3/tcp     open     compressnet
4/tcp     open     unknown
6/tcp     open     unknown
7/tcp     open     echo
9/tcp     open     discard
13/tcp    open     daytime
17/tcp    open     qotd
19/tcp    open     chargen
20/tcp    open     ftp-data
21/tcp    open     ftp
22/tcp    open     ssh
23/tcp    open     telnet
24/tcp    open     priv-mail
25/tcp    open     smtp
26/tcp    open     rsftp
30/tcp    open     unknown
...

Logs:

2017/11/17 04:47:17 ERROR user.tcp: close tcp g.g.g.g:5000->n.n.n.n:40613: use of closed network connection
2017/11/17 04:47:17 ERROR user.tcp: close tcp g.g.g.g:5000->n.n.n.n:50191: use of closed network connection
2017/11/17 04:47:17 ERROR user.tcp: close tcp g.g.g.g:5000->n.n.n.n:56103: use of closed network connection
2017/11/17 04:47:17 ERROR user.tcp: close tcp g.g.g.g:5000->n.n.n.n:56748: use of closed network connection
2017/11/17 04:47:17 ERROR user.tcp: close tcp g.g.g.g:5000->n.n.n.n:35219: use of closed network connection
2017/11/17 04:47:17 ERROR user.tcp: close tcp g.g.g.g:5000->n.n.n.n:37463: use of closed network connection
2017/11/17 04:47:17 ERROR user.tcp: close tcp g.g.g.g:5000->n.n.n.n:50858: use of closed network connection
2017/11/17 04:47:17 ERROR user.tcp: close tcp g.g.g.g:5000->n.n.n.n:41272: use of closed network connection
@glaslos
Copy link
Member

glaslos commented Nov 19, 2017

Did we confirm that you will get all ports when specifying the range?

@kung-foo
Copy link
Contributor

might be worth making a system test via Docker

@david-watson
Copy link
Author

Default nmap scans top 1000 ports, so no ports missed, but a lot of errors in the logs

@kung-foo
Copy link
Contributor

@glaslos glaslos changed the title Not all ports respond correctly to nmap port scan, many "use of closed connection" errors Fix error logging to be less noisy for port scans Nov 23, 2017
@glaslos
Copy link
Member

glaslos commented Nov 23, 2017

Updated title to reflect feedback

@t3chn0m4g3
Copy link
Contributor

I have a comparable situation which I think might be related to new connections / drops in normal operation (no portscan). For every connection attempt I am getting a ...

{"level":"info","ts":1523885848.9937115,"caller":"glutton/system.go:34","msg":"[system  ] running Go routines: 16 and open files: 9","sensorID":"ce2600c6-62dd-47e8-b4cd-507e83081847"}

... even if debug is set to false.

Is there an easy way to tune that down or just log [log.tcp ]-related events?

@glaslos
Copy link
Member

glaslos commented Apr 16, 2018

You want to change this line: https://github.com/mushorg/glutton/blob/master/system.go#L34

@t3chn0m4g3
Copy link
Contributor

@glaslos Thank you, just got rid of ...

			case <-ticker.C:
				openFiles := countOpenFiles()
				runningRoutines := countRunningRoutines()
				g.logger.Info(fmt.Sprintf("[system  ] running Go routines: %d and open files: %d",
					openFiles, runningRoutines))

... and the log file is finally quiet when nothing is going on.

@glaslos
Copy link
Member

glaslos commented May 18, 2018

You could also change g.logger.Info to g.logger.Debug and set Gluttons log level to info.

@glaslos
Copy link
Member

glaslos commented Jul 23, 2023

@t3chn0m4g3 do you want to try to reproduce this with the switch to TPROXY?

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

No branches or pull requests

4 participants