From a05a1f396c69b456302e9e43608600ed625d6481 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Thu, 19 Apr 2018 08:20:38 -0500 Subject: [PATCH 1/8] fix copy/paste typo --- db/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/CMakeLists.txt b/db/CMakeLists.txt index c8aa7cad6..ed215d35f 100644 --- a/db/CMakeLists.txt +++ b/db/CMakeLists.txt @@ -11,7 +11,7 @@ file(GLOB dbfileslist RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "zm_update-*.sql") install(FILES ${dbfileslist} DESTINATION "${CMAKE_INSTALL_DATADIR}/zoneminder/db") # install zm_update-1.31.30.sql -install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/zm_update-1.31.30.sql" DESTINATION "${CMAKE_INSTALL_DATADIR}/zoneminder/db") +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zm_update-1.31.30.sql" DESTINATION "${CMAKE_INSTALL_DATADIR}/zoneminder/db") # install zm_create.sql install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zm_create.sql" DESTINATION "${CMAKE_INSTALL_DATADIR}/zoneminder/db") From 3c225c9f1c1a6ade63c1b7702d6178abacde1a21 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Thu, 19 Apr 2018 14:01:46 -0500 Subject: [PATCH 2/8] Migrate Webcache out of webroot (#2083) * migrate webcache folder out of webroot, migrate htaccess files * rpm specfile - add missing reference to cache folder * fix submodule mixup --- CMakeLists.txt | 2 + distros/redhat/CMakeLists.txt | 1 + distros/redhat/apache/zoneminder.conf.in | 17 ++++++++ distros/redhat/systemd/zoneminder.tmpfiles.in | 3 ++ distros/redhat/zoneminder.spec | 1 + .../ubuntu1204/conf/apache2/zoneminder.conf | 32 +++++++++++++- distros/ubuntu1204/rules | 1 + distros/ubuntu1204/zoneminder.dirs | 1 + .../ubuntu1604/conf/apache2/zoneminder.conf | 31 +++++++++++++- distros/ubuntu1604/rules | 1 + distros/ubuntu1604/zoneminder.dirs | 2 +- distros/ubuntu1604/zoneminder.postinst | 2 +- distros/ubuntu1604/zoneminder.tmpfile | 2 +- misc/apache.conf.in | 42 +++++++++++++++++++ web/.htaccess | 5 --- web/api/.htaccess | 6 --- web/api/app/.htaccess | 6 --- web/api/app/Plugin/Crud | 2 +- web/api/app/webroot/.htaccess | 7 ---- .../lib/Cake/Console/Templates/skel/.htaccess | 5 --- .../Templates/skel/tmp/cache/models/empty | 0 .../Templates/skel/tmp/cache/persistent/empty | 0 .../Templates/skel/tmp/cache/views/empty | 0 .../Console/Templates/skel/tmp/logs/empty | 0 .../Console/Templates/skel/tmp/sessions/empty | 0 .../Console/Templates/skel/tmp/tests/empty | 0 .../Console/Templates/skel/webroot/.htaccess | 6 --- web/includes/config.php.in | 1 + web/includes/functions.php | 6 +-- 29 files changed, 136 insertions(+), 46 deletions(-) delete mode 100644 web/.htaccess delete mode 100644 web/api/.htaccess delete mode 100644 web/api/app/.htaccess delete mode 100644 web/api/app/webroot/.htaccess delete mode 100644 web/api/lib/Cake/Console/Templates/skel/.htaccess create mode 100644 web/api/lib/Cake/Console/Templates/skel/tmp/cache/models/empty create mode 100644 web/api/lib/Cake/Console/Templates/skel/tmp/cache/persistent/empty create mode 100644 web/api/lib/Cake/Console/Templates/skel/tmp/cache/views/empty create mode 100644 web/api/lib/Cake/Console/Templates/skel/tmp/logs/empty create mode 100644 web/api/lib/Cake/Console/Templates/skel/tmp/sessions/empty create mode 100644 web/api/lib/Cake/Console/Templates/skel/tmp/tests/empty delete mode 100644 web/api/lib/Cake/Console/Templates/skel/webroot/.htaccess diff --git a/CMakeLists.txt b/CMakeLists.txt index d6f989f01..b24bc6fa8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -141,6 +141,8 @@ set(ZM_WEBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/zoneminder/www" "Location of the web files, default: /${CMAKE_INSTALL_DATADIR}/zoneminder/www") set(ZM_CGIDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBEXECDIR}/zoneminder/cgi-bin" CACHE PATH "Location of the cgi-bin files, default: /${CMAKE_INSTALL_LIBEXECDIR}/zoneminder/cgi-bin") +set(ZM_CACHEDIR "/var/cache/zoneminder" CACHE PATH + "Location of the web server cache busting files, default: /var/cache/zoneminder") set(ZM_CONTENTDIR "/var/lib/zoneminder" CACHE PATH "Location of dynamic content (events and images), default: /var/lib/zoneminder") set(ZM_DB_HOST "localhost" CACHE STRING diff --git a/distros/redhat/CMakeLists.txt b/distros/redhat/CMakeLists.txt index 73f88f968..edc0fd080 100644 --- a/distros/redhat/CMakeLists.txt +++ b/distros/redhat/CMakeLists.txt @@ -52,6 +52,7 @@ file(MAKE_DIRECTORY sock swap zoneminder zoneminder-upload events images temp) install(DIRECTORY sock swap DESTINATION /var/lib/zoneminder DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) install(DIRECTORY zoneminder DESTINATION /var/log DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) install(DIRECTORY zoneminder DESTINATION /var/run DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) +install(DIRECTORY zoneminder DESTINATION /var/cache DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) install(DIRECTORY zoneminder-upload DESTINATION /var/spool DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) install(DIRECTORY events images temp DESTINATION /var/lib/zoneminder DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) diff --git a/distros/redhat/apache/zoneminder.conf.in b/distros/redhat/apache/zoneminder.conf.in index 0e546f9df..a52c1166a 100644 --- a/distros/redhat/apache/zoneminder.conf.in +++ b/distros/redhat/apache/zoneminder.conf.in @@ -9,6 +9,23 @@ RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^/?(zm)(.*) https://%{SERVER_NAME}/$1$2 [R,L] +# Order matters. This alias must come first. +Alias /zm/cache "@ZM_CACHEDIR@" + + SSLRequireSSL + Options -Indexes +MultiViews +FollowSymLinks + AllowOverride None + + # Apache 2.4 + Require all granted + + + # Apache 2.2 + Order deny,allow + Allow from all + + + Alias /zm "@ZM_WEBDIR@" # explicitly set index.php as the only directoryindex diff --git a/distros/redhat/systemd/zoneminder.tmpfiles.in b/distros/redhat/systemd/zoneminder.tmpfiles.in index f3acd0af7..de155b4cc 100644 --- a/distros/redhat/systemd/zoneminder.tmpfiles.in +++ b/distros/redhat/systemd/zoneminder.tmpfiles.in @@ -1,2 +1,5 @@ D @ZM_TMPDIR@ 0755 @WEB_USER@ @WEB_GROUP@ D @ZM_SOCKDIR@ 0755 @WEB_USER@ @WEB_GROUP@ +D @ZM_CACHEDIR@ 0755 @WEB_USER@ @WEB_GROUP@ +D @ZM_DIR_EVENTS@ 0755 @WEB_USER@ @WEB_GROUP@ +D @ZM_DIR_IMAGES@ 0755 @WEB_USER@ @WEB_GROUP@ diff --git a/distros/redhat/zoneminder.spec b/distros/redhat/zoneminder.spec index 5d8f213b6..3d2febab9 100644 --- a/distros/redhat/zoneminder.spec +++ b/distros/redhat/zoneminder.spec @@ -377,6 +377,7 @@ rm -rf %{_docdir}/%{name}-%{version} %dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_sharedstatedir}/zoneminder/sock %dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_sharedstatedir}/zoneminder/swap %dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_sharedstatedir}/zoneminder/temp +%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/cache/zoneminder %dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/log/zoneminder %dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/spool/zoneminder-upload %dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/run/zoneminder diff --git a/distros/ubuntu1204/conf/apache2/zoneminder.conf b/distros/ubuntu1204/conf/apache2/zoneminder.conf index 0dc312769..81e9713db 100644 --- a/distros/ubuntu1204/conf/apache2/zoneminder.conf +++ b/distros/ubuntu1204/conf/apache2/zoneminder.conf @@ -6,6 +6,12 @@ ScriptAlias /zm/cgi-bin "/usr/lib/zoneminder/cgi-bin" Require all granted +# Order matters. This Alias must come first +Alias /zm/cache /var/cache/zoneminder/cache + + Options -Indexes +FollowSymLinks + + Alias /zm /usr/share/zoneminder/www php_flag register_globals off @@ -15,6 +21,28 @@ Alias /zm /usr/share/zoneminder/www - - AllowOverride All +# For better visibility, the following directives have been migrated from the +# default .htaccess files included with the CakePHP project. +# Parameters not set here are inherited from the parent directive above. + + RewriteEngine on + RewriteRule ^$ app/webroot/ [L] + RewriteRule (.*) app/webroot/$1 [L] + RewriteBase /zm/api + + + RewriteEngine on + RewriteRule ^$ webroot/ [L] + RewriteRule (.*) webroot/$1 [L] + RewriteBase /zm/api + + + + RewriteEngine On + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^ index.php [L] + RewriteBase /zm/api + + diff --git a/distros/ubuntu1204/rules b/distros/ubuntu1204/rules index 0103d1c27..aed63c110 100755 --- a/distros/ubuntu1204/rules +++ b/distros/ubuntu1204/rules @@ -25,6 +25,7 @@ override_dh_auto_configure: -DZM_SOCKDIR="/var/run/zm" \ -DZM_TMPDIR="/tmp/zm" \ -DZM_CGIDIR="/usr/lib/zoneminder/cgi-bin" \ + -DZM_CACHEDIR="/var/cache/zoneminder/cache" \ -DZM_DIR_EVENTS="/var/cache/zoneminder/events" \ -DZM_DIR_IMAGES="/var/cache/zoneminder/images" \ -DZM_PATH_ZMS="/zm/cgi-bin/nph-zms" \ diff --git a/distros/ubuntu1204/zoneminder.dirs b/distros/ubuntu1204/zoneminder.dirs index ff1ec7858..79b2c66af 100644 --- a/distros/ubuntu1204/zoneminder.dirs +++ b/distros/ubuntu1204/zoneminder.dirs @@ -3,6 +3,7 @@ var/lib/zm var/cache/zoneminder/events var/cache/zoneminder/images var/cache/zoneminder/temp +var/cache/zoneminder/cache usr/share/zoneminder/db etc/zm etc/zm/conf.d diff --git a/distros/ubuntu1604/conf/apache2/zoneminder.conf b/distros/ubuntu1604/conf/apache2/zoneminder.conf index 59efc6248..a51b153a9 100644 --- a/distros/ubuntu1604/conf/apache2/zoneminder.conf +++ b/distros/ubuntu1604/conf/apache2/zoneminder.conf @@ -6,6 +6,12 @@ ScriptAlias /zm/cgi-bin "/usr/lib/zoneminder/cgi-bin" Require all granted +# Order matters. This alias must come first. +Alias /zm/cache /var/cache/zoneminder/cache + + Options -Indexes +FollowSymLinks + + Alias /zm /usr/share/zoneminder/www Options -Indexes +FollowSymLinks @@ -14,6 +20,27 @@ Alias /zm /usr/share/zoneminder/www - - AllowOverride All +# For better visibility, the following directives have been migrated from the +# default .htaccess files included with the CakePHP project. +# Parameters not set here are inherited from the parent directive above. + + RewriteEngine on + RewriteRule ^$ app/webroot/ [L] + RewriteRule (.*) app/webroot/$1 [L] + RewriteBase /zm/api + + + + RewriteEngine on + RewriteRule ^$ webroot/ [L] + RewriteRule (.*) webroot/$1 [L] + RewriteBase /zm/api + + + + RewriteEngine On + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^ index.php [L] + RewriteBase /zm/api diff --git a/distros/ubuntu1604/rules b/distros/ubuntu1604/rules index 97c084e42..f0808a8e1 100755 --- a/distros/ubuntu1604/rules +++ b/distros/ubuntu1604/rules @@ -25,6 +25,7 @@ override_dh_auto_configure: -DZM_SOCKDIR="/var/run/zm" \ -DZM_TMPDIR="/tmp/zm" \ -DZM_CGIDIR="/usr/lib/zoneminder/cgi-bin" \ + -DZM_CACHEDIR="/var/cache/zoneminder/cache" \ -DZM_DIR_EVENTS="/var/cache/zoneminder/events" \ -DZM_DIR_IMAGES="/var/cache/zoneminder/images" \ -DZM_PATH_ZMS="/zm/cgi-bin/nph-zms" diff --git a/distros/ubuntu1604/zoneminder.dirs b/distros/ubuntu1604/zoneminder.dirs index 08840aef4..6db3d5a95 100644 --- a/distros/ubuntu1604/zoneminder.dirs +++ b/distros/ubuntu1604/zoneminder.dirs @@ -3,7 +3,7 @@ var/lib/zm var/cache/zoneminder/events var/cache/zoneminder/images var/cache/zoneminder/temp +var/cache/zoneminder/cache usr/share/zoneminder/db -usr/share/zoneminder/www/cache etc/zm/ etc/zm/conf.d diff --git a/distros/ubuntu1604/zoneminder.postinst b/distros/ubuntu1604/zoneminder.postinst index b9307bddd..17272c2df 100644 --- a/distros/ubuntu1604/zoneminder.postinst +++ b/distros/ubuntu1604/zoneminder.postinst @@ -13,7 +13,7 @@ if [ "$1" = "configure" ]; then chown www-data:root /var/log/zm chown www-data:www-data /var/lib/zm if [ -z "$2" ]; then - chown www-data:www-data /var/cache/zoneminder /var/cache/zoneminder/* /usr/share/zoneminder/www/cache + chown www-data:www-data /var/cache/zoneminder /var/cache/zoneminder/* fi if [ ! -e "/etc/apache2/mods-enabled/cgi.load" ] && [ "$(command -v a2enmod)" != "" ]; then echo "The cgi module is not enabled in apache2. I am enabling it using a2enmod cgi." diff --git a/distros/ubuntu1604/zoneminder.tmpfile b/distros/ubuntu1604/zoneminder.tmpfile index f23ca55b3..9435be2a8 100644 --- a/distros/ubuntu1604/zoneminder.tmpfile +++ b/distros/ubuntu1604/zoneminder.tmpfile @@ -1,4 +1,4 @@ d /var/run/zm 0755 www-data www-data d /tmp/zm 0755 www-data www-data d /var/tmp/zm 0755 www-data www-data -d /usr/share/zoneminder/www/cache 0755 www-data www-data +d /var/cache/zoneminder/cache 0755 www-data www-data diff --git a/misc/apache.conf.in b/misc/apache.conf.in index 1344bb9b1..cb9c08667 100644 --- a/misc/apache.conf.in +++ b/misc/apache.conf.in @@ -8,6 +8,23 @@ ServerAdmin webmaster@localhost DocumentRoot "@WEB_PREFIX@" + + # Order matters. This alias must come first. + Alias /zm/cache "@ZM_CACHEDIR@" + + Options -Indexes +FollowSymLinks + AllowOverride None + + # Apache 2.4 + Require all granted + + + # Apache 2.2 + Order deny,allow + Allow from all + + + Alias /zm "@WEB_PREFIX@" Options -Indexes +FollowSymLinks @@ -38,6 +55,31 @@ + # For better visibility, the following directives have been migrated from the + # default .htaccess files included with the CakePHP project. + # Parameters not set here are inherited from the parent directive above. + + RewriteEngine on + RewriteRule ^$ app/webroot/ [L] + RewriteRule (.*) app/webroot/$1 [L] + RewriteBase /zm/api + + + + RewriteEngine on + RewriteRule ^$ webroot/ [L] + RewriteRule (.*) webroot/$1 [L] + RewriteBase /zm/api + + + + RewriteEngine On + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^ index.php [L] + RewriteBase /zm/api + + # Use the first option to have Apache logs written to the general log # directory, or the second to have them written to the regular Apache # directory (you may have to change the path to that used on your system) diff --git a/web/.htaccess b/web/.htaccess deleted file mode 100644 index f23dbaf66..000000000 --- a/web/.htaccess +++ /dev/null @@ -1,5 +0,0 @@ - - RewriteEngine on - RewriteRule ^$ app/webroot/ [L] - RewriteRule (.*) app/webroot/$1 [L] - \ No newline at end of file diff --git a/web/api/.htaccess b/web/api/.htaccess deleted file mode 100644 index 7139a2766..000000000 --- a/web/api/.htaccess +++ /dev/null @@ -1,6 +0,0 @@ - - RewriteEngine on - RewriteRule ^$ app/webroot/ [L] - RewriteRule (.*) app/webroot/$1 [L] - RewriteBase /zm/api - diff --git a/web/api/app/.htaccess b/web/api/app/.htaccess deleted file mode 100644 index 1af74d971..000000000 --- a/web/api/app/.htaccess +++ /dev/null @@ -1,6 +0,0 @@ - - RewriteEngine on - RewriteRule ^$ webroot/ [L] - RewriteRule (.*) webroot/$1 [L] - RewriteBase /zm/api - diff --git a/web/api/app/Plugin/Crud b/web/api/app/Plugin/Crud index 1351dde6b..0bd63fb46 160000 --- a/web/api/app/Plugin/Crud +++ b/web/api/app/Plugin/Crud @@ -1 +1 @@ -Subproject commit 1351dde6b4c75b215099ae8bcf5a21d6c6e10298 +Subproject commit 0bd63fb464957080ead342db58ca9e01532cf1ef diff --git a/web/api/app/webroot/.htaccess b/web/api/app/webroot/.htaccess deleted file mode 100644 index f08afa8b2..000000000 --- a/web/api/app/webroot/.htaccess +++ /dev/null @@ -1,7 +0,0 @@ - - RewriteEngine On - RewriteCond %{REQUEST_FILENAME} !-d - RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule ^ index.php [L] - RewriteBase /zm/api - diff --git a/web/api/lib/Cake/Console/Templates/skel/.htaccess b/web/api/lib/Cake/Console/Templates/skel/.htaccess deleted file mode 100644 index 128e7871b..000000000 --- a/web/api/lib/Cake/Console/Templates/skel/.htaccess +++ /dev/null @@ -1,5 +0,0 @@ - - RewriteEngine on - RewriteRule ^$ webroot/ [L] - RewriteRule (.*) webroot/$1 [L] - \ No newline at end of file diff --git a/web/api/lib/Cake/Console/Templates/skel/tmp/cache/models/empty b/web/api/lib/Cake/Console/Templates/skel/tmp/cache/models/empty new file mode 100644 index 000000000..e69de29bb diff --git a/web/api/lib/Cake/Console/Templates/skel/tmp/cache/persistent/empty b/web/api/lib/Cake/Console/Templates/skel/tmp/cache/persistent/empty new file mode 100644 index 000000000..e69de29bb diff --git a/web/api/lib/Cake/Console/Templates/skel/tmp/cache/views/empty b/web/api/lib/Cake/Console/Templates/skel/tmp/cache/views/empty new file mode 100644 index 000000000..e69de29bb diff --git a/web/api/lib/Cake/Console/Templates/skel/tmp/logs/empty b/web/api/lib/Cake/Console/Templates/skel/tmp/logs/empty new file mode 100644 index 000000000..e69de29bb diff --git a/web/api/lib/Cake/Console/Templates/skel/tmp/sessions/empty b/web/api/lib/Cake/Console/Templates/skel/tmp/sessions/empty new file mode 100644 index 000000000..e69de29bb diff --git a/web/api/lib/Cake/Console/Templates/skel/tmp/tests/empty b/web/api/lib/Cake/Console/Templates/skel/tmp/tests/empty new file mode 100644 index 000000000..e69de29bb diff --git a/web/api/lib/Cake/Console/Templates/skel/webroot/.htaccess b/web/api/lib/Cake/Console/Templates/skel/webroot/.htaccess deleted file mode 100644 index 1d499ba73..000000000 --- a/web/api/lib/Cake/Console/Templates/skel/webroot/.htaccess +++ /dev/null @@ -1,6 +0,0 @@ - - RewriteEngine On - RewriteCond %{REQUEST_FILENAME} !-d - RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule ^ index.php [L] - diff --git a/web/includes/config.php.in b/web/includes/config.php.in index c9bd55dd7..c6aa93c63 100644 --- a/web/includes/config.php.in +++ b/web/includes/config.php.in @@ -26,6 +26,7 @@ define( 'ZM_CONFIG_SUBDIR', '@ZM_CONFIG_SUBDIR@' ); // Path to config subfolder // Define, and override any given in config file define( 'ZM_VERSION', '@VERSION@' ); // Version define( 'ZM_DIR_TEMP', '@ZM_TMPDIR@' ); +define( 'ZM_DIR_CACHE', '@ZM_CACHEDIR@' ); global $configvals; $configFile = ZM_CONFIG; diff --git a/web/includes/functions.php b/web/includes/functions.php index 64d6ce29b..69d655d8a 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -2031,9 +2031,9 @@ function cache_bust( $file ) { $parts = pathinfo($file); global $css; $dirname = preg_replace( '/\//', '_', $parts['dirname'] ); - $cacheFile = 'cache/'.$dirname.'_'.$parts['filename'].'-'.$css.'-'.filemtime($file).'.'.$parts['extension']; - if ( file_exists( ZM_PATH_WEB.'/'.$cacheFile ) or symlink( ZM_PATH_WEB.'/'.$file, ZM_PATH_WEB.'/'.$cacheFile ) ) { - return $cacheFile; + $cacheFile = $dirname.'_'.$parts['filename'].'-'.$css.'-'.filemtime($file).'.'.$parts['extension']; + if ( file_exists( ZM_DIR_CACHE.'/'.$cacheFile ) or symlink( ZM_PATH_WEB.'/'.$file, ZM_DIR_CACHE.'/'.$cacheFile ) ) { + return 'cache/'.$cacheFile; } else { Warning("Failed linking $file to $cacheFile"); } From ed140426abae562f83577d1e714916720a0fa18b Mon Sep 17 00:00:00 2001 From: Andy Bauer Date: Thu, 19 Apr 2018 15:36:43 -0500 Subject: [PATCH 3/8] rpm packaging changes and documentation --- distros/redhat/CMakeLists.txt | 7 ++-- distros/redhat/readme/README.Fedora | 56 ++++++++++++---------------- distros/redhat/readme/README.Redhat6 | 52 +++++++++++--------------- distros/redhat/readme/README.Redhat7 | 54 +++++++++++---------------- distros/redhat/readme/README.https | 29 +++++++------- distros/redhat/zoneminder.spec | 5 +-- web/api/app/Plugin/Crud | 2 +- 7 files changed, 84 insertions(+), 121 deletions(-) diff --git a/distros/redhat/CMakeLists.txt b/distros/redhat/CMakeLists.txt index edc0fd080..ba8aba9c0 100644 --- a/distros/redhat/CMakeLists.txt +++ b/distros/redhat/CMakeLists.txt @@ -62,17 +62,16 @@ install(CODE "execute_process(COMMAND ln -sf ../../../../../../var/lib/zoneminde # Link to Cambozola install(CODE "execute_process(COMMAND ln -sf ../../java/cambozola.jar \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/cambozola.jar\")") -# Install auxiliary files required to run zoneminder on CentOS +# Install auxiliary files install(FILES misc/redalert.wav DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/sounds PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) install(DIRECTORY jscalendar-1.0/ DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/tools/jscalendar) +# Install zoneminder service files install(FILES zoneminder.logrotate DESTINATION /etc/logrotate.d RENAME zoneminder PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) +install(FILES zoneminder.conf DESTINATION /etc/zm/www PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) if(ZM_WEB_USER STREQUAL "nginx") - install(FILES zoneminder.conf DESTINATION /etc/nginx/default.d PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) install(FILES zoneminder.php-fpm.conf DESTINATION /etc/php-fpm.d PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ RENAME zoneminder.conf) -else(ZM_WEB_USER STREQUAL "nginx") - install(FILES zoneminder.conf DESTINATION /etc/httpd/conf.d PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) endif(ZM_WEB_USER STREQUAL "nginx") if(ZM_TARGET_DISTRO STREQUAL "el6") diff --git a/distros/redhat/readme/README.Fedora b/distros/redhat/readme/README.Fedora index e3cca1f8c..bd80b02a8 100644 --- a/distros/redhat/readme/README.Fedora +++ b/distros/redhat/readme/README.Fedora @@ -1,37 +1,19 @@ What's New ========== -1. ZoneMinder now uses a conf.d subfolder to process custom changes to - variables found in zm.conf. Changes to zm.conf will be overwritten - during an upgrade. Instead, create a file with a ".conf" extension under - the conf.d folder and make your changes there. - -2. ZoneMinder now supports recording directly to video container! This feature - is new and should be treated as experimental. Refer to the documentation - regarding how to use this feature. - -3. The Apache ScriptAlias has been changed from "/cgi-bin/zm/zms" to - "/cgi-bin-zm/zms". This has been to done to avoid this bug: - https://bugzilla.redhat.com/show_bug.cgi?id=973067 - - IMPORTANT: You must manually inspect the value for PATH_ZMS under Options - and verify it is set to "/cgi-bin-zm/nph-zms". Failure to do so will result - in a broken system. You have been warned. - -4. This package uses the HTTPS protocol by default to access the web portal. - Requests using HTTP will auto-redirect to HTTPS. See README.https for - more information. - +1. See the ZoneMinder release notes for a list of new features: + https://github.com/ZoneMinder/zoneminder/releases + New installs ============ 1. Unless you are already using MariaDB server, you need to ensure that the server is configured to start during boot and properly secured by running: - sudo dnf install mariadb-server - sudo systemctl enable mariadb - sudo systemctl start mariadb.service - mysql_secure_installation + sudo dnf install mariadb-server + sudo systemctl enable mariadb + sudo systemctl start mariadb.service + mysql_secure_installation 2. Assuming the database is local and using the password for the root account set during the previous step, you will need to create the ZoneMinder @@ -82,16 +64,24 @@ New installs SELINUX line from "enforcing" to "disabled". This change will take effect after a reboot. -6. Install mod_ssl or configure /etc/httpd/conf.d/zoneminder.conf to meet your - needs. This package comes preconfigured for HTTPS using the default self - signed certificate on your system. The recommended way to complete this step - is to simply install mod_ssl: +6. Configure the web server + This package uses the HTTPS protocol by default to access the web portal, + using rhe default self signed certificate on your system. Requests using + HTTP will auto-redirect to HTTPS. + + Inspect the web server configuration file and verify it meets your needs: + + /etc/zm/www/zoneminder.conf + + If you are running other web enabled services then you may need to edit + this file to suite. See README.https to learn about other alternatives. + + When in doubt, proceed with the default: + + sudo ln -s /etc/zm/www/zoneminder.conf /etc/httpd/conf.d/ sudo dnf install mod_ssl - If this does not meet your needs, then read README.https to - learn about alternatives. When in doubt, install mod_ssl. - 7. Now start the web server: sudo systemctl enable httpd @@ -131,7 +121,7 @@ Upgrades See step 2 of the Installation section to add missing permissions. 3. Verify the ZoneMinder Apache configuration file in the folder - /etc/httpd/conf.d. You will have a file called "zoneminder.conf" and there + /etc/zm/www. You will have a file called "zoneminder.conf" and there may also be a file called "zoneminder.conf.rpmnew". If the rpmnew file exists, inspect it and merge anything new in that file with zoneminder.conf. Verify the SSL REquirements meet your needs. Read README.https if necessary. diff --git a/distros/redhat/readme/README.Redhat6 b/distros/redhat/readme/README.Redhat6 index 939300d96..e7e4a4d49 100644 --- a/distros/redhat/readme/README.Redhat6 +++ b/distros/redhat/readme/README.Redhat6 @@ -1,7 +1,10 @@ What's New ========== -1. ***EOL NOTICE*** +1. See the ZoneMinder release notes for a list of new features: + https://github.com/ZoneMinder/zoneminder/releases + +2. ***EOL NOTICE*** It has become increasingly difficult to maintain the ZoneMinder project such that it remains compatible with EL6 distros. The version of php shipped with EL6 distros and the version of ffmpeg which will build against EL6 are too @@ -11,28 +14,7 @@ What's New replacing core packages, such as php, will not be supported by us. You are on your own should you choose to go down that path. -2. ZoneMinder now uses a conf.d subfolder to process custom changes to - variables found in zm.conf. Changes to zm.conf will be overwritten - during an upgrade. Instead, create a file with a ".conf" extension under - th2 conf.d folder and make your changes there. - -3. ZoneMinder now supports recording directly to video container! This feature - is new and should be treated as experimental. Refer to the documentation - regarding how to use this feature. - -4. The Apache ScriptAlias has been changed from "/cgi-bin/zm/zms" to - "/cgi-bin-zm/zms". This has been to done match the configuration of - CentOS7/Fedora and simplify the build process. - - IMPORTANT: You must manually verify the value of PATH_ZMS under Options. - Make sure it is set to "/cgi-bin-zm/nph-zms". Failure to do so will result - in a broken system. You have been warned. - -5. This package uses the HTTPS protocol by default to access the web portal. - Requests using HTTP will auto-redirect to HTTPS. See README.https for - more information. - -6. The php package that ships with CentOS 6 does not support the new ZoneMinder +3. The php package that ships with CentOS 6 does not support the new ZoneMinder API. If you require API functionality (such as using a mobile app) then you should consider an upgrade to CentOS 7 or use Fedora. @@ -81,15 +63,23 @@ New installs If you are not sure of the proper timezone specification to use, look at http://php.net/date.timezone -5. Install mod_ssl or configure /etc/httpd/conf.d/zoneminder.conf to meet your - needs. This package comes preconfigured for HTTPS using the default self - signed certificate on your system. The recommended way to complete this step - is to simply install mod_ssl: +5. Configure the web server - sudo yum install mod_ssl + This package uses the HTTPS protocol by default to access the web portal, + using rhe default self signed certificate on your system. Requests using + HTTP will auto-redirect to HTTPS. - If this does not meet your needs, then read README.https to - learn about alternatives. When in doubt, install mod_ssl. + Inspect the web server configuration file and verify it meets your needs: + + /etc/zm/www/zoneminder.conf + + If you are running other web enabled services then you may need to edit + this file to suite. See README.https to learn about other alternatives. + + When in doubt, proceed with the default: + + sudo ln -s /etc/zm/www/zoneminder.conf /etc/httpd/conf.d/ + sudo dnf install mod_ssl 6. Configure the web server to start automatically: @@ -137,7 +127,7 @@ Upgrades See step 2 of the Installation section to add missing permissions. 3. Verify the ZoneMinder Apache configuration file in the folder - /etc/httpd/conf.d. You will have a file called "zoneminder.conf" and there + /etc/zm/www. You will have a file called "zoneminder.conf" and there may also be a file called "zoneminder.conf.rpmnew". If the rpmnew file exists, inspect it and merge anything new in that file with zoneminder.conf. Verify the SSL REquirements meet your needs. Read README.https if necessary. diff --git a/distros/redhat/readme/README.Redhat7 b/distros/redhat/readme/README.Redhat7 index d74973a72..3e226fbbf 100644 --- a/distros/redhat/readme/README.Redhat7 +++ b/distros/redhat/readme/README.Redhat7 @@ -1,26 +1,8 @@ What's New ========== -1. ZoneMinder now uses a conf.d subfolder to process custom changes to - variables found in zm.conf. Changes to zm.conf will be overwritten - during an upgrade. Instead, create a file with a ".conf" extension under - the conf.d folder and make your changes there. - -2. ZoneMinder now supports recording directly to video container! This feature - is new and should be treated as experimental. Refer to the documentation - regarding how to use this feature. - -3. The Apache ScriptAlias has been changed from "/cgi-bin/zm/zms" to - "/cgi-bin-zm/zms". This has been to done to avoid this bug: - https://bugzilla.redhat.com/show_bug.cgi?id=973067 - - IMPORTANT: You must manually inspect the value for PATH_ZMS under Options - and verify it is set to "/cgi-bin-zm/nph-zms". Failure to do so will result - in a broken system. You have been warned. - -4. This package uses the HTTPS protocol by default to access the web portal. - Requests using HTTP will auto-redirect to HTTPS. See README.https for - more information. +1. See the ZoneMinder release notes for a list of new features: + https://github.com/ZoneMinder/zoneminder/releases New installs ============ @@ -28,10 +10,10 @@ New installs 1. Unless you are already using MariaDB server, you need to ensure that the server is configured to start during boot and properly secured by running: - sudo yum install mariadb-server - sudo systemctl enable mariadb - sudo systemctl start mariadb.service - mysql_secure_installation + sudo yum install mariadb-server + sudo systemctl enable mariadb + sudo systemctl start mariadb.service + mysql_secure_installation 2. Using the password for the root account set during the previous step, you will need to create the ZoneMinder database and configure a database @@ -82,15 +64,23 @@ New installs SELINUX line from "enforcing" to "disabled". This change will take effect after a reboot. -6. Install mod_ssl or configure /etc/httpd/conf.d/zoneminder.conf to meet your - needs. This package comes preconfigured for HTTPS using the default self - signed certificate on your system. The recommended way to complete this step - is to simply install mod_ssl: +6. Configure the web server - sudo yum install mod_ssl + This package uses the HTTPS protocol by default to access the web portal, + using rhe default self signed certificate on your system. Requests using + HTTP will auto-redirect to HTTPS. - If this does not meet your needs, then read README.https to - learn about alternatives. When in doubt, install mod_ssl. + Inspect the web server configuration file and verify it meets your needs: + + /etc/zm/www/zoneminder.conf + + If you are running other web enabled services then you may need to edit + this file to suite. See README.https to learn about other alternatives. + + When in doubt, proceed with the default: + + sudo ln -s /etc/zm/www/zoneminder.conf /etc/httpd/conf.d/ + sudo dnf install mod_ssl 7. Now start the web server: @@ -122,7 +112,7 @@ Upgrades See step 2 of the Installation section to add missing permissions. 3. Verify the ZoneMinder Apache configuration file in the folder - /etc/httpd/conf.d. You will have a file called "zoneminder.conf" and there + /etc/zm/www. You will have a file called "zoneminder.conf" and there may also be a file called "zoneminder.conf.rpmnew". If the rpmnew file exists, inspect it and merge anything new in that file with zoneminder.conf. Verify the SSL REquirements meet your needs. Read README.https if necessary. diff --git a/distros/redhat/readme/README.https b/distros/redhat/readme/README.https index 7e4132a4a..4b02aaa0d 100644 --- a/distros/redhat/readme/README.https +++ b/distros/redhat/readme/README.https @@ -1,29 +1,26 @@ -HTTPS is now a requirement -========================== +HTTPS is now the default +======================== -This package now depends on Apache's mod_ssl package. This will automatically -be installed along with ZoneMinder. Upon installation, the mod_ssl package -will create a default, self-signed certificate. This is the certificate that -ZoneMinder will use out of the box. +By default, ZoneMinder will use the certifciate created when the mod_ssl +pacakge was installed on your system. Since the certificate is self-signed, you will get a warning from your browser the first time you access the web portal. This is normal. This is not intended to be an all encompasing solution for everyone. ZoneMinder will work just fine over HTTPS the way it is currently configured. However, -here are a couple of considerations you may want to take. +here are a couple of considerations you may want to take to improve your +experience. -1. Create your own certificate. The CentOS wiki has a guide that describes how +1. Install a fully signed certificate from letsencrypt, using certbot. See the + certbot site for more information. This free service is very easy to set up. + https://certbot.eff.org/all-instructions/ + +2. Create your own certificate. The CentOS wiki has a guide that describes how to do this: https://wiki.centos.org/HowTos/Https . Additionally, Googling - "centos certificate" reveals many articles on the subject. Note that some - third party applications, such as zmNinja, will require you to create a - certificate different than the default certificate on your machine. + "centos certificate" reveals many articles on the subject. -2. You can turn off HTTPS entirely by simply commenting out the SSLRequireSSL +3. You can turn off HTTPS entirely by simply commenting out the SSLRequireSSL directives found in /etc/httpd/conf.d/zoneminder.conf. You should also comment out the HTTP -> HTTPS Rewrite rule. -3. Install a fully signed certificate from letsencrypt. See the Letsencrypt - site for more information. https://letsencrypt.org/ - This service is totally free! - diff --git a/distros/redhat/zoneminder.spec b/distros/redhat/zoneminder.spec index 3d2febab9..75d97ebeb 100644 --- a/distros/redhat/zoneminder.spec +++ b/distros/redhat/zoneminder.spec @@ -9,9 +9,6 @@ %if "%{zmuid_final}" == "nginx" %global with_nginx 1 -%global wwwconfdir %{_sysconfdir}/nginx/default.d -%else -%global wwwconfdir %{_sysconfdir}/httpd/conf.d %endif %global sslcert %{_sysconfdir}/pki/tls/certs/localhost.crt @@ -321,7 +318,7 @@ rm -rf %{_docdir}/%{name}-%{version} %config(noreplace) %attr(640,root,%{zmgid_final}) %{_sysconfdir}/zm/conf.d/*.conf %ghost %attr(640,root,%{zmgid_final}) %{_sysconfdir}/zm/conf.d/zmcustom.conf -%config(noreplace) %attr(644,root,root) %{wwwconfdir}/zoneminder.conf +%config(noreplace) %attr(644,root,root) /etc/zm/www/zoneminder.conf %config(noreplace) %{_sysconfdir}/logrotate.d/zoneminder %if 0%{?with_nginx} diff --git a/web/api/app/Plugin/Crud b/web/api/app/Plugin/Crud index 0bd63fb46..c3976f147 160000 --- a/web/api/app/Plugin/Crud +++ b/web/api/app/Plugin/Crud @@ -1 +1 @@ -Subproject commit 0bd63fb464957080ead342db58ca9e01532cf1ef +Subproject commit c3976f1478c681b0bbc132ec3a3e82c3984eeed5 From 2d2c0df8f18689cf09707fbdecefe41c4e6f381f Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Thu, 19 Apr 2018 15:39:08 -0500 Subject: [PATCH 4/8] rpm specfile - bump version --- distros/redhat/zoneminder.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distros/redhat/zoneminder.spec b/distros/redhat/zoneminder.spec index 75d97ebeb..e3d019a4b 100644 --- a/distros/redhat/zoneminder.spec +++ b/distros/redhat/zoneminder.spec @@ -33,7 +33,7 @@ %global _hardened_build 1 Name: zoneminder -Version: 1.31.41 +Version: 1.31.42 Release: 1%{?dist} Summary: A camera monitoring and analysis tool Group: System Environment/Daemons From 411a83133805b9bc89f1f1b0e05b869bbc1188e3 Mon Sep 17 00:00:00 2001 From: Andy Bauer Date: Thu, 19 Apr 2018 18:40:05 -0500 Subject: [PATCH 5/8] rpm packaging - mention the firewall in the README's --- distros/redhat/readme/README.Fedora | 58 +++++++++++++++++++--------- distros/redhat/readme/README.Redhat6 | 29 ++++++++++++++ distros/redhat/readme/README.Redhat7 | 51 ++++++++++++++++++------ 3 files changed, 108 insertions(+), 30 deletions(-) diff --git a/distros/redhat/readme/README.Fedora b/distros/redhat/readme/README.Fedora index bd80b02a8..d0ccf8c4e 100644 --- a/distros/redhat/readme/README.Fedora +++ b/distros/redhat/readme/README.Fedora @@ -32,13 +32,13 @@ New installs /etc/zm/conf.d and set your credentials there. For example, create the file /etc/zm/conf.d/zm-db-user.conf and add the following content to it: - ZM_DB_USER = {username of the sql account you want to use} - ZM_DB_PASS = {password of the sql account you want to use} + ZM_DB_USER = {username of the sql account you want to use} + ZM_DB_PASS = {password of the sql account you want to use} Once the file has been saved, set proper file & ownership permissions on it: - sudo chown root:apache *.conf - sudo chmod 640 *.conf + sudo chown root:apache *.conf + sudo chmod 640 *.conf 4. Edit /etc/php.ini, uncomment the date.timezone line, and add your local timezone. PHP will complain loudly if this is not set, or if it is set @@ -72,34 +72,54 @@ New installs Inspect the web server configuration file and verify it meets your needs: - /etc/zm/www/zoneminder.conf + /etc/zm/www/zoneminder.conf If you are running other web enabled services then you may need to edit this file to suite. See README.https to learn about other alternatives. When in doubt, proceed with the default: - sudo ln -s /etc/zm/www/zoneminder.conf /etc/httpd/conf.d/ - sudo dnf install mod_ssl + sudo ln -s /etc/zm/www/zoneminder.conf /etc/httpd/conf.d/ + sudo dnf install mod_ssl 7. Now start the web server: - sudo systemctl enable httpd - sudo systemctl start httpd + sudo systemctl enable httpd + sudo systemctl start httpd 8. Now start zoneminder: - sudo systemctl enable zoneminder - sudo systemctl start zoneminder + sudo systemctl enable zoneminder + sudo systemctl start zoneminder -9. The Fedora repos have a ZoneMinder package available, but it does not - support ffmpeg or libvlc, which many modern IP cameras require. Most users - will want to prevent the ZoneMinder package in the Fedora repos from - overwriting the ZoneMinder package in zmrepo, during a future dnf update. To - prevent that from happening you must edit /etc/yum.repos.d/fedora.repo - and /etc/yum.repos.d/fedora-updates.repo. Add the line "exclude=zoneminder*" - without the quotes under the [fedora] and [fedora-updates] blocks, - respectively. +9. Optionally configure the firewall + + All Redhat distros ship with the firewall enabled. That means you will not + be able to access the ZoneMinder web console from a remote machine until + changes are made to the firewall. + + What follows are a set of minimal commands to allow remote access to the + ZoneMinder web console and also allow ZoneMinder's ONVIF discovery to + work. The following commands do not put any restrictions on which remote + machine(s) have access to the listed ports or services. + + sudo firewall-cmd --permanent --zone=public --add-service=http + sudo firewall-cmd --permanent --zone=public --add-service=https + sudo firewall-cmd --permanent --zone=public --add-port=3702/udp + sudo firewall-cmd --reload + + Additional changes to the firewall may be required, depending on your + security requirements and how you use the system. It is up to you to verify + these commands are sufficient. + +10. Access the ZoneMinder web console + + You may now access the ZoneMinder web console from your web browser using + an appropriate url. Here are some examples: + + http://localhost/zm (works from the local machine only) + http://{machine name}/zm (works only if dns is configured for your network) + http://{ip address}/zm Upgrades ======== diff --git a/distros/redhat/readme/README.Redhat6 b/distros/redhat/readme/README.Redhat6 index e7e4a4d49..95c063b10 100644 --- a/distros/redhat/readme/README.Redhat6 +++ b/distros/redhat/readme/README.Redhat6 @@ -107,6 +107,35 @@ New installs Then point your web browser to http:///zm +9. Optionally configure the firewall + + All Redhat distros ship with the firewall enabled. That means you will not + be able to access the ZoneMinder web console from a remote machine until + changes are made to the firewall. + + What follows are a set of minimal commands to allow remote access to the + ZoneMinder web console and also allow ZoneMinder's ONVIF discovery to + work. The following commands do not put any restrictions on which remote + machine(s) have access to the listed ports or services. + + sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT + sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT + sudo iptables -A INPUT -p udp --dport 3702 -j ACCEPT + iptables-save | sudo tee /etc/sysconfig/iptables + + Additional changes to the firewall may be required, depending on your + security requirements and how you use the system. It is up to you to verify + these commands are sufficient. + +10. Access the ZoneMinder web console + + You may now access the ZoneMinder web console from your web browser using + an appropriate url. Here are some examples: + + http://localhost/zm (works from the local machine only) + http://{machine name}/zm (works only if dns is configured for your network) + http://{ip address}/zm + Upgrades ======== diff --git a/distros/redhat/readme/README.Redhat7 b/distros/redhat/readme/README.Redhat7 index 3e226fbbf..b70e7768d 100644 --- a/distros/redhat/readme/README.Redhat7 +++ b/distros/redhat/readme/README.Redhat7 @@ -32,13 +32,13 @@ New installs /etc/zm/conf.d and set your credentials there. For example, create the file /etc/zm/conf.d/zm-db-user.conf and add the following content to it: - ZM_DB_USER = {username of the sql account you want to use} - ZM_DB_PASS = {password of the sql account you want to use} + ZM_DB_USER = {username of the sql account you want to use} + ZM_DB_PASS = {password of the sql account you want to use} Once the file has been saved, set proper file & ownership permissions on it: - sudo chown root:apache *.conf - sudo chmod 640 *.conf + sudo chown root:apache *.conf + sudo chmod 640 *.conf 4. Edit /etc/php.ini, uncomment the date.timezone line, and add your local timezone. PHP will complain loudly if this is not set, or if it is set @@ -72,25 +72,54 @@ New installs Inspect the web server configuration file and verify it meets your needs: - /etc/zm/www/zoneminder.conf + /etc/zm/www/zoneminder.conf If you are running other web enabled services then you may need to edit this file to suite. See README.https to learn about other alternatives. When in doubt, proceed with the default: - sudo ln -s /etc/zm/www/zoneminder.conf /etc/httpd/conf.d/ - sudo dnf install mod_ssl + sudo ln -s /etc/zm/www/zoneminder.conf /etc/httpd/conf.d/ + sudo dnf install mod_ssl 7. Now start the web server: - sudo systemctl enable httpd - sudo systemctl start httpd + sudo systemctl enable httpd + sudo systemctl start httpd 8. Now start zoneminder: - sudo systemctl enable zoneminder - sudo systemctl start zoneminder + sudo systemctl enable zoneminder + sudo systemctl start zoneminder + +9. Optionally configure the firewall + + All Redhat distros ship with the firewall enabled. That means you will not + be able to access the ZoneMinder web console from a remote machine until + changes are made to the firewall. + + What follows are a set of minimal commands to allow remote access to the + ZoneMinder web console and also allow ZoneMinder's ONVIF discovery to + work. The following commands do not put any restrictions on which remote + machine(s) have access to the listed ports or services. + + sudo firewall-cmd --permanent --zone=public --add-service=http + sudo firewall-cmd --permanent --zone=public --add-service=https + sudo firewall-cmd --permanent --zone=public --add-port=3702/udp + sudo firewall-cmd --reload + + Additional changes to the firewall may be required, depending on your + security requirements and how you use the system. It is up to you to verify + these commands are sufficient. + +10. Access the ZoneMinder web console + + You may now access the ZoneMinder web console from your web browser using + an appropriate url. Here are some examples: + + http://localhost/zm (works from the local machine only) + http://{machine name}/zm (works only if dns is configured for your network) + http://{ip address}/zm Upgrades ======== From 39244ac6ec6402b4e9ee21e1b646714a3375f989 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Thu, 19 Apr 2018 20:01:31 -0500 Subject: [PATCH 6/8] buildsystem update --- utils/packpack/startpackpack.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/packpack/startpackpack.sh b/utils/packpack/startpackpack.sh index 95f887320..46f6f2356 100755 --- a/utils/packpack/startpackpack.sh +++ b/utils/packpack/startpackpack.sh @@ -138,11 +138,11 @@ commonprep () { fi CEBVER="1.0-zm" - if [ -e "build/crud-${CEBVER}.tar.gz" ]; then + if [ -e "build/cakephp-enum-behavior-${CEBVER}.tar.gz" ]; then echo "Found existing CakePHP-Enum-Behavior ${CEBVER} tarball..." else echo "Retrieving CakePHP-Enum-Behavior ${CEBVER} submodule..." - curl -L https://github.com/ZoneMinder/CakePHP-Enum-Behavior/archive/v${CEBVER}.tar.gz > build/crud-${CEBVER}.tar.gz + curl -L https://github.com/ZoneMinder/CakePHP-Enum-Behavior/archive/v${CEBVER}.tar.gz > build/cakephp-enum-behavior-${CEBVER}.tar.gz if [ $? -ne 0 ]; then echo "ERROR: Crud tarball retreival failed..." exit 1 From 087fcc6c784a3aeab872dc91a51880e9f3aa0b54 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Thu, 19 Apr 2018 20:23:17 -0500 Subject: [PATCH 7/8] update buildsystem --- utils/packpack/startpackpack.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/packpack/startpackpack.sh b/utils/packpack/startpackpack.sh index 46f6f2356..e8fa9c862 100755 --- a/utils/packpack/startpackpack.sh +++ b/utils/packpack/startpackpack.sh @@ -142,7 +142,7 @@ commonprep () { echo "Found existing CakePHP-Enum-Behavior ${CEBVER} tarball..." else echo "Retrieving CakePHP-Enum-Behavior ${CEBVER} submodule..." - curl -L https://github.com/ZoneMinder/CakePHP-Enum-Behavior/archive/v${CEBVER}.tar.gz > build/cakephp-enum-behavior-${CEBVER}.tar.gz + curl -L https://github.com/ZoneMinder/CakePHP-Enum-Behavior/archive/${CEBVER}.tar.gz > build/cakephp-enum-behavior-${CEBVER}.tar.gz if [ $? -ne 0 ]; then echo "ERROR: Crud tarball retreival failed..." exit 1 From 85ba5254963ce20857694765ccf7947d548bca5e Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Thu, 19 Apr 2018 20:41:11 -0500 Subject: [PATCH 8/8] rpm spec file - use %{_sourcedir} macro --- distros/redhat/zoneminder.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distros/redhat/zoneminder.spec b/distros/redhat/zoneminder.spec index e3d019a4b..d69469cd0 100644 --- a/distros/redhat/zoneminder.spec +++ b/distros/redhat/zoneminder.spec @@ -151,7 +151,7 @@ too much degradation of performance. %{__mv} -f crud-%{crud_version} ./web/api/app/Plugin/Crud # The all powerful autosetup macro does not work after the second source tarball -%{__gzip} -dc %{_topdir}/SOURCES/cakephp-enum-behavior-%{ceb_version}.tar.gz | tar -xvvf - +%{__gzip} -dc %{_sourcedir}/cakephp-enum-behavior-%{ceb_version}.tar.gz | tar -xvvf - %{__rm} -rf ./web/api/app/Plugin/CakePHP-Enum-Behavior %{__mv} -f CakePHP-Enum-Behavior-%{ceb_version} ./web/api/app/Plugin/CakePHP-Enum-Behavior