diff --git a/installer/prereq.sh b/installer/prereq.sh index 34f309b..33d0004 100755 --- a/installer/prereq.sh +++ b/installer/prereq.sh @@ -44,9 +44,10 @@ if ! command -v node &>/dev/null; then curl -sL https://deb.nodesource.com/setup_16.x | bash - apt-get -y install nodejs else - version=$(node -v) - if [[ ! $version =~ v16\..* ]]; then - echo "Found node $version, recommended node v16.x.x" + version=$(node -v | cut -d '.' -f1) + version=${version:1} + if [[ $version -lt 16 ]]; then + echo "Found node $version, recommended node v16.x.x or later" fi fi @@ -63,6 +64,12 @@ if [[ -z "$(lsmod | grep br_netfilter)" ]]; then echo "br_netfilter" >/etc/modules-load.d/br_netfilter.conf fi +# Install ufw +if ! command -v ufw &>/dev/null; then + stage "Installing ufw" + apt-get install -y ufw +fi + # ------------------------------- # fstab changes # We do not edit original file, instead we create a temp file with original and edit it. diff --git a/installer/sashimono-uninstall.sh b/installer/sashimono-uninstall.sh index 4aa238a..9f49a10 100755 --- a/installer/sashimono-uninstall.sh +++ b/installer/sashimono-uninstall.sh @@ -17,8 +17,8 @@ function confirm() { read -p "'y' or 'n' expected: " yn /dev/null | head -n 1) + instancename=$(echo $cfgpath | rev | cut -d '/' -f 3 | rev) + peerport=$(jq .mesh.port $cfgpath) + userport=$(jq .user.port $cfgpath) + output=$($SASHIMONO_BIN/user-uninstall.sh $user $peerport $userport $instancename | tee /dev/stderr) [ "${output: -10}" != "UNINST_SUC" ] && echo "Uninstall user '$user' failed. Aborting." && exit 1 done fi + + # Find if there are any garbage rules that are created by sashimono and remove them. + prefix="sashi" + ufw status | grep -E ^[0-9]+,[0-9]+/tcp\\s+ALLOW\\s+Anywhere\\s+\#\\s$prefix-.+$ | while read -r line; do + ports=$(echo $line | cut -d ' ' -f 1) + echo "Removing found garbage ufw $ports rule..." + p1=$(echo $ports | cut -d ',' -f 1) + p2=$(echo $ports | cut -d ',' -f 2 | cut -d '/' -f 1) + ufw delete allow "$p1","$p2"/tcp + done fi echo "Removing Sashimono cgroup creation service..." @@ -157,9 +172,9 @@ if grep -q "^$MB_XRPL_USER:" /etc/passwd; then fi echo "Deleting message board user..." - # Killall command is not found in every linux systems, therefore pkill command is used. + # Killall command is not found in every linux systems, therefore pkill command is used. # A small timeout(0.5 second) is applied before deleting the user because it takes some time to kill all the processes - loginctl disable-linger $MB_XRPL_USER + loginctl disable-linger $MB_XRPL_USER pkill -u $MB_XRPL_USER # Kill any running processes. sleep 0.5 userdel -f "$MB_XRPL_USER" diff --git a/installer/setup.sh b/installer/setup.sh index d5ba5bb..1333c2a 100755 --- a/installer/setup.sh +++ b/installer/setup.sh @@ -125,8 +125,9 @@ function GB() { function check_prereq() { # Check if node js installed. if command -v node &>/dev/null; then - version=$(node -v) - if [[ ! $version =~ v16\..* ]]; then + version=$(node -v | cut -d '.' -f1) + version=${version:1} + if [[ $version -lt 16 ]]; then echo "$evernode requires NodeJs 16.x or later. You system has NodeJs $version installed. Either remove the NodeJs installation or upgrade to NodeJs 16.x." exit 1 fi diff --git a/mb-xrpl/lib/appenv.js b/mb-xrpl/lib/appenv.js index 3881c5e..9db4d5f 100644 --- a/mb-xrpl/lib/appenv.js +++ b/mb-xrpl/lib/appenv.js @@ -24,7 +24,7 @@ appenv = { ACQUIRE_LEASE_WAIT_TIMEOUT_THRESHOLD: 0.4, ORPHAN_PRUNE_SCHEDULER_INTERVAL_HOURS: 4, SASHI_CLI_PATH: appenv.IS_DEV_MODE ? "../build/sashi" : "/usr/bin/sashi", - MB_VERSION: '0.5.9', + MB_VERSION: '0.5.10', TOS_HASH: '757A0237B44D8B2BBB04AE2BAD5813858E0AECD2F0B217075E27E0630BA74314' // This is the sha256 hash of TOS text. } Object.freeze(appenv); diff --git a/src/version.hpp b/src/version.hpp index 7ef5e10..e6695f5 100644 --- a/src/version.hpp +++ b/src/version.hpp @@ -6,7 +6,7 @@ namespace version { // Sashimono agent version. Written to new configs. - constexpr const char *AGENT_VERSION = "0.5.9"; + constexpr const char *AGENT_VERSION = "0.5.10"; // Minimum compatible config version (this will be used to validate configs). constexpr const char *MIN_CONFIG_VERSION = "0.5.0";