1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-14 20:22:08 +00:00

/usr/bin/iiab-remoteit to quickly obtain a new claim code

This commit is contained in:
root 2022-04-02 23:41:49 -04:00
parent 4e2e4c8eff
commit 5854ab7c61
4 changed files with 110 additions and 40 deletions

View file

@ -18,11 +18,15 @@ For other approaches, please see http://FAQ.IIAB.IO -> "How can I remotely manag
### Install remote.it onto an IIAB + register it + authorize services/ports
1. Set `remoteit_install` and `remoteit_enabled` to `True` in your IIAB's [/etc/iiab/local_vars.yml](http://wiki.laptop.org/go/IIAB/FAQ#What_is_local_vars.yml_and_how_do_I_customize_it.3F)
1. Connect your IIAB device to the Internet.
(If possible, do that prior to [installing IIAB](https://download.iiab.io/), then install IIAB using `sudo iiab`, and when that's complete go directly to Step 3. below.)
2. If your IIAB software is already installed, run `sudo iiab-remoteit` then skip to Step 5. below.
2. Make sure your IIAB is connected to the Internet.
3. If your IIAB software isn't yet installed, set `remoteit_install` and `remoteit_enabled` to `True` in its [/etc/iiab/local_vars.yml](https://wiki.iiab.io/go/FAQ#What_is_local_vars.yml_and_how_do_I_customize_it.3F).
Install [IIAB software](https://download.iiab.io/) e.g. by running `sudo iiab` then follow any on-screen instructions — until "INTERNET-IN-A-BOX (IIAB) SOFTWARE INSTALL IS COMPLETE" eventually appears on screen.
<!-- , and when that's complete go directly to Step 3. below.
Then install and enable remote.it (its [Device Package](https://docs.remote.it/software/device-package)) on your IIAB, by running:
@ -36,13 +40,11 @@ For other approaches, please see http://FAQ.IIAB.IO -> "How can I remotely manag
```
cd /opt/iiab/iiab
sudo ./runrole --reinstall remoteit
```
``` -->
(While rarely needed, both above also install 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.)
(This installs and enables the remote.it [Device Package](https://docs.remote.it/software/device-package) for your CPU and OS. This approach 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.)
<!--EXPLANATION: The above installs remote.it, in a way that was originally designed to be interactive, and provide you the claim code needed to make a remote connection to this IIAB. The claim code is further explained below.-->
3. To obtain your IIAB's 8-character remote.it claim code (allowing you to make a remote connection to this IIAB device) run:
4. To obtain your IIAB's 8-character remote.it claim code (allowing you to make a remote connection to this IIAB device) run:
```
sudo grep claim /etc/remoteit/config.json
@ -50,7 +52,7 @@ For other approaches, please see http://FAQ.IIAB.IO -> "How can I remotely manag
*The claim code must be used within 24 hours, per:* https://docs.remote.it/device-package/installation#2.-update-your-package-manager-and-install
_If your claim code has expired, please reinstall the latest remote.it (in Step 2. above!)_
_If your claim code has expired, please run `sudo iiab-remoteit` just as in Step 2._
<!-- If necessary, run this command to get a new claim code: *(adjust version & architecture in the .deb filename as appropriate!)*
@ -58,16 +60,22 @@ For other approaches, please see http://FAQ.IIAB.IO -> "How can I remotely manag
sudo apt install /opt/iiab/downloads/remoteit-4.14.1.armhf.rpi.deb
``` -->
4. Submit the claim code at https://remote.it (log into the Web Portal), or within the remote.it desktop application if you installed that on your own laptop/computer.
5. Submit the claim code at https://remote.it (log into their Web Portal), or within the remote.it [desktop application](https://remote.it/download/) on your own laptop/computer.
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
5. 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
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
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
### How to I disable remote.it on my IIAB?
1. Run `sudo nano /etc/iiab/local_vars.yml` to set `remoteit_enabled: False`
2. Run `cd /opt/iiab/iiab` and then `sudo ./runrole remoteit`
## Docs
<!-- "auto-registration" of remote.it, and other more advanced configuration options, see: -->

View file

@ -7,29 +7,29 @@
# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing!
# 2022-03-31: https://remote.it/download/ offers 4 relevant "Device Packages"
# 1) Raspberry Pi (ARM) = armhf.rpi
# 2) Raspberry Pi (ARM64) = arm64.rpi
# 3) Debian Linux (ARM64) = arm64
# 4) Debian Linux (x86_64) = amd64
# # 2022-03-31: https://remote.it/download/ offers 4 relevant "Device Packages"
# # 1) Raspberry Pi (ARM) = armhf.rpi
# # 2) Raspberry Pi (ARM64) = arm64.rpi
# # 3) Debian Linux (ARM64) = arm64
# # 4) Debian Linux (x86_64) = amd64
# See https://docs.remote.it/software/device-package/installation to refine URL below:
device_suffixes:
armv6: armhf.rpi
armv6l: armhf.rpi
armv7: armhf.rpi
armv7l: armhf.rpi
armv8: arm64.rpi
aarch64: arm64
x86_64: amd64
remoteit_device_suffix: "{{ device_suffixes[ansible_architecture] | default('unknown') }}"
remoteit_device_url: https://downloads.remote.it/remoteit/latest/remoteit.{{ remoteit_device_suffix }}.deb
# # See https://docs.remote.it/software/device-package/installation to refine URL below:
# device_suffixes:
# armv6: armhf.rpi
# armv6l: armhf.rpi
# armv7: armhf.rpi
# armv7l: armhf.rpi
# armv8: arm64.rpi
# aarch64: arm64
# x86_64: amd64
# remoteit_device_suffix: "{{ device_suffixes[ansible_architecture] | default('unknown') }}"
# remoteit_device_url: https://downloads.remote.it/remoteit/latest/remoteit.{{ remoteit_device_suffix }}.deb
# 2022-03-31: Use "latest" above, instead of ever-changing version below
# remoteit_version: 4.14.1
# remoteit_deb: remoteit-{{ remoteit_version }}.{{ remoteit_device_suffix }}.deb
# remoteit_device_url: https://downloads.remote.it/remoteit/v{{ remoteit_version }}/{{ remoteit_deb }}
# # Example... https://downloads.remote.it/remoteit/v4.14.1/remoteit-4.14.1.armhf.rpi.deb
# # 2022-03-31: Use "latest" above, instead of ever-changing version below
# # remoteit_version: 4.14.1
# # remoteit_deb: remoteit-{{ remoteit_version }}.{{ remoteit_device_suffix }}.deb
# # remoteit_device_url: https://downloads.remote.it/remoteit/v{{ remoteit_version }}/{{ remoteit_deb }}
# # # Example... https://downloads.remote.it/remoteit/v4.14.1/remoteit-4.14.1.armhf.rpi.deb
# 2022-03-31: https://remote.it/download/ offers 4 relevant "CLI" installs:

View file

@ -1,7 +1,7 @@
- name: Fail if architecture remoteit_device_suffix == "unknown"
fail:
msg: "Could not find a remote.it Device Package (.deb) for CPU architecture \"{{ ansible_architecture }}\""
when: remoteit_device_suffix == "unknown"
# - name: Fail if architecture remoteit_device_suffix == "unknown"
# fail:
# msg: "Could not find a remote.it Device Package (.deb) for CPU architecture \"{{ ansible_architecture }}\""
# when: remoteit_device_suffix == "unknown"
# - name: mkdir {{ downloads_dir }} # As roles/2-common/tasks/fl.yml has not run yet
# file:
@ -15,19 +15,30 @@
# force: yes
# timeout: "{{ download_timeout }}"
- name: Uninstall previously installed 'remoteit*' Device Package(s)
- name: Purge previously installed 'remoteit*' Device Package(s)
apt:
name: remoteit*
state: absent
purge: yes
ignore_errors: yes
# - name: "Install Device Package: {{ downloads_dir }}/{{ remoteit_deb }}"
# apt:
# deb: "{{ downloads_dir }}/{{ remoteit_deb }}"
- name: "Install Device Package: {{ remoteit_device_url }}"
apt:
deb: "{{ remoteit_device_url }}"
# - name: "Install Device Package: {{ remoteit_device_url }}"
# apt:
# deb: "{{ remoteit_device_url }}"
- name: Install remote.it Device Package for your CPU/OS, using https://downloads.remote.it/remoteit/install_agent.sh
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)"
template:
src: iiab-remoteit
dest: /usr/bin
mode: 0755
- name: Fail if architecture remoteit_cli_suffix == "unknown"

View file

@ -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"