Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions bash/nord/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# NordVPN commands

The following commands are supplied:

- login.sh
- logout.sh
- config.sh
- connect.sh
- list_connected
- exit-node.sh
- status.sh

The following devices run NordVPN:

- DELL - DellNord
- HP - HPNord
- Pixel
- Tab8
- sunndal
- raspberry

The raspberry will be configured as an exit-node allowing the other devices to
route all traffic through this device.
6 changes: 6 additions & 0 deletions bash/nord/config.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#! /usr/bin/bash
# set -euo pipefail

command -v nordvpn >/dev/null 2>&1 || {
echo "nordvpn CLI not found in PATH" >&2
exit 1
}

# Check for jq
if ! command -v jq &> /dev/null
Expand Down
1 change: 1 addition & 0 deletions bash/nord/exit_node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ fi
echo ""
echo "Example:"
echo " $0 mesh-r

# Function to display usage information
display_help() {
echo "Usage: $0 <nickname_for_this_device>"
Expand Down
41 changes: 41 additions & 0 deletions bash/nord/nord_watchdog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/bash

# Configuration - Replace with your Nord account email
USER_EMAIL="terje.innerdal@protonmail.com"

echo "Checking NordVPN status..."

# 1. Ensure the NordVPN daemon is running
if ! systemctl is-active --quiet nordvpnd; then
echo "NordVPN daemon is down. Restarting..."
sudo systemctl start nordvpnd
sleep 2
fi

# 2. Check if logged in (Exits if not)
if ! nordvpn status | grep -q "Status:"; then
echo "Error: NordVPN is not logged in. Please login manually once."
exit 1
fi

# 3. Ensure Meshnet is ENABLED
if ! nordvpn settings | grep -q "Meshnet: enabled"; then
echo "Enabling Meshnet..."
nordvpn set meshnet on
fi

# 4. Ensure Exit Node permission is ACTIVE
# We check if the email is in the allowed list
if ! nordvpn meshnet peer list | grep -A 5 "This device" | grep -q "Allowing to use as exit node: yes"; then
echo "Setting Exit Node permissions for $USER_EMAIL..."
nordvpn meshnet peer allow-exit-node set "$USER_EMAIL"
fi

# 5. Ensure IP Forwarding is active in the kernel
IF_FORWARD=$(cat /proc/sys/net/ipv4/ip_forward)
if [[ "$IF_FORWARD" -eq 0 ]]; then
echo "Enabling IP Forwarding..."
sudo sysctl -w net.ipv4.ip_forward=1
fi

echo "NordVPN Exit Node is configured and ready."
3 changes: 0 additions & 3 deletions bash/nord/status.sh

This file was deleted.