diff --git a/installer/sashimono-install.sh b/installer/sashimono-install.sh index 7871353..e66afa8 100755 --- a/installer/sashimono-install.sh +++ b/installer/sashimono-install.sh @@ -537,7 +537,7 @@ if ! grep -q "^$MB_XRPL_USER:" /etc/passwd; then chown -R "$MB_XRPL_USER":"$SASHIADMIN_GROUP" /home/$MB_XRPL_USER secret_path=$(jq -r '.xrpl.secretPath' "$MB_XRPL_CONFIG") - chown "$MB_XRPL_USER": $secret_path + chown "$MB_XRPL_USER":"$SASHIADMIN_GROUP" $secret_path fi # Assign message board user priviledges. diff --git a/installer/setup.sh b/installer/setup.sh index deef09c..705f60b 100755 --- a/installer/setup.sh +++ b/installer/setup.sh @@ -947,7 +947,7 @@ ([ -z $xrpl_address ] || [ -z $key_file_path ] || [ -z $lease_amount ] || [ -z $extra_txn_fee ] || [ -z $email_address ]) && echo "Configuration file format has been altered." && exit 1 if [ -n "$key_file_path" ] && [ -e "$key_file_path" ]; then # Change the ownership in case user is removed. - chown "$MB_XRPL_USER": $key_file_path + chown "$MB_XRPL_USER":"$SASHIADMIN_GROUP" $key_file_path xrpl_secret=$(jq -r ".xrpl.secret | select( . != null )" "$key_file_path") @@ -1002,18 +1002,26 @@ } function collect_host_xrpl_account_inputs() { + # NOTE this method declares the accounts and secrets for a provided prefix. + local xahau_account_address="" + local xahau_account_secret="" + local prefix="${1:-xrpl}" + while true; do - read -ep "Specify the Xahau account address: " xrpl_address "$key_file_path" && chmod 440 "$key_file_path" && - chown $MB_XRPL_USER: $key_file_path && + chown $MB_XRPL_USER:$SASHIADMIN_GROUP $key_file_path && echomult "Key file saved successfully at $key_file_path" || { echomult "Error occurred in permission and ownership assignment of key file." exit 1 @@ -1147,14 +1155,14 @@ fi if [ -e "$reputationd_key_file_path" ]; then - if confirm "The file '$reputationd_key_file_path' already exists. Do you want to continue using that key file?\nPressing 'n' would terminate the installation."; then + if confirm "The file '$reputationd_key_file_path' already exists. Do you want to continue using that key file?\nPressing 'n' would terminate the opting-in."; then echomult "Continuing with the existing key file." reputationd_existing_secret=$(jq -r '.xrpl.secret' "$reputationd_key_file_path" 2>/dev/null) if [ "$reputationd_existing_secret" != "null" ] && [ "$reputationd_existing_secret" != "-" ]; then while true; do account_json=$(exec_jshelper generate-account $reputationd_existing_secret) && break echo "Error occurred when existing account retrieval." - confirm "\nDo you want to retry?\nPressing 'n' would terminate the installation." || return 1 + confirm "\nDo you want to retry?\nPressing 'n' would terminate the opting-in.." || return 1 done reputationd_xrpl_address=$(jq -r '.address' <<<"$account_json") @@ -1176,11 +1184,16 @@ exit 1 fi else - generate_keys "reputationd" + + if ! confirm "Do you already have a Xahau account that has been used for reputation assessment?" "n"; then + generate_keys "reputationd" + else + collect_host_xrpl_account_inputs "reputationd_xrpl" + fi echo "{ \"xrpl\": { \"secret\": \"$reputationd_xrpl_secret\" } }" >"$reputationd_key_file_path" && chmod 440 "$reputationd_key_file_path" && - chown $REPUTATIOND_USER: $reputationd_key_file_path && + chown $REPUTATIOND_USER:$SASHIADMIN_GROUP $reputationd_key_file_path && echomult "Key file saved successfully at $reputationd_key_file_path" || { echomult "Error occurred in permission and ownership assignment of key file." exit 1 @@ -2064,14 +2077,14 @@ WantedBy=timers.target" >/etc/systemd/system/$EVERNODE_AUTO_UPDATE_SERVICE.timer [ "$EUID" -ne 0 ] && echo "Please run with root privileges (sudo)." && return 1 # Configure reputationd users and register host. - echomult "configuring Evernode reputation for reward distribution..." + echomult "Configuring Evernode reputation for reward distribution..." if [ -f "$REPUTATIOND_CONFIG" ]; then reputationd_secret_path=$(jq -r '.xrpl.secretPath' "$REPUTATIOND_CONFIG") - chown "$REPUTATIOND_USER": $reputationd_secret_path + chown "$REPUTATIOND_USER":"$SASHIADMIN_GROUP" $reputationd_secret_path fi if [ "$upgrade" == "0" ]; then - #account generation, + # Account generation, if ! set_host_reputationd_account; then echo "error setting up reputationd account." return 1 @@ -2320,8 +2333,9 @@ WantedBy=timers.target" >/etc/systemd/system/$EVERNODE_AUTO_UPDATE_SERVICE.timer elif [ "$mode" == "uninstall" ]; then - echomult "\nNOTE: By continuing with this, you will not LOSE the SECRET; it remains within the specified path. - \nThe secret path can be found inside the configuration stored at '$MB_XRPL_DATA/mb-xrpl.cfg'." + echomult "\nNOTE: By continuing with this, you will not LOSE the ACCOUNT SECRETs; those remain within the specified paths. + \nThe path where the registration account secret is saved can be found inside the configuration stored at '$MB_XRPL_DATA/mb-xrpl.cfg'. + \nIf you have configured a reputation account, the path where that account secret is saved can be found inside the configuration stored at $REPUTATIOND_DATA/reputationd.cfg" ! confirm "\nAre you sure you want to uninstall $evernode?" && exit 1 @@ -2344,8 +2358,10 @@ WantedBy=timers.target" >/etc/systemd/system/$EVERNODE_AUTO_UPDATE_SERVICE.timer while allowing you to transfer the registration to a preferred transferee. \n\nAre you sure you want to transfer $evernode registration from this host?" && exit 1 - echomult "\nNOTE: By continuing with this, you will not LOSE the SECRET; it remains within the specified path. - \nThe secret path can be found inside the configuration stored at '$MB_XRPL_DATA/mb-xrpl.cfg'." + echomult "\nNOTE: By continuing with this, you will not LOSE the ACCOUNT SECRETs; those remain within the specified paths. + \nThe path where the registration account secret is saved can be found inside the configuration stored at '$MB_XRPL_DATA/mb-xrpl.cfg'. + \nIf you have configured a reputation account, the path where that account secret is saved can be found inside the configuration stored at $REPUTATIOND_DATA/reputationd.cfg" + ! confirm "\nAre you sure you want to continue?" && exit 1 diff --git a/reputationd/lib/setup.js b/reputationd/lib/setup.js index 13b31f5..6c7a6d2 100644 --- a/reputationd/lib/setup.js +++ b/reputationd/lib/setup.js @@ -71,7 +71,7 @@ class Setup { }); try { - console.log(`Preparing reputation account:${acc.address} reputation:${hostClient.config.reputationAddress}`); + console.log(`Preparing reputation account:${acc.address} | Reputation Hook:${hostClient.config.reputationAddress}`); await hostClient.prepareReputationAccount(acc.address, acc.secret, { retryOptions: { maxRetryAttempts: MAX_TX_RETRY_ATTEMPTS, feeUplift: Math.floor(acc.affordableExtraFee / MAX_TX_RETRY_ATTEMPTS) } }); await hostClient.disconnect(); }