Skip to content

Disable routing - #12

Closed
terjeinnerdal wants to merge 2 commits into
mainfrom
disable_routing
Closed

Disable routing#12
terjeinnerdal wants to merge 2 commits into
mainfrom
disable_routing

Conversation

@terjeinnerdal

@terjeinnerdal terjeinnerdal commented May 11, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Meshnet now configured with Nordlynx technology and auto-connect to Norway enabled
    • Meshnet notifications enabled by default
    • Post-quantum cryptography and LAN discovery disabled in default settings
  • Bug Fixes

    • Device no longer attempts to grant itself peer routing and local access permissions during peer configuration

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

NordVPN Meshnet configuration is enhanced with explicit feature toggles (notifications, PQ, LAN discovery, technology) and Norway-specific auto-connect. Peer data extraction is refactored for consistency, peer filesharing configuration gains documentation, and exit-node peer permission loops now include self-nickname guards to prevent self-permission attempts.

Changes

Meshnet Configuration and Peer Permissions

Layer / File(s) Summary
Meshnet Configuration and Nickname Setup
bash/nord/config.sh
NordVPN configuration block now enables Meshnet, assigns the meshnet nickname, turns on notifications, disables PQ and LAN discovery, sets technology to nordlynx, and enables auto-connect for Norway instead of an unparameterized auto-connect.
Peer Data Extraction and Parsing
bash/nord/config.sh
jq parsing block refactored to consolidate extraction of allowed_for_fileshare and all_peers from the peers JSON with the same jq selectors and failure-handling behavior.
Per-Peer Filesharing Configuration
bash/nord/config.sh
Peer configuration loop gains additional inline comments while preserving the conditional skip logic for the local device nickname.
Exit Node Peer Permission Guards
bash/nord/exit_node.sh
Routing and local-access permission loops now check if PEER equals the device's own NICKNAME and skip self-entries using continue before running the corresponding nordvpn meshnet peer ... allow commands.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • terjeinnerdal/scripts#7: Both PRs modify the same NordVPN scripts to change Meshnet peer/config handling (nicknames, auto-connect, and peer routing/allow rules).
  • terjeinnerdal/scripts#4: Both PRs modify bash/nord/config.sh and bash/nord/exit_node.sh to deal with meshnet peer permissions and configuration.
  • terjeinnerdal/scripts#11: Both PRs modify the same NordVPN scripts' nickname handling and autoconnect behavior in config.sh and exit_node.sh.

Poem

🐰 A mesh of peers now knows its place,
Each device guarding its own space,
No self-permission loops run wild,
NordVPN config, gracefully styled,
Safe routing flows, Norwegian dreams.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title 'Disable routing' is misleading; the changes actually prevent self-routing in meshnet peer loops and reorganize NordVPN config, not disable routing entirely. Revise the title to accurately reflect the main changes, such as 'Skip self-routing in meshnet peer configuration' or 'Prevent device from configuring itself in meshnet loops'.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch disable_routing
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch disable_routing

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
bash/nord/config.sh (1)

67-91: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Remove duplicate JSON parsing code.

Lines 80-91 are an exact duplicate of lines 67-78, parsing the same allowed_for_fileshare and all_peers arrays twice. This appears to be an unintentional copy-paste error and should be removed.

🐛 Proposed fix
 fi
 
-if ! mapfile -t FILESHARE_PEERS < <(jq -r '.allowed_for_fileshare[]' "$PEERS_FILE"); then
-    echo "Error: Failed to parse 'allowed_for_fileshare' from '$PEERS_FILE'." >&2
-    echo "Please ensure it's a valid JSON file with an 'allowed_for_fileshare' key containing an array of strings." >&2
-    exit 1
-fi
-
-echo "Reading all peers from '$PEERS_FILE'..."
-if ! mapfile -t ALL_PEERS < <(jq -r '.all_peers[]' "$PEERS_FILE"); then
-    echo "Error: Failed to parse 'all_peers' from '$PEERS_FILE'." >&2
-    echo "Please ensure it's a valid JSON file with an 'all_peers' key containing an array of strings." >&2
-    exit 1
-fi
-
 echo "Configuring fileshare and auto-accept for specific peers..."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@bash/nord/config.sh` around lines 67 - 91, The code duplicates the JSON
parsing of allowed_for_fileshare and all_peers using mapfile/jq (variables
FILESHARE_PEERS and ALL_PEERS reading from PEERS_FILE); remove the second
repeated block so each jq/mapfile invocation only runs once, keeping the
original error handling and messages for the FILESHARE_PEERS and ALL_PEERS reads
(i.e., retain the first mapfile -t FILESHARE_PEERS < <(jq -r
'.allowed_for_fileshare[]' "$PEERS_FILE") and the first mapfile -t ALL_PEERS <
<(jq -r '.all_peers[]' "$PEERS_FILE") and delete the duplicate calls and their
echo/exit handling).
🧹 Nitpick comments (1)
bash/nord/config.sh (1)

34-35: 💤 Low value

Clarify the purpose of commented-out lines.

The commented-out nordvpn set meshnet off and nordvpn set routing disable commands suggest they might be used for testing or debugging. Consider either removing them if no longer needed or adding a comment explaining when to uncomment them.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@bash/nord/config.sh` around lines 34 - 35, The two commented lines `nordvpn
set meshnet off` and `nordvpn set routing disable` are ambiguous; either remove
them if obsolete or add a short explanatory comment above them clarifying when
to uncomment (e.g., for testing, disabling Meshnet or routing temporarily, or
troubleshooting network issues) and who/what should use them; update the comment
to mention any expected side effects or required permissions so future
maintainers understand purpose and safety of `nordvpn set meshnet off` and
`nordvpn set routing disable`.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@bash/nord/config.sh`:
- Line 39: The nordvpn command uses an unquoted shell variable; update the
invocation that calls nordvpn meshnet set nickname $NICKNAME to quote the
variable (use "$NICKNAME") so the NICKNAME variable is passed intact to the
nordvpn meshnet set nickname command and avoids word-splitting or globbing
issues.
- Around line 44-45: Update the inaccurate comment that mentions "Perfect
Forward Secrecy (PFS)": replace it with a correct description for the `pq`
setting (Post-Quantum encryption protection) so the comment accurately describes
`nordvpn set pq off` — e.g., change the comment above the `nordvpn set pq off`
command to state that it disables Post-Quantum encryption protection to improve
compatibility with certain devices/configurations.

---

Outside diff comments:
In `@bash/nord/config.sh`:
- Around line 67-91: The code duplicates the JSON parsing of
allowed_for_fileshare and all_peers using mapfile/jq (variables FILESHARE_PEERS
and ALL_PEERS reading from PEERS_FILE); remove the second repeated block so each
jq/mapfile invocation only runs once, keeping the original error handling and
messages for the FILESHARE_PEERS and ALL_PEERS reads (i.e., retain the first
mapfile -t FILESHARE_PEERS < <(jq -r '.allowed_for_fileshare[]' "$PEERS_FILE")
and the first mapfile -t ALL_PEERS < <(jq -r '.all_peers[]' "$PEERS_FILE") and
delete the duplicate calls and their echo/exit handling).

---

Nitpick comments:
In `@bash/nord/config.sh`:
- Around line 34-35: The two commented lines `nordvpn set meshnet off` and
`nordvpn set routing disable` are ambiguous; either remove them if obsolete or
add a short explanatory comment above them clarifying when to uncomment (e.g.,
for testing, disabling Meshnet or routing temporarily, or troubleshooting
network issues) and who/what should use them; update the comment to mention any
expected side effects or required permissions so future maintainers understand
purpose and safety of `nordvpn set meshnet off` and `nordvpn set routing
disable`.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 621ad93c-8e85-4559-9e3e-ce0223d2608b

📥 Commits

Reviewing files that changed from the base of the PR and between cd6015a and 3c8031f.

📒 Files selected for processing (2)
  • bash/nord/config.sh
  • bash/nord/exit_node.sh

Comment thread bash/nord/config.sh

# Enable Meshnet and set the device's nickname
nordvpn set meshnet on
nordvpn meshnet set nickname $NICKNAME

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Quote the variable to prevent word splitting.

The $NICKNAME variable should be quoted to prevent potential issues if the nickname contains spaces or special characters.

🛡️ Proposed fix
-nordvpn meshnet set nickname $NICKNAME
+nordvpn meshnet set nickname "$NICKNAME"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
nordvpn meshnet set nickname $NICKNAME
nordvpn meshnet set nickname "$NICKNAME"
🧰 Tools
🪛 Shellcheck (0.11.0)

[info] 39-39: Double quote to prevent globbing and word splitting.

(SC2086)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@bash/nord/config.sh` at line 39, The nordvpn command uses an unquoted shell
variable; update the invocation that calls nordvpn meshnet set nickname
$NICKNAME to quote the variable (use "$NICKNAME") so the NICKNAME variable is
passed intact to the nordvpn meshnet set nickname command and avoids
word-splitting or globbing issues.

Comment thread bash/nord/config.sh
Comment on lines +44 to 45
# Disable Perfect Forward Secrecy (PFS) to allow for better compatibility with certain devices and configurations.
nordvpn set pq off

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

What does the 'nordvpn set pq' command control in NordVPN?

💡 Result:

The command nordvpn set pq controls NordVPN’s post-quantum (PQ) protection setting (it enables or disables “Post-quantum encryption”). [1][2] When you run it with on/off (for example nordvpn set pq on or nordvpn set pq off), NordVPN turns that PQ protection feature on or off for subsequent connections. [1] NordVPN’s PQ feature is specifically described as “post-quantum encryption” / “post-quantum protection.” [1][2]

Citations:


Correct the comment to accurately describe the pq setting.

The code comment refers to "Perfect Forward Secrecy (PFS)" but nordvpn set pq off actually disables Post-Quantum encryption protection, not PFS. These are different security mechanisms. Update the comment to say something like: # Disable Post-Quantum encryption protection to allow for better compatibility with certain devices and configurations.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@bash/nord/config.sh` around lines 44 - 45, Update the inaccurate comment that
mentions "Perfect Forward Secrecy (PFS)": replace it with a correct description
for the `pq` setting (Post-Quantum encryption protection) so the comment
accurately describes `nordvpn set pq off` — e.g., change the comment above the
`nordvpn set pq off` command to state that it disables Post-Quantum encryption
protection to improve compatibility with certain devices/configurations.

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

Successfully merging this pull request may close these issues.

1 participant