Documentation / Getting started

Requirements

This page lists what you need before installing Neti: the server, an SMTP account for the sign-in codes, and the domains and backends you want to publish. It also says which software the package brings with it and how Neti sizes its own PHP processes. The installer checks the server by itself and stops without changing anything if a requirement is not met; see Installation.

The Neti server

  • Debian 13 (trixie), amd64 architecture, clean installation. The installer refuses any other system, version or architecture.
  • At least 1 GB of RAM and 4 GB of free disk space on the root partition (/). The installer accepts a machine that reports 900 MB or more, because a "1 GB" virtual server usually shows a little less.
  • A public IP address (a VPS is perfectly fine). The server does not need a domain name of its own: the console is reached by IP address. A server behind NAT also works, with a port forward on the router: the guided setup detects it and lets you enter the public address by hand (see Identity).
  • root access over SSH. The installer and the neti command must run as root.
  • No other website on the machine. On a new installation the installer stops if nginx already has sites configured (anything other than Debian's default site) or if ports 80/443 are already used by a program other than nginx. Neti owns the web ports of the machine: it removes Debian's nginx welcome page and writes its own nginx configuration.
  • An outgoing Internet connection: Debian packages, the Neti repository, certificates, the APIs of the DNS providers, the lists Neti downloads (Cloudflare address ranges, Tor exit nodes).

The installer checks system, architecture, RAM and disk by itself and stops without modifying anything if something is wrong.

To send the sign-in codes

  • An SMTP server: host, port, security (STARTTLS, SSL/TLS or none), user, password and sender address. You enter it in the guided setup and prove it with a test email (see Outgoing email).

Email is not optional. Neti sends the sign-in codes by email, to the visitors of the protected services and to the administrator too when signing in to the console from a new browser. Without a working SMTP server the administrator cannot get back in from another device.

To publish services

  • The domains to publish and the possibility to change their DNS records.
  • Optional but recommended: the DNS of the domains hosted at a supported provider (Cloudflare or OVHcloud), so that Neti creates the records and obtains the certificates without opening port 80. See DNS.
  • The backends (the applications to protect) reachable from the Neti server: over a direct network connection or through a WireGuard tunnel. See Network & Tunnels and the glossary entries backend and tunnel.

What gets installed

The neti package depends on these packages from the Debian repositories; APT installs them together with Neti:

  • nginx and PHP 8.4 (php8.4-fpm, php8.4-cli, php8.4-sqlite3, php8.4-curl, php8.4-mbstring). Neti uses its own group of PHP processes, sized on the CPU and memory of the server (8 to 64 processes) and recalculated at every update; Debian's default one stays as it is (see Neti's PHP processes);
  • nftables and ufw (firewall), fail2ban;
  • wireguard-tools, iproute2, socat;
  • openssl, curl, ca-certificates, gpgv, python3, sudo, cron, logrotate;
  • unattended-upgrades (Debian's automatic security updates).

The package also recommends mmdb-bin (a reader for the GeoIP databases). Before adding the Neti repository the installer installs ca-certificates and gnupg, which it needs to verify the repository key.

These are installed later, from the console and only if you need them:

  • acme.sh, for automatic certificates (see Certificates);
  • CrowdSec, to block the IP addresses with a bad reputation;
  • the GeoIP databases and the nginx module, to know which country a visitor comes from and to filter by country.

CrowdSec and GeoIP can be installed during the guided setup (see Defenses) or later from the Server page.

What the package creates on the server

Useful to know when you inspect the machine or write a backup policy:

/opt/neti
The program. Replaced at every update; do not edit files here.
/usr/sbin/neti
The administration command (see The neti command).
/etc/neti
Configuration and keys of this installation, readable only by root and by the web user. Created empty by the package and filled by neti setup.
/var/lib/neti
Database and working data. Database snapshots taken before each database update are in /var/lib/neti/backup.
/var/log/neti
Neti's own logs (for example auth.log, the failed sign-ins that fail2ban watches).
/etc/php/8.4/fpm/pool.d/neti.conf
Neti's PHP pool, written by neti setup.

The package never generates secrets and never asks questions while it is being installed: keys, console address and first-access token are generated by neti setup, so they are different on every server even when the machine is cloned from an image that already contains the package.

Neti's PHP processes

neti status prints a line like php pool: neti, 16 processi al massimo ("16 processes at most"; terminal messages are currently in Italian). It is the maximum number of Neti's PHP processes working at the same instant, not the number of users or connections the server can handle.

In Neti, PHP does only two things:

  • it shows the pages of the console;
  • it performs the gate check: on the services protected by the gate, for every request nginx asks PHP whether the visitor is authorized, and the answer arrives in a few milliseconds.

The traffic itself (pages, images, files going from the backend to the visitor) is handled by nginx, without PHP; on services without the gate PHP is not involved at all. If all the processes are busy, the extra requests wait in a queue for a few milliseconds; they are not refused. Because each check is very short, a few processes are enough for thousands of requests per second: in our tests 24 processes on 8 CPUs handled about 3,000 requests per second through the gate.

How the number is calculated

Neti calculates the number at every neti setup and at every update:

  • 4 processes per CPU;
  • no more than a quarter of the memory, counting about 40 MB per process;
  • in any case between 8 and 64.

For example: 1 or 2 CPUs give the minimum, 8 processes; 4 CPUs and 8 GB give 16; 8 CPUs and 16 GB give 32. If you enlarge the server, the number grows by itself at the next update or with neti setup --refresh.

Debian's own PHP pool (www) is left exactly as Debian ships it. If Neti's pool cannot start, console and gate fall back to the www pool and neti setup prints a warning.

Setting the number by hand

Usually there is no need to touch it. If the server is very busy and the PHP log (/var/log/php8.4-fpm.log) often reports max_children for the pool neti while the CPU is not at its maximum, you can raise it by hand:

  1. Open /etc/php/8.4/fpm/pool.d/neti.conf.
  2. Change the line ; neti: auto to ; neti: manual. From then on Neti no longer rewrites the file (neti setup prints that the pool is set by hand and left as it is).
  3. Change pm.max_children.
  4. Reload PHP: systemctl reload php8.4-fpm.

To go back to automatic sizing, restore the line ; neti: auto and run neti setup --refresh.

What to look at on a busy server

neti status
The size of the neti pool.
grep max_children /var/log/php8.4-fpm.log
If [pool neti] appears often, the pool is at its limit. With free CPU you can raise it by hand as described in Setting the number by hand.
Community

Community

Discussion board. Sign in to open topics and reply.

Loading…

The same account works for Community and Console.

Complete your profile

Your profile

One more step to join the community.

My posts

Your discussions and replies.