Interconnect question: how to work with names

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Interconnect question: how to work with names

Max Lapshin-2

I have server with hostname   myserver.l
This hostname is in /etc/hosts and it is pingable

I have master node running on it with:   erl -name [hidden email]

When I write software, I don't know what will be the hostname, so I write
shell script for connecting to shell:

erl -name debug -remsh [hidden email]

It fails:

Erlang/OTP 21 [erts-10.3.5.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

*** ERROR: Shell process terminated! (^G to start new job) ***

When I provide hostname, it works:

erl -name debug -remsh [hidden email]
Erlang/OTP 21 [erts-10.3.5.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Eshell V10.3.5.2  (abort with ^G)
([hidden email])1> 



What is the proper way to deal with this situation?
I can see the master node in epmd names, I can connect to it, I can pass interconnect protocol.
But I do not understand, why remsh doesn't connect to it.



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Interconnect question: how to work with names

Gerhard Lazu
My understanding is that you are opening a remote shell to a node with a specific name.

There is a node with name [hidden email] on myserver.l

There is no node with name [hidden email] on host 127.0.0.1

On Fri, Jun 28, 2019 at 9:47 AM Max Lapshin <[hidden email]> wrote:

I have server with hostname   myserver.l
This hostname is in /etc/hosts and it is pingable

I have master node running on it with:   erl -name [hidden email]

When I write software, I don't know what will be the hostname, so I write
shell script for connecting to shell:

erl -name debug -remsh [hidden email]

It fails:

Erlang/OTP 21 [erts-10.3.5.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

*** ERROR: Shell process terminated! (^G to start new job) ***

When I provide hostname, it works:

erl -name debug -remsh [hidden email]
Erlang/OTP 21 [erts-10.3.5.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Eshell V10.3.5.2  (abort with ^G)
([hidden email])1> 



What is the proper way to deal with this situation?
I can see the master node in epmd names, I can connect to it, I can pass interconnect protocol.
But I do not understand, why remsh doesn't connect to it.


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Interconnect question: how to work with names

Max Lapshin-2
myserver.l and 127.0.0.1  is the same server. I run it from this server.

There is node  called "master" in epmd and I do not understand why I can connect to it via hostname: [hidden email] and
cannot connect to it via 127.0.0.1


On Fri, Jun 28, 2019 at 11:53 AM Gerhard Lazu <[hidden email]> wrote:
My understanding is that you are opening a remote shell to a node with a specific name.

There is a node with name [hidden email] on myserver.l

There is no node with name [hidden email] on host 127.0.0.1

On Fri, Jun 28, 2019 at 9:47 AM Max Lapshin <[hidden email]> wrote:

I have server with hostname   myserver.l
This hostname is in /etc/hosts and it is pingable

I have master node running on it with:   erl -name [hidden email]

When I write software, I don't know what will be the hostname, so I write
shell script for connecting to shell:

erl -name debug -remsh [hidden email]

It fails:

Erlang/OTP 21 [erts-10.3.5.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

*** ERROR: Shell process terminated! (^G to start new job) ***

When I provide hostname, it works:

erl -name debug -remsh [hidden email]
Erlang/OTP 21 [erts-10.3.5.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Eshell V10.3.5.2  (abort with ^G)
([hidden email])1> 



What is the proper way to deal with this situation?
I can see the master node in epmd names, I can connect to it, I can pass interconnect protocol.
But I do not understand, why remsh doesn't connect to it.


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Interconnect question: how to work with names

Dániel Szoboszlay
In reply to this post by Gerhard Lazu
The host part of the node name has to match, otherwise the master node would believe the debug node is trying to connect to someone else and would refuse the connection.

Try this command instead:
erl -name debug -remsh master@$(hostname)

On Fri, 28 Jun 2019 at 10:53, Gerhard Lazu <[hidden email]> wrote:
My understanding is that you are opening a remote shell to a node with a specific name.

There is a node with name [hidden email] on myserver.l

There is no node with name [hidden email] on host 127.0.0.1

On Fri, Jun 28, 2019 at 9:47 AM Max Lapshin <[hidden email]> wrote:

I have server with hostname   myserver.l
This hostname is in /etc/hosts and it is pingable

I have master node running on it with:   erl -name [hidden email]

When I write software, I don't know what will be the hostname, so I write
shell script for connecting to shell:

erl -name debug -remsh [hidden email]

It fails:

Erlang/OTP 21 [erts-10.3.5.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

*** ERROR: Shell process terminated! (^G to start new job) ***

When I provide hostname, it works:

erl -name debug -remsh [hidden email]
Erlang/OTP 21 [erts-10.3.5.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Eshell V10.3.5.2  (abort with ^G)
([hidden email])1> 



What is the proper way to deal with this situation?
I can see the master node in epmd names, I can connect to it, I can pass interconnect protocol.
But I do not understand, why remsh doesn't connect to it.


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Interconnect question: how to work with names

Dániel Szoboszlay
In reply to this post by Max Lapshin-2
The name of the Erlang node is the full thing, both the part before and after the @ sign.
[hidden email] and [hidden email] and [hidden email] are all different nodes for Erlang.

It is a bit confusing that epmd only stores the part of the name before the @. It is assumed that if you're talking to epmd on 127.0.0.1 or myserver.l than all the nodes you find there will have 127.0.0.1 or myserverl. in their name after the @ respectively. But this is of course not necessarily holds, since there can be multiple names/IP addresses that resolve to the same host.

So for example Erlang would believe [hidden email] and [hidden email] are different nodes, in practice you cannot have both nodes running at the same time, because they would both try to register as master in the same epmd instance. (Using the loopback address in the node name can lead to further complications when you have remote nodes in the cluster. E.g. you can have debug@1217.0.0.1 connected to [hidden email] when they're on the same host, but if [hidden email] would also connect to [hidden email] it would try to connect to [hidden email] on myotherserver.l.)

On Fri, 28 Jun 2019 at 11:06, Max Lapshin <[hidden email]> wrote:
myserver.l and 127.0.0.1  is the same server. I run it from this server.

There is node  called "master" in epmd and I do not understand why I can connect to it via hostname: [hidden email] and
cannot connect to it via 127.0.0.1


On Fri, Jun 28, 2019 at 11:53 AM Gerhard Lazu <[hidden email]> wrote:
My understanding is that you are opening a remote shell to a node with a specific name.

There is a node with name [hidden email] on myserver.l

There is no node with name [hidden email] on host 127.0.0.1

On Fri, Jun 28, 2019 at 9:47 AM Max Lapshin <[hidden email]> wrote:

I have server with hostname   myserver.l
This hostname is in /etc/hosts and it is pingable

I have master node running on it with:   erl -name [hidden email]

When I write software, I don't know what will be the hostname, so I write
shell script for connecting to shell:

erl -name debug -remsh [hidden email]

It fails:

Erlang/OTP 21 [erts-10.3.5.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

*** ERROR: Shell process terminated! (^G to start new job) ***

When I provide hostname, it works:

erl -name debug -remsh [hidden email]
Erlang/OTP 21 [erts-10.3.5.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Eshell V10.3.5.2  (abort with ^G)
([hidden email])1> 



What is the proper way to deal with this situation?
I can see the master node in epmd names, I can connect to it, I can pass interconnect protocol.
But I do not understand, why remsh doesn't connect to it.


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Interconnect question: how to work with names

Max Lapshin-2
> Validates the node name and the version number: https://github.com/erlang/otp/blob/master/lib/kernel/src/dist_util.erl#L772-L773

Yes, this seems to be the answer.


Ok, what have I done:

1) I launch my server with hostname server.l:


2) I add this hostname to control tool:

  inet_db:set_lookup([file, dns]),
  inet_db:add_host({127,0,0,1}, ["server.l"]),

Now I can connect to [hidden email]

Server admin can put any hostname that he wants, I do not depend on it anymore.



On Fri, Jun 28, 2019 at 4:16 PM Dániel Szoboszlay <[hidden email]> wrote:
I'm not claiming the response to the challenge itself would be dependent on the node names. It is not.

What I'm trying to say, is that together with the challenge, in the same SEND_CHALLENGE message there are two more pieces of information: the protocol version and the node name.

Upon receiving the challenge (https://github.com/erlang/otp/blob/master/lib/kernel/src/dist_util.erl#L770) the node that's trying to connect:
So the recv_challenge/1 function is where the connection attempt fails if there's a mismatch in the node names. And that's what you originally asked: where does this check happen, what prevents us from connecting to a node with the wrong name (in the post-@ part)?

If you rewrite the handshake on your own, and omit this check, than fine, you can of course connect. But this is probably not a good thing to do, because you've just introduced some inconsistency into the cluster: the nodes will disagree on what their name is. That can cause a lot of problems, not in the distribution connection layer probably, but higher up in the application layer (e.g. you send the value of node() across to your peer and it will believe you're not talking about yourself, but a third, unknown node).

And as a side note, the is_allowed check has nothing to do with this problem. That's a rarely used feature where you can blacklist/whitelist nodes that are allowed to connect to you.

On Fri, 28 Jun 2019 at 14:07, Max Lapshin <[hidden email]> wrote:
I do not understand, what for to use words like "believe"

I've rewritten the handshake from scratch and I see that nodes send their names, but encryption digest does not use node name.


Perhaps problem is here:


When we change node name, we can pass interconnect handshake, but do not allow to connect.

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Interconnect question: how to work with names

Eckard Brauer
In reply to this post by Dániel Szoboszlay
So IMHO it could be wise to (more) explicitely point out that name
resolution in Erlang is at least partially different from the system one
(nsswitch.conf), and to include a compact description on that in the
manual (didn't check if it already is there). Seems the question arises
from time to time...

Best regards,
Eckard

Am Fri, 28 Jun 2019 11:17:13 +0200
schrieb Dániel Szoboszlay <[hidden email]>:

> The name of the Erlang node is the full thing, both the part before
> and after the @ sign.
> master@127.0.0.1 and [hidden email] and master@127.0.0.2 are all
> different nodes for Erlang.
>
> It is a bit confusing that epmd only stores the part of the name
> before the @. It is assumed that if you're talking to epmd on
> 127.0.0.1 or myserver.l than all the nodes you find there will have
> 127.0.0.1 or myserverl. in their name after the @ respectively. But
> this is of course not necessarily holds, since there can be multiple
> names/IP addresses that resolve to the same host.
>
> So for example Erlang would believe master@127.0.0.1 and
> master@127.0.0.2 are different nodes, in practice you cannot have
> both nodes running at the same time, because they would both try to
> register as master in the same epmd instance. (Using the loopback
> address in the node name can lead to further complications when you
> have remote nodes in the cluster. E.g. you can have debug@1217.0.0.1
> connected to [hidden email] when they're on the same host, but if
> [hidden email] would also connect to [hidden email] it
> would try to connect to debug@127.0.0.1 on myotherserver.l.)
>
> On Fri, 28 Jun 2019 at 11:06, Max Lapshin <[hidden email]>
> wrote:
>
> > myserver.l and 127.0.0.1  is the same server. I run it from this
> > server.
> >
> > There is node  called "master" in epmd and I do not understand why
> > I can connect to it via hostname: [hidden email] and
> > cannot connect to it via 127.0.0.1
> >
> >
> > On Fri, Jun 28, 2019 at 11:53 AM Gerhard Lazu <[hidden email]>
> > wrote:
> >
> >> My understanding is that you are opening a remote shell to a node
> >> with a specific name.
> >>
> >> There is a node with name *[hidden email]* on *myserver.l*
> >>
> >> There is no node with name *master@127.0.0.1 <master@127.0.0.1>
> >> *on host *127.0.0.1*
> >>
> >> On Fri, Jun 28, 2019 at 9:47 AM Max Lapshin <[hidden email]>
> >> wrote:
> >>
> >>>
> >>> I have server with hostname   myserver.l
> >>> This hostname is in /etc/hosts and it is pingable
> >>>
> >>> I have master node running on it with:   erl -name
> >>> [hidden email]
> >>>
> >>> When I write software, I don't know what will be the hostname, so
> >>> I write shell script for connecting to shell:
> >>>
> >>> erl -name debug -remsh master@127.0.0.1
> >>>
> >>> It fails:
> >>>
> >>> Erlang/OTP 21 [erts-10.3.5.2] [source] [64-bit] [smp:8:8]
> >>> [ds:8:8:10] [async-threads:1] [hipe]
> >>>
> >>> *** ERROR: Shell process terminated! (^G to start new job) ***
> >>>
> >>> When I provide hostname, it works:
> >>>
> >>> erl -name debug -remsh [hidden email]
> >>> Erlang/OTP 21 [erts-10.3.5.2] [source] [64-bit] [smp:8:8]
> >>> [ds:8:8:10] [async-threads:1] [hipe]
> >>>
> >>> Eshell V10.3.5.2  (abort with ^G)
> >>> ([hidden email])1>
> >>>
> >>>
> >>>
> >>> What is the proper way to deal with this situation?
> >>> I can see the master node in epmd names, I can connect to it, I
> >>> can pass interconnect protocol.
> >>> But I do not understand, why remsh doesn't connect to it.
> >>>
> >>>
> >>> _______________________________________________
> >>> erlang-questions mailing list
> >>> [hidden email]
> >>> http://erlang.org/mailman/listinfo/erlang-questions
> >>>
> >> _______________________________________________
> > erlang-questions mailing list
> > [hidden email]
> > http://erlang.org/mailman/listinfo/erlang-questions
> >



--
Wir haften nicht für die korrekte Funktion der in dieser eMail
enthaltenen Viren. We are not liable for correct function of the
viruses in this email! :)
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions