Documentation

Security Practices

Access control, patching cadence, and incident reporting — the practices that do most of the work, described plainly.

What this page is

General practice and the reasoning behind it, applicable to any server. It is not a statement of what is configured on your account, and it is not a compliance document. The division of responsibility between you and the platform — who patches what, who holds which credential, and where to report an incident — is established during onboarding and marked here as a placeholder. If you have a regulatory obligation such as HIPAA, PCI DSS, or GDPR, raise it explicitly during onboarding; it changes the requirements rather than merely adding to them.

Access control

Most compromises of otherwise well-run systems start with a credential rather than an exploit. These are in rough order of how much they help:

  • Named accounts, never shared logins. One login used by four people cannot be audited, cannot be revoked for one person, and guarantees nobody changes the password when someone leaves.
  • Multi-factor authentication everywhere it is offered — the control panel, the domain registrar, the git host, the DNS provider, email. Prefer an authenticator app or a hardware key over SMS.
  • Least privilege, by default. Give the access the role needs today, not the access it might need someday. This applies to database users and API tokens as much as to people: an application that only reads a table should have a user that can only read it.
  • Administrative access is a separate thing you step into, not your everyday state. Work as an unprivileged user and escalate with sudo when needed, so privileged actions are deliberate and logged.
  • A password manager for everything else. Long, unique, generated, never reused, never sent over chat or email. Shared credentials that genuinely must be shared belong in a managed vault, not in a document.

SSH and remote access

The standard hardening set, and what each part is actually for:

SettingWhy
Key authentication only; passwords disabledRemoves brute-force and credential-stuffing against SSH entirely. This is the single highest-value change.
Root login disabledForces named accounts, so actions are attributable, and removes the one username every attacker already knows.
Ed25519 keys, with a passphraseModern, short, fast. The passphrase protects the key if the laptop holding it is lost.
Rate limiting or fail2banCuts log noise and slows automated probing. Useful, but not a substitute for disabling passwords.
Access restricted by source address where practicalTurns remote exposure into a much smaller target. Only workable where administrators have stable addresses.

Moving SSH to a non-standard port reduces log volume and nothing else — treat it as tidiness, not as a control.

Checking what a server currently accepts:

# Effective config, including anything set in included files
sudo sshd -T | grep -i -E "permitrootlogin|passwordauthentication|pubkeyauthentication"

# Who has a key on this account
cat ~/.ssh/authorized_keys

Review authorized_keys periodically. Keys are added during a deadline and removed approximately never unless someone makes it a habit.

Secrets handling

  • Never in the repository. Not in a config file, not in a test fixture, not in a commit you intend to amend later. Git history is permanent and usually mirrored somewhere you do not control.
  • Never in a file the web server can serve. An .env file inside the public document root is a reliably exploited mistake.
  • Injected as environment variables or from a secret store, with restrictive file permissions on anything on disk.
  • Rotated when someone leaves, when a credential has been exposed, and on a routine schedule for anything long-lived.
  • Treated as burned once exposed. A key pasted into a chat, a ticket, or a log is compromised regardless of who saw it. Rotate it; do not reason about likelihood.

Add a pre-commit secret scan if you can — catching a key before it is committed is far cheaper than rotating it and rewriting history afterwards.

Patching cadence

Patching is a routine, not a project. The practical structure is three tiers with different urgency:

TierCoversTypical cadence
Security updates to the OS Kernel, OpenSSL, the web server, the runtime Automatically, as they are published. Most distributions provide unattended security updates; enabling them is almost always correct.
Application dependencies Package manager lockfile entries, framework releases On a regular review — small and frequent, so upgrades stay routine rather than becoming a migration.
Major version upgrades OS release, database engine, language runtime Planned, with a maintenance window, before the current version goes end-of-life.

Your maintenance window and the division of patching responsibility between you and the platform: confirm during onboarding.

Details that matter

  • Some updates need a restart to take effect. A patched library on disk does not help a process that loaded the old one. Kernel updates need a reboot; library updates need the services that link them restarted. On Debian and Ubuntu, needrestart reports which services are still running old code.
  • Track end-of-life dates. An OS or runtime past EOL stops receiving security fixes at all — no amount of patching discipline helps after that point. Know the date for each and plan the upgrade before it.
  • Keep dependencies current continuously. The cost of upgrading grows faster than linearly with how far behind you are, and a stack too far behind to upgrade safely is how known vulnerabilities end up staying unpatched.
# Debian / Ubuntu — what security updates are pending
sudo apt update && apt list --upgradable 2>/dev/null | grep -i security

# Which running services still need a restart after an update
sudo needrestart -r l

# Is a reboot required?
[ -f /var/run/reboot-required ] && cat /var/run/reboot-required

Network exposure

  • Default-deny inbound. Open the ports the service needs and nothing else. Every additional listening port is a thing you have to keep patched.
  • Databases should not be reachable from the internet. Bind to localhost or a private interface, and reach them over SSH or a private network. An exposed database with a weak password is found by automated scanning within hours.
  • Administrative interfaces are not public. Restrict them by source address, put them behind a VPN, or at minimum require MFA.
  • Check what is actually listening, rather than what you believe is.
# Listening sockets, with the owning process
sudo ss -tulpn

# Current firewall state
sudo ufw status verbose        # or: sudo nft list ruleset

Logging and monitoring

Logs matter most for the incident you have not had yet — if they are not being kept before something happens, they cannot tell you what happened.

  • Retain authentication logs, web access logs, and application error logs for long enough to investigate something noticed late. Intrusions are frequently discovered weeks after the fact.
  • Ship logs off the host where practical. Logs stored only on a compromised machine are logs an attacker can edit.
  • Keep secrets, tokens, and personal data out of log output. A log file is a lower-security copy of whatever you put in it.
  • Alert on a few things that actually indicate a problem — the service being down, certificate expiry, disk filling, backup jobs failing. Alerts nobody reads are worse than none.

Offboarding and access reviews

Access accumulates. Schedule a review — twice a year is a reasonable minimum — and run a checklist every time someone leaves or changes role:

  • Remove their SSH keys from every authorized_keys file.
  • Disable the account in the control panel, the git host, the registrar, the DNS provider, and any database console.
  • Revoke API tokens and personal access tokens they created — these often outlive the account that made them.
  • Rotate any shared credential they knew. If a shared credential existed, this is the step that actually removes their access.
  • Transfer ownership of anything registered in their name, particularly domains and certificates.
  • Confirm they no longer receive alerts or support correspondence.

Incident reporting

Report early, report uncertain

Report anything that looks wrong, including when you are not sure it is real. A false alarm costs a conversation; a delayed report costs containment time. Nobody is penalised for reporting something that turns out to be nothing.

What to report

  • Suspected unauthorised access, or a login you cannot account for.
  • A credential, key, or token that has been exposed — committed, pasted, emailed, or found in a log.
  • Unexpected changes: files you did not deploy, users you did not create, DNS records you did not add, outbound traffic you cannot explain.
  • A lost or stolen device holding keys or an authenticated session.
  • A phishing attempt targeting anyone with access, whether or not it succeeded.
  • Any suspected exposure of personal data. These often carry statutory notification deadlines measured in days, which start when the organisation becomes aware — not when the investigation finishes.

What to do first

  1. Report it through your support contact: incident contact route — confirm during onboarding. The general route is the contact form on the main site. If a credential is exposed, revoke it immediately — that does not need to wait for a reply.
  2. Preserve evidence. Do not delete files, wipe the server, or reset it to a clean state. Logs, timestamps, and file modification times are how the entry point is identified; destroying them means it stays open.
  3. Contain, do not clean. Rotating credentials, revoking sessions and tokens, and isolating the affected system are containment. Reinstalling or deleting the evidence is not, and it forecloses the investigation.
  4. Write a timeline as you go — what was seen, when, by whom, and what was done in response. Reconstructing this afterwards from memory is unreliable and always takes longer.
  5. Keep the discussion in one place with a named person coordinating. Parallel uncoordinated responses cause people to undo each other's containment.

What to include in the report

Account / site:      your account or domain
Environment:         production | staging
What was observed:   plain description of what looks wrong
First observed:      YYYY-MM-DD HH:MM timezone
How it was noticed:  alert | log review | user report | other
Systems affected:    server, database, domain, mailbox, …
Data possibly involved: none known | personal data | credentials | unknown
Actions already taken:  e.g. rotated API key, revoked sessions
Still ongoing?       yes | no | unknown
Contact for this incident: name and how to reach you, out of hours if relevant

Afterwards

Once the immediate issue is contained, write up what happened and what would have prevented or caught it sooner — and fix that, rather than only the symptom. Keep the write-up focused on the system rather than the person; blameless write-ups are the ones that get written honestly, and an honest one is the only kind worth having.