Documentation / Getting started

The neti command

neti is the administration command of Neti on the server. You use it from an SSH session as root to configure a new installation, confirm the firewall, see whether everything is running and where the console is, bring the database and the generated files up to date after an update, and restore a remote backup on a new server. Everything else is done from the console.

Where: on the Neti server, as root. The command is /usr/sbin/neti.

Messages are currently in Italian, whatever the language of the console. This page quotes them as they appear and explains them in English. (The installer, get-neti.sh, prints its own three stages in English; see Installation.)

Summary of the subcommands

CommandWhat it does
neti statusState of the services, size of Neti's PHP pool, console address.
neti setupConfigures this installation, or repeats the configuration.
neti setup --autoThe same, without asking questions.
neti setup --confirm-firewallConfirms the firewall rules just enabled, from a new connection.
neti setup --refreshAfter an update: database, PHP pool, console and published services are brought up to date. Nothing else is touched.
neti migrateOnly the database update, with a snapshot first.
neti diagnoseGathers state, checks and recent logs of the node in one archive, to understand a problem or to give to the support.
neti restore-backup <file>Restores Neti from an encrypted remote backup file (Neti Pro).

With no subcommand, or with an unknown one, neti prints the usage line (uso: neti setup [--auto] | neti setup --confirm-firewall | neti setup --refresh | neti migrate | neti status | neti diagnose [--days N] [--full] [--send] | neti restore-backup <file>) and exits with status 2. There are no other subcommands: in particular the command does not manage users, passwords, services or updates.

neti status

Use it to see at a glance whether the pieces Neti needs are running, and to find the console address again.

nginx        active
php8.4-fpm   active
fail2ban     active
ufw          active
php pool:    neti, 16 processi al massimo
console:     https://192.0.2.10:31245/3f9a1c/0123456789abcdef
nginx, php8.4-fpm, fail2ban, ufw
The state systemd reports for each service: active when it is running, otherwise inactive or failed. All four should be active. The ufw line is the state of the firewall's system service, not of its rules: to know whether the firewall is really enabled, run ufw status (Status: active) or look at the Firewall page of the console.
php pool: neti, N processi al massimo
"N processes at most": Neti's own PHP pool is running, with the maximum number of PHP processes that can work at the same instant. See Neti's PHP processes. If the line is missing, Neti's pool is not running and console and gate are using Debian's default PHP pool.
firewall: in attesa di conferma (neti setup --confirm-firewall)
"Waiting for confirmation": shown only while the firewall has been enabled and not yet confirmed. Without confirmation it turns itself off 3 minutes after it was enabled. See neti setup --confirm-firewall.
console: https://…
The address of the console: IP address of the server, port and private path. Treat it as confidential.
non configurato: esegui neti setup
"Not configured: run neti setup": shown instead of the console address when the package is installed but neti setup has never completed its first phase.

The address shown uses the server's own IP address (the one it uses to reach the Internet). On a server behind NAT that is the private address: from outside, use the public address of the router with the same port and path.

neti setup

Configures this installation. The installer runs it automatically after installing the package; you run it by hand when the installation was interrupted, when a phase failed, or when the firewall turned itself off because it was not confirmed. It is safe to repeat: keys, console address, certificate and database are created only if they do not exist yet, and the first-access token only while no user exists.

From a terminal it asks one question the first time, Nome dell'istanza [hostname] (instance name): press Enter to accept the proposed host name. The phases, each announced by a title in square brackets:

[segreti] Chiavi e parametri della singola installazione
Keys and parameters of this installation: the configuration file /etc/neti/secrets.php with the secret key, a random console port (20000 to 45000) and a random console path; the self-signed certificate of the console (/etc/neti/selfsigned.crt); the database; the first-access token. Messages: configurazione creata: porta e percorso della console sono casuali (configuration created), già presenti: non li rigenero (already there, not regenerated), certificato autofirmato generato, token di primo accesso generato.
[database] Migrazioni del database
The database update; the same as neti migrate.
[php] PHP della console e del gate
Writes Neti's PHP pool (/etc/php/8.4/fpm/pool.d/neti.conf) sized on CPUs and memory, and prints pool neti: N processi al massimo. If you set the pool by hand it prints pool impostato a mano (…): lasciato com'è and leaves it alone. If the new file is not valid for PHP the previous one is put back, with a warning (ATTENZIONE: configurazione PHP non valida con il pool di Neti, resta quella di prima). ATTENZIONE: il pool di Neti non risponde: console e gate usano il pool www di Debian means Neti's pool did not start and Debian's default pool is used instead. See Neti's PHP processes.
[console] Pubblicazione della console di gestione
Publishes the console on nginx (nginx attivo sulla porta N), removes Debian's nginx welcome page, installs the fail2ban rules of the console and restarts fail2ban (fail2ban attivo sulla console). If the nginx configuration is not valid the phase stops with configurazione nginx non valida after printing nginx's own error.
[firewall] Regole di ingresso
Inbound rules. If ufw is not active: inbound denied by default, outbound allowed, SSH port and console port opened, firewall enabled with an automatic rollback after 180 seconds (aperte solo SSH (N) e console (N)). From a terminal it then asks you to open a new SSH session and to type ok within the time; without a terminal it tells you to run neti setup --confirm-firewall from a new connection. If ufw is already active it only adds the console port (firewall già attivo: aggiunta la porta della console) and asks for nothing. See Confirming the firewall.
[aggiornamenti] Aggiornamenti di sicurezza di Debian
Checks that Debian's automatic security updates are on: automatici, ogni giorno, senza riavvio (Neti si aggiorna solo quando lo decidi tu) (automatic, daily, no reboot; Neti is updated only when you decide), or ATTENZIONE: aggiornamenti automatici non attivi (controlla /etc/apt/apt.conf.d). The first time it also starts the first check for Neti updates in the background.
[verifica] Controllo finale
Final check: nginx, php8.4-fpm and fail2ban must be attivo (a stopped one is shown as FERMO) and the console must answer (console: risponde; otherwise console: HTTP N). If something is wrong: alcuni controlli non sono passati.
[pronto] Neti è installato
The closing summary: Console: with the address, Impronta del certificato (SHA-256): with the fingerprint to compare with the one the browser shows, and, while no administrator exists, the first-access link (Primo accesso, apri questo link e crea l'amministratore), valid once. See Creating the administrator.

Errors: any phase that cannot complete stops the command with ERRORE: … and Correggi il problema e rilancia: neti setup ("fix the problem and run neti setup again"), exit status 1. Run as a user other than root it answers serve root ("root is needed"); an option it does not know gives opzione sconosciuta: ….

neti setup --auto

The same configuration without questions: the instance name is the host name of the server and the firewall is never confirmed at the prompt, so it must be confirmed from a new connection with neti setup --confirm-firewall within 180 seconds. The installer uses this mode by itself when it runs without a terminal. Use it in provisioning scripts.

neti setup --confirm-firewall

Confirms the firewall that neti setup has just enabled, cancelling the automatic rollback. Run it from a new SSH connection: being able to open one is the proof that the rules do not lock you out. It does nothing else.

firewall confermato: annullato il ritorno automatico
Confirmed: the firewall stays on.
nessuna conferma in sospeso
"No confirmation pending": either the firewall was already confirmed, or the 180 seconds have passed and it has turned itself off. Check with ufw status: if it says Status: inactive, run neti setup again and confirm in time.

neti setup --refresh

Brings an already configured installation in line with the installed version of the program. It runs by itself at every update of the package; run it by hand if the update printed ATTENZIONE: rigenerazione non riuscita, controlla con: neti setup --refresh, after enlarging the server (to resize the PHP pool), or whenever you want the console and the services regenerated. It asks no questions. Keys, settings, users, certificates and firewall are not touched.

The phases, in order:

[database]
Database update with a snapshot first, as in neti migrate.
[php]
Neti's PHP pool recalculated (unless set by hand).
[console]
The nginx configuration and the fail2ban rules of the console rewritten from the current templates; fail2ban restarted.
[servizi] Rigenerazione dei servizi pubblicati
The nginx configuration of every published service rewritten from the current templates: servizi: N, vhost aggiornati. Also the ban rules of the gate exceptions and, if enabled, of the automatic ban of bursts; if only these fail, the refresh goes on with the warning regole di ban delle eccezioni non aggiornate: ….
[crowdsec] Letture doppie dei log disattivate
Shown only if CrowdSec is installed and was reading the same log files twice (which would ban addresses at half the intended threshold): the duplicate reading is turned off and reported.
[verifica]
The final check, as in neti setup.

On a server where neti setup has never run it answers Neti non è ancora configurato: esegui neti setup.

neti migrate

Runs only the database update: it brings the database to the version the installed code expects. You rarely need it by hand, because neti setup, neti setup --refresh and every package update already do it. Before changing anything it saves a consistent copy of the database in /var/lib/neti/backup (neti-DATE-TIME-schemaN.sqlite); the last 5 copies are kept.

schema alla versione N, niente da fare
The database is already at the right version: nothing to do, no snapshot taken.
schema portato da N a M (istantanea: /var/lib/neti/backup/…)
The database was updated; the path is the snapshot taken before.
database alla versione N, più nuova del codice (M): lasciato com'è
The database is newer than the installed program (for example after a downgrade of the package): it is left as it is.
ERRORE: database: passo N (…) fallito: … — il database è rimasto alla versione di prima del passo fallito
A step failed. Each step is applied as a whole or not at all, so the database stays at the version before the failed step; the snapshot is in /var/lib/neti/backup.

neti diagnose

neti diagnose gathers in one archive what is needed to understand a problem of this node, and prints what its checks find out of place. It is the same package you get in the console from Settings → Diagnostics (see Settings); the command also works when the console does not answer. It needs root.

What looks wrong:
  [warning] disk / is 91% full
  [info] a reboot is required by an update

Package: /var/lib/neti/diagnose/neti-diagnose-gw1-20261123-105206.tar.gz (37 KB)
It is plain text: MANIFEST.txt lists what it contains. It is removed by itself after 24 hours.
OptionWhat it does
--days NHow many days of logs go into the package, from 1 to 30. Default: 3.
--fullLeaves the public IP addresses of the visitors and the email addresses as they are. Without it the addresses are shortened (a.b.c.x) and the emails masked (u***@domain).
--sendNeti Pro: uploads the package to the support instead of leaving it on the server, and prints its reference (D-…). See Support.
What the package contains
Text files only: versions of Neti and of the system, clock, memory and disk; state of the services, test of the nginx configuration, listening ports, firewall rules; certificates with their expiry; the list of the published services with their destination and the names of the saved settings; state of the license, of the updates and of the backups; reachability of the repository, of the license server and of Let's Encrypt; the logs you see in Logs for the chosen days; of the traffic only the counts by result. SUMMARY.txt repeats what the checks found and MANIFEST.txt lists every file.
What it never contains
Private keys, passwords, tokens and API credentials, the license code, the passwords of the users, the path of the console. This does not depend on --full.
Size
Usually well under 1 MB. Each log is limited to its last 3,000 lines and the whole package to 24 MB; a package over 5 MB cannot be sent to the support: make it again with fewer days.
Nothing piles up on the disk
Only the last package is kept in /var/lib/neti/diagnose (readable by root only) and it is removed after 24 hours. With --send nothing is left on the server.

neti restore-backup

neti restore-backup file.tar.gz.age restores Neti from an encrypted remote backup file (Neti Pro; see Neti Pro and Backup). Its main use is a new server: install Neti, copy the backup file to the server and run the command. On a server that still works, restore from the console instead.

  1. The command explains what is about to happen: database, configuration, certificates and maintenance pages of this server are replaced with those of the backup, and if the checks after the restore do not pass everything goes back as it was.
  2. Chiave di ripristino (AGE-SECRET-KEY-1...): paste the recovery key of the backups. What you type is not shown.
  3. Scrivi RIPRISTINA per continuare: type the word RIPRISTINA exactly. Anything else ends with Annullato. (cancelled) and nothing is changed.
  4. Neti opens and checks the archive, saves the current state, replaces the data, then checks nginx, the system services and the console. If they do not answer as before, it puts the previous state back by itself. On success it prints Ripristino completato da … and exits with status 0; otherwise it prints what went wrong and exits with status 1.
What is restored
Database, configuration, certificates, tunnels and maintenance pages. The restore never writes program code, firewall rules or the destination of the backups.
Version
The backup must come from a version of Neti equal to or older than the installed one. Otherwise: il backup viene da Neti X, più recente di quello installato (Y): aggiorna prima Neti (update Neti first).
Requirements
Root, a real terminal (it cannot be run from a script or from the console: solo da terminale), and the tools age and rclone; if they are missing the command says strumenti mancanti: … (apt install age rclone). The file must exist and must not be a symbolic link (file non trovato: …). Without a file name: uso: neti restore-backup <file.tar.gz.age>.
After the restore
Sign in to the console again. On a new server the license must be reactivated; see Neti Pro.
Opening a backup by hand
age -d -i key.txt file.tar.gz.age | tar -xz, with the recovery key saved in key.txt.

These are not subcommands of neti, but an administrator may need them at the terminal.

/opt/neti/bin/sysagent.sh setup-token-new
Generates a new first-access token when the first-access link was lost before the administrator was created. It prints the token; open the console address (from neti status) and paste it in the Setup token field. It works only as root from a terminal and only while no user exists. See Lost or missing token.
apt update && apt install neti
Updates Neti from the terminal. The package runs neti setup --refresh by itself. Prefer the update from the console (Settings → Updates), which checks every service before and after and goes back to the previous version by itself if something no longer answers: the terminal update has neither the checks nor the automatic return. See Updates.
systemctl reload php8.4-fpm
Reloads PHP after you changed Neti's PHP pool by hand; see Setting the number by hand.

How to find the console address again

  1. Connect to the server over SSH as root.
  2. Run neti status.
  3. The last line, console:, is the address. Save it in your password manager.

How to recover when the firewall was not confirmed

  1. Wait 3 minutes from the moment the firewall was enabled: it turns itself off and SSH answers again.
  2. Connect and run ufw status: it says Status: inactive.
  3. Check which port your SSH server uses, then run neti setup: the existing configuration is kept and the firewall phase is repeated.
  4. Open a new SSH session, verify that it connects, and type ok in the first one (or run neti setup --confirm-firewall in the new one).

Troubleshooting

neti: command not found
You are not root, or /usr/sbin is not in your path: become root with su - or call /usr/sbin/neti.
serve root
The subcommand needs root.
neti status shows a service that is not active
Look at the service's own log (journalctl -u nginx, journalctl -u php8.4-fpm, journalctl -u fail2ban), fix the cause, then run neti setup --refresh to regenerate Neti's files and repeat the final check.
The final check says console: HTTP N
The console did not answer correctly from inside the server. Check that nginx and PHP are running, then repeat neti setup --refresh.
The php pool line is missing from neti status
Neti's PHP pool is not running; Neti still works on Debian's default pool, with fewer processes. Run neti setup --refresh and read the messages of the [php] phase.

Good to know

  • The files an administrator may meet: /etc/neti (configuration and keys of this installation), /var/lib/neti (database and data; snapshots in /var/lib/neti/backup), /var/log/neti (logs), /opt/neti (the program, replaced at every update).
  • neti setup never regenerates keys or the console address once they exist. To change the port or the path of the console use Settings → General in the console; see Settings.
  • Neti is never updated by the neti command. Updates are installed from the console or with APT; see Updates.
  • Users and passwords are managed in the console; see Users.
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.