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

12.3.2 Cookies (third edition) #31

Open
tisdall opened this issue Oct 16, 2024 · 2 comments
Open

12.3.2 Cookies (third edition) #31

tisdall opened this issue Oct 16, 2024 · 2 comments

Comments

@tisdall
Copy link

tisdall commented Oct 16, 2024

Cookies provide a bare minimum of security and also help prevent a fully connected cluster in which all nodes can directly talk to each other. For example, let's say you want to connect node A to B and B to C, but you don't want to connect A and C. This can be done by assigning different cookies to all nodes and then, in A and C, using the Node.set_cookie/2 function, which allows you to explicitly set different cookies that need to be used when connecting to different nodes.

I've read this several times and am still very confused. My understanding is that 2 nodes are able to communicate if they have the same cookie value. If A is able to talk to B then they must have the same cookie value. If B can talk to C, then same cookie. By the transitive property, A and C must have the same cookie value and can communicate. If you explicitly make it so A and C have different cookie values then either the A/B connection stops working or the B/C does, no?

Also, the text says "assigning different cookies to all nodes" and then says to set different cookies to A and C, so don't all the nodes all have different cookies at every point?

@sasa1977
Copy link
Owner

Each node can set its own cookie, and that's used by default to connect to other nodes. However, you can override this by setting the cookie for each node with set_cookie/2.

@tisdall
Copy link
Author

tisdall commented Nov 12, 2024

Ah... I thought set_cookie only defined the cookie to be used on the local node. Earlier it only showed examples of set_cookie/1 and I completely missed the /2 in the quoted text. So, on B you would call set_cookie/2 to define what cookie to use to connect to A and then again for C. Is that correct?

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

2 participants