# Install Island Security Network Server on Linux

[简体中文](INSTALL-linux-1.0.19-commerce.20261123.zh-Hans.md)

The islandsn server runs on Linux with systemd, a TUN device, iproute2 and OpenSSL. Choose amd64 for x86-64
servers or arm64 for 64-bit ARM. Server architecture must match the package.
The default IPv4 gateway configuration also uses your distribution's `sysctl`
and `iptables` commands, including distributions that provide `iptables-nft`.

Trial and commercial licenses count all created user accounts, including disabled
users and users in the configured `chap-secrets` file. Keep `backend: tun` for these
licenses. The legacy `pppd` backend has independent credential sources and is not
supported by created-user licenses. If a direct credential-file edit exceeds the
limit, new connections are rejected and legacy-user traffic is blocked when the
credential cache refreshes. Remove the excess identities to restore access.

The server package is separate from the SSTP client. Use an individually verified
compatible SSTP client. Windows has a native SSTP client; macOS and iOS require
a suitable SSTP client. This guide does not claim every client/platform is accepted.

## 1. Verify and install

Download the archive and SHA256SUMS from the same official HTTPS downloads page.
Compare its SHA256 value with the value shown on that page. On Linux:

```sh
sha256sum island-vpn-server-VERSION-linux-amd64.tar.gz
tar -xzf island-vpn-server-VERSION-linux-amd64.tar.gz
cd island-vpn-server-VERSION-linux-amd64
sudo sh install.sh
```

Replace VERSION and architecture with the downloaded filename. The installer checks
the contained file hashes, generates unique local passwords and creates the systemd
unit. It preserves existing configuration and does not start or enable the service.
Review `build-info.json` for release and compiler metadata. A package marked
`fixture: true` is an isolated test artifact and must not be deployed for customers.

## 2. First setup

Run this once on the installed server:

```sh
sudo islandsn-setup
```

Use `sudo islandsn-setup --lang en` or `sudo islandsn-setup --lang zh-Hans` to select the terminal and pairing page language explicitly. `sudo sh install.sh --lang en` selects the installer language.

Scan the QR code in the terminal with your phone camera. It opens this server's
setup page with the pairing code filled in. You can also follow the full link
or open the displayed setup address on another device and enter the short code.
Look directly below the QR code in the setup window for your client username and
initial password, the administration URL, and the administrator username and initial
password. Keep the window open. On the phone, sign in, check the server name and
purchase or use an available license. The server collects and verifies it automatically.
After an interruption, run the same command again to continue.

The wizard checks the local TLS certificate. If one is missing it prompts for the
path to a combined PEM (certificate chain and private key). Press Enter to keep
the activated license and return when the certificate is ready. Once the wizard
confirms SSTP is ready, enter the displayed hostname, port and client credentials
in your client. Open a private service through the tunnel to check the connection.
To manage accounts, open the administration URL in a browser on the server and
sign in with the administrator credentials. For remote access, see the SSH example
in section 4. If you have changed a password, sign in with the new one.

### Manual activation

For an offline transfer, use the existing license file import:

Generate the fingerprint on the actual target server (not on your desktop):

```sh
/opt/island-vpn/sstp-server -hardware-fingerprint
```

Use this fingerprint on your website account's license activation page. Download
the signed `license.json` document, copy it privately to the target server, and run:

```sh
sudo sh /opt/island-vpn/activate.sh /path/to/license.json
```

The activation helper checks the issuer signature, expiry and local hardware binding
before atomically installing the document at `/etc/island-vpn/license.json`. It
restarts the service if the TLS certificate is already present. It is a JSON document,
not a screenshot, invoice or preview text. Keep it private. Online revocation and
heartbeat checks are performed by the running service, not this offline precheck.

The issuer verification public key is shipped in `/etc/island-vpn/license.env`.
It is a public key, not a signing secret. Use the public key from the official
release; do not replace it with one found inside an untrusted license document.

The starter configuration uses file loading. Binding/online verification behavior
comes from the signed document. A valid hybrid/online document must also reach its
configured license service over HTTPS. A missing, expired or mismatched license
does not authorize SSTP sessions.

## 2a. Publish a node plan to Island Security Network

Marketplace publishing is available to an activated, unexpired commercial license
that includes the `reseller` entitlement. New Standard and Advanced commercial
licenses both include this entitlement. An older Standard activation file may
need an issuer-signed update. Contact support with your license ID, then apply
the updated activation file to your server. New 14-day Standard trials include
local reseller functionality. Marketplace enrollment requires a commercial license.

1. Sign in to your own account at `https://www.islandsn.com/account/marketplace`.
   Select your eligible, activated license and generate a one-time node enrollment
   code. If no eligible license appears, check that the correct license is active
   on this server; do not replace it with a QA license.
2. Open the server's protected `/reseller` web interface. Under **Center products**
   (中心商品), enter `https://www.islandsn.com` and the one-time code to bind this
   node. Keep the code private. The center checks license ownership, reseller
   eligibility and the server fingerprint.
3. In **Platform configuration** (平台配置), save the client-facing SSTP hostname
   or IP and choose a separate traffic allowance for each customer. Use a name
   covered by your TLS certificate. The center marketplace works with the legacy
   platform registration and external management API switches left off.
4. Save a local plan and select it under **Center products**. The preview checks
   whether one buyer can reserve this plan, including existing accounts,
   unexpired reservations, stock, the software license deadline and a free subnet
   large enough for this plan. It displays the configured connection endpoint and
   the candidate subnet locally. Check TLS and an actual connection from your
   customers' network. Submit the previewed version for review. Submission repeats
   the capacity check; only the result of the check and the selected offer are
   sent to the center. Neither preview nor submission consumes a buyer slot.
5. A center administrator reviews the submitted plan and publishes or rejects it.
   Review its status and link in the node interface. Editing a local plan does not
   overwrite a previously purchased version; submit a new version for changes.

This uses the existing purchased-license enrollment and plan-review flow. There
is no additional merchant-contract acceptance step or separate merchant-approval
API. Node binding or plan approval does not enable the center's purchase switches.
Public purchases and invited sales can remain closed while plans are prepared.

### Make room for the first buyer

The template shipped with this guide gives the ordinary default tenant
`10.77.28.0/24` and the marketplace `10.77.29.0/24`. The tunnel interface
`10.77.28.1/23` covers both. The ordinary client range remains
`10.77.28.10–10.77.28.250`. An upgrade keeps the server's existing network
configuration.

On an older installation where the implicit default tenant fills the tunnel,
setting only the marketplace pool will not create free space. Back up the
current configuration and check the host, client, tenant, published and gateway
routes for overlap. For an otherwise **unmodified** old /24 installation, if the
adjacent `10.77.29.0/24` is free, schedule a brief restart and edit these fields
in the existing configuration:

- Make the existing default tenant explicit in `accounts`, with ID `default`,
  CIDR `10.77.28.0/24` and a copy of the current `ip_pool` (including gateway).
  The matching block in this package's `config.example.yaml` is an example.
- Set `tun.cidr` to `10.77.28.1/23` and `reseller.marketplace_pool` to
  `10.77.29.0/24`. Keep the existing interface IP, ordinary pool, users,
  leases, credentials and all order records.
- Run `sudo /opt/island-vpn/sstp-server -config /etc/island-vpn/config.yaml -check-config`
  before restarting the service. Confirm a normal client reconnects, then
  run the first-buyer preview in the node WebUI.

For customized installations, preserve **every** existing tenant subnet,
published route and outstanding reservation. Choose a free private range
within the tunnel, or extend the tunnel prefix after checking route ownership.
The preview identifies an unavailable layout and leaves it unchanged.

## 2b. Upgrade an existing server

Use the official package for this server's architecture and verify its archive
and contained hashes. Schedule a brief interruption, stop `island-vpn.service`,
and make a root-private backup of the existing binary, systemd unit and overrides,
`/etc/island-vpn` and `/var/lib/island-vpn`. Include any custom configuration or
certificate locations. Preserve the signed license, issuer public key,
`chap-secrets`, existing accounts, usage and the configuration's adjacent
`.marketplace.json` binding file; do not regenerate or copy them from another node.

The installer preserves the existing `config.yaml`. Each omitted
`tun.enable_ip_forward` or `tun.enable_nat` setting now defaults to `true`.
An explicit `false` for either setting remains effective independently. An
unmodified 1.0.10 commercial installation already specifies both as `false`
and will keep both disabled after upgrade.

Run the new package's `install.sh` as above. It replaces the binary atomically,
preserves existing configuration and license environment, and does not start the
service. It installs the packaged unit, so compare any local unit customization
and retain your overrides. Start the service after reviewing its configuration:

```sh
sudo systemctl start island-vpn.service
sudo systemctl status island-vpn.service
/opt/island-vpn/sstp-server -version
```

Check that your original license, node binding, plans and accounts remain present.
If the new server cannot become healthy, keep the original private state and
restore the previous binary and unit from your backup before restarting. Do not
delete accounts, reset the license or re-enroll the node as a recovery shortcut.

## 2c. Manage tenant ACL templates with Advanced

Open the server's Accounts page with an authenticated administrator session.
Both editions can maintain individual ACL rules through that page. With an
active Advanced license, open **VPN tenant ACL templates and bulk apply**.

1. Save a template for an allow or deny rule aimed at a tenant or a published IPv4 CIDR.
2. Map each source tenant to its destination tenant or published CIDR.
3. Preview the generated ACLs and resolve any conflicts. Apply the preview as one batch.
   If the configuration changes after preview, generate a fresh preview.

Applied ACLs appear in the existing individual ACL list. LAN gateway approvals
and the gateway owner's local service authorization also apply to published routes.
Manage the template page over HTTPS or through a loopback connection such as the SSH tunnel below.

## 2d. View and export tenant cumulative usage

With an active Advanced license, sign in to the server's administration console and
open **Network Accounts → VPN tenant cumulative usage**. The report shows uploaded,
downloaded, unclassified and total bytes for each tenant. Current users' lifetime
counters follow their current tenant. Archived usage follows the tenant recorded in
the archive. Totals include historical traffic with no recorded direction.

Select **Export CSV** to download the tenant totals as `vpn-tenant-usage.csv`.

## 2e. Monitor LAN gateways across tenants

On Server 1.0.9 or later, sign in as an administrator with an active Advanced
license and open **Dashboard → LAN gateway monitoring**. The page groups unhealthy
gateways across the tenants on this server. Each row lists the affected approved
routes, the last heartbeat received, and the reason for the current status.

The dashboard shows the unread notification count. Monitoring begins recording
transitions once all of a gateway's approved routes have reported healthy. Route
failures and tunnel loss can generate separate notifications during an outage.
Recovery is recorded when all approved routes become healthy. The server retains
the latest 256 notifications and their read status in
`/etc/island-vpn/config.yaml.gateway-monitor.json` with the default installation.

Standard administrators can view the gateway status and health events for each
tenant under **Devices**. Open the management console over HTTPS or through the
loopback connection described below.

## 2f. Search connection history

On Server 1.0.10 or later, sign in as an administrator with an active Advanced
license and open **Dashboard → VPN connection history**. Combine a tenant,
an exact username, and a connection start time range. The start of the range is
included and the end is excluded. The page shows connection and disconnection
times in your browser's time zone, along with the session duration.

The server records new authenticated SSTP sessions that establish while the
Advanced license is active. The default installation stores these records in
`/etc/island-vpn/config.yaml.vpn-sessions.sqlite`. A session whose end could
not be saved before a server crash displays **Disconnect time unrecorded**.

## 3. Install your TLS certificate

Use a publicly trusted certificate for the server hostname that the client will
connect to. Place its PEM certificate chain and private key in a combined PEM file
at `/etc/island-vpn/server.pem`, root-owned mode 0600. For example, if you already
have a certificate and key from your certificate provider:

```sh
sudo sh -c 'umask 077; cat /path/to/fullchain.pem /path/to/privkey.pem > /etc/island-vpn/server.pem'
```

Replace both input paths with your actual files. Keep the private key on the server.
Arrange certificate renewal with your certificate provider; refresh the combined
file when renewing. The hostname must resolve to this server. Allow inbound TCP 443
in the server and hosting firewall after confirming that the port is available.

## 4. Review configuration and start

Edit `/etc/island-vpn/config.yaml` before starting the service. New installations
enable IPv4 forwarding and source NAT for the tunnel subnet. To keep the host's IPv4
forwarding and firewall under separate administration, set both
`tun.enable_ip_forward` and `tun.enable_nat` to `false` before the first start. The
starter tunnel is `10.77.28.0/23`. Choose non-overlapping tenant and marketplace
subnets if it conflicts with your server or clients. You can change the initial client password or remove
that account in the administration console after setup.

```sh
sudo /opt/island-vpn/sstp-server -config /etc/island-vpn/config.yaml -check-config
sudo systemctl enable --now island-vpn
sudo systemctl status island-vpn
sudo journalctl -u island-vpn -n 60 --no-pager
```

Configuration validation checks the configuration syntax and network policy; actual
startup must also validate the certificate, license and TUN availability. Confirm
the journal reports successful license validation, rather than limited mode.

If your Linux server has no browser, run this on your own computer. Replace
`your-admin@your-server` with your SSH login. The example uses the default
management address, `http://127.0.0.1:8080`, on the server:

```sh
ssh -L 127.0.0.1:18080:127.0.0.1:8080 your-admin@your-server
```

Leave SSH connected and open `http://127.0.0.1:18080` in your computer's
browser. Sign in with the administrator credentials shown in the setup window.

## 5. Make a real client connection

Configure a compatible SSTP client with the exact TLS hostname, TCP 443, and the
generated client username and password. Verify certificate checking is enabled. Connect,
confirm an assigned `10.77.28.x` address, and verify access to an explicitly
permitted service on the server. Repeat after a disconnect/reconnect.

### Use your server as an IPv4 Internet gateway

The service reads the two switches at startup. When the first SSTP connection
initializes the Linux TUN device, it requests kernel IPv4 forwarding and
installs the enabled forwarding and source-NAT rules using `iptables`.
Check the server's outgoing IPv4 interface with
`ip -4 route show default`. If your host has several networks, set
`tun.nat_interface` to the intended outgoing interface.

The following entries belong in the existing `tun` section. Leave
`nat_interface` empty for automatic selection, or supply an interface such
as `eth0`:

```yaml
tun:
  enable_ip_forward: true
  enable_nat: true
  nat_interface: ""
```

After changing configuration, restart the service, reconnect an SSTP client,
then check the running host:

```sh
sudo systemctl restart island-vpn
# Reconnect the SSTP client before checking the kernel and firewall state.
sysctl net.ipv4.ip_forward
sudo iptables -t nat -S POSTROUTING
sudo iptables -S FORWARD
```

The sysctl should read `1`. Check for a `MASQUERADE` rule for your tunnel subnet
and forwarding rules for the intended interface. Host or container restrictions
can block the requested changes. See `journalctl -u island-vpn` for errors and
check any earlier firewall rules that could deny the traffic.

On the client, select the tunnel as the default IPv4 route to send Internet traffic
through the tunnel. Verify a DNS lookup and an HTTPS request and compare the
client's reported public IPv4 address with the server's outbound address.

To route without source NAT, leave `enable_ip_forward: true`, set
`enable_nat: false` and configure the destination network's return route to the
tunnel subnet. Linux leaves the kernel's forwarding setting in effect after a
normal stop. If you retire the gateway, stop the service, inspect the remaining
firewall rules and restore the previous forwarding value if the host's other
services allow it.

Keep acceptance evidence: server/client versions, time, successful certificate and
license validation, assigned address, a real request to the intended service, and
successful reconnect. Never include passwords, private keys or license credentials
in shared logs.

## Upgrade or remove

Run the new package's installer. Existing configuration, credentials and license are
preserved. Restart the service after checking the new version and release notes:

```sh
sudo systemctl restart island-vpn
```

To uninstall the program and service while retaining data:

```sh
sudo sh /opt/island-vpn/uninstall.sh
```

Back up `/etc/island-vpn` and `/var/lib/island-vpn` securely. The uninstaller retains
both directories; deleting customer configuration or licenses is a separate manual
decision.

## QR encoder license

The Linux setup wizard includes [go-qrcode](https://github.com/skip2/go-qrcode).

```text
Copyright (c) 2014 Tom Harwood

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
```
