## OrpheAgent Binary Daemon Version

### Quick Start

#### Step 1. Generate a Provision Key on the OrpheLink
1. Log in to the OrpheLink dashboard and navigate to the Provision page.
2. Generate and copy a new Provision Key for your device.

#### Step 2. Install OrpheAgent and LuCI Web UI on the Device
1. Upload the OrpheAgent `.ipk` package to your OpenWrt/LEDE device. The package will be named `orphe_agent_1.1.2_<architecture>.ipk` (replace `<architecture>` with your device architecture, e.g., amd64, armhf, arm64).
2. (Optional, recommended) Upload the LuCI Web UI package `luci-app-orphe-agent_1.1.2.ipk` to your device for web-based management.
3. Install the packages using the following commands:
    ```shs
    opkg update
    opkg install orphe_agent_1.1.2_<architecture>.ipk
    opkg install luci-app-orphe-agent_1.1.2.ipk
    ```
   The LuCI package is optional but provides a graphical interface for configuration and monitoring via the router's web UI.

#### Step 3. Register the Provision Key
1. Run the following command and paste your Provision Key:
    ```sh
    orphe-agent config save --provision-key <your Provision Key>
    ```
2. You will see output similar to:
    ```
    Saved configuration at /etc/orphe-agent/orphe-agent.yaml
    To edit the config run:

            vi /etc/orphe-agent/orphe-agent.yaml

    Restart the OrpheAgent to apply the new configuration.

    To restart the OrpheAgent run:

            sudo orphe-agent down
            sudo orphe-agent up

    Do you want to restart the OrpheAgent now? (yes/no): yes
    Restarting OrpheAgent...
    ```
3. When prompted "Do you want to restart the OrpheAgent now? (yes/no):", type `yes` to let OrpheAgent automatically restart and apply the new configuration.

#### Step 4. Discover and Provision the New Agent on the OrpheLink
1. Go back to the OrpheLink Provision page and click re-discover. The new agent will appear in the device list.
2. Select the OrpheAgent device, then click the provision button at the bottom to let the OrpheLink take over management.
3. After provisioning succeeds, you can see the device on the OrpheLink's inventory page.
---

### Dependencies

To ensure all features work as intended, it is highly recommended to install all the following dependencies.

#### orphe_agent_1.1.2_<architecture>.ipk

These dependencies enhance OrpheAgent's networking capabilities and compatibility on OpenWrt/LEDE devices:
**Depends:**  
- `ip-full`: Provides the complete set of `ip` command utilities for advanced network configuration and management.
- `kmod-tun`: Kernel module supporting TUN/TAP virtual network interfaces, essential for tunneling functionality.
- `iptables-nft` (or `iptables`): Used to configure and manage firewall rules, enabling traffic control and security policies.
- `kmod-ipt-nat`: Kernel module supporting Network Address Translation (NAT), required for traffic forwarding and isolation.

These dependencies ensure OrpheAgent can properly create tunnels, manage network traffic, and integrate seamlessly with the OpenWrt/LEDE networking stack.

**Suggests:**  
These packages are optional and designed to provide comprehensive support for advanced users. They are not essential for basic operation and must be installed manually using opkg if needed.  
They enhance authentication capabilities when establishing connections between OrpheAgent, enabling secure and flexible Auth features for site-to-site networking.
- `ipset`: Provides support for managing IP sets, enabling efficient handling of large lists of IP addresses for firewall rules and network filtering.
- `conntrack`: Offers connection tracking utilities, allowing inspection and management of active network connections for advanced firewall and NAT operations.
- `kmod-ipt-conntrack`: Kernel module that enables connection tracking features in iptables, essential for stateful packet inspection and dynamic firewall rules.

#### luci-app-orphe-agent_1.1.2.ipk
For the best experience with the LuCI Web UI, ensure these dependencies are present. Most are included on OpenWrt/LEDE systems with LuCI, but installing all is recommended for full functionality:

**Depends:**  
- `luci`: Provides the core LuCI web interface framework for OpenWrt/LEDE.
- `rpcd`: Enables remote procedure calls, allowing backend communication for web UI operations.
- `uhttpd`: Lightweight web server required to serve the LuCI interface.
- `orphe-agent`: The OrpheAgent binary package, required for backend functionality.
- `lua`: Scripting language used by LuCI and its modules.
- `liblua`: Lua interpreter library, supporting LuCI scripts.
- `luci-base`: Core LuCI libraries and utilities.
- `luci-lib-base`: Base library for LuCI modules.
- `luci-lib-nixio`: Provides network and system I/O functions for LuCI.
- `luci-compat`: Compatibility layer for LuCI modules.
- `curl`: Command-line tool for transferring data, used for backend API calls.

These dependencies guarantee that the LuCI Web UI can fully manage and monitor OrpheAgent, providing a reliable and user-friendly experience.