go-guerrilla icon indicating copy to clipboard operation
go-guerrilla copied to clipboard

Socket Not Responding.

Open nhalstead opened this issue 5 years ago • 11 comments

What I am working on will take incoming emails (using your package) and send them to an API to be processed further (Ik, I can point it to MySQL, redis, etc., I would like to make it do a web request not store it).

My issue is that I can the see the socket is open, but nothing happens when I connect to it, It just times out and I can not figure out the issue so far.

Here is the code that does the work for it https://github.com/nhalstead/go_to_script/blob/master/src/main.go

I have tried to change the primary_mail_host and the ListenInterface values with no change. (I am planning on using this cross domains so I will be adding latter on wildcard-processor.)

nhalstead avatar Oct 08 '18 04:10 nhalstead

Thanks for the report. Will investigate soon.

flashmob avatar Oct 09 '18 01:10 flashmob

I could be very wrong in my code but I can at a loss atm.

Here is the Env Go is running in. Should not matter for Golang but it may be a contributing factor. env.txt

nhalstead avatar Oct 09 '18 03:10 nhalstead

Thanks for the env, also running Go 1.10. Just tested the package by using the same setup that you have in your code, but couldn't find any problem with connecting.

Have you tried a more specific interface, say 127.0.0.1? Also, how about a different port such as 2525?

flashmob avatar Oct 09 '18 14:10 flashmob

Ok, So testing based on the issue with the Interface IP, I am able to open the socket connection with the server with the interface IP set to 0.0.0.0 (normal for listen to all interfaces, Does not work out of Localhost), 127.0.0.1 (Supposed to be for listen only to localhost), and x.x.x.x (Supposed to be for listen to a specific IP, Connection gets refused localhost and remote gets no response but connection is made).

No matter what IP I put it will not listen unless the connection is from localhost.

  • Also once I am connected I am attempting to send an email (via Telnet) I am unable to get it to accept the RCPT TO address. (Its another problem to handle later once the connection issue is resolved).
  • Once I establish a connection and I send a EHLO or HELO message to the server it does not recognize the command for some reason. As you can see here, I have a connection and it does not accept the first command (Unless I am missing something)

image

I can provide more info later when I get a bit of time...

nhalstead avatar Oct 09 '18 15:10 nhalstead

From the screenshot, it looks like your client that you're using for testing is injecting some weird bytes. See the DEBU[0016] message, there's been some funny bytes stuffed before the EHLO. (Not sure if that's coming from your telnet client, just assuming - it could be caused by something else such as a firewall or not using 7bit-ASCII encoding, but the bottom line is that it looks like the server is getting fed incorrect input)

Also, have you tried a different port, such as 2525?

flashmob avatar Oct 09 '18 23:10 flashmob

I have figured out the extra characters in the beginning were caused by the connection being started as TELNET not RAW as I am using PuTTY.

As far as using port 2525 the results are the same for the Connection communications, No communication from another machine or locally when using any other IP other than the loopback address or 0.0.0.0 (that should be able to listen to all interfaces).

IP Set to: 10.0.0.34 (Local network IP, Port 2525) image The socket connects but does not respond.

IP Set to: 127.0.0.1 (Loop back address, Port 2525) image Works and has the same result as using 127.0.0.1 as the listen IP.

nhalstead avatar Oct 10 '18 03:10 nhalstead

Oh. It sounds like a firewall issue - the go-guerrilla package uses standard Go library for networking so 0.0.0.0 should work. Will investigate soon to see if the issue can be reproduced.

On Wed., 10 Oct. 2018, 12:23 Noah Halstead, [email protected] wrote:

I have figured out the extra characters in the beginning were caused by the connection being started as TELNET not RAW as I am using PuTTY.

As far as using port 2525 the results are the same for the Connection communications, No communication from another machine or locally when using any other IP other than the loopback address or 0.0.0.0 (that should be able to listen to all interfaces).

IP Set to: 10.0.0.34 (Local network IP, Port 2525) [image: image] https://user-images.githubusercontent.com/5577816/46711089-cd460680-cc18-11e8-9125-e7f39e69bfff.png The socket connects but does not respond.

IP Set to: 127.0.0.1 (Loop back address, Port 2525) [image: image] https://user-images.githubusercontent.com/5577816/46711095-d46d1480-cc18-11e8-8a7c-b8dfe125d8c0.png Works and has the same result as using 127.0.0.1 as the listen IP.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/flashmob/go-guerrilla/issues/124#issuecomment-428425139, or mute the thread https://github.com/notifications/unsubscribe-auth/AAnmP4UalNuyOilfcaOJ3oUMcnOm6Kmmks5ujWg4gaJpZM4XMPhY .

flashmob avatar Oct 10 '18 03:10 flashmob

So taking a look at the open ports I only see an IPv6 Port Open. Also the Firewall is disabled on my vps. So not sure what part is not working...

image

nhalstead avatar Oct 10 '18 15:10 nhalstead

Please note that sometimes ISPs can filter connections from your host to the vps port 25. So even though your vps is not behind a firewall, you may be in front of one! Port 25 is usually filtered by ISPs to prevent malware from sending spam. To test this, you could log in to another vps instance and then try to connect to your port 25 vps.

On Thu., 11 Oct. 2018, 00:26 Noah Halstead, [email protected] wrote:

So taking a look at the open ports I only see an IPv6 Port Open. Also the Firewall is disabled on my vps. So not sure what part is not working...

[image: image] https://user-images.githubusercontent.com/5577816/46747385-2a74a300-cc7f-11e8-9611-c2a8f0a7e0a5.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/flashmob/go-guerrilla/issues/124#issuecomment-428616960, or mute the thread https://github.com/notifications/unsubscribe-auth/AAnmP-1sGP4HuMIPER8zKst8VboGO_-aks5ujhGIgaJpZM4XMPhY .

flashmob avatar Oct 11 '18 05:10 flashmob

More discussion here, including one solution, "Issue resolved by changing listen interface to 0.0.0.0 instead of 127.0.0.1 earlier." https://github.com/flashmob/go-guerrilla/issues/123

flashmob avatar Apr 03 '19 05:04 flashmob

+1 for me on Ubuntu 16.04 LTS. Need use listen interface 0.0.0.0, not 127.0.0.1 as it in default config. Solved my "Connection refused" in telnet

$ sudo netstat -tulpn | grep 25
tcp6       0      0 :::25                   :::*                    LISTEN      27328/guerrillad

lord-alfred avatar Aug 06 '19 10:08 lord-alfred