Skip to main content

Host hardening

Every edge package - Scanner, Apex, Syslog Collector and Integrator - carries a hardening pass for the Ubuntu Server host it is installed on. It closes the findings a vulnerability scan raises against a stock install: SSH defaults, kernel and network settings, legacy services, no audit trail, no host firewall, loose file permissions, password policy, login banners and unattended security updates.

It is part of the package rather than a separate download so that a host you build from the CyberOptix CTEM Platform repository ends up in the same state as every other, and stays there: a timer re-applies it daily and any drift is corrected.

Before you start​

  • The package has been installed. The hardening ships with it and needs nothing else.
  • At least one account on the host holds an SSH key. The pass disables SSH password login, and it refuses to do so while no account has a key, so that it never leaves the console as the only way in. Linking the system provisions the operators' accounts and keys, which satisfies this.
  • A reboot window at some point. Two changes take effect at the next boot: /tmp as a memory-backed filesystem, and auditing from early boot. Nothing reboots the host for you.

Run it​

Installing or upgrading a package enables the daily timer but does not apply the hardening during the install itself. Link the system first, then run the pass once by hand so the first application happens while you are watching:

sudo optix-harden

It prints a summary at the end: the system it detected, the effective SSH settings, what is listening, the firewall state, the audit state and what still needs a reboot.

To preview without changing anything:

sudo optix-harden --check --diff

To see when it runs next and how the last run went:

systemctl list-timers optix-hardening.timer
journalctl -u optix-hardening.service -n 50
Why a timer rather than cron

The unit, the timer and the hardening files are owned by the package, so dpkg -V cyberoptix.<package> reports any change to them. There are no crontabs or cron.d drop-ins to edit, the pass keeps its own timer enabled, and the audit rules record changes to the unit directories and the cron paths with the account that made them.

What it changes​

AreaChange
SSHKey-only login, no root login, no agent or X11 forwarding, verbose logging, modern ciphers and key exchange only, idle disconnect after 15 minutes, a legal banner.
Kernel and networkAddress space randomisation, restricted debugger attach, hidden kernel pointers, no ICMP redirects or source routing, SYN cookies, reverse path filtering.
Kernel modulesUnused filesystems and network protocols can no longer be loaded.
Mounts/dev/shm is nodev, nosuid, noexec. /tmp is memory-backed with nodev, nosuid.
AccountsPassword ageing and quality rules, lockout after five failures, sudo logged to its own file, root's password locked, empty passwords locked.
BannersAn authorised-use notice before login. The message of the day no longer reveals the release.
Auditauditd records time, identity, login, permission, mount, deletion, sudo, kernel module and configuration changes, and every privileged command.
ServicesCtrl-Alt-Del disabled, AppArmor and time sync on, the journal persistent and capped, core dumps off, no remote syslog reception by the host's own rsyslog.
UpdatesSecurity updates install unattended with no automatic reboot. The edge packages themselves, Docker and redis are excluded so an update never restarts a running task; those follow the maintenance flow instead.
PermissionsSystem account files, cron directories and the files under /etc/optix that hold credentials are restricted.
FirewallDepends on the system, see below.
Removed packagestelnet, rsh, talk, NIS, ftp, tftp, xinetd, avahi, cups, rpcbind, NFS, bind9, DHCP server, vsftpd, apache, nginx, samba, squid, snmpd, dovecot, ldap-utils. None is used by an edge system.
Operator accounts

The accounts the Scanner and Apex create for your operators log in with their SSH key only. sudo keeps the standard rule and asks for a password, so each operator sets one under Appliance Password on their profile page; CyberOptix CTEM Platform stores only its hash and the appliance applies that hash on its next check-in. Until an operator sets one, the account carries a random password that nobody holds, rather than no password, so it is a real credential and the password ageing rules can never expire a key-based login. No account on the appliance is granted passwordless sudo.

What differs by system​

The Scanner and Apex do offensive work, and some of the measures above would get in its way: an exploited target calls back to the host on whatever port the payload chose, operators tunnel through the host so every connection to a target leaves from its address, and the tool containers share the host's kernel and network. The pass detects which system is installed and adjusts.

ScannerApexSyslog CollectorIntegrator
Host firewallOffOffOn: SSH and the Collector port onlyOn: SSH only
SSH tunnelling (-L, -D)AllowedAllowedBlockedBlocked
Reverse path filteringLooseLooseStrictStrict
IPv6 router advertisementsAcceptedAcceptedRefusedRefused
SCTPLoadableLoadableBlockedBlocked
/tmp memory-backedYesNoYesYes

Nothing on a Scanner or Apex host listens for the network except SSH: the tool containers bind to loopback and the services run unprivileged and open no ports. The firewall being off on those two therefore removes nothing that was protecting them, and the summary lists what is listening so a stray listener is visible.

Only a Scanner and Apex may share a host

That is the one supported combination. Both use the offensive profile, so nothing conflicts, and Apex's /tmp setting applies to the shared host, which keeps /tmp on disk for both.

Every other mix is not supported, even though it may appear to work. The syslog Collector and the Integrator get the strict profile. Installed on a host that already runs a Scanner or Apex, the offensive profile wins: the tools keep working, but the Collector or Integrator runs without the firewall and the other protections it would have on its own host, and the pass says so in its summary. The reverse is worse: a Collector host turned into a Scanner by adding the Scanner package has its firewall and SSH tunnelling rules undone by the next run. Give the Collector and the Integrator their own hosts, and expect no support for a host that mixes them with anything else.

Turning parts off​

Each area is a switch. Pass it to the command and the daily run keeps whatever you set only until its next run, so put a permanent change in a variables file rather than on the command line:

sudo optix-harden -e edge_hardening_auditd=false

The switches are packages, ssh, sysctl, kernel_modules, mounts, auth, banner, auditd, firewall, services, updates and permissions, each prefixed with edge_hardening_. The firewall policy on a strict-profile host can also be opened with edge_hardening_firewall_policy=open, and a Scanner whose callback ports are fixed can enforce the firewall and open just those with edge_hardening_firewall_policy=enforce plus a rule list; /usr/share/optix/hardening/README.md on the host documents every variable.

Files​

PathPurpose
/usr/share/optix/hardening/The hardening pass itself, replaced on every package upgrade
/usr/local/bin/optix-hardenRuns it by hand
/usr/lib/systemd/system/optix-hardening.timerThe daily schedule
/etc/ssh/sshd_config.d/00-cyberoptix-hardening.confThe SSH settings it applies
/etc/sysctl.d/60-cyberoptix-hardening.confThe kernel and network settings
/etc/audit/rules.d/50-cyberoptix.rulesThe audit rules
/var/log/sudo.logEvery sudo invocation

Next​