Skip to main content
Documentation

What the reporter sends

The reporter is a short shell script that you run on your own server or in your own pipeline. It sends software versions, and some details that identify the machine, to Alopex in one request. Alopex never logs in to your server.

Note

Servers and threats are in beta. They appear only on accounts where Alopex has switched them on.

The script is a single file of about 170 lines, and the full text is on the server page under The script. Read it before you run it. This page describes what it does, and the script is the authority if the two ever differ.

What it needs and does

  • It needs sh, awk, gzip and curl.
  • It needs no root. It runs read-only commands and writes no files.
  • It makes one https request to the Alopex ping host and contacts nothing else, unless you set ALOPEX_URL yourself.
  • It is run by cron on a host, or by your pipeline for an environment. Setup is in Add a server.

What it sends

DataWhat is sentWhere it comes fromHosts only
Schema and reporter versionTwo numbers that say which format and which script version this is.The script.No
Modehost or environment, which is the Kind of the server.The --environment option.No
Host nameThe machine's name.The hostname command.No
Operating systemThree values: ID, VERSION_ID and PRETTY_NAME./etc/os-releaseNo
PackagesThe name, version and source package name of every installed package, and which package manager they came from (dpkg or apk). With dpkg, also the archive and archive component (such as main or universe) each came from, when apt knows, so Alopex can tell Ubuntu's own builds, which follow Ubuntu's support dates.dpkg-query and apt-cache policy, or apk list -INo
ProgramsFor each of php, nginx, mysql, mysqld, mariadb, mariadbd, postgres, psql, sqlite3 and node that the script finds: the program's name, its path, and the first line of its version output that contains a version number.Running each program with -v or --versionNo
Plesk versionThe version number, when Plesk is installed./usr/local/psa/versionNo
AddressesThe machine's global IP addresses.ip -o addr show scope globalYes
Plesk sitesThe names of the sites Plesk hosts, when Plesk is installed.plesk bin site --listYes

The script looks for each program in every folder on PATH, plus /usr/local/sbin, /usr/local/bin, /usr/sbin and /sbin. It also looks for PHP under /opt/plesk/php/, Node under /opt/plesk/node/ and PostgreSQL under /usr/lib/postgresql/. Cron runs with a short PATH, which is why it adds those folders.

Alopex keeps only the public addresses from the list, and drops private and reserved ones. For a host it also records the address that the report arrived from.

What it does not send

The script does not send file contents, configuration, logs, users, passwords or environment variables. It sends only the data in the table above, and ALOPEX_TOKEN in the request header.

It does send data that is not a version: the host name, the program paths, the addresses and the Plesk site names. It reads three environment variables of its own, all optional for a dry run. ALOPEX_TOKEN authenticates the report. ALOPEX_URL changes where the report goes, and is filled in for you in the copy you download. ALOPEX_ROOT exists for tests.

To see the data before it leaves, run it with --dry-run. See Check it yourself.

The request

The script makes one request:

  • Method and address: POST to https://et.alopex.uk/report.
  • Body: the report as JSON, compressed with gzip.
  • Headers: Content-Type: application/json, Content-Encoding: gzip, and Authorization: Bearer <token>.
  • Time allowed: 30 seconds.

Alopex answers with a status and no body:

StatusMeaning
204The report was accepted.
401The token does not match a server.
403Servers are switched off for the account, or the account is suspended.
413The body is larger than the first two limits below, or is not valid gzip.
415The body was not sent as application/json.
422The report is not valid, has more packages than the limit below, or its mode does not match the server's kind.
429Too many requests. See the limits below.

The script uses curl -f, so it prints an error and exits with a failure for any of the error statuses above.

Authentication

The token identifies the server. It starts with alx_, followed by 40 letters and digits. Alopex stores only a hash of it, so it is shown once, when you add the server or regenerate it. See Server settings.

The script reads the token from the ALOPEX_TOKEN variable and passes it to curl through a file descriptor rather than on the command line, so ps does not show it. The crontab holds the token in plain text, and while the script runs the token is in its environment, so the user who runs the job, and root, can read it. The script refuses to run if the variable is empty or contains anything other than letters, digits and underscores. Treat the token as a password. Anyone who has it can send a report for that server.

Limits

LimitValue
Request body, compressed512 KiB
Report after decompression4 MiB
Packages in one report20,000
Programs in one report64
Addresses kept from the report32
Plesk sites kept2,000
Reports per minute for one token10
Reports per minute from one IP address60
Downloads of the script per minute120

A report over the first three limits is refused. Over the limits on programs, addresses and sites, the report is trimmed: the extra ones are not kept. Over a rate limit, the request is refused with 429.

Schedule

A host runs the reporter hourly from cron, at a minute that Alopex chooses for it. An environment runs it whenever your pipeline does. A host that has not reported for 3 hours is marked as Stopped reporting. See About servers.

Check it yourself

  1. Copy the SHA-256 hash from The script on the server page.

  2. Download the script and compare. The install commands do this for you, and refuse to install a file whose hash does not match:

    curl -fsS https://et.alopex.uk/reporter.sh -o alopex-reporter.sh
    echo "<sha256>  alopex-reporter.sh" | sha256sum -c -
    
  3. Read alopex-reporter.sh.

  4. Print what it would send, without sending anything. The token is not needed:

    sh alopex-reporter.sh --dry-run
    

    Add --environment to see the report for an environment.

The printed JSON has the fields in the table above and nothing else. Run it as the same user as the cron job: what a command such as plesk prints can depend on the user.