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

Allow remote.it license key to be pasted into local_vars.yml

This commit is contained in:
root 2022-04-06 18:13:05 -04:00
parent c8769a8ea6
commit dcc6615d72
5 changed files with 82 additions and 18 deletions

View file

@ -17,7 +17,7 @@ For other approaches, please see http://FAQ.IIAB.IO -> "How can I remotely manag
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
### OPTION #1: Generate a remote.it claim code for your IIAB + register it + authorize services/ports
Prerequisite: Find any IIAB with `remoteit_installed: True` in `/etc/iiab/iiab_state.yml` (this is the default!) It means that the remote.it [Device Package](https://docs.remote.it/software/device-package) is installed on your IIAB, most important. It also means the _strictly optional_ `/usr/bin/remoteit` [command-line interface (CLI)](https://docs.remote.it/software/cli) is installed, offering [a few more features](https://support.remote.it/hc/en-us/articles/4412786750861-Install-the-remoteit-agent-on-your-device) than the Device Package.
@ -83,6 +83,35 @@ Prerequisite: Find any IIAB with `remoteit_installed: True` in `/etc/iiab/iiab_s
EXAMPLES: Add an SSH Service on port 22 and/or add an HTTP Service on port 80 ([screenshot guide](https://support.remote.it/hc/en-us/articles/360058603991-Configuring-remoteit-Services-on-devices-with-remote-it-Desktop)).
### OPTION #2: Paste your remote.it license key to IIAB + enable it + authorize services/ports
1. Copy your remote.it account _license key_ from their Desktop Application (https://remote.it/download/) (or from their https://remote.it Web Portal) as shown in this [screenshot](https://docs.remote.it/oem-and-bulk-provisioning/registration-into-a-users-account#3.-user-receives-the-device-and-registers-his-account).
Paste it into your IIAB's [/etc/iiab/local_vars.yml](https://wiki.iiab.io/go/FAQ#What_is_local_vars.yml_and_how_do_I_customize_it.3F) as in this example:
```
remoteit_license_key: 592AA9BB-XXXX-YYYY-ZZZZ-6E27654C3DF6
```
2. Also set `remoteit_enabled: True` in /etc/iiab/local_vars.yml
3. If your [IIAB software](https://download.iiab.io/) is not yet installed, do that e.g. by running `sudo iiab` and following any on-screen instructions &mdash; until "INTERNET-IN-A-BOX (IIAB) SOFTWARE INSTALL IS COMPLETE" eventually appears on screen.
When that's complete, skip to Step 5.
4. If your IIAB software is already installed, make sure your IIAB is online, and then run:
```
cd /opt/iiab/iiab
sudo ./runrole remoteit
```
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).
SUMMARY: One or more [remote.it "Services"](https://support.remote.it/hc/en-us/articles/360060992631-Services) needs to be authorized (registered) to allow remote access to your IIAB device.
EXAMPLES: Add an SSH Service on port 22 and/or add an HTTP Service on port 80 ([screenshot guide](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 iiab-remoteit-off`

View file

@ -49,4 +49,15 @@ cli_suffixes:
x86_64: x86_64
remoteit_cli_suffix: "{{ cli_suffixes[ansible_architecture] | default('unknown') }}"
remoteit_cli_url: https://downloads.remote.it/cli/latest/remoteit_linux_{{ remoteit_cli_suffix }}
remoteit_REGISTRATION_CODE: none #eg "592AA9BB-68C8-520A-AACA-6E27654C3DF6" generated in the desktop or web portal
# OPTION #1: Run 'sudo iiab-remoteit' after IIAB is installed.
# OPTION #2: Pre-populate your remote.it account "license key" (a.k.a.
# R3_REGISTRATION_CODE) in /etc/iiab/local_vars.yml -- e.g. prior to installing
# IIAB -- by using a line like:
#
# remoteit_license_key: 592AA9BB-XXXX-YYYY-ZZZZ-6E27654C3DF6
#
# BACKGROUND: You can obtain a license key at https://remote.it or by using
# their Desktop Application (https://remote.it/download/) as shown here:
# https://docs.remote.it/oem-and-bulk-provisioning/registration-into-a-users-account#3.-user-receives-the-device-and-registers-his-account

View file

@ -1,6 +1,20 @@
- name: Using pre-created REGISTRATION_CODE from desktop or web portal
shell: echo {{ remoteit_REGISTRATION_CODE }} > /etc/remoteit/registration
when: remoteit_REGISTRATION_CODE is not none
- name: Copy OPTIONAL remoteit_license_key, e.g. from /etc/iiab/local_vars.yml to /etc/remoteit/registration, if remoteit_enabled and remoteit_license_key is defined
# shell: echo {{ remoteit_license_key }} > /etc/remoteit/registration
template:
src: registration.j2
dest: /etc/remoteit/registration
when: remoteit_enabled and remoteit_license_key is defined
- name: Redact OPTIONAL remoteit_license_key from /etc/iiab/local_vars.yml, if remoteit_enabled and remoteit_license_key is defined
# shell: sed -i '/^remoteit_license_key:/d' {{ iiab_local_vars_file }}
lineinfile:
path: "{{ iiab_local_vars_file }}"
regexp: '^remoteit_license_key:.*'
state: absent
when: remoteit_enabled and remoteit_license_key is defined
# 2022-04-06 QUESTION: Does connectd (below) delete /etc/remoteit/registration,
# but only after confirming online that the license key is valid?
- name: Enable & Restart remote.it "parent" service connectd, which exits after spawning 2 "child" services/daemons below
systemd:
@ -35,10 +49,6 @@
ignore_errors: yes
when: not remoteit_enabled
- name: Clean up REGISTRATION_CODE from {{ iiab_local_vars_file }} if used
shell: sed -i '/remoteit_REGISTRATION_CODE/d' {{ iiab_local_vars_file }}
when: remoteit_REGISTRATION_CODE is not none
# - name: Identify remoteit "Remote tcp connection service" unit file name, including uuid, e.g. remoteit@80:00:01:7F:7E:00:56:36.service
# shell: ls /etc/systemd/system/multi-user.target.wants/ | grep remoteit@
# register: remoteit_service

View file

@ -24,6 +24,23 @@
purge: yes
ignore_errors: yes
# Speeds things up a bit, deferring online claim code generation if not nec:
# https://docs.remote.it/oem-and-bulk-provisioning/registration-into-a-users-account
- name: "'mkdir /etc/remoteit' e.g. if your 'remoteit_license_key: 592AA9BB-XXXX-YYYY-ZZZZ-6E27654C3DF6' exists in /etc/iiab/local_vars.yml"
file:
state: directory
path: /etc/remoteit
when: remoteit_license_key is defined
- name: "'touch /etc/remoteit/registration' e.g. if your 'remoteit_license_key: 592AA9BB-XXXX-YYYY-ZZZZ-6E27654C3DF6' exists in /etc/iiab/local_vars.yml"
file:
state: touch
path: /etc/remoteit/registration
when: remoteit_license_key is defined
# - name: "Install Device Package: {{ downloads_dir }}/{{ remoteit_deb }}"
# apt:
# deb: "{{ downloads_dir }}/{{ remoteit_deb }}"
@ -32,13 +49,10 @@
# apt:
# deb: "{{ remoteit_device_url }}"
- name: Going to use pre-created REGISTRATION_CODE from desktop or web portal
shell: mkdir /etc/remoteit || true && touch /etc/remoteit/registration
when: remoteit_REGISTRATION_CODE is not none
- name: Install remote.it Device Package for your CPU/OS, using https://downloads.remote.it/remoteit/install_agent.sh -- this puts a claim code in /etc/remoteit/config.json which is valid for 24h
shell: curl -L https://downloads.remote.it/remoteit/install_agent.sh | sh
- name: Install /usr/bin/iiab-remoteit from template -- so IIAB operators can quickly enable remote.it AND generate a new remote.it claim code (in /etc/remoteit/config.json) -- optionally downloading + installing the very latest Device Package (like the 2 steps above)
template:
src: iiab-remoteit

View file

@ -18,9 +18,9 @@
- include_tasks: enable-or-disable.yml
- name: Find the claim code if blank the machine was registrated
shell: grep claim /etc/remoteit/config.json | rev | cut -d\" -f2 | rev
register: remoteit_claim
# - name: Extract claim code from /etc/remoteit/config.json if it exists
# shell: grep claim /etc/remoteit/config.json | rev | cut -d\" -f2 | rev
# register: remoteit_claim_code
- name: Add 'remoteit' variable values to {{ iiab_ini_file }}
ini_file:
@ -37,5 +37,5 @@
value: "{{ remoteit_install }}"
- option: remoteit_enabled
value: "{{ remoteit_enabled }}"
- option: remoteit_claim_code
value: "{{ remoteit_claim.stdout }}"
# - option: remoteit_claim_code
# value: "{{ remoteit_claim_code.stdout }}"