Erlang OTP: Distributed & Fault-Tolerant Systems Programming · บทเรียน

การเสริมความปลอดภัยให้คุกกี้การกระจายและการเข้าถึงโหนด

จำกัดโหนดที่สามารถเชื่อมต่อกับคลัสเตอร์ด้วยคุกกี้ รายการโหนดที่อนุญาต และการแยกเครือข่าย เพื่อป้องกันการเข้าถึงโดยไม่ได้รับอนุญาต

บทเรียน 4 จาก 413 ขั้นตอน

การเสริมความปลอดภัยให้คุกกี้การกระจายและการเข้าถึงโหนด เป็นบทเรียน Erlang OTP: Distributed & Fault-Tolerant Systems Programming ฟรีบน CoddyKit นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Erlang OTP: Distributed & Fault-Tolerant Systems Programming และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Erlang OTP: Distributed & Fault-Tolerant Systems Programming มีบทเรียนทั้งหมด 4 บทเรียน

บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ

How Nodes Authenticate

Erlang nodes form a cluster by sharing a secret cookie. Any node that knows the cookie and can reach the port may connect — and once connected, can run arbitrary code. This makes the cookie a critical secret.

The Magic Cookie

By default each node reads its cookie from ~/.erlang.cookie. If two nodes share it, they trust each other completely.

erlang:get_cookie().

The Danger of Defaults

A weak or default cookie on a publicly reachable distribution port is a full remote-code-execution hole. Treat the cookie like a root password.

Setting a Strong Cookie

Set a long, random cookie explicitly at startup rather than relying on the file default.

erlang:set_cookie(node(), 'a-very-long-random-secret').

Protecting the Cookie File

The cookie file must be readable only by its owner. Erlang refuses to start if permissions are too open.

chmod 400 ~/.erlang.cookie

Restricting Node Names

Use net_kernel options and firewall rules so only known hostnames can even attempt a connection. Distribution should never be exposed to the open internet.

Binding the Distribution Port

Pin the distribution to specific ports and bind EPMD to a private interface so the cluster is unreachable from outside the trusted network.

erl -kernel inet_dist_listen_min 9100 inet_dist_listen_max 9105

Monitoring Connections

nodes/0 lists currently connected nodes. Periodically auditing this list helps detect an unexpected peer.

nodes().

Reacting to New Nodes

Subscribe to node up/down events with net_kernel:monitor_nodes/1 to log or reject connections you did not expect.

net_kernel:monitor_nodes(true).

Hidden Nodes

Start tooling or monitoring nodes as hidden with -hidden so they connect without joining the full mesh, reducing the trust surface of your cluster.

erl -hidden -name tool@10.0.0.5 -setcookie SECRET

Defense in Depth

Cookies alone are not enough. Combine them with TLS distribution, a private network (VPN/VLAN), firewalled EPMD, and least-privilege node placement.

Quick Check

Test your node security knowledge.

Recap

You learned to harden node access:

  • The shared cookie is the cluster password — keep it long, random, secret
  • Protect ~/.erlang.cookie with 400 permissions
  • Bind distribution and EPMD to private interfaces; firewall them
  • Audit connected nodes with nodes/0 and monitor events
  • Layer cookies with TLS and network isolation
เริ่มต้นได้ฟรี

เรียนรู้ Erlang ด้วย AI tutor — ฟรี

เขียนและเรียกใช้โค้ดจริงในเบราว์เซอร์ของคุณ รับความช่วยเหลือทันทีจาก AI tutor 24/7 และเรียนรู้ต่อจากที่คุณหยุดบนเว็บหรือในแอป

คอร์ส
12
บทเรียน
48

คำถามที่พบบ่อย

บทเรียน “การเสริมความปลอดภัยให้คุกกี้การกระจายและการเข้าถึงโหนด” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “การเสริมความปลอดภัยให้คุกกี้การกระจายและการเข้าถึงโหนด” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Erlang OTP: Distributed & Fault-Tolerant Systems Programming ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Erlang OTP: Distributed & Fault-Tolerant Systems Programming มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “การเสริมความปลอดภัยให้คุกกี้การกระจายและการเข้าถึงโหนด”

จำกัดโหนดที่สามารถเชื่อมต่อกับคลัสเตอร์ด้วยคุกกี้ รายการโหนดที่อนุญาต และการแยกเครือข่าย เพื่อป้องกันการเข้าถึงโดยไม่ได้รับอนุญาต คุณปฏิบัติ Erlang OTP: Distributed & Fault-Tolerant Systems Programming ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Erlang OTP: Distributed & Fault-Tolerant Systems Programming หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน Erlang OTP: Distributed & Fault-Tolerant Systems Programming บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน

บทเรียน “การเสริมความปลอดภัยให้คุกกี้การกระจายและการเข้าถึงโหนด” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน Erlang OTP: Distributed & Fault-Tolerant Systems Programming นี้ได้ไหม

ได้ บทเรียน Erlang OTP: Distributed & Fault-Tolerant Systems Programming ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. การสื่อสารระหว่างโหนดอย่างปลอดภัย (TLS)
  2. การยืนยันตัวตนและการอนุญาตสิทธิ์
  3. การปกป้องข้อมูลสำคัญ
  4. การเสริมความปลอดภัยให้คุกกี้การกระจายและการเข้าถึงโหนด
← กลับไปที่ Erlang OTP: Distributed & Fault-Tolerant Systems Programming