Database: Add options to verify TLS connections with a custom CA bundle
As an administrator connecting PhotoPrism to a remote MariaDB server, I want to configure a CA bundle for certificate-verified TLS, so that I can secure the connection without writing a custom DSN or adding certificates to the container's system trust store.
Currently, a verified TLS connection requires a manually written PHOTOPRISM_DATABASE_DSN with tls=true, and the server certificate must be trusted by the container's system trust store. There is no DSN parameter for a CA file, so certificates issued by a private CA cannot be configured directly.
Dedicated options should let administrators choose whether TLS is required and name a PEM-encoded CA bundle, independently of how the database server, name, and credentials are configured. When verification is requested, PhotoPrism should refuse to connect rather than fall back to a weaker connection.
Related: #5854
Acceptance Criteria
- Administrators MUST be able to require a certificate-verified TLS connection to MariaDB through configuration options, without writing a custom DSN.
- Administrators MUST be able to specify a PEM-encoded CA bundle used to verify the server certificate.
- The server certificate MUST match the configured database hostname or IP address.
- When verification is requested and fails, PhotoPrism MUST report a clear error and MUST NOT connect without it.
- Index backups and restores MUST use the same TLS settings as the application.
- Existing installations without the new options MUST keep working as before.
- Administrators SHOULD be able to configure a client certificate and key for servers that require one.
- The new options MUST be documented, including an example for a private CA.
Source: photoprism/photoprism