diff --git a/distros/redhat/CMakeLists.txt b/distros/redhat/CMakeLists.txt
index 63e742d68..0ec9c6de8 100644
--- a/distros/redhat/CMakeLists.txt
+++ b/distros/redhat/CMakeLists.txt
@@ -1,7 +1,11 @@
# CMakeLists.txt for the Redhat/CentOS Target Distro.
# Create the zoneminder service file
-configure_file(zoneminder.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.service @ONLY)
+if(ZM_TARGET_DISTRO STREQUAL "el7")
+ configure_file(zoneminder.service.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.service @ONLY)
+else
+ configure_file(zoneminder.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder @ONLY)
+endif(ZM_TARGET_DISTRO STREQUAL "el7")
# Download jscalendar & move files into position
file(DOWNLOAD http://softlayer-dal.dl.sourceforge.net/project/jscalendar/jscalendar/1.0/jscalendar-1.0.zip ${CMAKE_CURRENT_SOURCE_DIR}/jscalendar-1.0.zip LOG jsc_log STATUS download_jsc)
@@ -41,10 +45,16 @@ install(CODE "execute_process(COMMAND ln -sf ../../../../var/lib/zoneminder/imag
install(CODE "execute_process(COMMAND ln -sf ../../../../var/lib/zoneminder/temp \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/temp\")")
# Install auxillary files required to run zoneminder on CentOS
-install(FILES zoneminder.conf DESTINATION /etc/httpd/conf.d PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
-install(FILES zm-logrotate_d DESTINATION /etc/logrotate.d RENAME zoneminder PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
install(FILES 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(FILES zoneminder.service DESTINATION /etc/rc.d/init.d RENAME zoneminder PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
+if(ZM_TARGET_DISTRO STREQUAL "el7")
+ install(FILES zoneminder.el7.conf DESTINATION /etc/httpd/conf.d RENAME zoneminder.conf PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
+ install(FILES zoneminder.el7.logrotate DESTINATION /etc/logrotate.d RENAME zoneminder PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
+ install(FILES zoneminder.service DESTINATION /usr/lib/systemd/system PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
+else
+ install(FILES zoneminder.el6.conf DESTINATION /etc/httpd/conf.d RENAME zoneminder.conf PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
+ install(FILES zoneminder.el6.logrotate DESTINATION /etc/logrotate.d RENAME zoneminder PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
+ install(FILES zoneminder DESTINATION /etc/rc.d/init.d PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
+endif(ZM_TARGET_DISTRO STREQUAL "el7")
# Install jscalendar
if(unzip_jsc STREQUAL "")
diff --git a/distros/redhat/zm-init b/distros/redhat/archive/zm-init
similarity index 100%
rename from distros/redhat/zm-init
rename to distros/redhat/archive/zm-init
diff --git a/distros/redhat/zoneminder-1.28.0-defaults.patch b/distros/redhat/archive/zoneminder-1.28.0-defaults.patch
similarity index 100%
rename from distros/redhat/zoneminder-1.28.0-defaults.patch
rename to distros/redhat/archive/zoneminder-1.28.0-defaults.patch
diff --git a/distros/redhat/redalert.wav b/distros/redhat/redalert.wav
old mode 100755
new mode 100644
diff --git a/distros/redhat/zoneminder.conf b/distros/redhat/zoneminder.el6.conf
similarity index 79%
rename from distros/redhat/zoneminder.conf
rename to distros/redhat/zoneminder.el6.conf
index 4a4d93261..081eccfb3 100644
--- a/distros/redhat/zoneminder.conf
+++ b/distros/redhat/zoneminder.el6.conf
@@ -1,6 +1,3 @@
-# The Zoneminder web interface has been disabled by default due to a small
-# security issue in the default install.
-#
# When using Zoneminder's own authentication, recorded CCTV images are
# accessible from the web directly without passing the authentication. This
# means any attacker could see your CCTV images without a password. In order
@@ -18,10 +15,8 @@ Alias /zm "/usr/share/zoneminder/www"
AllowOverride All
Order allow,deny
Allow from all
- # The code unfortunately uses short tags in many places
- php_value short_open_tag 1
-
-Deny from all # DELETE THIS LINE
+ # ZoneMinder no longer uses short tags so this is safe to leave disabled
+ # php_value short_open_tag 1
ScriptAlias /cgi-bin/zm "/usr/libexec/zoneminder/cgi-bin"
diff --git a/distros/redhat/zm-logrotate_d b/distros/redhat/zoneminder.el6.logrotate
similarity index 100%
rename from distros/redhat/zm-logrotate_d
rename to distros/redhat/zoneminder.el6.logrotate
diff --git a/distros/redhat/zoneminder.el7.conf b/distros/redhat/zoneminder.el7.conf
new file mode 100644
index 000000000..3f9e6d17b
--- /dev/null
+++ b/distros/redhat/zoneminder.el7.conf
@@ -0,0 +1,42 @@
+# When using Zoneminder's own authentication, recorded CCTV images are
+# accessible from the web directly without passing the authentication. This
+# means any attacker could see your CCTV images without a password. In order
+# to avoid this you can disable Zoneminder's authentication and configure
+# standard Apache authentication (see the Apache documentation for details on
+# this).
+#
+# If you still wish to use Zoneminder's own authentication, or have an
+# internal site which needs no authentication, you need to delete the line
+# marked below and restart Apache.
+
+Alias /zm "/usr/share/zoneminder/www"
+
+ Options -Indexes +MultiViews +FollowSymLinks
+ AllowOverride All
+
+ # Apache 2.4
+ Require all granted
+
+
+ # Apache 2.2
+ Order deny,allow
+ Allow from all
+
+ # ZoneMinder no longer uses short tags so this is safe to leave disabled
+ # php_value short_open_tag 1
+
+
+ScriptAlias /cgi-bin/zm "/usr/libexec/zoneminder/cgi-bin"
+
+ AllowOverride All
+ Options ExecCGI
+
+ # Apache 2.4
+ Require all granted
+
+
+ # Apache 2.2
+ Order deny,allow
+ Allow from all
+
+
diff --git a/distros/redhat/zoneminder.el7.logrotate b/distros/redhat/zoneminder.el7.logrotate
new file mode 100644
index 000000000..7bd1d189b
--- /dev/null
+++ b/distros/redhat/zoneminder.el7.logrotate
@@ -0,0 +1,8 @@
+/var/log/zoneminder/*.log {
+ missingok
+ notifempty
+ sharedscripts
+ postrotate
+ /usr/bin/zmpkg.pl logrot 2> /dev/null > /dev/null || :
+ endscript
+}
diff --git a/distros/redhat/zoneminder.in b/distros/redhat/zoneminder.in
old mode 100755
new mode 100644
diff --git a/distros/redhat/zoneminder.service b/distros/redhat/zoneminder.service
deleted file mode 100644
index fdd9b3af2..000000000
--- a/distros/redhat/zoneminder.service
+++ /dev/null
@@ -1,13 +0,0 @@
-[Unit]
-Description=Video security and surveillance system
-After=mysqld.service
-
-[Service]
-Type=forking
-ExecStart=/usr/bin/zmpkg.pl start
-ExecReload=/usr/bin/zmpkg.pl reload
-PIDFile=/run/zoneminder/zm.pid
-
-[Install]
-WantedBy=multi-user.target
-
diff --git a/distros/redhat/zoneminder.service.in b/distros/redhat/zoneminder.service.in
new file mode 100644
index 000000000..7afe8473a
--- /dev/null
+++ b/distros/redhat/zoneminder.service.in
@@ -0,0 +1,18 @@
+# ZoneMinder systemd unit file for CentOS 7
+
+[Unit]
+Description=ZoneMinder CCTV recording and security system
+After=network.target mariadb.service httpd.service
+Requires=mariadb.service httpd.service
+
+[Service]
+User=@WEB_USER@
+Type=forking
+ExecStart=@BINDIR@/zmpkg.pl start
+ExecReload=@BINDIR@/zmpkg.pl restart
+ExecStop=@BINDIR@/zmpkg.pl stop
+PIDFile="@ZM_RUNDIR@/zm.pid"
+
+[Install]
+WantedBy=multi-user.target
+