Skip to content

chore(ethpillar.sh): improve ssh config handling, EL switcher gating,…#128

Merged
coincashew merged 1 commit intomainfrom
ethp
Sep 7, 2025
Merged

chore(ethpillar.sh): improve ssh config handling, EL switcher gating,…#128
coincashew merged 1 commit intomainfrom
ethp

Conversation

@coincashew
Copy link
Copy Markdown
Owner

@coincashew coincashew commented Sep 7, 2025

… besu description, version

Summary by CodeRabbit

  • New Features
    • SSH port validation during firewall setup: requires a numeric port (1–65535) and applies appropriate allow/rate-limit rules.
    • Guard added to prevent Execution Layer switching on the Ephemery testnet, with a prompt and exit.
  • Documentation
    • Lodestar-Besu option description updated to include Java.
  • Chores
    • Version bumped to 5.1.0.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Sep 7, 2025

Walkthrough

Single-file update to ethpillar.sh: bumped EP_VERSION to 5.1.0; added numeric SSH port validation loop (1–65535) before applying ufw rules with rate-limit for port 22; added guard to prevent EL switching on the Ephemery testnet; updated Lodestar-Besu menu description to include “java.”

Changes

Cohort / File(s) Summary
Versioning
ethpillar.sh
EP_VERSION updated 5.0.0 → 5.1.0.
Firewall SSH Port Validation
ethpillar.sh
Added looped input validation for SSH port (must be numeric and within 1–65535); shows error dialog on invalid input; applies ufw rule only when valid; uses rate-limit rule for port 22, otherwise standard allow.
EL Switcher Ephemery Guard
ethpillar.sh
Added guard to detect Ephemery testnet and prevent EL client switching there; displays message and exits the switch branch.
Menu Text Update
ethpillar.sh
Updated Lodestar-Besu option text to include “java” (now: ziglang & javascript & java).

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant Script as ethpillar.sh
    participant UFW as ufw

    User->>Script: Enable SSH in firewall setup
    loop Validate SSH port until valid
        Script->>User: Prompt for SSH port
        User-->>Script: Enter port
        alt Port invalid (non-numeric or out of 1–65535)
            Script->>User: Show error dialog
        else Port valid
            alt Port == 22
                Script->>UFW: ufw limit 22/tcp
            else
                Script->>UFW: ufw allow <port>/tcp
            end
            UFW-->>Script: rule applied
        end
    end
    Script-->>User: Continue setup
Loading
sequenceDiagram
    actor User
    participant Script as ethpillar.sh
    participant EL as EL Switcher

    User->>Script: Initiate EL switch
    Script->>Script: Detect current testnet
    alt Network is Ephemery
        Script-->>User: Inform switching is disabled on Ephemery
        Script->>EL: Abort switch (exit branch)
    else Other networks
        Script->>EL: Proceed with switch
        EL-->>Script: Complete
        Script-->>User: Done
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

I thump the ground—version hops anew,
A cautious port, “Is your number true?”
Ephemery whispers, “Not today, dear EL,”
Besu nods, a java tale to tell.
With ufw snug and menus bright—rabbit signs off, goodnight. 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b50a627 and 47d6418.

📒 Files selected for processing (1)
  • ethpillar.sh (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • ethpillar.sh
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ethp

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
ethpillar.sh (3)

980-989: Good validation loop; consider reusing it and rate-limiting SSH on 22.

  • Reuse this validation for UFW options 2/3 to keep UX consistent.
  • When port is 22, prefer ufw limit to mitigate brute-force. Below keeps your loop and adds rate limiting.

Apply this diff:

 while true; do
   read -r -p "Enter your SSH port. Press Enter to use default '22': " _ssh_port
   _ssh_port=${_ssh_port:-22}
   if ! [[ "$_ssh_port" =~ ^[0-9]+$ ]] || [ "$_ssh_port" -lt 1 ] || [ "$_ssh_port" -gt 65535 ]; then
        whiptail --title "Error" --msgbox "Invalid port. Try again." 8 78
   else
-      sudo ufw allow ${_ssh_port}/tcp comment 'Allow SSH port'
+      if [ "$_ssh_port" -eq 22 ]; then
+        sudo ufw limit 22/tcp comment 'Rate-limit SSH (port 22)'
+      else
+        sudo ufw allow "${_ssh_port}/tcp" comment 'Allow SSH port'
+      fi
       break
   fi
 done

Optionally, extract this into a read_valid_port() helper and call it from UFW menu options 2/3.


1413-1413: Make Ephemery guard case-insensitive.
Current check is case-sensitive; normalize to avoid surprises.

-        [[ "${NETWORK}" == "Ephemery" ]] && echo "EL Switcher not available for EPHEMERY testnet. To switch, use System Admin > Reinstall node . Press ENTER to continue." && read && break
+        [[ "${NETWORK,,}" == "ephemery" ]] && echo "EL Switcher not available for Ephemery testnet. To switch, use System Admin > Reinstall node. Press ENTER to continue." && read && break

1508-1508: Tweak wording/capitalization.
Minor copy edit for consistency with other entries.

-"Lodestar-Besu" "performant. robust. ziglang & javascript & java" \
+"Lodestar-Besu" "performant. robust. Zig & JavaScript & Java" \
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bae5f97 and b50a627.

📒 Files selected for processing (1)
  • ethpillar.sh (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
ethpillar.sh (1)
functions.sh (1)
  • print_node_info (102-143)
🔇 Additional comments (1)
ethpillar.sh (1)

15-15: Version bump looks good.

@coincashew coincashew merged commit c5cb50c into main Sep 7, 2025
1 check passed
@coincashew coincashew deleted the ethp branch September 7, 2025 20:29
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