--- rpms/smeserver-cacti/contribs10/smeserver-cacti-1.1.19-sme10.patch 2022/07/27 19:00:37 1.4 +++ rpms/smeserver-cacti/contribs10/smeserver-cacti-1.1.19-sme10.patch 2022/07/27 20:32:07 1.8 @@ -1,244 +1,5 @@ diff -Nur --no-dereference smeserver-cacti-1.1.19.old/createlinks smeserver-cacti-1.1.19/createlinks --- smeserver-cacti-1.1.19.old/createlinks 2014-06-16 11:53:01.000000000 -0400 -+++ smeserver-cacti-1.1.19/createlinks 2022-07-26 00:15:21.267000000 -0400 -@@ -5,6 +5,7 @@ - for my $event (qw( - post-upgrade - bootstrap-console-save -+ console-save - )) - { - templates2events("/etc/cacti/db.php", $event); -@@ -22,3 +23,26 @@ - } - - templates2events("/etc/e-smith/sql/init/80cacti", "post-upgrade"); -+ -+my $event="smeserver-cacti-update"; -+event_templates($event, qw( -+ /etc/cacti/db.php -+ /etc/httpd/conf/httpd.conf -+ /etc/crontab -+ /etc/opt/remi/php74/php-fpm.d/www.conf -+ /etc/e-smith/sql/init/80cacti -+)); -+ -+event_services($event, -+ 'crond' => 'restart', -+ 'mysql.init' => 'restart', -+ 'httpd-e-smith' => 'sigusr1', -+ 'php74-php-fpm' => 'reload-or-restart' -+); -+ -+#backup ? -+#use esmith::Build::Backup qw(:all); -+#backup_includes("smeserver-cacti", qw( -+# -+#)); -+ -diff -Nur --no-dereference smeserver-cacti-1.1.19.old/root/etc/e-smith/db/configuration/migrate/80cacti smeserver-cacti-1.1.19/root/etc/e-smith/db/configuration/migrate/80cacti ---- smeserver-cacti-1.1.19.old/root/etc/e-smith/db/configuration/migrate/80cacti 1969-12-31 19:00:00.000000000 -0500 -+++ smeserver-cacti-1.1.19/root/etc/e-smith/db/configuration/migrate/80cacti 2022-07-26 00:51:52.311000000 -0400 -@@ -0,0 +1,45 @@ -+{ -+ use MIME::Base64 qw(encode_base64); -+ -+ my $service; -+ my $rec; -+ my $pw; -+ -+ # Store the cacti password in the configuration database (if not already there) -+ $service = 'cacti'; -+ -+ $rec = $DB->get($service) || $DB->new_record($service, {type => 'service'}); -+ -+ $pw = $rec->prop('DbPassword'); -+ -+ -+ if (! $pw) -+ { -+ -+ if ( open( RANDOM, "/dev/urandom" ) ) -+ { -+ my $buf; -+ # 57 bytes is a full line of Base64 coding, and contains -+ # 456 bits of randomness - given a perfectly random /dev/random -+ if ( read( RANDOM, $buf, 57 ) != 57 ) -+ { -+ warn("Short read from /dev/random: $!"); -+ } -+ else -+ { -+ $pw = encode_base64($buf); -+ chomp $pw; -+ } -+ close RANDOM; -+ } -+ else -+ { -+ warn "Could not open /dev/urandom: $!"; -+ } -+ -+ $rec->set_prop('DbPassword', $pw); -+ } -+ -+ -+ -+} -diff -Nur --no-dereference smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/e-smith/sql/init/80cacti smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/e-smith/sql/init/80cacti ---- smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/e-smith/sql/init/80cacti 2019-12-11 14:46:28.000000000 -0500 -+++ smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/e-smith/sql/init/80cacti 2022-07-26 00:48:18.028000000 -0400 -@@ -1,9 +1,9 @@ - { -- my $db = $cacti{DbName} || 'cacti_sme'; -+ my $db = $cacti{DbDatabase} || 'cacti_sme'; - my $user = $cacti{DbUser} || 'cacti'; - my $pass = $cacti{DbPassword} || 'changeme'; - $OUT .= </dev/null |/usr/bin/mysql mysql - /usr/bin/mysql $db < /etc/e-smith/db/configuration/migrate/80cacti_sme.sql - END --} -\ Pas de fin de ligne à la fin du fichier -+} -diff -Nur --no-dereference smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/86Cacti smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/86Cacti ---- smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/86Cacti 2014-06-16 11:53:00.000000000 -0400 -+++ smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/86Cacti 2022-07-26 00:30:15.300000000 -0400 -@@ -5,32 +5,19 @@ - SSLRequireSSL - Options -Indexes - AllowOverride None -- order deny,allow -- deny from all -- --{ -- my $cactiaxs = $cacti{'access'} || "private"; -- if ($cactiaxs eq "private") -- { -- $OUT .= " allow from $localAccess $externalSSLAccess"; -- } else { -- $OUT .= " allow from all"; -- } --} -- Satisfy all -- AddType application/x-httpd-php .php .php3 -- php_flag magic_quotes_gpc on -- php_flag track_vars on -+ Require { (($cacti{'access'} ||"private") eq "public") ? "all granted" : "ip $localAccess $externalSSLAccess"; } -+ AddType application/x-httpd-php .php -+ -+ SetHandler "proxy:unix:/var/run/php-fpm/php74-cacti.sock|fcgi://localhost" -+ - - - - - -- Order deny,allow -- Deny from all -+ Require all denied - - -- Order deny,allow -- Deny from all -+ Require all denied - - -diff -Nur --no-dereference smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/php-fpm.d/www.conf/15cacti smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/php-fpm.d/www.conf/15cacti ---- smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/php-fpm.d/www.conf/15cacti 1969-12-31 19:00:00.000000000 -0500 -+++ smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/php-fpm.d/www.conf/15cacti 2022-07-26 00:03:45.335000000 -0400 -@@ -0,0 +1,68 @@ -+{ -+ -+if ($PHP_VERSION eq '74'){ -+ if (($cacti{'status'} || 'disabled') eq 'enabled'){ -+ my $max_upload_size = ($cacti{MaxUploadSize} || '4096'); -+ $max_upload_size .= 'M' if ($max_upload_size =~ m/^\d+$/); -+ my $memory_limit = ($cacti{MemoryLimit} || '512M'); -+ $memory_limit .= 'M' if ($memory_limit =~ m/^\d+$/); -+ my $open_basedir= $cacti{PHPBaseDir} || ''; -+ $open_basedir = "/usr/share/cacti:/var/lib/cacti:/var/log/cacti.log:/var/lib/php/cacti:/home/e-smith/files/cacti:/dev/urandom:/proc/meminfo:$open_basedir"; -+ my $id = 'cacti'; -+ my $max_children = $cacti{'PHPmaxChildren'} || 20; -+ my $min_spare_servers = $cacti{'PHPminServers'} || 4; -+ my $start_servers = $cacti{'PHPstartServers'} || 6; -+ my $max_spare_servers = $cacti{'PHPmaxServers'} || 8; -+ my $max_requests = $cacti{'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/cacti/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, symlink, exec, dl, shell_exec, passthru, phpinfo, escapeshellarg, escapeshellcmd -+php_admin_value[open_basedir] = $open_basedir -+php_admin_flag[allow_url_fopen] = on -+php_admin_flag[file_upload] = 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 .= '; Nextcloud is disabled'; -+ } -+} -+} -+ -+ -+ -diff -Nur --no-dereference smeserver-cacti-1.1.19.old/root/etc/e-smith/templates.metadata/etc/cacti/db.php smeserver-cacti-1.1.19/root/etc/e-smith/templates.metadata/etc/cacti/db.php ---- smeserver-cacti-1.1.19.old/root/etc/e-smith/templates.metadata/etc/cacti/db.php 2014-06-16 11:53:01.000000000 -0400 -+++ smeserver-cacti-1.1.19/root/etc/e-smith/templates.metadata/etc/cacti/db.php 2022-07-26 00:44:20.988000000 -0400 -@@ -1,3 +1,3 @@ --UID="cacti" -+UID="root" - GID="www" - PERMS=0640 -diff -Nur --no-dereference smeserver-cacti-1.1.19.old/createlinks smeserver-cacti-1.1.19/createlinks ---- smeserver-cacti-1.1.19.old/createlinks 2014-06-16 11:53:01.000000000 -0400 +++ smeserver-cacti-1.1.19/createlinks 2022-07-27 14:55:50.939000000 -0400 @@ -5,6 +5,7 @@ for my $event (qw( @@ -663,7 +424,7 @@ diff -Nur --no-dereference smeserver-cac fi /usr/bin/mysql <