PostgreSQL controls for SOC 2 audits

A SOC 2 examination will ask how your PostgreSQL databases control access, log activity, change schemas, recover data and protect connections. This page maps those criteria to PostgreSQL features, the evidence each produces, and the gaps that remain outside the database.

On this page

What SOC 2 asks of a PostgreSQL database

A SOC 2 examination that includes a PostgreSQL database will be measured against the AICPA's 2017 Trust Services Criteria, in the version with the revised points of focus published in 2022. Security is covered by the common criteria CC1 to CC9, and those apply to every SOC 2 report. The availability, processing integrity, confidentiality and privacy categories add criteria only when your organization includes them in scope. If the database holds customer data that you have committed to keep available or confidential, expect the auditor to ask for evidence under those categories as well. Confirm the scope with your auditor before you start collecting evidence, because the scope decides which criteria the database must support.

For the database itself, the evidence falls into a few groups that map to the common criteria: who holds access and how it is reviewed, which activity is logged and retained, how schema and data changes are approved and tested before they reach production, whether backups are taken and restored in practice, and whether connections are encrypted in transit. PostgreSQL gives you the mechanisms for each of these, including roles and privileges, pg_hba.conf rules, TLS settings, pgAudit logs and restore tests, but a mechanism only becomes evidence when you can show it was configured, reviewed and operated over the audit period. PostgreSQL cannot supply the auditor's opinion, the policies your organization writes, the identity provider's MFA enforcement, or the training and vendor management records that sit around the database. Those come from your own governance and from the systems that front the database.

DeployOpen prepares the database, its configuration and the evidence trail for a SOC 2 examination. We do not issue SOC 2 reports, attestations or certifications, and we do not decide whether your controls are sufficient; your CPA firm does. Before work starts, ask your auditor which Type they expect (Type 1 tests design as of a date, Type 2 tests operating effectiveness over a period), which systems are in scope, and which samples they will draw. Those answers determine how far back the logs, reviews and restore records must go.

Which PostgreSQL capability answers each SOC 2 criteria series

This table maps each SOC 2 criteria series in the AICPA 2017 Trust Services Criteria to the PostgreSQL capability and configuration that supports it. Confirm exact criterion numbers and wording in the AICPA document before you write control descriptions, since the series titles here are a starting point. Read each row as a question an auditor will ask and the database evidence that answers it.

Criteria seriesPostgreSQL capabilityConfiguration to set upEvidence to keep
CC6 logical and physical accessAuthentication methods and role designUse SCRAM password hashing, certificate or GSSAPI authentication where available, and scope pg_hba.conf entries to named networks and rolesCurrent pg_hba.conf, role inventory, quarterly privilege review sign-off
CC6 directory-backed accessLDAP, GSSAPI or OAuth 2.0 authenticationMap database logins to identity provider groups, disable shared application accounts, confirm supported methods for your versionIdentity provider group mapping, login test results, list of disabled local accounts
CC6 privileged accessLeast-privilege roles and superuser restrictionGrant privileges to group roles, limit superuser and replication attributes to break-glass accounts, revoke default PUBLIC privilegesRole grants export, superuser account list, break-glass access log
CC7 system operationspgAudit and PostgreSQL loggingEnable pgAudit for DDL, role changes and sensitive reads or writes, set log_connections and log_disconnections, ship logs off the database hostSample audit entries, logging configuration file, log retention settings
CC7 monitoring of anomaliesLog review and alertingAlert on failed logins, role changes and access outside expected hours, and record who reviews alerts and how oftenAlert rules, review tickets, examples of investigated events
CC8 change managementSchema migrations under version controlRun migrations through a reviewed pipeline, use separate approval for production, record the migration tool version and applied migration historyMerged change requests, approval records, migration history table exports
CC9 risk mitigation and vendor dependenciesSupported major versions and patch cadenceTrack the PostgreSQL support end dates for your major version, apply minor releases on a documented schedule, and track PgBouncer security releasesVersion inventory, upgrade plan, patch records with dates
A1 availabilityPoint-in-time recovery and replicationSchedule base backups, archive WAL to separate storage, and test restores to a recovery environment on a documented cadenceBackup job logs, restore test reports with measured recovery time, replication status
C1 confidentialityTLS and encryption in transitRequire TLS for client and replication connections, restrict certificate authorities, and disable plaintext listeners where the setup allowsServer TLS settings, client connection checks, certificate inventory

How Type 1 and Type 2 reports change the database evidence set

A SOC 2 Type 1 report covers management's description of the system and the suitability of control design as of a specific date. For the database team, the evidence is a snapshot: the state of roles, privileges, authentication settings and logging configuration on that day, plus proof that the designed controls exist. The auditor is asking whether the controls, as built, would address the criteria, not whether they worked over time.

  • Role and privilege export: A dated listing of every role, its attributes and its granted privileges, produced from the catalog views rather than from memory or a spreadsheet.
  • Authentication configuration: The effective pg_hba.conf rules, the password_encryption setting and the TLS settings in postgresql.conf, captured with the file's version or change reference.
  • Logging configuration: The settings that control what the database records, such as log_connections, log_disconnections and pgAudit parameters, with the date they took effect.
  • Backup and change design: The documented backup schedule, the restore procedure and the migration tooling and approval steps, showing how each control is meant to operate.
  • System description support: Diagrams and text describing the database components, their boundaries and the people who administer them, written to match the system description criteria.

Check that the snapshot date, the configuration version and the system description all refer to the same environment and the same day.

Which SOC 2 evidence a PostgreSQL estate produces and how to keep it

A SOC 2 examination tests whether controls operated over a period, so the evidence has to be produced routinely and kept unchanged. The cards below cover the artifacts a self-hosted PostgreSQL estate generates, who creates each one, where it should live, and how to preserve it. No single artifact satisfies a criterion on its own; auditors read them together with your policies and tickets.

Role and privilege inventory exports

A scheduled export of every login role, group membership, and object privilege, taken from the catalog views such as pg_roles and the grants on schemas and tables. It shows who could access what on a given date, which is the starting point for testing logical access criteria in the common criteria series CC6. Generate it with a service account, hash the file, and write it to write-once storage so the population an auditor samples is provably complete. Confirm that shared or default accounts are visible in the export.

Access review sign-offs

Records showing that a named owner reviewed the privilege inventory at a set interval and approved, changed or removed each grant. The reviewer should not be the person who administers the roles. Keep the before and after exports, the reviewer's decision, and the tickets that executed removals. A review that approves everything without evidence of comparison is a common finding, so record the specific grants reviewed and the date each change was made.

pgAudit log extracts and retention settings

Extracts from the audit log produced by the pgAudit extension, showing session and object activity such as DDL, privileged role changes and reads of sensitive tables. Pair each extract with the configuration that defines what is logged, such as the pgaudit.log setting, and the retention policy applied to the log store. Auditors often test whether logs are protected from change and whether administrator activity appears in them, so confirm both before the period starts. Check the logging scope with your own risk owners, since the setting you choose determines what the extract can prove.

Schema migration tickets with approvals

Each schema change should link a change request, the reviewer's approval, the migration file version under source control, and the deployment log showing who ran it and when. This connects change management criteria in CC8 to actual database changes. Store migrations in version control with protected branches, and require that the approver is not the author. Emergency fixes made directly in production are the usual gap, so require that they are recorded and reconciled to the repository afterward.

Backup job records and restore test reports

Backup job logs from base backups and WAL archiving, plus restore test reports that state the backup restored, the target environment, the elapsed time and the result of validation queries. Availability criteria in A1 look for evidence that backups run and that recovery has been tested, not just scheduled. Point-in-time recovery depends on archived WAL, so include archive continuity checks. Record restore timings in the report so that the time to recover can be compared against the targets you have documented.

TLS configuration and certificate inventory

Evidence that client and replication connections require encryption, usually a pg_hba.conf extract with hostssl entries, the ssl settings in postgresql.conf, and a list of certificates with issuer, subject, expiry and the system that holds each private key. It supports the confidentiality and security criteria for data in transit. Export the active settings from a running server, not only the files in source control, and keep the certificate list reviewed on a schedule so expired or unknown certificates are caught.

PostgreSQL authentication methods

Configuring PostgreSQL so the controls can be tested

This sequence turns a PostgreSQL estate into one whose access, logging, change and recovery controls can be sampled and evidenced. Each step ends with an artifact an auditor can read, so the control design exists before the observation period starts.

  1. Fix the in-scope system boundary and data flows

    Before touching the database, the team lists every PostgreSQL cluster, database, replica, backup target and log destination that stores or processes in-scope customer data, along with the applications, admin paths and pipelines that connect to them. Security, platform engineering and the owner of the system description sign off on the list. The artifact is a boundary diagram and data flow inventory that matches the system description management will give to the auditor. Each later step should cite this inventory, so a database outside it is either brought in or documented as out of scope.

  2. Set authentication in pg_hba.conf with SCRAM

    The platform team restricts pg_hba.conf so that each host and database accepts only the users and networks listed in the boundary inventory, and sets password authentication to SCRAM-SHA-256. MD5 password authentication is deprecated in PostgreSQL 18, so existing MD5 roles should be re-keyed during the change window. Where the organization uses a directory or identity provider, the team confirms which authentication method (such as LDAP, GSSAPI or certificate) it will use and documents the reason. The artifact is the version-controlled pg_hba.conf, a reviewed change record and a test log showing that unlisted sources are rejected.

  3. Define group roles with least privilege

    Access is granted through group roles such as read-only analyst, application writer and migration operator, with login roles added as members rather than granted privileges directly. Superuser is reserved for break-glass accounts that are locked by default, and application services never connect as a superuser or the owner of the schema. The owner of the access review confirms each grant maps to a documented job need. The artifact is a role catalog, the SQL that creates it under version control, and a query-based export of role memberships that can be re-run at each access review.

  4. Enable pgAudit or core logging and ship logs off host

    The team enables pgAudit, or the core logging settings if pgAudit is not approved for the platform, and configures it to record the statement classes that matter for the in-scope system, including role changes, DDL and access to sensitive tables. Confirm the pgAudit version against the PostgreSQL major version in use, since builds are tied to releases. Logs are forwarded to a central store that the database administrators cannot silently edit, and the team tests that a sample login and a sample schema change both appear. The artifact is the logging configuration, a shipping pipeline description and a test entry with its timestamp.

  5. Put schema changes through versioned migrations

    Schema changes are written as numbered migration files in the application repository, reviewed by a second person, and applied by a pipeline account rather than by hand. Emergency changes go through the same path with a recorded approval and a follow-up migration. Engineers confirm that direct DDL on production is blocked for normal roles. The artifact is the migration history in version control, the approval record linked to each merge, and the pipeline run log that shows who applied each change and when. Auditors commonly sample this trail to test change management.

  6. Schedule base backups and WAL archiving

    The operations team configures base backups and continuous WAL archiving for point-in-time recovery, with the archive stored outside the primary host and access limited to the backup role. Schedules, retention and encryption settings are written down in the backup standard. Confirm the chosen tooling supports the incremental backup and restore workflow you need, since pg_basebackup incremental backups are reconstructed with pg_combinebackup at restore time. The artifact is the backup configuration, the job history and an archive listing that shows continuous coverage over the review period.

  7. Run and document a restore test

    A named engineer restores a recent base backup plus archived WAL into a separate environment, recovers to a chosen point in time, and runs integrity checks and row count comparisons against agreed reference values. The start and end times, the target time, the person who approved the test and any defects are recorded. Repeat the test on a schedule written into the control description, because a single test proves only that one restore worked. The artifact is a signed restore test record with its evidence attachments, filed where the auditor can request it.

  8. Enforce TLS for client and replication connections

    The team configures the server to accept TLS for client connections, sets pg_hba.conf entries to reject non-TLS connections for in-scope databases, and applies the same requirement to streaming replication and backup connections. Certificates come from the organization's internal authority with a documented renewal owner. Test with a deliberately non-TLS client and confirm it is refused. The artifact is the TLS configuration, the certificate inventory with expiry tracking and a test output showing the rejected connection.

How access, logs, changes and backups feed the evidence pack

The diagram starts with an administrator or application signing in through the identity provider, then reaching PostgreSQL directly or through PgBouncer. The database writes pgAudit and server logs to a separate log store, schema changes pass through a version-controlled pipeline with approval, and base backups and WAL archives go to a separate backup location where restore tests run. Each arrow is a hand-off an auditor may sample, so check that every system stamps its records with dates and that the evidence repository can show who approved each change.

Access, logging, change and backup records converge on one dated evidence repository.

How auditors sample SOC 2 database evidence

Auditors rarely inspect every database event in a period. They pick samples from populations, and the population is the complete list the sample is drawn from. For PostgreSQL, the usual populations are the list of accounts with privileged access, the production schema changes made in the period, the backup jobs and restore tests run in the period, and the log entries for selected security-relevant events. The team should be able to produce each population in full: the role inventory from pg_roles and pg_auth_members with a dated export, the change log tied to migration tool history, the backup catalog with restore test records, and the pgAudit output for the audited window. If a sample is drawn from a list the team cannot show is complete, the auditor has no basis to test it.

Unexplained gaps are where SOC 2 testing usually turns into findings. A missing log segment, a privileged role with no access review sign-off, or a schema change deployed without a linked approval will be treated as an exception unless management can explain it with records. Check that logging stayed on across the period, that a gap in pgAudit or server log output is documented with its cause, and that each change in the sample traces to a request, an approval and a deployment record. Confirm with your audit firm, early in the readiness work, which populations it will use, the period they cover, the sample size approach and how it will treat system-generated events versus manual ones. Agreeing this before the examination window opens avoids rebuilding evidence after the fact.

What PostgreSQL does not cover for a SOC 2 audit

PostgreSQL can produce strong evidence for access, logging, change and recovery controls, but several criteria are met by people, processes and systems around the database. Auditors will ask for those too, and a gap in any of them can weaken a database control that looks sound on its own.

Identity provider and joiner-mover-leaver process

Database roles are only as trustworthy as the process that creates, changes and removes them. Map each PostgreSQL login to a person or service account, and confirm that the identity provider or HR system drives role grants and revocations. Ask who approves a new role, how a transfer removes old privileges, and how a leaver's access is cut off and when. Keep the tickets, approvals and removal timestamps that show the process ran.

Automatic failover tooling

PostgreSQL does not detect a failed primary or promote a standby on its own. That work falls to external failover software, which is itself in scope for availability and change management. Record which tool runs failover, who can trigger it manually, and how each event is logged. Auditors may sample failover runs, so retain the tool's own logs and test records alongside the database's.

PostgreSQL failover docs

Policies, risk assessments and vendor management

Security policies, a documented risk assessment, risk treatment decisions and management of third-party vendors sit outside the database. A PostgreSQL configuration cannot show that the organization reviews risks or that a hosting provider's controls were assessed. Confirm that each database control maps to a written policy owner, a risk entry and, where relevant, a vendor review record for any managed service, backup target or tooling supplier.

The auditor's opinion and report

Only an independent CPA firm can examine the system and issue a SOC 2 report, and the report states the auditor's opinion. Your PostgreSQL evidence supports that examination but does not replace it. Confirm with your auditor which period a Type 2 report covers, which database samples they will select, and who prepares the system description that management provides.

AICPA SOC 2 overview

Trust services categories outside the database

Availability, processing integrity, confidentiality and privacy add criteria only when they are in scope. If your report includes one of these categories and the database does not implement the related controls, such as availability targets, data quality checks or data retention limits, those gaps must be closed elsewhere. Decide the scope early and confirm which category each database control supports.

Log storage, monitoring and alert response

pgAudit and PostgreSQL logs only show value if they are shipped off the host, kept unchanged, watched, and acted on. Confirm where logs are stored, who can alter or delete them, which alerts fire on privileged or failed logins, and how responders record their actions. Sample a full chain from an alert to its ticket and closure, because that chain is what auditors test.

Questions teams ask before hiring help for SOC 2 database controls

What drives the cost and effort of preparing database evidence for SOC 2?

The main drivers are the number of PostgreSQL databases in scope, the number of environments (production, staging, disaster recovery copies), the number of roles and human and service accounts that hold privileges, the volume of audit logs that must be collected and reviewed, and whether controls already exist in writing and in tooling. A team that already has role inventories, a migration pipeline with approvals and tested restores has less to build than a team that must create these from scratch. Cost comes from the people doing the design, configuration and sampling work, and the recurring part is the evidence collection that continues through the observation period. Ask any provider for a quote that lists each database, environment and control area separately, and states which items are one-time setup and which recur.

Can our own team prepare PostgreSQL controls for SOC 2 without a partner?

Yes, many teams do this internally, provided someone owns the work and the evidence follows a schedule. The owner needs to understand the criteria that apply to the database, such as logical access, change management, backup and encryption in transit, and must keep a dated evidence calendar that shows when each access review, backup restore test and migration approval was performed. The usual gap is not the database configuration itself but the consistency of records over time, so a written calendar and a named reviewer for each control matter more than the tooling. A partner is useful when the team lacks capacity, has not run this kind of review before, or needs an outside check of design before the auditor starts sampling.

How long does it take to produce database evidence for a SOC 2 examination?

The duration depends mainly on the observation window that the auditor sets for a Type 2 report and on how many controls already operate as written. A Type 1 report looks at the design of controls as of a date, while a Type 2 report tests operating effectiveness across a period, so the evidence must exist for the whole window, not only at the start. Controls that are new when the window opens need time to produce a history. Ask for a written plan that lists the control areas, the evidence each one produces, the owner, the frequency of each recurring activity and the date by which design work must finish. Do not accept a timeline that is not tied to the auditor's stated period.

What does the engagement need from our team and systems?

The work needs read access to the database hosts and their configuration, including pg_hba.conf, role definitions and the logging settings, plus the ability to inspect pgAudit output. It also needs access to the identity provider so that database logins can be matched to named people and groups, the change pipeline that applies schema migrations and approvals, and the backup tooling with its restore logs. A named contact on your side should approve access requests, confirm which systems are in scope, and sign off on the control descriptions. Access should be granted with the least privilege needed for review, and the client should keep ownership of its own accounts and secrets.

Can DeployOpen prepare evidence that an auditor will accept?

DeployOpen can prepare the systems, controls and evidence that an auditor samples, including role and privilege reviews, pgAudit configuration, migration approval records, restore test records and encryption in transit settings. DeployOpen does not issue SOC 2 reports, attestations or certifications. Those are issued by an independent CPA firm that performs the examination under the AICPA attestation standards. Your auditor decides what evidence is sufficient, so the right first step is to confirm with the auditor which samples and periods they expect before the evidence is prepared.

What do auditors usually sample from a PostgreSQL environment?

Auditors typically select a sample of items from each control and ask for proof that the control operated in the sampled period. For PostgreSQL this often means a set of access reviews with reviewer sign-off, a sample of role grants and their approvals, a sample of schema migrations with their review and deployment records, and a sample of backup jobs and restore tests with their outcomes. They may also ask how logins map to individuals and how encrypted connections are enforced. Confirm the sample sizes and the period with your auditor, because these vary by engagement and by the control's frequency.

Which parts of the database controls are most often missing when teams start?

Teams most often lack a current inventory of database roles and their owners, a record of who approved each privilege, and logs that show who changed the schema or data outside the normal pipeline. Backup jobs may run without any recorded restore test, and encryption in transit may be enforced on some clients but not documented for all of them. A short gap review against the criteria for logical access, change management and availability usually shows which items need design work first. Ask any partner to show how they will identify these gaps before they propose changes to your systems.

How DeployOpen scopes and delivers SOC 2 database controls

DeployOpen plans, implements and documents self-hosted PostgreSQL inside your own infrastructure so the database controls an auditor samples are designed, tested and recorded before the examination period starts. We prepare systems and evidence for your assessment, while independent auditors issue the SOC 2 report.

How we scope

  • Engagements are fixed-scope, with the database inventory, systems in scope and deliverables agreed in writing before work starts.
  • The written scope names which Trust Services Criteria categories your SOC 2 covers, since security applies to every SOC 2 and the other four are added only when in scope.
  • Scope also records which evidence sources your auditor expects, such as role exports, pgAudit logs, migration tickets and restore test records.

How we build

  • We configure role hierarchies, privilege reviews and authentication settings so access can be exported and reviewed on a regular schedule.
  • We enable pgAudit and log routing so entries capture who acted, what they did and when, and that logs are retained and protected.
  • We set up TLS for client and replication connections, a schema migration workflow with review records, and scheduled backups with restore tests.

How we hand over

  • You receive a control narrative mapping each database control to the relevant criteria and to the system where its evidence lives.
  • You receive runbooks for access reviews, restore testing, migration approvals and log review, with templates for each recurring record.
  • You receive a verification report showing that each control was tested in your environment, with findings, fixes and a retest where needed.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers, so controls keep producing evidence through the audit period.
  • Retainer work can cover quarterly access review support, restore test cycles and PostgreSQL minor and major upgrade planning.
  • Confirm with your auditor which evidence format and sampling periods they expect before the first examination period begins.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.