gobengo / distbin

distributed social pastebin using Activitypub
https://distbin.com
Apache License 2.0
78 stars 8 forks source link

IPV6 #19

Open yalh76 opened 5 years ago

yalh76 commented 5 years ago

I made some test from an IPV6 only server to https://distbin.com but as https://distbin.com doesn't have IPV6 activated and configured, I've broken some post :/// For example:

Sorry

yalh76 commented 5 years ago

In addition but difficult to explain: On IPV6 only server (or with a wrong IPV4 address) when going to a post: https://example.com/activities/6e1b2688-596c-44ac-8b0c-5d63787957a2, distbin is unable to display the post.

It's like he tried to display the post using IPV4 first instead of IPV6 first. But according to the official standards it should prefer IPv6..

I don't think it come from distbin directly but more from the librairies...

gobengo commented 5 years ago

But according to the official standards it should prefer IPv6..

I don't disagree, but will you share more about what standards you're referring to?

gobengo commented 5 years ago

https://distbin.com/activities/9b78e993-cf33-49b2-8512-7c307c948dd6

Here is the .json: https://distbin.com/activities/9b78e993-cf33-49b2-8512-7c307c948dd6.json

Did you create this post? I can't see anything in the JSON that references another server that's ipv6 only or something.

Unclear why the html page rendering results in an ENETUNREACH 2a01:e34:ec2f:cf62:215:5dff:fea8:32a:443. What is it resolving to that ipv6 addr?

What I'm trying to understand is that is this a problem with distbin itself as deployed? Or only when interacting with another server (yours?) that is ipv6-only?

btw this is the stack trace from logs behind the scenes

distbin-com-distbin-5bfd89bc95-rmqlf distbin { Error: connect ENETUNREACH 2a01:e34:ec2f:cf62:215:5dff:fea8:32a:443 - Local (:::0)
distbin-com-distbin-5bfd89bc95-rmqlf distbin     at Object._errnoException (util.js:992:11)
distbin-com-distbin-5bfd89bc95-rmqlf distbin     at _exceptionWithHostPort (util.js:1014:20)
distbin-com-distbin-5bfd89bc95-rmqlf distbin     at internalConnect (net.js:960:16)
distbin-com-distbin-5bfd89bc95-rmqlf distbin     at defaultTriggerAsyncIdScope (internal/async_hooks.js:284:19)
distbin-com-distbin-5bfd89bc95-rmqlf distbin     at GetAddrInfoReqWrap.emitLookup [as callback] (net.js:1106:9)
distbin-com-distbin-5bfd89bc95-rmqlf distbin     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:97:10)
distbin-com-distbin-5bfd89bc95-rmqlf distbin   code: 'ENETUNREACH',
distbin-com-distbin-5bfd89bc95-rmqlf distbin   errno: 'ENETUNREACH',
distbin-com-distbin-5bfd89bc95-rmqlf distbin   syscall: 'connect',
distbin-com-distbin-5bfd89bc95-rmqlf distbin   address: '2a01:e34:ec2f:cf62:215:5dff:fea8:32a',
distbin-com-distbin-5bfd89bc95-rmqlf distbin   port: 443 }
gobengo commented 5 years ago

Btw traffic into https://distbin.com goes through: AWS ELB -> one of several kubernetes workers running nginx ingresses where hostnames are matched for distbin.com -> distbin containers themselves.

It's looking like this error may not be due to my particular deployment, but the application code, just sharing so others can help diagnose.

gobengo commented 5 years ago

@yalh76 I'm not sure how to reproduce this. Can you create a reduced test case, either as a script that I can run to produce more bad posts locally, or as step-by-step instructions?

gobengo commented 5 years ago

Did you create this post? I can't see anything in the JSON that references another server that's ipv6 only or something.

Unclear why the html page rendering results in an ENETUNREACH 2a01:e34:ec2f:cf62:215:5dff:fea8:32a:443. What is it resolving to that ipv6 addr?

Aha. I can see at https://distbin.com/activities/9b78e993-cf33-49b2-8512-7c307c948dd6/replies that you submitted a reply with id https://test.yh.yalh.net/activities/a4c3da7a-219b-44c7-a297-d6f14ef28d67. And that domain name resolves to the above ipv6 address. That clears that up.

Now, when I fetch that URL from my laptop, I get a ECONNREFUSED, since the server is down. For ancestors of any given activity being rendered by distbin-html/an-activity, I catch ECONNREFUSED and render a placeholder. But I don't watch for ENETUNREACH. https://github.com/gobengo/distbin/blob/master/src/distbin-html/an-activity.ts#L513

Notably, when rendering descendants (replies), I do no such error catching if nod's http fetch fails.

Finally, I actually do want my deployment to support fetching federated URLs that resolve to ipv6 addrs.

gobengo commented 5 years ago

Reproduction steps:

Actual Behavior:

Expected Behavior:

yalh76 commented 5 years ago

Did you create this post?

Yes I created it, as far as I remember...

ENETUNREACH 2a01:e34:ec2f:cf62:215:5dff:fea8:32a:443. What is it resolving to that ipv6 addr?

It was the IPV6 address of the server I made some test from.

@yalh76 I'm not sure how to reproduce this. Can you create a reduced test case, either as a script that I can run to produce more bad posts locally, or as step-by-step instructions?

I'll let you now when I reinstalled a new server and made some tests... (I will keep the server up longer) Not sure I'm able to write some code... I'm a windows system administrator... far from bash, javascript, etc...

gobengo commented 5 years ago

@yalh76 Got it. It's not so important for you to bring the server back online. I believe the current error will happen even then, as my deployment of distbin still won't be able to reach any ipv6 addresses (ENUTUNREACHABLE).

But if you do bring it back up, and the error changes, that would invalidate my hypothesis and be useful.

yalh76 commented 5 years ago

@gobengo I've two VMs up and running: First one IPV4 (78.194.252.246) and IPV6 (2a01:e34:ec2f:cf62:d8fd:cbff:fea0:d261) available from internet:

Second one with only IPV6 (2a01:e34:ec2f:cf62:215:5dff:fea8:32a) available from internet

I made a test:

  1. write a post content #Test A1: https://distbin.com/activities/0fbb5888-4cf9-4c9e-a613-e652a1192cc1
  2. make a local response: using https://distbin.com/?inReplyTo=https://distbin.com/activities/0fbb5888-4cf9-4c9e-a613-e652a1192cc1
  3. make a response from host with IPV4 and IPV6 available from internet using https://distbin.yalh.net/?inReplyTo=https://distbin.com/activities/0fbb5888-4cf9-4c9e-a613-e652a1192cc1
  4. make a response from IPV6 only host using https://test.yh.yalh.net/?inReplyTo=https://distbin.com/activities/0fbb5888-4cf9-4c9e-a613-e652a1192cc1
  5. make a response from from IPV6 only host using https://test2.yh.yalh.net/distbin/?inReplyTo=https://distbin.com/activities/0fbb5888-4cf9-4c9e-a613-e652a1192cc1

As soon as I made a response from an IPV6 only, the original post on https://distbin.com/activities/0fbb5888-4cf9-4c9e-a613-e652a1192cc1 content goes to : Error: Error: connect ENETUNREACH 2a01:e34:ec2f:cf62:215:5dff:fea8:32a:443 - Local (:::0)

gobengo commented 5 years ago

@yalh76 This is perfect, thanks.

You have no idea how happy seeing this federate makes me: https://distbin.yalh.net/activities/27c20a2e-9a79-47b5-80ea-19d81e7645d9

Been waiting for 3 years!

yalh76 commented 5 years ago

Lol, I didn't knew that you was waiting for that for so long ^^

As distbin is packaged for Yunohost, it's like one click to install it on Debian Jessie, Stretch, Testing and Raspberry Pi . I hope we will see others ^^ (It would be good to add distbin on https://the-federation.info/ and https://fediverse.network/)

Next step for me, be able to install it in a sub path and Syntax Highlighting, but a few other projects to close first for Yunohost

PS: If you need some access to the VMs, to checks logs, etc... don't hesitate

yalh76 commented 5 years ago

Made another test from IPV6:

  1. A first post : https://distbin.com/activities/1edb06bb-9ddd-4ba7-a1ad-703739a7d0fd
  2. A reply from an IPV6 only distbin instance https://test.yh.yalh.net/activities/d5dbab94-5e08-48ce-b45c-d56a74ed69c2

After replying, original post shows: Error: Error: connect ENETUNREACH 2a01:e34:ec2f:cf62:215:5dff:fea8:32a:443 - Local (:::0)

IPV6 server IP address is: 2a01:e34:ec2f:cf62:215:5dff:fea8:32a