Skip to content

Security: garamahq/server-foundation

Security

docs/security.md

Security

The base image prioritizes a small package set and predictable baseline controls. The production profile adds stronger host logging, audit, and hardening without adding role packages.

Included

  • SSH key authentication enabled.
  • SSH password authentication disabled.
  • Root SSH login limited to key-based access.
  • UFW enabled with incoming traffic denied by default.
  • OpenSSH allowed through UFW.
  • Fail2Ban installed and enabled for SSH.
  • unattended security upgrades enabled.
  • qemu guest agent installed and enabled.
  • cloud-init configured to regenerate SSH host keys on first boot.
  • machine-id reset during cleanup.

Included In Production

  • persistent journald storage with retention limits.
  • rsyslog and logrotate defaults for common system logs.
  • auditd enabled with baseline rules for identity, sudo, SSH, firewall, Fail2Ban, apt, time, hostname, and mount changes.
  • sysctl hardening for kernel pointer exposure, dmesg access, ptrace restrictions, protected links/files, redirects, source routing, reverse path filtering, martian logging, and TCP SYN cookies.

Excluded From Base

The base image intentionally excludes heavy or role-specific software:

  • Docker
  • Node.js
  • PHP
  • MariaDB or MySQL
  • CyberPanel
  • Kubernetes packages
  • development toolchains

Those should be added through future role profiles so the base image remains lightweight and broadly reusable.

Ports

Base and production profiles default to closed incoming ports except SSH. Role profiles explicitly open the required ports:

  • Web Server Profile: Opens ports 80 (HTTP) and 443 (HTTPS).
  • CyberPanel Profile: Opens ports 21 (FTP), 25 (SMTP), 53 (DNS TCP/UDP), 80 (HTTP), 443 (HTTPS), 465 (SMTPS), 587 (Submission), 993 (IMAPS), 995 (POP3S), 7080 (LiteSpeed WebAdmin Console), and 8090 (CyberPanel console).

The SSH port is configurable via the SF_SSH_PORT build parameter (default 22). Unlike other services, the SSH port uses packet rate-limiting (ufw limit) to mitigate quick brute-force attempts.

IP Bans

Fail2Ban is the primary automated banning layer. It uses UFW actions and configures:

  • The SSH jail by default.
  • A custom cyberpanel jail to monitor login failures in /home/cyberpanel/error-logs.txt and block offending IPs (automatically activated when the cyberpanel module is included).

Docker Host Security

For profiles incorporating the docker module, security configurations are standardized to protect the host machine:

  • Log Management: A default /etc/docker/daemon.json sets log rotation constraints (max-size: 50m, max-file: 3) to prevent storage exhaustion attacks/bugs.
  • Availability: live-restore is enabled to keep running containers alive during daemon restarts or updates.
  • Access Control: A dedicated docker group is pre-configured, adding the default administrative ubuntu user to it, eliminating the requirement for sudo prefixing when managing containers locally while isolating non-sudo users from the docker socket.

Extension Rules

Security improvements should usually land in reusable modules. OS-specific behavior can branch inside a module or use OS-specific module implementations later, but profile names should stay role-oriented rather than distribution-script-oriented.

There aren't any published security advisories