sitetus / collector
Read-only single-file PHP collector for the Sitetus monitoring panel: answers the panel's signed pull with an inventory and health envelope, keeps no secret on the server.
Requires
- php: >=7.4
Requires (Dev)
- phpunit/phpunit: ^9.6
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Read-only collector for the Sitetus monitoring panel: a single PHP file you place on your server so the panel can read a package inventory and health facts from inside the site, through signed requests the panel sends. It is optional: the panel works without it; the collector only adds inventory and inside-the-server health data.
The file is generated by the panel for each installation (public key, identifier and a random path baked in) and downloaded as a zip. The Laravel wrapper (sitetus/laravel-collector) installs the same core through Composer.
What this file will not do
A public commitment, enforced by the code and its tests:
- It never reads or transmits
.envor configuration files. Level 2 reports a fixed list of flags and counts only:app.debug,app.env, session cookie flags, theapp.urlscheme, whetherAPP_KEYis set, the names of the mail / cache / queue / session drivers, the number of pending jobs and migrations, flags for thepublic/storagelink, the Redis version string; fromphp.inionly flags and limits, never paths. - Where the project sits on the server is reported without a path, an account name or a host name: two yes/no flags (
public_htmlorprivate_htmlon its path; the document root being the project root), the hosting panel as one word (cpanel,plesk,directadmin,unknown), and the account the PHP process runs as only as the first 12 characters of a hash keyed with the installation's project key. From/etc/os-releaseonly theIDandVERSION_IDvalues are sent (for exampleubuntu 22.04). - Maintenance mode is read from the marker file only as on/off, for how long, and whether a bypass secret exists — never the secret or the file content.
- It never transmits file contents, logs included — only sizes, counts and ages. Optional modules add relative file names under the web root (at most 50 each), never content. The first 4 KB of
.htaccess/.user.ini/web.configin the uploads directory are read locally and reported only as a class: enables PHP / protective / unknown. The bot-traffic module reports counts per bot identity from the access log — never an IP, an address, a referer or a User-Agent string. - It never reads database records (only a connection attempt, its latency, the server version and — on MySQL and MariaDB running on the same server — whether the application's database account may connect from the server itself, from one named host or from any host, as the single word
local,specificorany; never the account name or the host), collects no personal data, makes no outbound requests on its own, stores no secret on the server and writes nothing except its own nonce file. - It never uses a request parameter as a path, command or include target.
- Modules you did not select are not in the file at all, and the panel cannot push code into it.
- A request without the signature headers, or with another installation's project key, gets an empty
404, exactly as if the file did not exist. A request that carries this installation's project key but cannot be accepted gets an empty403with one fixed word in theX-Sitetus-Errorheader (see "How it works") — never a body, never anything else about the server. Afterexpires_at, or after 90 days without a valid request, it sleeps: even a correctly signed request gets a404until a new package is installed. - The code is open source (MIT).
How it works
- The panel's package puts the file under a random path (
public/<random>/index.php). - The panel sends a signed request there a few times a day; the file verifies the signature with the embedded public key (Ed25519, or RSA-SHA256 where
sodiumis unavailable) and answers with a read-only JSON envelope. - Every request without the signature headers or with another project key gets a bodyless
404. No secret lives on your server: the public key and the installation identifier are not secrets. - When the project key is right and the request is still refused, the answer is a bodyless
403whoseX-Sitetus-Errorheader names the reason, so the panel can tell you what to fix:unsupported-algo(this PHP cannot verify the file's signature algorithm;X-Sitetus-Supportslists the ones it can),signature(the signature does not verify: the file was changed or replaced, or a header is altered on the way),skew(the server clock is more than 10 minutes off),nonce-store(the collector's folder is not writable),nonce(the request was already used). - Panel requests come from fixed IPs:
https://sitetus.com/ips.txt
Install (shared hosting included)
- Download the zip from the panel:
index.phpplus an install note. - Upload
index.phpwith FTP or the file manager into the random-named folder under yourpublic/(or web root) directory, as the package says. - Press "Verify connection" in the panel. That is all.
Optional one line (Laravel): to let the panel watch the scheduler and queue health, add the single line from the package to routes/console.php and deploy; without it those two checks show "no data" and nothing else is affected.
Uninstall: delete the file. The panel side can also revoke the collector with one click.
Composer wrapper (Laravel)
The same core is available as the sitetus/laravel-collector package (PHP ≥ 8.1): its service provider registers the pull route (/sitetus/<install-path>), writes the scheduler and queue heartbeats itself (no line to add), and lets you add developer-defined checks to the envelope with Sitetus::check('orders_last_24h', fn () => CheckOutcome::ok(42)) — numbers and booleans only, never text. The envelope is byte-for-byte the single-file one, except for collector.name.
Optional modules
No module is selected by default. You choose them in the panel when the package is generated; the code of every module you did not choose is removed from your file, and the list of the selected ones is written at its top.
| Module | What it adds |
|---|---|
files |
Names (never content) of sensitive, recently changed or suspicious files under the web root and the upload directories |
archives |
Number, size and names of archive and dump files left under the web root |
permissions |
World-writable files and directories in the project |
bot_traffic |
Request counts per AI crawler from the access log |
files: what the content scan recognises
The first and last 8 KB of the PHP files under the web root are read on your server and matched against a short list of shapes that planted code takes. A match sends the file's name and the id of the rule, never a line of the file.
- Evaluation of decoded or request-supplied text, a function whose name comes from the request, a command run directly from request input, the evaluating modifier of an old regular-expression function, and an encoded block of 800 characters or more.
remote_loader: code that runs what it has just fetched — an evaluation whose argument reads a file or an address, or an include of a web or FTP address, adata:stream or the request body.shell_toolkit: a file that calls four or more different command-execution functions and also reads request input. Code that only looks for a function the host left enabled stops at two or three and does not read the request in the same file.
A match is a reason to look at the file, not a verdict; "nothing matched" says nothing about a file longer than 16 KB beyond its two ends.
Verification
Every envelope carries the SHA-256 of the installed file (collector.file_hash); the panel compares it with the fingerprint it recorded when it generated your package, and the source version is written at the top of the file. composer build prints the SHA-256 of the build it produces.
Requirements
- PHP ≥ 7.4, zero Composer dependencies.
- The
sodiumextension, to verify the Ed25519 signature of the panel's requests (bundled with PHP since 7.2, but some hosts switch it off). Without it an Ed25519 package answers403unsupported-algo; the alternative is an RSA-SHA256 package, which needs theopensslextension instead. - A writable collector folder: the file keeps its nonce store (one small JSON file) next to itself. If the folder is not writable, requests are refused with
403nonce-store. Nothing else is ever written.
Works under strict disable_functions and open_basedir; what it cannot measure is reported as "no data".
Development
composer install composer test # PHPUnit composer build # produces dist/index.php, lints it and prints its SHA-256
Security reports: write to security@sitetus.com; please do not open a public issue. See SECURITY.md.
License
MIT — LICENSE.