|
| 1 | +--- |
| 2 | +description: Generating standards-compliant clusters with TPA |
| 3 | +title: Compliance |
| 4 | +originalFilePath: compliance.md |
| 5 | + |
| 6 | +--- |
| 7 | + |
| 8 | +TPA can generate configurations designed to make it easy for a |
| 9 | +cluster to comply with the STIG or CIS standards. If you pass |
| 10 | +`--compliance stig` or `--compliance cis` to `tpaexec configure`, |
| 11 | +TPA will: |
| 12 | + |
| 13 | +- Check that other options are compatible with the appropriate |
| 14 | + standard. |
| 15 | +- Add various entries to the generated `config.yml`, including |
| 16 | + marking that this is a cluster meant to comply with a particular |
| 17 | + standard and setting Postgres configuration as required by |
| 18 | + the standard. |
| 19 | +- Adjust some deployment tasks to enforce compliance. |
| 20 | +- Run checks at the end of deployment. |
| 21 | + |
| 22 | +The deploy-time checks can |
| 23 | +be skipped by giving the option `--excluded_tasks=compliance` to `tpaexec |
| 24 | +deploy`. This feature is intended for testing only, when using a test |
| 25 | +system on which full compliance is impossible (for example, |
| 26 | +because SSL certificates are not available). |
| 27 | + |
| 28 | +There are some situations in which TPA will intentionally fail to |
| 29 | +comply with the selected standard; these are documented under Exceptions |
| 30 | +below. |
| 31 | + |
| 32 | +## STIG |
| 33 | + |
| 34 | +STIG compliance is indicated by the `--compliance stig` option to |
| 35 | +`tpaexec configure`. |
| 36 | + |
| 37 | +### Option compatibility |
| 38 | + |
| 39 | +STIG compliance requires the `bare` platform and the `epas` flavour. |
| 40 | +It requires the RedHat OS with version 8 or 9. |
| 41 | + |
| 42 | +### Settings in config.yml |
| 43 | + |
| 44 | +The following entry is added to `cluster_vars` to use the SQL/Protect |
| 45 | +feature of EDB Postgres Advanced Server: |
| 46 | + |
| 47 | +``` |
| 48 | + extra_postgres_extensions: [ 'sql_protect' ] |
| 49 | +``` |
| 50 | + |
| 51 | +The following entries are added to `cluster_vars` to force clients |
| 52 | +to use SSL authentication: |
| 53 | + |
| 54 | +``` |
| 55 | + hba_force_hostssl: True |
| 56 | + hba_force_certificate_auth: True |
| 57 | + hba_cert_authentication_map: sslmap |
| 58 | +``` |
| 59 | + |
| 60 | +The following entries are added to `cluster_vars` to set GUCs in |
| 61 | +postgresql.conf: |
| 62 | + |
| 63 | +``` |
| 64 | + tcp_keepalives_idle: 10 |
| 65 | + tcp_keepalives_interval: 10 |
| 66 | + tcp_keepalives_count: 10 |
| 67 | + log_destination: "stderr" |
| 68 | + postgres_log_file_mode: "0600" |
| 69 | +``` |
| 70 | + |
| 71 | +The following entries are added to `postgres_conf_settings` in |
| 72 | +`cluster_vars` to set GUCs in postgresql.conf: |
| 73 | + |
| 74 | +``` |
| 75 | + edb_audit: "xml" |
| 76 | + edb_audit_statement: "all" |
| 77 | + edb_audit_connect: "all" |
| 78 | + edb_audit_disconnect: "all" |
| 79 | + statement_timeout: 1000 |
| 80 | + client_min_messages: "ERROR" |
| 81 | +``` |
| 82 | + |
| 83 | +### Deployment differences |
| 84 | + |
| 85 | +During deployment, TPA will set connection limits for the database users |
| 86 | +it creates, corresponding to the number of connections that are needed |
| 87 | +for normal operation. As each user is set up, it will also check that |
| 88 | +an SSL client certificate has been provided for it. |
| 89 | + |
| 90 | +### Providing client ssl certificates |
| 91 | + |
| 92 | +STIG requires DOD-approved ssl certificates for client connections. |
| 93 | +These certificates can't be generated by TPA and therefore must be |
| 94 | +supplied. When setting up authentication for a user from a |
| 95 | +node in the cluster, TPA will look for a certificate/key pair on the |
| 96 | +node. The certificate and key should be in files called .crt |
| 97 | +and .key in the directory given by the `ssl_client_cert_dir` |
| 98 | +setting. The default for this setting is `/`, so the files would be, |
| 99 | +for example, `/barman.crt` and `/barman.key` when the `barman` user is |
| 100 | +being set up. |
| 101 | + |
| 102 | +### Final checks |
| 103 | + |
| 104 | +At the end of deployment, TPA will check that the server has FIPS |
| 105 | +enabled. |
| 106 | + |
| 107 | +### Exceptions |
| 108 | + |
| 109 | +If you select EFM as the failover manager, TPA will configure password |
| 110 | +authentication for the EFM user. This goes against the STIG requirement |
| 111 | +that all TCP connections use certificate authentication. The reason for |
| 112 | +this exception is that EFM does not support certificate authentication. |
| 113 | + |
| 114 | +## CIS |
| 115 | + |
| 116 | +CIS compliance is indicated by the `--compliance cis` option to `tpaexec |
| 117 | +configure`. |
| 118 | + |
| 119 | +### Settings in config.yml |
| 120 | + |
| 121 | +The following entries are added to `cluster_vars` to set GUCs in |
| 122 | +postgresql.conf: |
| 123 | + |
| 124 | +``` |
| 125 | + log_connections: "on" |
| 126 | + log_disconnections: "on" |
| 127 | +``` |
| 128 | + |
| 129 | +The following entry is added to `cluster_vars` to enable required |
| 130 | +extensions: |
| 131 | + |
| 132 | +``` |
| 133 | + extra_postgres_extensions: ["passwordcheck", "pgaudit"] |
| 134 | +``` |
| 135 | + |
| 136 | +The following entry is added to `cluster_vars` to set the umask for |
| 137 | +the postgres OS user: |
| 138 | + |
| 139 | +``` |
| 140 | + extra_bash_rc_lines: "umask 0077" |
| 141 | +``` |
| 142 | + |
| 143 | +The following entries are added to `postgres_conf_settings` in |
| 144 | +`cluster_vars` to set GUCs in postgresql.conf: |
| 145 | + |
| 146 | +``` |
| 147 | +
|
| 148 | + log_error_verbosity: "verbose" |
| 149 | + log_line_prefix: "'%m [%p]: [%l-1] db=%d,user=%u,app=%a,client=%h '" |
| 150 | + log_replication_commands: "on" |
| 151 | + temp_file_limit: "1GB" |
| 152 | +``` |
| 153 | + |
| 154 | +### Final checks |
| 155 | + |
| 156 | +At the end of deployment, TPA will check that the server has FIPS |
| 157 | +enabled. |
| 158 | + |
| 159 | +### Exceptions |
| 160 | + |
| 161 | +TPA does not support pgBackRest as mentioned in the CIS specification. |
| 162 | +Instead TPA installs Barman. |
| 163 | + |
| 164 | +TPA does not install and configure `set_user` as required by the CIS |
| 165 | +specification. This is because preventing logon by the Postgres user |
| 166 | +would leave TPA unable to connect to, and configure, the database. |
0 commit comments