Security and Compliance

Authentication, authorization, encryption, audit, and compliance baseline for database and infrastructure security.

Pigsty’s security goals are the CIA triad:

  • Confidentiality: prevent unauthorized access and leakage
  • Integrity: prevent tampering or silent corruption
  • Availability: prevent outages from failures

Pigsty’s security philosophy:

  • Secure by default: out-of-the-box baseline with minimal config and broad coverage.
  • Defense in depth: layered protections so one breach does not collapse the system.
  • Least privilege: roles and privileges enforce least-privilege by default.
  • Compliance-ready: security capabilities plus process can meet audits.

Default Security Baseline (What Problems It Solves)

Security OptionDefaultProblems Solved
Password encryptionpg_pwd_enc: scram-sha-256Prevent weak hashes and plaintext leakage
Data checksumspg_checksum: trueDetect silent data corruption
HBA layeringAdmin from internet must use sslPrevent plaintext access from the public network
Local CAca_create: trueUnified certificate trust chain
Backup & recoverypgbackrest_enabled: truePrevent data loss from mistakes
Nginx HTTPSnginx_sslmode: enablePrevent plaintext web ingress
MinIO HTTPSminio_https: truePrevent backup traffic snooping
OS baselineSELinux permissiveBaseline for enforcing mode

Defaults prioritize usability and scalability. Production should be hardened to meet compliance needs.


Hardening Roadmap

Pigsty provides the security hardening template conf/ha/safe.yml, which upgrades the baseline to a higher security level:

  • Enforce SSL and certificate auth
  • Password strength and expiration policies
  • Connection and disconnection logs
  • Firewall and SELinux hardening

This Chapter

SectionDescriptionCore Question
Defense in DepthSeven-layer security model and baselineHow does the security system land end to end?
AuthenticationHBA rules, password policy, certificate authHow do we verify identities?
Access ControlRole system, permission model, database isolationHow do we control privileges?
Encrypted CommunicationTLS, local CA, certificate managementHow do we protect transport and certs?
Data SecurityChecksums, backup, encryption, recoveryHow do we keep data intact and recoverable?
Compliance ChecklistMLPS Level 3 and SOC2 mappingHow do we meet compliance requirements?


Seven-Layer Security Model

Pigsty defense-in-depth model with layered security baselines from physical to user.

Authentication

HBA rules, password policy, and certificate auth - who can connect and how to prove identity.

Access Control

Pigsty provides an out-of-the-box role and privilege model that enforces least privilege.

Encrypted Communication and Local CA

Pigsty includes a self-signed CA to issue TLS certificates and encrypt network traffic.

Data Security

Data integrity, backup and recovery, encryption and audit.

Compliance Checklist

Map Pigsty security capabilities and evidence preparation using SOC2 and MLPS Level 3.