Add a server
Adding a server gives you a token and a short install command. The reporter script then sends your software versions to Alopex. How the inventory is used is explained in About servers.
Note
Servers and threats are in beta. They appear only on accounts where Alopex has switched them on.
Before you start
- Servers switched on for your account. If Servers is not in the sidebar, they are not.
- For a host, a root shell to run the install commands once.
- For an environment, a CI pipeline that can store a secret and run
docker runagainst your image. sh,awk,gzipandcurlon the machine or in the image. The script needs all four. The install commands for a host also useuseradd,crontab,mktemp,sha256sumandinstall.- Outbound
httpsfrom the machine or the pipeline toet.alopex.uk. The script is downloaded from there and reports go there.
Read What the reporter sends first if you want to know what leaves the machine.
Create the server
- Select Servers in the sidebar, then Add server.
- In Name, enter a name such as
vps-1. It can be up to 100 characters and must differ from your other servers' names. - Under Kind, choose Host for a machine that runs cron, or Environment for a container image reported from CI.
- Leave Internet facing selected if the server's software listens on the internet. Threats to software that listens on the internet are ranked higher. Clear it for a server that is not reachable from outside.
- Select Add server.
The server page opens with a token under Copy this token now. It won't be shown again. The token starts with alx_. Copy it into your password manager or your CI secrets before you do anything else. If you lose it, select Regenerate token in the Reporter section to get a new one. The old one stops working at once.
Install on a host
Do this for a Host. For an environment, go to Install in CI.
- In the Reporter section, under Install, select Copy to copy the install commands.
- On the host, paste them into a root shell. They:
- create a system user,
alopex-reporter, with no home folder and no login shell, unless it already exists - download the script to a temporary file, check it against the SHA-256 hash shown, and install it as
/usr/local/bin/alopex-reporter.shonly if the hash matches - put the
ALOPEX_TOKENline and an hourly job line in thealopex-reporteruser's crontab, keeping anything else already there
- create a system user,
The commands look like this, with your own hash, token and minute:
# Run as root. Run it again after regenerating the token.
id alopex-reporter >/dev/null 2>&1 \
|| useradd --system --no-create-home --shell /usr/sbin/nologin alopex-reporter \
&& tmp=$(mktemp) && {
curl -fsS https://et.alopex.uk/reporter.sh -o "$tmp" \
&& echo "<sha256> $tmp" | sha256sum -c - \
&& install -m 0755 "$tmp" /usr/local/bin/alopex-reporter.sh;
rc=$?; rm -f "$tmp"; [ "$rc" -eq 0 ];
} && {
crontab -u alopex-reporter -l 2>/dev/null | grep -v -e '^ALOPEX_TOKEN=' -e 'alopex-reporter\.sh'
echo 'ALOPEX_TOKEN=<token>'
echo '17 * * * * /bin/sh /usr/local/bin/alopex-reporter.sh'
} | crontab -u alopex-reporter -
If the hash does not match, nothing is installed and the crontab is left as it was. Alopex chooses the minute from the server, to spread reports across the hour. Use the commands that Alopex shows you.
The script runs as alopex-reporter rather than as root, or as the user your sites run as, so neither the token nor the script has more access than it needs. To use another user, change alopex-reporter in the commands before you run them.
The commands are safe to run again. After you regenerate the token, run them with the new token and they replace the old ALOPEX_TOKEN and job lines.
After you leave the page, the token in the commands is replaced by <token>. Put the token you copied in its place.
Install in CI
Do this for an Environment. The reporter describes the image it runs in, not the CI machine, so it runs inside the container.
- In the Reporter section, under Install, select Copy.
- In your CI settings, store the token as a secret named
ALOPEX_TOKEN. - Add the commands to your pipeline, after the step that builds the image, and replace
<image>with your image name.
The commands look like this:
# Run this in CI after each deploy. curl -fsS https://et.alopex.uk/reporter.sh -o alopex-reporter.sh echo "<sha256> alopex-reporter.sh" | sha256sum -c - docker run --rm -e ALOPEX_TOKEN="$ALOPEX_TOKEN" -v "$PWD/alopex-reporter.sh:/alopex-reporter.sh:ro" <image> sh /alopex-reporter.sh --environment
The image needs sh, awk, gzip and curl. The --environment option tells the reporter to describe an image, so it leaves out the machine's addresses and Plesk site names.
An environment reports each time the pipeline runs these commands. It never goes stale, so a pipeline that stops running raises no alert.
Check that it reported
Open the server from Servers. A new host shows Waiting for first report. An environment shows Reports on deploy.
To avoid waiting for the cron minute, run the job once by hand as the cron user. As root:
su -s /bin/sh -c 'ALOPEX_TOKEN=<token> /bin/sh /usr/local/bin/alopex-reporter.sh' alopex-reporter
A report that Alopex accepts prints nothing.
Reload the server page. A host now shows Reporting, and Reported gives how long ago. Components lists what the reporter recognised, with a count of packages in the last report.
If nothing changes, see My server stopped reporting.
Link domains
Linking tells Alopex which of your domains a server serves, so a threat shows the domains it touches.
- On the server page, find Suggested domains. For each suggestion, choose a role if you want one, then select Link. Select Dismiss if the suggestion is wrong.
- For a domain that is not suggested, use Link a domain. Choose the Domain, choose a Role (No role, Web, Database, Worker or Proxy), then select Link domain. A role is only a label, shown beside the domain on a threat's page.
The domain appears under Linked domains. Change its role from the list beside it, or select Unlink to remove the link. Suggestions come from DNS records that point at the server's addresses and from Plesk site names. Domains behind Cloudflare or a load balancer need linking by hand.
Next steps
- Add anything the reporter cannot see, such as a managed database, in Server settings.
- Read About threats to see what Alopex does with the inventory.