From 4bca799d435807ed77023568d69859d2f6efa267 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Mon, 17 Jul 2017 08:11:36 -0500 Subject: [PATCH] reorganize zm config files (#1937) * reogranize config files * process 01-system-paths.conf.in * exclude .in files in install directive --- CMakeLists.txt | 5 +-- conf.d/01-system-paths.conf.in | 53 ++++++++++++++++++++++++++++++++ conf.d/02-multiserver.conf | 12 ++++++++ conf.d/zm-server-host.conf | 7 ----- distros/redhat/zoneminder.spec | 10 ++++-- zm.conf.in | 56 +++++++--------------------------- 6 files changed, 87 insertions(+), 56 deletions(-) create mode 100644 conf.d/01-system-paths.conf.in create mode 100644 conf.d/02-multiserver.conf delete mode 100644 conf.d/zm-server-host.conf diff --git a/CMakeLists.txt b/CMakeLists.txt index edf9cc615..e1c605d6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -801,11 +801,12 @@ endif(ZM_PERL_SEARCH_PATH) # If this is an out-of-source build, copy the files we need to the binary directory if(NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)) - file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/conf.d" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/conf.d") + file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/conf.d" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/conf.d" PATTERN "*.in" EXCLUDE) endif(NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)) # Generate files from the .in files configure_file(zm.conf.in "${CMAKE_CURRENT_BINARY_DIR}/zm.conf" @ONLY) +configure_file(conf.d/01-system-paths.conf.in "${CMAKE_CURRENT_BINARY_DIR}/conf.d/01-system-paths.conf" @ONLY) configure_file(zoneminder-config.cmake "${CMAKE_CURRENT_BINARY_DIR}/config.h" @ONLY) configure_file(zmconfgen.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmconfgen.pl" @ONLY) configure_file(zmlinkcontent.sh.in "${CMAKE_CURRENT_BINARY_DIR}/zmlinkcontent.sh" @ONLY) @@ -850,7 +851,7 @@ endif(zmconfgen_result EQUAL 0) # Install zm.conf and conf.d subfolder install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zm.conf" DESTINATION "${ZM_CONFIG_DIR}") -install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/conf.d/" DESTINATION "${ZM_CONFIG_SUBDIR}") +install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/conf.d/" DESTINATION "${ZM_CONFIG_SUBDIR}" PATTERN "*.in" EXCLUDE) # Uninstall target configure_file( diff --git a/conf.d/01-system-paths.conf.in b/conf.d/01-system-paths.conf.in new file mode 100644 index 000000000..9f45abdbd --- /dev/null +++ b/conf.d/01-system-paths.conf.in @@ -0,0 +1,53 @@ +# ========================================================================== +# +# ZoneMinder System Paths Configuration +# +# ========================================================================== +# +# This config file contains the variables previously found under Options -> Paths +# +# *** DO NOT EDIT THIS FILE *** +# +# To make custom changes to the variables below, create a new configuration +# file, with an extention of .conf, containing your desired modifications. +# + +# Full path to the folder events are recorded to. +# The web account user must have full read/write permission to this folder. +ZM_DIR_EVENTS=@ZM_DIR_EVENTS@ + +# Full path to the folder images, not directly associated with events, +# are recorded to. +# The web account user must have full read/write permission to this folder. +ZM_DIR_IMAGES=@ZM_DIR_IMAGES@ + +# Foldername under the webroot where ZoneMinder looks for optional sound files +# to play when an alarm is detected. +ZM_DIR_SOUNDS=@ZM_DIR_SOUNDS@ + +# Full path to the folder where exported archives are stored +# The web account user must have full read/write permission to this folder. +ZM_DIR_EXPORTS=@ZM_TMPDIR@ + +# ZoneMinder url path to the zms streaming server +ZM_PATH_ZMS=@ZM_PATH_ZMS@ + +# Full Path to ZoneMinder's mapped memory files +# The web account user must have full read/write permission to this folder. +ZM_PATH_MAP=@ZM_PATH_MAP@ + +# Full Path to ZoneMinder's socket folder +# The web account user must have full read/write permission to this folder. +ZM_PATH_SOCKS=@ZM_SOCKDIR@ + +# Full path to ZoneMinder's log folder +# The web account user must have full read/write permission to this folder. +ZM_PATH_LOGS=@ZM_LOGDIR@ + +# Full path to ZoneMinder's swap folder +# The web account user must have full read/write permission to this folder. +ZM_PATH_SWAP=@ZM_TMPDIR@ + +# Full path to optional arp binary +# ZoneMinder will find the arp binary automatically on most systems +ZM_PATH_ARP=@ZM_PATH_ARP@ diff --git a/conf.d/02-multiserver.conf b/conf.d/02-multiserver.conf new file mode 100644 index 000000000..d2fdfcca7 --- /dev/null +++ b/conf.d/02-multiserver.conf @@ -0,0 +1,12 @@ +# ========================================================================== +# +# ZoneMinder Multiserver Configuration +# +# ========================================================================== +# 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= + diff --git a/conf.d/zm-server-host.conf b/conf.d/zm-server-host.conf deleted file mode 100644 index 7c61c200d..000000000 --- a/conf.d/zm-server-host.conf +++ /dev/null @@ -1,7 +0,0 @@ -# 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= - diff --git a/distros/redhat/zoneminder.spec b/distros/redhat/zoneminder.spec index f60ae222a..baf87b2f6 100644 --- a/distros/redhat/zoneminder.spec +++ b/distros/redhat/zoneminder.spec @@ -286,12 +286,18 @@ rm -rf %{_docdir}/%{name}-%{version} %files %license COPYING %doc AUTHORS README.md distros/redhat/readme/README.%{readme_suffix} distros/redhat/readme/README.https distros/redhat/jscalendar-doc + +# We want these two folders to have "normal" read permission +# compared to the folder contents %dir %{_sysconfdir}/zm %dir %{_sysconfdir}/zm/conf.d + +# Config folder contents contain sensitive info +# and should not be readable by normal users %{_sysconfdir}/zm/conf.d/README -# Always overwrite zm.conf now that ZoneMinder supports conf.d folder -%attr(640,root,%{zmgid_final}) %{_sysconfdir}/zm/zm.conf +%config(noreplace) %attr(640,root,%{zmgid_final}) %{_sysconfdir}/zm/zm.conf %config(noreplace) %attr(640,root,%{zmgid_final}) %{_sysconfdir}/zm/conf.d/*.conf +%ghost %{_sysconfdir}/zm/conf.d/zmcustom.conf %config(noreplace) %attr(644,root,root) %{wwwconfdir}/zoneminder.conf %config(noreplace) %{_sysconfdir}/logrotate.d/zoneminder diff --git a/zm.conf.in b/zm.conf.in index c417aacd2..bde068104 100644 --- a/zm.conf.in +++ b/zm.conf.in @@ -1,16 +1,15 @@ # ========================================================================== # -# ZoneMinder Base Configuration File +# ZoneMinder Base Configuration # # ========================================================================== # # *** DO NOT EDIT THIS FILE *** -# Changes made directly to this configuration file are no longer supported. -# They will be overwritten during an upgrade. # -# Instead, create a custom configuration file, with an extention of ".conf" -# under the @ZM_CONFIG_SUBDIR@ subfolder containing your desired modifications. -# +# To make custom changes to the variables below, create a new configuration +# file, with an extention 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@ @@ -50,43 +49,10 @@ ZM_DB_USER=@ZM_DB_USER@ # ZoneMinder database password ZM_DB_PASS=@ZM_DB_PASS@ -# Full path to the folder events are recorded to. -# The web account user must have full read/write permission to this folder. -ZM_DIR_EVENTS=@ZM_DIR_EVENTS@ - -# Full path to the folder images, not directly associated with events, -# are recorded to. -# The web account user must have full read/write permission to this folder. -ZM_DIR_IMAGES=@ZM_DIR_IMAGES@ - -# Foldername under the webroot where ZoneMinder looks for optional sound files -# to play when an alarm is detected. -ZM_DIR_SOUNDS=@ZM_DIR_SOUNDS@ - -# Full path to the folder where exported archives are stored -# The web account user must have full read/write permission to this folder. -ZM_DIR_EXPORTS=@ZM_TMPDIR@ - -# ZoneMinder url path to the zms streaming server -ZM_PATH_ZMS=@ZM_PATH_ZMS@ - -# Full Path to ZoneMinder's mapped memory files -# The web account user must have full read/write permission to this folder. -ZM_PATH_MAP=@ZM_PATH_MAP@ - -# Full Path to ZoneMinder's socket folder -# The web account user must have full read/write permission to this folder. -ZM_PATH_SOCKS=@ZM_SOCKDIR@ - -# Full path to ZoneMinder's log folder -# The web account user must have full read/write permission to this folder. -ZM_PATH_LOGS=@ZM_LOGDIR@ - -# Full path to ZoneMinder's swap folder -# The web account user must have full read/write permission to this folder. -ZM_PATH_SWAP=@ZM_TMPDIR@ - -# Full path to optional arp binary -# ZoneMinder will find the arp binary automatically on most systems -ZM_PATH_ARP=@ZM_PATH_ARP@ +# 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=