Files
zoneminder/zm.conf.in
T
SteveGilvarry e60bdc67b2 feat: add ZM_DB_SSL_VERIFY_SERVER_CERT option (portable across MySQL/MariaDB)
Add a ZM_DB_SSL_VERIFY_SERVER_CERT setting so a database connection that uses
ZM_DB_SSL_CA_CERT can talk to a server with a self-signed or otherwise
non-matching certificate. When enabled, verification is by identity (the cert
must chain to the CA and its CN/SAN must match ZM_DB_HOST), consistent across
the C++ daemons, the PHP web interface, the CakePHP API and the Perl scripts.

This re-does the reverted #3817. That PR broke the build because it called
mysql_options(MYSQL_OPT_SSL_VERIFY_SERVER_CERT, ...), and that enum was removed
from the MySQL 8.0 C client in favour of MYSQL_OPT_SSL_MODE; it also passed a
c_str() where a my_bool* was expected, and referenced the PHP constant
unconditionally (fatal on PHP 8 for an upgraded install whose zm.conf predates
the option).

The option that controls server-cert verification differs by client library and
the symbols are enum values, not macros, so CMake feature-detects them by
compiling:
  - HAVE_MYSQL_OPT_SSL_MODE  (MySQL 5.7.11+/8.0, MariaDB Connector/C 3.1+)
  - HAVE_MYSQL_OPT_SSL_VERIFY_SERVER_CERT  (older MariaDB/MySQL)
zm_db.cpp uses SSL_MODE_VERIFY_IDENTITY / SSL_MODE_REQUIRED when the former is
available, else falls back to the latter with a proper my_bool.

Value handling is three-way in every layer: a truthy value verifies, a false-y
value (0/false/no/off) skips verification, and an empty/unset value leaves the
client default in place so existing installs are unchanged on upgrade. PHP, the
API datasource (via PDO flags) and the Perl DSN are all guarded with defined()
checks. Fresh installs default to 1.

Documents the full ZM_DB_* connection and SSL settings, including the hostname
verification gotcha when connecting by IP, in docs/userguide/configfiles.rst.

refs #3816
2026-06-14 13:20:00 +10:00

73 lines
2.1 KiB
Plaintext

# ==========================================================================
#
# ZoneMinder Base Configuration
#
# ==========================================================================
#
# *** DO NOT EDIT THIS FILE ***
#
# To make custom changes to the variables below, create a new configuration
# file, with an extension of .conf, under the @ZM_CONFIG_SUBDIR@
# folder, containing your desired modifications.
#
# Path to installed data directory, used mostly for finding DB upgrade scripts
ZM_PATH_DATA=@PKGDATADIR@
# Path to ZoneMinder binaries
ZM_PATH_BIN=@BINDIR@
# Path to ZoneMinder libraries (none at present, for future use)
ZM_PATH_LIB=@LIBDIR@
# Path to ZoneMinder configuration (this file only at present)
ZM_PATH_CONF=@ZM_CONFIG_DIR@
# Path to ZoneMinder web files
ZM_PATH_WEB=@WEB_PREFIX@
# Path to ZoneMinder cgi files
ZM_PATH_CGI=@CGI_PREFIX@
# Username and group that web daemon (httpd/apache) runs as
ZM_WEB_USER=@WEB_USER@
ZM_WEB_GROUP=@WEB_GROUP@
# ZoneMinder database type: so far only mysql is supported
ZM_DB_TYPE=@ZM_DB_TYPE@
# ZoneMinder database hostname or ip address and optionally port or unix socket
# Acceptable formats include hostname[:port], ip_address[:port], or
# localhost:/path/to/unix_socket
ZM_DB_HOST=@ZM_DB_HOST@
# ZoneMinder database name
ZM_DB_NAME=@ZM_DB_NAME@
# ZoneMinder database user
ZM_DB_USER=@ZM_DB_USER@
# ZoneMinder database password
ZM_DB_PASS=@ZM_DB_PASS@
# SSL CA certificate for ZoneMinder database
ZM_DB_SSL_CA_CERT=@ZM_DB_SSL_CA_CERT@
# SSL client key for ZoneMinder database
ZM_DB_SSL_CLIENT_KEY=@ZM_DB_SSL_CLIENT_KEY@
# SSL client cert for ZoneMinder database
ZM_DB_SSL_CLIENT_CERT=@ZM_DB_SSL_CLIENT_CERT@
# Verify the database server's SSL certificate against the CA (only applies when
# ZM_DB_SSL_CA_CERT is set). Set to 0 to allow a self-signed server certificate.
ZM_DB_SSL_VERIFY_SERVER_CERT=@ZM_DB_SSL_VERIFY_SERVER_CERT@
# Do NOT set ZM_SERVER_HOST if you are not using Multi-Server
# You have been warned
#
# The name specified here must have a corresponding entry
# in the Servers tab under Options
ZM_SERVER_HOST=