chore(ethpillar.sh): improve ssh config handling, EL switcher gating,…#128
chore(ethpillar.sh): improve ssh config handling, EL switcher gating,…#128coincashew merged 1 commit intomainfrom
Conversation
WalkthroughSingle-file update to Changes
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
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
🧪 Generate unit tests
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. Comment |
There was a problem hiding this comment.
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 doneOptionally, 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
📒 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.
… besu description, version
… besu description, version
Summary by CodeRabbit