diff --git a/roles/remoteit/README.md b/roles/remoteit/README.md index 7e9ad2c47..dbaa5251d 100644 --- a/roles/remoteit/README.md +++ b/roles/remoteit/README.md @@ -8,16 +8,26 @@ For other approaches, please see http://FAQ.IIAB.IO -> "How can I remotely manag ## Getting Started -### Create a remote.it account + consider its desktop application +### Create a remote.it account + install its desktop application 1. Browse to [https://remote.it](https://remote.it) (Web Portal) and sign up for an account. -2. Download the [remote.it desktop application](https://remote.it/download/) (e.g. for Windows, macOS or Linux) to your own laptop/computer — if you prefer this over the https://remote.it Web Portal and its [mobile apps](https://docs.remote.it/introduction/get-started/readme#installation-packages). +2. Download and install the remote.it [desktop application](https://remote.it/download/) (e.g. for Windows, macOS or Linux) on your own laptop/computer. Their https://remote.it Web Portal and [mobile apps](https://docs.remote.it/introduction/get-started/readme#installation-packages) are also sometimes possible, but less functional. COMPARISON: "The Desktop and [CLI](https://docs.remote.it/software/cli) can [each] support both peer to peer connections and proxy connections [whereas] the Web Portal and API can only support proxy connections" according to https://docs.remote.it/software/device-package/usage -### Install remote.it onto an IIAB + register it + authorize services/ports + +### Generate a remote.it claim code for your IIAB + register it + authorize services/ports +Prerequisite: Find an IIAB with `remoteit_installed: True` in `/etc/iiab/iiab_state.yml`. + +1. Run `sudo iiab-remoteit` + + Hit `[Enter]` twice if you want to quickly generate a new claim code for your IIAB. + + The claim code is stored in `/etc/remoteit/config.json` and must be used [within 24 hours](https://docs.remote.it/device-package/installation#2.-update-your-package-manager-and-install). + + - (This installs and enables the remote.it [Device Package](https://docs.remote.it/software/device-package) for your CPU and OS. This also installs the _optional_ `/usr/bin/remoteit` [command-line interface (CLI)](https://docs.remote.it/software/cli), which offers [a few more features](https://support.remote.it/hc/en-us/articles/4412786750861-Install-the-remoteit-agent-on-your-device) than the Device Package.) + -5. Submit the claim code within the remote.it [desktop application](https://remote.it/download/) on your own laptop/computer. Or if you prefer, do that by logging into their Web Portal at https://remote.it +2. Submit the claim code within the remote.it [desktop application](https://remote.it/download/) on your own laptop/computer. Or if you prefer, do that by logging into their Web Portal at: https://remote.it - Either way, click on the '+' icon to enter the remote.it claim code (to register the IIAB device to your account) as shown in this screenshot: https://docs.remote.it/software/device-package/installation#3.-claim-and-register-the-device + Either way, click on the '+' icon to enter the remote.it claim code (to register the IIAB device to your account) as shown in this [screenshot](https://docs.remote.it/software/device-package/installation#3.-claim-and-register-the-device). -6. Authorize services/ports (e.g. SSH, HTTP, etc) for your IIAB device, as shown in these screenshots: https://docs.remote.it/software/device-package/installation#4.-set-up-services-on-your-device +3. Authorize services/ports (e.g. SSH, HTTP, etc) for your IIAB device, as shown in these [screenshots](https://docs.remote.it/software/device-package/installation#4.-set-up-services-on-your-device). - SUMMARY: One or more remote.it "Services" need to be authorized (registered) to allow remote access to your IIAB device: https://support.remote.it/hc/en-us/articles/360060992631-Services + SUMMARY: One or more remote.it "Services" need to be authorized (registered) to allow remote access to your IIAB device:
https://support.remote.it/hc/en-us/articles/360060992631-Services - EXAMPLES: SSH (port 22) and/or HTTP (port 80): https://support.remote.it/hc/en-us/articles/360058603991-Configuring-remoteit-Services-on-devices-with-remote-it-Desktop + EXAMPLES: SSH (port 22) and/or HTTP (port 80):
https://support.remote.it/hc/en-us/articles/360058603991-Configuring-remoteit-Services-on-devices-with-remote-it-Desktop ### How to I disable remote.it on my IIAB? @@ -81,6 +94,13 @@ For other approaches, please see http://FAQ.IIAB.IO -> "How can I remotely manag sudo ./runrole remoteit ``` +3. If want to completely remove the remote.it software and its settings, also run: + + ``` + sudo apt purge "remoteit*" + sudo rm /usr/bin/remoteit + ``` + ## Docs diff --git a/roles/remoteit/tasks/install.yml b/roles/remoteit/tasks/install.yml index 557a963a1..88ca82640 100644 --- a/roles/remoteit/tasks/install.yml +++ b/roles/remoteit/tasks/install.yml @@ -15,6 +15,8 @@ # force: yes # timeout: "{{ download_timeout }}" +# 2022-04-03: Unfort still necessary, as their install_agent.sh below uses apt +# with 'install -y' instead of '-y reinstall' or '-y --reinstall install' - name: Purge previously installed 'remoteit*' Device Package(s) apt: name: remoteit* @@ -34,7 +36,7 @@ shell: curl -L https://downloads.remote.it/remoteit/install_agent.sh | sh -- name: "Install from template /usr/bin/iiab-remoteit to quickly obtain a new remote.it claim code, if later nec (much like the above 2 steps)" +- name: "Install /usr/bin/iiab-remoteit from template -- so IIAB operators can quickly generate a new remote.it claim code (in /etc/remoteit/config.json) AND enable remoteit's 3 systemd services -- optionally downloading + installing the very latest Device Package (like the 2 steps above)" template: src: iiab-remoteit dest: /usr/bin diff --git a/roles/remoteit/templates/iiab-remoteit b/roles/remoteit/templates/iiab-remoteit index 79163e81a..ee346d070 100755 --- a/roles/remoteit/templates/iiab-remoteit +++ b/roles/remoteit/templates/iiab-remoteit @@ -3,21 +3,52 @@ # Run 'sudo iiab-remoteit' to (re)install & enable remote.it -- GENERAL TIPS: # http://FAQ.IIAB.IO -> "How can I remotely manage my Internet-in-a-Box?" -# /usr/bin/remoteit CLI is already be installed by: +# 'remoteit' Device Package AND /usr/bin/remoteit CLI already installed by: # https://github.com/iiab/iiab/blob/master/roles/remoteit/tasks/install.yml -echo -e "\nhttps://remote.it can help you remotely manage this IIAB:" +# 2022-04-03: SEE ALSO roles/remoteit/templates/iiab-remote.old + +echo -e "\nhttps://remote.it can help you remotely manage this IIAB. Summary:\n" + echo -e "https://github.com/iiab/iiab/blob/master/roles/remoteit/README.md\n" -echo -en "\e[1mInstall remote.it Device Package after purging all prior versions? [Y/n]\e[0m " +echo -en "\e[1mTo proceed we will delete /etc/remoteit/config.json, Ok? [Y/n]\e[0m " read ans < /dev/tty # Strips outer whitespace, whether we like it or not! echo -[ "$ans" = "n" ] || [ "$ans" = "N" ] && exit 1 +[[ $ans = "n" ]] || [[ $ans = "N" ]] && exit 1 -if grep -q '^remoteit_install:' /etc/iiab/local_vars.yml; then - sed -i "s/^remoteit_install:.*/remoteit_install: True/" /etc/iiab/local_vars.yml +echo -e "\nThis IIAB must be online to begin!\n" + +echo -en "\e[1mOptionally download + install latest remote.it Device Package? [y/N]\e[0m " +read ans < /dev/tty # Strips outer whitespace, whether we like it or not! +echo + +if [[ $ans = "y" ]] || [[ $ans = "Y" ]]; then + # 2022-04-02: Full Path Avoids problematic /usr/local/bin/apt on Linux Mint + /usr/bin/apt -y purge "remoteit*" || true + + # Why the brutal purge? Even 'apt -y reinstall remoteit.*.deb' is stronger + # than 'install -y' in install_agent.sh, but still sometimes insufficient! + + # apt install & enable "latest" remote.it Device Package for your CPU/OS + curl -L https://downloads.remote.it/remoteit/install_agent.sh | sh else - echo "remoteit_install: True" >> /etc/iiab/local_vars.yml + # '|| true' overrides 'bash -e' so script continues if config.json missing + mv /etc/remoteit/config.json /etc/remoteit/config.json.$(date +%F_%T_%Z) || true + + echo -e "In just a few seconds, all 3 services should be enabled + started.\n" + + systemctl restart connectd # Claim Code logic + kickstarts 2 svcs below + systemctl enable connectd # 3 enable lines, like enable-or-disable.yml + + # "Remote tcp command service" started above + systemctl enable schannel # 3 enable lines, like enable-or-disable.yml + + # "Remote tcp connection service" appears a few seconds after connectd is + # started above. It's also auto-enabled by above, so this may be overkill: + systemctl enable $(ls /etc/systemd/system/multi-user.target.wants/ | grep remoteit@) # 3 enable lines, like enable-or-disable.yml + # Its systemd service name (e.g. remoteit@80:00:01:7F:7E:00:56:36.service) + # changes when a new claim code is generated. fi if grep -q '^remoteit_enabled:' /etc/iiab/local_vars.yml; then @@ -26,26 +57,11 @@ else echo "remoteit_enabled: True" >> /etc/iiab/local_vars.yml fi -# 2022-04-02: Full Path Avoids problematic /usr/local/bin/apt on Linux Mint -/usr/bin/apt -y purge remoteit* +claim_code=$(grep claim /etc/remoteit/config.json | rev | cut -d\" -f2 | rev) +echo -e "\nYour new claim code is \e[44;1m${claim_code}\e[0m -- YOUR NEXT STEPS ARE...\n" -# Why the brutal purge? Even 'apt -y reinstall remoteit.*.deb' is much stronger -# than 'install -y' in install_agent.sh below, but still insufficient. Maybe in -# future years their /usr/bin/remoteit CLI might seed a new claim code when nec? - -# apt install & enable "latest" remote.it Device Package for your CPU/OS -curl -L https://downloads.remote.it/remoteit/install_agent.sh | sh - -if grep -q '^remoteit_installed:' /etc/iiab/iiab_state.yml; then - sed -i "s/^remoteit_installed:.*/remoteit_installed: True/" /etc/iiab/iiab_state.yml -else - echo "remoteit_installed: True" >> /etc/iiab/iiab_state.yml -fi - -echo -e "\e[44;1mNEXT STEPS...\e[0m\n" - -echo -e "\e[1m1) Install the remote.it Desktop Application on your own laptop/computer:" +echo -e "\e[1m1) Install the remote.it Desktop Application on your own laptop/computer:\e[0m" echo -e " https://remote.it/download/\n" -echo -e "2) Use the above 8-character claim code within 24h as shown here:" -echo -e " https://docs.remote.it/software/device-package/installation#3.-claim-and-register-the-device\e[0m\n" +echo -e "\e[1m2) Use the above 8-character claim code WITHIN 24H as shown here:\e[0m" +echo -e " https://docs.remote.it/software/device-package/installation#3.-claim-and-register-the-device\n" diff --git a/roles/remoteit/templates/iiab-remoteit.old b/roles/remoteit/templates/iiab-remoteit.old new file mode 100755 index 000000000..79163e81a --- /dev/null +++ b/roles/remoteit/templates/iiab-remoteit.old @@ -0,0 +1,51 @@ +#!/bin/bash -e + +# Run 'sudo iiab-remoteit' to (re)install & enable remote.it -- GENERAL TIPS: +# http://FAQ.IIAB.IO -> "How can I remotely manage my Internet-in-a-Box?" + +# /usr/bin/remoteit CLI is already be installed by: +# https://github.com/iiab/iiab/blob/master/roles/remoteit/tasks/install.yml + +echo -e "\nhttps://remote.it can help you remotely manage this IIAB:" +echo -e "https://github.com/iiab/iiab/blob/master/roles/remoteit/README.md\n" + +echo -en "\e[1mInstall remote.it Device Package after purging all prior versions? [Y/n]\e[0m " +read ans < /dev/tty # Strips outer whitespace, whether we like it or not! +echo +[ "$ans" = "n" ] || [ "$ans" = "N" ] && exit 1 + +if grep -q '^remoteit_install:' /etc/iiab/local_vars.yml; then + sed -i "s/^remoteit_install:.*/remoteit_install: True/" /etc/iiab/local_vars.yml +else + echo "remoteit_install: True" >> /etc/iiab/local_vars.yml +fi + +if grep -q '^remoteit_enabled:' /etc/iiab/local_vars.yml; then + sed -i "s/^remoteit_enabled:.*/remoteit_enabled: True/" /etc/iiab/local_vars.yml +else + echo "remoteit_enabled: True" >> /etc/iiab/local_vars.yml +fi + +# 2022-04-02: Full Path Avoids problematic /usr/local/bin/apt on Linux Mint +/usr/bin/apt -y purge remoteit* + +# Why the brutal purge? Even 'apt -y reinstall remoteit.*.deb' is much stronger +# than 'install -y' in install_agent.sh below, but still insufficient. Maybe in +# future years their /usr/bin/remoteit CLI might seed a new claim code when nec? + +# apt install & enable "latest" remote.it Device Package for your CPU/OS +curl -L https://downloads.remote.it/remoteit/install_agent.sh | sh + +if grep -q '^remoteit_installed:' /etc/iiab/iiab_state.yml; then + sed -i "s/^remoteit_installed:.*/remoteit_installed: True/" /etc/iiab/iiab_state.yml +else + echo "remoteit_installed: True" >> /etc/iiab/iiab_state.yml +fi + +echo -e "\e[44;1mNEXT STEPS...\e[0m\n" + +echo -e "\e[1m1) Install the remote.it Desktop Application on your own laptop/computer:" +echo -e " https://remote.it/download/\n" + +echo -e "2) Use the above 8-character claim code within 24h as shown here:" +echo -e " https://docs.remote.it/software/device-package/installation#3.-claim-and-register-the-device\e[0m\n"