1 |
diff -Nur --no-dereference smeserver-cacti-1.1.19.old/createlinks smeserver-cacti-1.1.19/createlinks |
2 |
--- smeserver-cacti-1.1.19.old/createlinks 2014-06-16 11:53:01.000000000 -0400 |
3 |
+++ smeserver-cacti-1.1.19/createlinks 2022-07-26 00:15:21.267000000 -0400 |
4 |
@@ -5,6 +5,7 @@ |
5 |
for my $event (qw( |
6 |
post-upgrade |
7 |
bootstrap-console-save |
8 |
+ console-save |
9 |
)) |
10 |
{ |
11 |
templates2events("/etc/cacti/db.php", $event); |
12 |
@@ -22,3 +23,26 @@ |
13 |
} |
14 |
|
15 |
templates2events("/etc/e-smith/sql/init/80cacti", "post-upgrade"); |
16 |
+ |
17 |
+my $event="smeserver-cacti-update"; |
18 |
+event_templates($event, qw( |
19 |
+ /etc/cacti/db.php |
20 |
+ /etc/httpd/conf/httpd.conf |
21 |
+ /etc/crontab |
22 |
+ /etc/opt/remi/php74/php-fpm.d/www.conf |
23 |
+ /etc/e-smith/sql/init/80cacti |
24 |
+)); |
25 |
+ |
26 |
+event_services($event, |
27 |
+ 'crond' => 'restart', |
28 |
+ 'mysql.init' => 'restart', |
29 |
+ 'httpd-e-smith' => 'sigusr1', |
30 |
+ 'php74-php-fpm' => 'reload-or-restart' |
31 |
+); |
32 |
+ |
33 |
+#backup ? |
34 |
+#use esmith::Build::Backup qw(:all); |
35 |
+#backup_includes("smeserver-cacti", qw( |
36 |
+# |
37 |
+#)); |
38 |
+ |
39 |
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 |
40 |
--- 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 |
41 |
+++ smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/e-smith/sql/init/80cacti 2022-07-26 00:29:43.464000000 -0400 |
42 |
@@ -3,7 +3,7 @@ |
43 |
my $user = $cacti{DbUser} || 'cacti'; |
44 |
my $pass = $cacti{DbPassword} || 'changeme'; |
45 |
$OUT .= <<END |
46 |
-#! /bin/sh |
47 |
+#!/bin/bash |
48 |
if [ -d /var/lib/mysql/$db ]; then |
49 |
exit |
50 |
fi |
51 |
@@ -19,4 +19,4 @@ |
52 |
/usr/bin/mysql_tzinfo_to_sql /usr/share/zoneinfo/ 2>/dev/null |/usr/bin/mysql mysql |
53 |
/usr/bin/mysql $db < /etc/e-smith/db/configuration/migrate/80cacti_sme.sql |
54 |
END |
55 |
-} |
56 |
\ Pas de fin de ligne à la fin du fichier |
57 |
+} |
58 |
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 |
59 |
--- 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 |
60 |
+++ smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/86Cacti 2022-07-26 00:30:15.300000000 -0400 |
61 |
@@ -5,32 +5,19 @@ |
62 |
SSLRequireSSL |
63 |
Options -Indexes |
64 |
AllowOverride None |
65 |
- order deny,allow |
66 |
- deny from all |
67 |
- |
68 |
-{ |
69 |
- my $cactiaxs = $cacti{'access'} || "private"; |
70 |
- if ($cactiaxs eq "private") |
71 |
- { |
72 |
- $OUT .= " allow from $localAccess $externalSSLAccess"; |
73 |
- } else { |
74 |
- $OUT .= " allow from all"; |
75 |
- } |
76 |
-} |
77 |
- Satisfy all |
78 |
- AddType application/x-httpd-php .php .php3 |
79 |
- php_flag magic_quotes_gpc on |
80 |
- php_flag track_vars on |
81 |
+ Require { (($cacti{'access'} ||"private") eq "public") ? "all granted" : "ip $localAccess $externalSSLAccess"; } |
82 |
+ AddType application/x-httpd-php .php |
83 |
+ <FilesMatch \.php$ > |
84 |
+ SetHandler "proxy:unix:/var/run/php-fpm/php74-cacti.sock|fcgi://localhost" |
85 |
+ </FilesMatch> |
86 |
</Directory> |
87 |
|
88 |
|
89 |
|
90 |
<Directory /usr/share/cacti/log> |
91 |
- Order deny,allow |
92 |
- Deny from all |
93 |
+ Require all denied |
94 |
</Directory> |
95 |
<Directory /usr/share/cacti/rra> |
96 |
- Order deny,allow |
97 |
- Deny from all |
98 |
+ Require all denied |
99 |
</Directory> |
100 |
|
101 |
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 |
102 |
--- 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 |
103 |
+++ 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 |
104 |
@@ -0,0 +1,68 @@ |
105 |
+{ |
106 |
+ |
107 |
+if ($PHP_VERSION eq '74'){ |
108 |
+ if (($cacti{'status'} || 'disabled') eq 'enabled'){ |
109 |
+ my $max_upload_size = ($cacti{MaxUploadSize} || '4096'); |
110 |
+ $max_upload_size .= 'M' if ($max_upload_size =~ m/^\d+$/); |
111 |
+ my $memory_limit = ($cacti{MemoryLimit} || '512M'); |
112 |
+ $memory_limit .= 'M' if ($memory_limit =~ m/^\d+$/); |
113 |
+ my $open_basedir= $cacti{PHPBaseDir} || ''; |
114 |
+ $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"; |
115 |
+ my $id = 'cacti'; |
116 |
+ my $max_children = $cacti{'PHPmaxChildren'} || 20; |
117 |
+ my $min_spare_servers = $cacti{'PHPminServers'} || 4; |
118 |
+ my $start_servers = $cacti{'PHPstartServers'} || 6; |
119 |
+ my $max_spare_servers = $cacti{'PHPmaxServers'} || 8; |
120 |
+ my $max_requests = $cacti{'PHPmaxRequests'} || 1000; |
121 |
+ $min_spare_servers = ( $min_spare_servers > $max_spare_servers ) ? printf("%.0f",$max_spare_servers/2) : $min_spare_servers; |
122 |
+ $start_servers = ( $start_servers > $max_spare_servers ) ? printf("%.0f", $max_spare_servers /2 + $min_spare_servers/2 ) : $start_servers; |
123 |
+ |
124 |
+ $OUT .=<<_EOF; |
125 |
+ |
126 |
+[php$PHP_VERSION-$id] |
127 |
+user = www |
128 |
+group = www |
129 |
+listen.owner = root |
130 |
+listen.group = www |
131 |
+listen.mode = 0660 |
132 |
+listen = /var/run/php-fpm/php$PHP_VERSION-$id.sock |
133 |
+pm = dynamic |
134 |
+pm.max_children = $max_children |
135 |
+pm.start_servers = $start_servers |
136 |
+pm.min_spare_servers = $min_spare_servers |
137 |
+pm.max_spare_servers = $max_spare_servers |
138 |
+pm.max_requests = $max_requests |
139 |
+php_admin_value[session.save_path] = /var/lib/php/$id/session |
140 |
+php_admin_value[session.gc_maxlifetime] = 86400 |
141 |
+php_admin_value[opcache.file_cache] = /var/lib/php/$id/opcache |
142 |
+php_admin_value[upload_tmp_dir] = /var/lib/php/$id/tmp |
143 |
+php_admin_value[error_log] = /var/log/php/$id/error.log |
144 |
+slowlog = /var/log/php/cacti/slow.log |
145 |
+php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f php@{ $DomainName } |
146 |
+php_admin_flag[display_errors] = off |
147 |
+php_admin_flag[log_errors] = on |
148 |
+php_admin_value[error_log] = syslog |
149 |
+php_admin_value[memory_limit] = $memory_limit |
150 |
+php_admin_value[max_execution_time] = 3600 |
151 |
+php_admin_value[post_max_size] = $max_upload_size |
152 |
+php_admin_value[upload_max_filesize] = $max_upload_size |
153 |
+php_admin_value[disable_functions] = system, show_source, symlink, exec, dl, shell_exec, passthru, phpinfo, escapeshellarg, escapeshellcmd |
154 |
+php_admin_value[open_basedir] = $open_basedir |
155 |
+php_admin_flag[allow_url_fopen] = on |
156 |
+php_admin_flag[file_upload] = on |
157 |
+php_admin_flag[session.cookie_httponly] = on |
158 |
+php_admin_flag[allow_url_include] = off |
159 |
+php_admin_value[session.save_handler] = files |
160 |
+php_admin_flag[output_buffering] = off |
161 |
+ |
162 |
+_EOF |
163 |
+ |
164 |
+ } |
165 |
+ else{ |
166 |
+ $OUT .= '; Nextcloud is disabled'; |
167 |
+ } |
168 |
+} |
169 |
+} |
170 |
+ |
171 |
+ |
172 |
+ |