initial commit of file from CVS for smeserver-zoneminder on Sat Sep 7 21:19:42 AEST 2024

This commit is contained in:
Trevor Batley
2024-09-07 21:19:42 +10:00
parent b982e5614c
commit 91cd950535
27 changed files with 870 additions and 2 deletions

View File

@@ -0,0 +1 @@
url

View File

@@ -0,0 +1 @@
enabled

View File

@@ -0,0 +1 @@
service

View File

@@ -0,0 +1,9 @@
{
my $zoneminder = $DB->get('zoneminder') || $DB->new_record('zoneminder', {type => 'service'});
my $dbpass = $zoneminder->prop('DbPassword') ||
$zoneminder->set_prop('DbPassword', `/usr/bin/openssl rand -base64 40 | /usr/bin/tr -c -d '[:graph:]'`);
my $managerpass = $zoneminder->prop('ManagerPassword') ||
$zoneminder->set_prop('ManagerPassword', `/usr/bin/openssl rand -base64 10 | /usr/bin/tr -c -d '[:alnum:]'`);
}

View File

@@ -0,0 +1,16 @@
#!/bin/bash
# check if inodb is enabled for up to SME9
innodb=$(/sbin/e-smith/db configuration getprop mysqld InnoDB || echo "disabled")
if [[ "$innodb" != "enabled" ]]; then
/sbin/e-smith/db configuration setprop mysqld InnoDB enabled
/sbin/e-smith/expand-template /etc/my.cnf
sv t /service/mysqld
sleep 8
fi
# restart mysql.init
/sbin/service zoneminder stop 1>/dev/null
/sbin/service mysql.init restart 1>/dev/null
/sbin/service zoneminder start 1>/dev/null
exit 0

View File

@@ -0,0 +1 @@
PERMS=0540

View File

@@ -0,0 +1,63 @@
{
my $dbname = $zoneminder{'DbName'} || 'zm';
my $dbuser = $zoneminder{'DbUser'} || 'zm';
my $dbpass = $zoneminder{'DbPassword'} || 'secret';
my $ManagerPassword = $zoneminder{'ManagerPassword'} || 'admin';
$OUT .= << "HERE";
#! /bin/sh
if [ ! -d /var/lib/mysql/$dbname ]; then
mysqladmin create $dbname
if [ -e /usr/share/zoneminder/db/zm_create.sql ]; then
mysql $dbname < /usr/share/zoneminder/db/zm_create.sql
else
echo "Error: file /usr/share/zoneminder/db/zm_create.sql doesn't exists"
exit 1
fi
fi
/usr/bin/mysql $dbname -e 'insert into Users VALUES (NULL,"admin",password("$ManagerPassword"),"",1,"View","Edit","Edit","Edit","Edit","Edit","Edit","","")
ON DUPLICATE KEY UPDATE `Password` = password("$ManagerPassword");'
/usr/bin/mysql <<EOF
USE mysql;
REPLACE INTO user (
host,
user,
password)
VALUES (
'localhost',
'$dbuser',
PASSWORD ('$dbpass'));
REPLACE INTO db (
host,
db,
user,
select_priv, insert_priv, update_priv, delete_priv,
create_priv, alter_priv, index_priv, drop_priv, create_tmp_table_priv,
grant_priv, lock_tables_priv, references_priv)
VALUES (
'localhost',
'$dbname',
'$dbuser',
'Y', 'Y', 'Y', 'Y',
'Y', 'Y', 'Y', 'Y', 'Y',
'N', 'Y', 'Y');
FLUSH PRIVILEGES;
EOF
HERE
}

View File

@@ -0,0 +1,64 @@
#
# ZoneMinder Apache configuration file
# With SSLRequire and HTTPS auto redirect
# Modify this configuration to suit your requirements
#
<Directory "/var/cache/zoneminder">
SSLRequireSSL
Options -Indexes +MultiViews +FollowSymLinks
AllowOverride None
Require all granted
</Directory>
<Directory "/usr/share/zoneminder/www">
# explicitly set index.php as the only directoryindex
DirectoryIndex disabled
DirectoryIndex index.php
SSLRequireSSL
Options -Indexes +MultiViews +FollowSymLinks
#AddType application/x-httpd-php .php
<FilesMatch .php>
SetHandler "proxy:unix:/var/run/php-fpm/php74-zoneminder.sock|fcgi://localhost"
</FilesMatch>
AllowOverride All
AuthName "Zoneminder"
AuthType Basic
AuthBasicProvider external
AuthExternal pwauth
require user admin
</Directory>
<Directory "/usr/libexec/zoneminder/cgi-bin">
SSLRequireSSL
AllowOverride None
Options +ExecCGI +FollowSymLinks
Require all granted
</Directory>
# 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.
<Directory "/usr/share/zoneminder/www/api">
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
RewriteBase /zm/api
</Directory>
<Directory "/usr/share/zoneminder/www/api/app">
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
RewriteBase /zm/api
</Directory>
<Directory "/usr/share/zoneminder/www/api/app/webroot">
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
RewriteBase /zm/api
</Directory>

View File

@@ -0,0 +1,12 @@
#Zoneminder
{
$OUT="";
if ( $port ne $SSLPort ) {
$OUT .= "RewriteEngine On\n";
$OUT .= 'RewriteCond %{HTTPS} !=on'."\n";
$OUT .= 'RewriteRule ^/?(zm)(.*) https://%{SERVER_NAME}/$1$2 [R,L]'."\n";}
}
# Order matters. This alias must come first.
Alias /zm/cache "/var/cache/zoneminder"
Alias /zm "/usr/share/zoneminder/www"
ScriptAlias /cgi-bin-zm "/usr/libexec/zoneminder/cgi-bin"

View File

@@ -0,0 +1,65 @@
{
if ($PHP_VERSION eq '74'){
if (($zoneminder{'status'} || 'disabled') eq 'enabled'){
my $max_upload_size = ($zoneminder{MaxUploadSize} || '4096');
$max_upload_size .= 'M' if ($max_upload_size =~ m/^\d+$/);
my $memory_limit = ($zoneminder{MemoryLimit} || '500M');
$memory_limit .= 'M' if ($memory_limit =~ m/^\d+$/);
my $open_basedir= $zoneminder{PHPBaseDir} || '';
$open_basedir = "/usr/share/zoneminder:/var/cache/zoneminder:/usr/libexec/zoneminder:/var/log/zoneminder/:/var/lib/php/zoneminder:$open_basedir";
my $id = 'zoneminder';
my $max_children = $zoneminder{'PHPmaxChildren'} || 20;
my $min_spare_servers = $zoneminder{'PHPminServers'} || 4;
my $start_servers = $zoneminder{'PHPstartServers'} || 6;
my $max_spare_servers = $zoneminder{'PHPmaxServers'} || 8;
my $max_requests = $zoneminder{'PHPmaxRequests'} || 1000;
$min_spare_servers = ( $min_spare_servers > $max_spare_servers ) ? printf("%.0f",$max_spare_servers/2) : $min_spare_servers;
$start_servers = ( $start_servers > $max_spare_servers ) ? printf("%.0f", $max_spare_servers /2 + $min_spare_servers/2 ) : $start_servers;
$OUT .=<<_EOF;
[php$PHP_VERSION-$id]
user = www
group = www
listen.owner = root
listen.group = www
listen.mode = 0660
listen = /var/run/php-fpm/php$PHP_VERSION-$id.sock
pm = dynamic
pm.max_children = $max_children
pm.start_servers = $start_servers
pm.min_spare_servers = $min_spare_servers
pm.max_spare_servers = $max_spare_servers
pm.max_requests = $max_requests
php_admin_value[session.save_path] = /var/lib/php/$id/session
php_admin_value[session.gc_maxlifetime] = 86400
php_admin_value[opcache.file_cache] = /var/lib/php/$id/opcache
php_admin_value[upload_tmp_dir] = /var/lib/php/$id/tmp
php_admin_value[error_log] = /var/log/php/$id/error.log
slowlog = /var/log/php/zoneminder/slow.log
php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f php@{ $DomainName }
php_admin_flag[display_errors] = off
php_admin_flag[log_errors] = on
php_admin_value[error_log] = syslog
php_admin_value[memory_limit] = $memory_limit
php_admin_value[max_execution_time] = 3600
php_admin_value[post_max_size] = $max_upload_size
php_admin_value[upload_max_filesize] = $max_upload_size
php_admin_value[disable_functions] = system, show_source, dl, passthru, phpinfo
php_admin_value[open_basedir] = $open_basedir
php_admin_flag[allow_url_fopen] = on
php_admin_flag[file_uploads] = on
php_admin_flag[session.cookie_httponly] = on
php_admin_flag[allow_url_include] = off
php_admin_value[session.save_handler] = files
php_admin_flag[output_buffering] = off
_EOF
}
else{
$OUT .= '; zoneminder is disabled';
}
}
}

View File

@@ -0,0 +1,11 @@
# ==========================================================================
#
# ZoneMinder Base Configuration, $Date$, $Revision$
#
# ==========================================================================
#
# This file is generated by 'configure'. Care should be taken if manually
# editing this file as an changes may be overwritten by subsequent configuration
# or installations.
#

View File

@@ -0,0 +1,19 @@
# Path to installed data directory, used mostly for finding DB upgrade scripts
ZM_PATH_DATA=/usr/share/zoneminder
# Path to ZoneMinder binaries
ZM_PATH_BIN=/usr/bin
# Path to ZoneMinder libraries (none at present, for future use)
ZM_PATH_LIB=/usr/lib64
# Path to ZoneMinder configuration (this file only at present)
ZM_PATH_CONF=/etc/zm
# Path to ZoneMinder web files
ZM_PATH_WEB=/usr/share/zoneminder/www
# Path to ZoneMinder cgi files
ZM_PATH_CGI=/usr/libexec/zoneminder/cgi-bin

View File

@@ -0,0 +1,5 @@
# Username and group that web daemon (httpd/apache) runs as
ZM_WEB_USER=www
ZM_WEB_GROUP=www

View File

@@ -0,0 +1,30 @@
# ZoneMinder database type: so far only mysql is supported
ZM_DB_TYPE=mysql
# ZoneMinder database hostname or ip address and optionally port or unix socket
# Acceptable formats include hostname[:port], ip_address[:port], or localhost:unix_socket
{
my $zmhost= ${'zoneminder'}{'DbHost'} || "localhost";
$OUT = "ZM_DB_HOST=$zmhost";
}
# ZoneMinder database name
{
my $zm= ${'zoneminder'}{'DbName'} || "zm";
$OUT = "ZM_DB_NAME=$zm";
}
# ZoneMinder database user
{
my $zmuser= ${'zoneminder'}{'DbUser'} || "zm";
$OUT = "ZM_DB_USER=$zmuser";
}
# ZoneMinder database password
{
my $zmpass= ${'zoneminder'}{'DbPassword'} || "";
$OUT = "ZM_DB_PASS=$zmpass"
}

View File

@@ -0,0 +1,7 @@
# 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={${'freepbx'}{'ZM_SERVER_HOST'};}

View File

@@ -0,0 +1,6 @@
[Unit]
#After=wan.service
#After=networking.service
[Install]
WantedBy=sme-server.target

View File

View File

View File

View File