HF PanelDocsv1.0.0

Server layout

The folders, files, services and scheduled jobs HF Panel uses on the server, and how the panel does work that needs root.

This page lists where HF Panel keeps its programs, settings, data and logs on the server, which services it runs, and how its parts fit together.

How it fits together

text
visitor ──► Nginx (80, 443, 8443, 2087) ──► websites: Apache (127.0.0.1:8080) or Nginx only ──► PHP-FPM per account
                       │
                       └──► hf-api (unix socket) ──► panels, HF Mail, HF Files, HF Studio, the API
                                    │
                                    └──► sudo hf-agent ──► root work: users, web server, DNS, mail, certificates
  • Nginx answers every web request. It serves static files itself and passes the rest to Apache (so .htaccess works) or, for websites set to Nginx only, straight to PHP.
  • Each hosting account has its own PHP-FPM pool, running as the account's own user.
  • hf-api is the whole panel: Server Admin, Reseller Panel, Control Panel, HF Mail, HF Files, HF Studio and the API. It runs as the unprivileged user hostfog.
  • Everything that needs root goes through one helper, hf-agent, which checks every argument it is given. The hostfog user may run only that program as root.

Folders and files

Programs

Path What it holds
/usr/local/hostfog/ HF Panel's programs
/usr/local/hostfog/bin/hf-api the panel program (also used by the commands below)
/usr/local/hostfog/bin/hf-agent, bin/lib/ the root helper and its commands
/usr/local/hostfog/bin/hf-panel the administrator's command; linked from /usr/local/sbin/hf-panel (old name: hf-admin)
/usr/local/hostfog/bin/hf-uninstall, bin/hf-dns-setup the uninstaller and the DNS list, run by hf-panel uninstall and hf-panel dns-setup
/usr/local/hostfog/panel/, webmail/ the built interfaces of the panels and HF Mail
/usr/local/hostfog/templates/ templates for customers' PHP pools, default pages and web server settings
/home/hostfog-install/ the downloaded release while an install or update runs (removed when it succeeds; kept after a failure so it can be run again)

Settings

Path What it holds
/etc/hostfog/config.json the panel's settings (see Settings)
/etc/hostfog/webmail.json HF Mail's settings
/etc/hostfog/VERSION the installed HF Panel version
/etc/hostfog/sites/<user>--<domain>.conf each website's settings (folder, PHP version, SSL …); the web server files are written from these
/etc/hostfog/php/<user>.ver, <user>.ini each account's PHP version and PHP settings
/etc/hostfog/ssl/ the panel's certificate and uploaded website certificates
/etc/hostfog/secrets.key the server's key that seals saved passwords and tokens (backup destinations and others)
/etc/hostfog/licence.pub the licence server's public key
/etc/hostfog/dns-setup.zone the server domain's DNS records, ready to import at a DNS provider
/etc/cron.d/hostfog HF Panel's scheduled jobs
/etc/nginx/sites-available/hostfog-*.conf the panel's web server sites (the panel port, the separate panels, the service names)
/etc/nginx/hostfog/ shared web server snippets, including security.txt

Warning: /etc/hostfog/config.json and /etc/hostfog/secrets.key hold secrets. Keep them readable only by root and the hostfog group, as the installer sets them.

Data

Path What it holds
/var/lib/hostfog/hostfog.sqlite the panel database: accounts, packages, domains, mailboxes, invoices, tickets, settings …
/var/lib/hostfog/panel-backups/ nightly copies of the panel database (see hf-panel panel-backups)
/var/lib/hostfog/licence.json the last licence answer
/var/lib/hostfog/sess_* panel sign-in sessions
/var/lib/hostfog-webmail/ HF Mail's data: sessions, contacts and settings
/var/lib/hostfog-lists/ mailing-list archives and members
/var/backups/hostfog/<user>/ customers' backups. Copy these off the server too
/var/backups/hostfog-config/ earlier versions of service config files edited in the panel
/home/hostfog-import/ full account backups waiting to be imported
/root/hostfog-mailboxes.txt passwords of the mailboxes the installer and hf-panel company-mail made (root only)

Hosting accounts

Path What it holds
/home/<user>/ the account's home folder
/home/<user>/web/<domain>/public_html a website's files
/home/<user>/logs/ the account's website logs
/home/<user>/tmp/ the account's temporary files
/var/mail/vhosts/<domain>/<mailbox> email
/etc/bind/hf-zones/ DNS zones
/etc/opendkim/keys/<domain>/ each mail domain's DKIM key

Services

Service What it is
hostfog-api hf-api: the panels, HF Mail, HF Files, HF Studio and the API
hostfog-mailpolicy hourly email sending limits
hostfog-mongo the MongoDB databases service, in front of FerretDB
nginx the web server in front
apache2 the web server behind Nginx, on 127.0.0.1:8080
php<version>-fpm PHP for websites, one pool per account
mariadb MySQL databases
postgresql PostgreSQL databases (and the storage of MongoDB databases)
postfix, dovecot, opendkim, SpamAssassin email: receiving, sending, mailboxes, DKIM signing, spam filtering
named (BIND) the DNS server
pure-ftpd FTP with TLS
redis-server Redis caches for accounts
fail2ban blocks addresses with repeated failed logins
cron scheduled jobs

Server Admin › Server › Services shows each one's status and restarts it.

Scheduled jobs

/etc/cron.d/hostfog runs these as the hostfog user. Their output goes to /var/log/hostfog-cron.log.

When Job
every 5 minutes statistics and resource samples, AutoSSL, settings refreshes
every hour at :41 customers' own backup schedules
every night at 03:20 bandwidth, statistics, disk usage, SSL, backups, panel data copies, clean-up
every 6 hours at :17 the licence check

The server's users

User What it is
hostfog runs hf-api and the scheduled jobs; may run only hf-agent as root
<username> one Linux user per hosting account, in the group hfusers, without a shell login
vmail owns the mailboxes in /var/mail/vhosts