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-27 14:55:50.939000000 -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,32 @@ |
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 |
+event_actions($event, |
34 |
+'cacti-conf' => '50', |
35 |
+'cacti-ldap' => '95' |
36 |
+); |
37 |
+ |
38 |
+ |
39 |
+#backup ? |
40 |
+#use esmith::Build::Backup qw(:all); |
41 |
+#backup_includes("smeserver-cacti", qw( |
42 |
+# |
43 |
+#)); |
44 |
+ |
45 |
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 |
46 |
--- smeserver-cacti-1.1.19.old/root/etc/e-smith/db/configuration/migrate/80cacti 1969-12-31 19:00:00.000000000 -0500 |
47 |
+++ smeserver-cacti-1.1.19/root/etc/e-smith/db/configuration/migrate/80cacti 2022-07-27 14:46:58.425000000 -0400 |
48 |
@@ -0,0 +1,72 @@ |
49 |
+{ |
50 |
+ use MIME::Base64 qw(encode_base64); |
51 |
+ |
52 |
+ my $service; |
53 |
+ my $rec; |
54 |
+ my $pw; |
55 |
+ |
56 |
+ # Store the cacti password in the configuration database (if not already there) |
57 |
+ $service = 'cacti'; |
58 |
+ |
59 |
+ $rec = $DB->get($service) || $DB->new_record($service, {type => 'service'}); |
60 |
+ |
61 |
+ $pw = $rec->prop('DbPassword'); |
62 |
+ |
63 |
+ |
64 |
+ if (! $pw) |
65 |
+ { |
66 |
+ |
67 |
+ if ( open( RANDOM, "/dev/urandom" ) ) |
68 |
+ { |
69 |
+ my $buf; |
70 |
+ # 57 bytes is a full line of Base64 coding, and contains |
71 |
+ # 456 bits of randomness - given a perfectly random /dev/random |
72 |
+ if ( read( RANDOM, $buf, 57 ) != 57 ) |
73 |
+ { |
74 |
+ warn("Short read from /dev/random: $!"); |
75 |
+ } |
76 |
+ else |
77 |
+ { |
78 |
+ $pw = encode_base64($buf); |
79 |
+ chomp $pw; |
80 |
+ } |
81 |
+ close RANDOM; |
82 |
+ } |
83 |
+ else |
84 |
+ { |
85 |
+ warn "Could not open /dev/urandom: $!"; |
86 |
+ } |
87 |
+ |
88 |
+ $rec->set_prop('DbPassword', $pw); |
89 |
+ } |
90 |
+ $pwa = $rec->prop('AdminPassword'); |
91 |
+ if (! $pwa) |
92 |
+ { |
93 |
+ |
94 |
+ if ( open( RANDOM, "/dev/urandom" ) ) |
95 |
+ { |
96 |
+ my $buf; |
97 |
+ # 57 bytes is a full line of Base64 coding, and contains |
98 |
+ # 456 bits of randomness - given a perfectly random /dev/random |
99 |
+ if ( read( RANDOM, $buf, 15 ) != 15 ) |
100 |
+ { |
101 |
+ warn("Short read from /dev/random: $!"); |
102 |
+ } |
103 |
+ else |
104 |
+ { |
105 |
+ $pwa = encode_base64($buf); |
106 |
+ chomp $pwa; |
107 |
+ } |
108 |
+ close RANDOM; |
109 |
+ } |
110 |
+ else |
111 |
+ { |
112 |
+ warn "Could not open /dev/urandom: $!"; |
113 |
+ } |
114 |
+ |
115 |
+ $rec->set_prop('AdminPassword', $pwa); |
116 |
+ } |
117 |
+ |
118 |
+ |
119 |
+ |
120 |
+} |
121 |
diff -Nur --no-dereference smeserver-cacti-1.1.19.old/root/etc/e-smith/events/actions/cacti-conf smeserver-cacti-1.1.19/root/etc/e-smith/events/actions/cacti-conf |
122 |
--- smeserver-cacti-1.1.19.old/root/etc/e-smith/events/actions/cacti-conf 1969-12-31 19:00:00.000000000 -0500 |
123 |
+++ smeserver-cacti-1.1.19/root/etc/e-smith/events/actions/cacti-conf 2022-07-27 14:46:58.891000000 -0400 |
124 |
@@ -0,0 +1,16 @@ |
125 |
+#!/bin/bash |
126 |
+ |
127 |
+#easy configuration of what is needed for cacti to work correctly |
128 |
+something=0; |
129 |
+psomething=0; |
130 |
+#check if something already set, if not let's do it |
131 |
+ |
132 |
+/sbin/e-smith/config getprop mariadb TmpTableSize 1>/dev/null || ( config setprop mariadb TmpTableSize 32M ; echo "setting mariadb TmpTableSize 32M" ; something=1) |
133 |
+/sbin/e-smith/config getprop mariadb MaxHeapTableSize 1>/dev/null || ( config setprop mariadb MaxHeapTableSize 32M ; echo "setting mariadb MaxHeapTableSize 32M" ; something=1) |
134 |
+/sbin/e-smith/config getprop mariadb JoinBufferSize 1>/dev/null || ( config setprop mariadb JoinBufferSize 62M ; echo "setting mariadb JoinBufferSize 62M" ; something=1) |
135 |
+ |
136 |
+#/sbin/e-smith/config getprop php74 MemoryLimit 1>/dev/null || ( config setprop php74 MemoryLimit 800M ; echo "setting php74 memory_limit 800M" ; psomething=1) |
137 |
+# install detect cli for php not php74 even if $php_path is set |
138 |
+ |
139 |
+[ $something == 1 ] && /usr/sbin/e-smith/expand-template /etc/my.cnf && /usr/bin/systemctl restart mariadb.service |
140 |
+#[ $psomething == 1 ] && /usr/sbin/e-smith/expand-template /etc/opt/remi/php74/php.ini && /usr/bin/systemctl restart php74-php-fpm.service |
141 |
diff -Nur --no-dereference smeserver-cacti-1.1.19.old/root/etc/e-smith/events/actions/cacti-ldap smeserver-cacti-1.1.19/root/etc/e-smith/events/actions/cacti-ldap |
142 |
--- smeserver-cacti-1.1.19.old/root/etc/e-smith/events/actions/cacti-ldap 1969-12-31 19:00:00.000000000 -0500 |
143 |
+++ smeserver-cacti-1.1.19/root/etc/e-smith/events/actions/cacti-ldap 2022-07-27 14:46:58.663000000 -0400 |
144 |
@@ -0,0 +1,44 @@ |
145 |
+#!/bin/bash |
146 |
+ |
147 |
+#use esmith::ConfigDB; |
148 |
+#use esmith::util; |
149 |
+#my $cdb = esmith::ConfigDB->open_ro(); |
150 |
+#my $domain = $cdb->get_value('DomainName'); |
151 |
+#my $baseDN = esmith::util::ldapBase($cdb->get_value('DomainName')); |
152 |
+#print $baseDN . "\n"; |
153 |
+ |
154 |
+db=$(config getprop cacti DbDatabase || echo 'cacti_sme'); |
155 |
+user=$(config getprop cacti DbUser || echo 'cacti'); |
156 |
+pass=$(config getprop cacti DbPassword || echo 'changeme'); |
157 |
+adminpass=$(config getprop cacti AdminPassword || echo 'changeme'); |
158 |
+domain=$(config get DomainName) |
159 |
+DN=$(perl -Mesmith::util -e "print esmith::util::ldapBase(\"$domain\");") |
160 |
+ |
161 |
+ |
162 |
+# set ldap auth with optional group |
163 |
+#ldap_group_require 'on' or '' |
164 |
+# then set our admin password |
165 |
+/usr/bin/mysql <<EOF |
166 |
+UPDATE ${db}.settings SET value='memberUid' WHERE name='ldap_group_attrib'; |
167 |
+UPDATE ${db}.settings SET value='uid=cactigroup,ou=Groups,$DN' WHERE name='ldap_group_dn'; |
168 |
+ |
169 |
+UPDATE ${db}.settings SET value='0' WHERE name='ldap_tls_certificate'; |
170 |
+UPDATE ${db}.settings SET value='3' WHERE name='ldap_version'; |
171 |
+UPDATE ${db}.settings SET value='localhost' WHERE name='ldap_server'; |
172 |
+UPDATE ${db}.settings SET value='objectClass=inetOrgPerson' WHERE name='ldap_search_filter'; |
173 |
+UPDATE ${db}.settings SET value='ou=Users,$DN' WHERE name='ldap_search_base'; |
174 |
+UPDATE ${db}.settings SET value='0' WHERE name='ldap_referrals'; |
175 |
+UPDATE ${db}.settings SET value='636' WHERE name='ldap_port_ssl'; |
176 |
+UPDATE ${db}.settings SET value='389' WHERE name='ldap_port'; |
177 |
+UPDATE ${db}.settings SET value='0' WHERE name='ldap_mode'; |
178 |
+UPDATE ${db}.settings SET value='0' WHERE name='ldap_encryption'; |
179 |
+UPDATE ${db}.settings SET value='uid=<username>,ou=Users,$DN' WHERE name='ldap_dn'; |
180 |
+UPDATE ${db}.settings SET value='3' WHERE name='auth_method'; |
181 |
+UPDATE ${db}.settings SET value='cn' WHERE name='cn_full_name'; |
182 |
+UPDATE ${db}.settings SET value='mail' WHERE name='cn_email'; |
183 |
+ |
184 |
+ |
185 |
+# set password of admin |
186 |
+UPDATE ${db}.user_auth SET email_address='admin@${domain}', must_change_password='',password=md5('$adminpass'), enabled='on' WHERE username='admin' and id='1'; |
187 |
+EOF |
188 |
+ |
189 |
diff -Nur --no-dereference smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/cacti/db.php/10DB smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/cacti/db.php/10DB |
190 |
--- smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/cacti/db.php/10DB 1969-12-31 19:00:00.000000000 -0500 |
191 |
+++ smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/cacti/db.php/10DB 2022-07-27 14:46:55.823000000 -0400 |
192 |
@@ -0,0 +1,54 @@ |
193 |
+<?php |
194 |
+/* |
195 |
+ +-------------------------------------------------------------------------+ |
196 |
+ | Copyright (C) 2004 Ian Berry | |
197 |
+ | | |
198 |
+ | This program is free software; you can redistribute it and/or | |
199 |
+ | modify it under the terms of the GNU General Public License | |
200 |
+ | as published by the Free Software Foundation; either version 2 | |
201 |
+ | of the License, or (at your option) any later version. | |
202 |
+ | | |
203 |
+ | This program is distributed in the hope that it will be useful, | |
204 |
+ | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
205 |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
206 |
+ | GNU General Public License for more details. | |
207 |
+ +-------------------------------------------------------------------------+ |
208 |
+ | cacti: a php-based graphing solution | |
209 |
+ +-------------------------------------------------------------------------+ |
210 |
+ | Most of this code has been designed, written and is maintained by | |
211 |
+ | Ian Berry. See about.php for specific developer credit. Any questions | |
212 |
+ | or comments regarding this code should be directed to: | |
213 |
+ | - iberry@raxnet.net | |
214 |
+ +-------------------------------------------------------------------------+ |
215 |
+ | - raXnet - http://www.raxnet.net/ | |
216 |
+ +-------------------------------------------------------------------------+ |
217 |
+*/ |
218 |
+ |
219 |
+/* make sure these values refect your actual database/host/user/password */ |
220 |
+$database_type = "mysql"; |
221 |
+$database_default = "{$cacti{'DbDatabase'}}"; |
222 |
+$database_hostname = "localhost"; |
223 |
+$database_username = "{$cacti{'DbUser'}}"; |
224 |
+$database_password = "{$cacti{'DbPassword'}}"; |
225 |
+$database_port = "3306"; |
226 |
+ |
227 |
+/* |
228 |
+ * Server is a remote poller, then these entries point to |
229 |
+ * the main cacti server. Otherwise, these variables have no use and |
230 |
+ * must remain commented out. |
231 |
+ */ |
232 |
+ |
233 |
+#$rdatabase_type = 'myql'; |
234 |
+#$rdatabase_default = 'cacti'; |
235 |
+#$rdatabase_hostname = 'localhost'; |
236 |
+#$rdatabase_username = 'cactiuser'; |
237 |
+#$rdatabase_password = 'cactiuser'; |
238 |
+#$rdatabase_port = '3306'; |
239 |
+#$rdatabase_retries = 5; |
240 |
+#$rdatabase_ssl = false; |
241 |
+#$rdatabase_ssl_key = ''; |
242 |
+#$rdatabase_ssl_cert = ''; |
243 |
+#$rdatabase_ssl_ca = ''; |
244 |
+ |
245 |
+ |
246 |
+ |
247 |
diff -Nur --no-dereference smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/cacti/db.php/12poller_id smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/cacti/db.php/12poller_id |
248 |
--- smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/cacti/db.php/12poller_id 1969-12-31 19:00:00.000000000 -0500 |
249 |
+++ smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/cacti/db.php/12poller_id 2022-07-27 14:46:56.040000000 -0400 |
250 |
@@ -0,0 +1,7 @@ |
251 |
+/* |
252 |
+ * The poller_id of this system. set to `1` for the main cacti web server. |
253 |
+ * Otherwise, you this value should be the poller_id for the remote poller. |
254 |
+ */ |
255 |
+ |
256 |
+$poller_id = 1; |
257 |
+ |
258 |
diff -Nur --no-dereference smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/cacti/db.php/15urlpath smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/cacti/db.php/15urlpath |
259 |
--- smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/cacti/db.php/15urlpath 1969-12-31 19:00:00.000000000 -0500 |
260 |
+++ smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/cacti/db.php/15urlpath 2022-07-27 14:46:56.287000000 -0400 |
261 |
@@ -0,0 +1,9 @@ |
262 |
+/* |
263 |
+ * Set the $url_path to point to the default URL of your cacti install. |
264 |
+ * For exmaple if your cacti install as at `https://serverip/cacti/` this |
265 |
+ * would be set to `/cacti/`. |
266 |
+ */ |
267 |
+ |
268 |
+$url_path = '/cacti/'; |
269 |
+ |
270 |
+ |
271 |
diff -Nur --no-dereference smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/cacti/db.php/25session smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/cacti/db.php/25session |
272 |
--- smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/cacti/db.php/25session 1969-12-31 19:00:00.000000000 -0500 |
273 |
+++ smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/cacti/db.php/25session 2022-07-27 14:46:56.522000000 -0400 |
274 |
@@ -0,0 +1,19 @@ |
275 |
+/* |
276 |
+ * Default session name - session name must contain alpha characters |
277 |
+ */ |
278 |
+ |
279 |
+$cacti_session_name = 'Cacti'; |
280 |
+ |
281 |
+/* |
282 |
+ * Default Cookie domain - The cookie domain to be used for Cacti |
283 |
+ */ |
284 |
+ |
285 |
+//$cacti_cookie_domain = 'cacti.net'; |
286 |
+ |
287 |
+/* |
288 |
+ * Save sessions to a database for load balancing |
289 |
+ */ |
290 |
+ |
291 |
+$cacti_db_session = false; |
292 |
+ |
293 |
+ |
294 |
diff -Nur --no-dereference smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/cacti/db.php/30log smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/cacti/db.php/30log |
295 |
--- smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/cacti/db.php/30log 1969-12-31 19:00:00.000000000 -0500 |
296 |
+++ smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/cacti/db.php/30log 2022-07-27 14:46:56.771000000 -0400 |
297 |
@@ -0,0 +1,6 @@ |
298 |
+/* |
299 |
+ * Disable log rotation settings for packagers |
300 |
+ */ |
301 |
+ |
302 |
+$disable_log_rotation = true; |
303 |
+ |
304 |
diff -Nur --no-dereference smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/cacti/db.php/40input smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/cacti/db.php/40input |
305 |
--- smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/cacti/db.php/40input 1969-12-31 19:00:00.000000000 -0500 |
306 |
+++ smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/cacti/db.php/40input 2022-07-27 14:46:57.012000000 -0400 |
307 |
@@ -0,0 +1,18 @@ |
308 |
+/* |
309 |
+ * Optional parameters to define scripts and resource paths. These |
310 |
+ * variables become important when using remote poller installs when the |
311 |
+ * scripts and resource files are not in the main Cacti web server path. |
312 |
+ */ |
313 |
+ |
314 |
+//$scripts_path = '/var/www/html/cacti/scripts'; |
315 |
+//$resource_path = '/var/www/html/cacti/resource/'; |
316 |
+ |
317 |
+/* |
318 |
+ * Optional parameter to define a data input whitelist command string. This |
319 |
+ * whitelist file will help protect cacti from unauthorized changes to Cacti |
320 |
+ * data input command string. |
321 |
+ */ |
322 |
+ |
323 |
+//$input_whitelist = '/usr/local/etc/cacti/input_whitelist.json'; |
324 |
+ |
325 |
+ |
326 |
diff -Nur --no-dereference smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/cacti/db.php/50php smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/cacti/db.php/50php |
327 |
--- smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/cacti/db.php/50php 1969-12-31 19:00:00.000000000 -0500 |
328 |
+++ smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/cacti/db.php/50php 2022-07-27 14:46:57.268000000 -0400 |
329 |
@@ -0,0 +1,6 @@ |
330 |
+/* |
331 |
+ * Optional parameter to give explicit path to PHP |
332 |
+ */ |
333 |
+$php_path = '/usr/bin/php74'; |
334 |
+ |
335 |
+ |
336 |
diff -Nur --no-dereference smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/cacti/db.php/60snmp smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/cacti/db.php/60snmp |
337 |
--- smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/cacti/db.php/60snmp 1969-12-31 19:00:00.000000000 -0500 |
338 |
+++ smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/cacti/db.php/60snmp 2022-07-27 14:46:57.504000000 -0400 |
339 |
@@ -0,0 +1,8 @@ |
340 |
+/* |
341 |
+ * Optional parameter to disable the PHP SNMP extension. If not set, defaults |
342 |
+ * to class_exists('SNMP'). |
343 |
+ */ |
344 |
+ |
345 |
+//$php_snmp_support = false; |
346 |
+ |
347 |
+ |
348 |
diff -Nur --no-dereference smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/cacti/db.php/70csrf smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/cacti/db.php/70csrf |
349 |
--- smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/cacti/db.php/70csrf 1969-12-31 19:00:00.000000000 -0500 |
350 |
+++ smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/cacti/db.php/70csrf 2022-07-27 14:46:57.727000000 -0400 |
351 |
@@ -0,0 +1,8 @@ |
352 |
+/* |
353 |
+ * Optional parameter to define the path of the csrf_secret.php path. This |
354 |
+ * variable is for packagers who wish to specify an alternate location of |
355 |
+ * the CRSF secret file. |
356 |
+ */ |
357 |
+ |
358 |
+$path_csrf_secret = '/var/lib/cacti/csrf/csrf-secret.php'; |
359 |
+ |
360 |
diff -Nur --no-dereference smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/cacti/db.php/90DEBUG smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/cacti/db.php/90DEBUG |
361 |
--- smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/cacti/db.php/90DEBUG 1969-12-31 19:00:00.000000000 -0500 |
362 |
+++ smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/cacti/db.php/90DEBUG 2022-07-27 14:46:57.957000000 -0400 |
363 |
@@ -0,0 +1,30 @@ |
364 |
+/* |
365 |
+ * The following are optional variables for debugging low level system |
366 |
+ * functions that are generally only used by Cacti Developers to help |
367 |
+ * identify potential issues in commonly used functions |
368 |
+ * |
369 |
+ * To use them, uncomment and the equivalent field will be set in the |
370 |
+ * $config variable allowing for instant on but still allowing the |
371 |
+ * ability to fine turn and turn them off. |
372 |
+ */ |
373 |
+ |
374 |
+/* |
375 |
+ * Debug the read_config_option program flow |
376 |
+ */ |
377 |
+# define('DEBUG_READ_CONFIG_OPTION', true); |
378 |
+ |
379 |
+/* |
380 |
+ * Automatically suppress the DEBUG_READ_CONFIG_OPTION |
381 |
+ */ |
382 |
+# define('DEBUG_READ_CONFIG_OPTION_DB_OPEN', true); |
383 |
+ |
384 |
+/* |
385 |
+ * Always write the SQL command to the cacti log file |
386 |
+ */ |
387 |
+# define('DEBUG_SQL_CMD', true); |
388 |
+ |
389 |
+/* |
390 |
+ * Debug the flow of calls to the db_xxx functions that |
391 |
+ * are defined in lib/database.php |
392 |
+ */ |
393 |
+# define('DEBUG_SQL_FLOW', true); |
394 |
diff -Nur --no-dereference smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/cacti/db.php/95end smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/cacti/db.php/95end |
395 |
--- smeserver-cacti-1.1.19.old/root/etc/e-smith/templates/etc/cacti/db.php/95end 1969-12-31 19:00:00.000000000 -0500 |
396 |
+++ smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/cacti/db.php/95end 2022-07-27 14:46:58.190000000 -0400 |
397 |
@@ -0,0 +1 @@ |
398 |
+?> |
399 |
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 |
400 |
--- 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 |
401 |
+++ smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/e-smith/sql/init/80cacti 2022-07-27 14:46:55.114000000 -0400 |
402 |
@@ -1,22 +1,34 @@ |
403 |
{ |
404 |
- my $db = $cacti{DbName} || 'cacti_sme'; |
405 |
+ my $db = $cacti{DbDatabase} || 'cacti_sme'; |
406 |
my $user = $cacti{DbUser} || 'cacti'; |
407 |
my $pass = $cacti{DbPassword} || 'changeme'; |
408 |
$OUT .= <<END |
409 |
-#! /bin/sh |
410 |
+#!/bin/bash |
411 |
if [ -d /var/lib/mysql/$db ]; then |
412 |
+ /usr/bin/mysql <<EOF |
413 |
+ use $db; |
414 |
+ use mysql; |
415 |
+ ALTER DATABASE $db COLLATE = 'utf8mb4_unicode_ci'; |
416 |
+ GRANT ALL PRIVILEGES ON $db.* TO $user\@localhost |
417 |
+ IDENTIFIED BY '$pass'; |
418 |
+ GRANT SELECT ON mysql.time_zone_name TO '$user'\@'localhost'; |
419 |
+ flush privileges; |
420 |
+EOF |
421 |
+ |
422 |
+ |
423 |
exit |
424 |
fi |
425 |
/usr/bin/mysql <<EOF |
426 |
- CREATE DATABASE $db DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; |
427 |
+ CREATE DATABASE $db DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; |
428 |
use $db; |
429 |
use mysql; |
430 |
GRANT ALL PRIVILEGES ON $db.* TO $user\@localhost |
431 |
IDENTIFIED BY '$pass'; |
432 |
- GRANT SELECT ON `mysql`.`time_zone_name` TO '$user'@'localhost'; |
433 |
+ GRANT SELECT ON mysql.time_zone_name TO '$user'\@'localhost'; |
434 |
flush privileges; |
435 |
EOF |
436 |
/usr/bin/mysql_tzinfo_to_sql /usr/share/zoneinfo/ 2>/dev/null |/usr/bin/mysql mysql |
437 |
- /usr/bin/mysql $db < /etc/e-smith/db/configuration/migrate/80cacti_sme.sql |
438 |
+ /usr/bin/mysql $db < \$(rpm -ql cacti|grep cacti.sql) |
439 |
+ #/usr/bin/mysql $db < /etc/e-smith/db/configuration/migrate/80cacti_sme.sql |
440 |
END |
441 |
-} |
442 |
\ Pas de fin de ligne à la fin du fichier |
443 |
+} |
444 |
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 |
445 |
--- 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 |
446 |
+++ smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/86Cacti 2022-07-26 00:30:15.300000000 -0400 |
447 |
@@ -5,32 +5,19 @@ |
448 |
SSLRequireSSL |
449 |
Options -Indexes |
450 |
AllowOverride None |
451 |
- order deny,allow |
452 |
- deny from all |
453 |
- |
454 |
-{ |
455 |
- my $cactiaxs = $cacti{'access'} || "private"; |
456 |
- if ($cactiaxs eq "private") |
457 |
- { |
458 |
- $OUT .= " allow from $localAccess $externalSSLAccess"; |
459 |
- } else { |
460 |
- $OUT .= " allow from all"; |
461 |
- } |
462 |
-} |
463 |
- Satisfy all |
464 |
- AddType application/x-httpd-php .php .php3 |
465 |
- php_flag magic_quotes_gpc on |
466 |
- php_flag track_vars on |
467 |
+ Require { (($cacti{'access'} ||"private") eq "public") ? "all granted" : "ip $localAccess $externalSSLAccess"; } |
468 |
+ AddType application/x-httpd-php .php |
469 |
+ <FilesMatch \.php$ > |
470 |
+ SetHandler "proxy:unix:/var/run/php-fpm/php74-cacti.sock|fcgi://localhost" |
471 |
+ </FilesMatch> |
472 |
</Directory> |
473 |
|
474 |
|
475 |
|
476 |
<Directory /usr/share/cacti/log> |
477 |
- Order deny,allow |
478 |
- Deny from all |
479 |
+ Require all denied |
480 |
</Directory> |
481 |
<Directory /usr/share/cacti/rra> |
482 |
- Order deny,allow |
483 |
- Deny from all |
484 |
+ Require all denied |
485 |
</Directory> |
486 |
|
487 |
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 |
488 |
--- 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 |
489 |
+++ smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/php-fpm.d/www.conf/15cacti 2022-07-27 14:46:55.335000000 -0400 |
490 |
@@ -0,0 +1,68 @@ |
491 |
+{ |
492 |
+ |
493 |
+if ($PHP_VERSION eq '74'){ |
494 |
+ if (($cacti{'status'} || 'disabled') eq 'enabled'){ |
495 |
+ my $max_upload_size = ($cacti{MaxUploadSize} || '4096'); |
496 |
+ $max_upload_size .= 'M' if ($max_upload_size =~ m/^\d+$/); |
497 |
+ my $memory_limit = ($cacti{MemoryLimit} || '5555500M'); |
498 |
+ $memory_limit .= 'M' if ($memory_limit =~ m/^\d+$/); |
499 |
+ my $open_basedir= $cacti{PHPBaseDir} || ''; |
500 |
+ $open_basedir = "/tmp/:/share/:/var/log/cacti:/etc/cacti/db.php:/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"; |
501 |
+ my $id = 'cacti'; |
502 |
+ my $max_children = $cacti{'PHPmaxChildren'} || 20; |
503 |
+ my $min_spare_servers = $cacti{'PHPminServers'} || 4; |
504 |
+ my $start_servers = $cacti{'PHPstartServers'} || 6; |
505 |
+ my $max_spare_servers = $cacti{'PHPmaxServers'} || 8; |
506 |
+ my $max_requests = $cacti{'PHPmaxRequests'} || 1000; |
507 |
+ $min_spare_servers = ( $min_spare_servers > $max_spare_servers ) ? printf("%.0f",$max_spare_servers/2) : $min_spare_servers; |
508 |
+ $start_servers = ( $start_servers > $max_spare_servers ) ? printf("%.0f", $max_spare_servers /2 + $min_spare_servers/2 ) : $start_servers; |
509 |
+ |
510 |
+ $OUT .=<<_EOF; |
511 |
+ |
512 |
+[php$PHP_VERSION-$id] |
513 |
+user = www |
514 |
+group = www |
515 |
+listen.owner = root |
516 |
+listen.group = www |
517 |
+listen.mode = 0660 |
518 |
+listen = /var/run/php-fpm/php$PHP_VERSION-$id.sock |
519 |
+pm = dynamic |
520 |
+pm.max_children = $max_children |
521 |
+pm.start_servers = $start_servers |
522 |
+pm.min_spare_servers = $min_spare_servers |
523 |
+pm.max_spare_servers = $max_spare_servers |
524 |
+pm.max_requests = $max_requests |
525 |
+php_admin_value[session.save_path] = /var/lib/php/$id/session |
526 |
+php_admin_value[session.gc_maxlifetime] = 86400 |
527 |
+;php_admin_value[opcache.file_cache] = /var/lib/php/$id/opcache |
528 |
+php_admin_value[upload_tmp_dir] = /var/lib/php/$id/tmp |
529 |
+php_admin_value[error_log] = /var/log/php/$id/error.log |
530 |
+slowlog = /var/log/php/cacti/slow.log |
531 |
+php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f php@{ $DomainName } |
532 |
+php_admin_flag[display_errors] = off |
533 |
+php_admin_flag[log_errors] = on |
534 |
+php_admin_value[error_log] = syslog |
535 |
+php_admin_value[memory_limit] = $memory_limit |
536 |
+php_admin_value[max_execution_time] = 3600 |
537 |
+php_admin_value[post_max_size] = $max_upload_size |
538 |
+php_admin_value[upload_max_filesize] = $max_upload_size |
539 |
+;php_admin_value[disable_functions] = system, show_source, symlink, dl, passthru, phpinfo, escapeshellarg, escapeshellcmd |
540 |
+;php_admin_value[open_basedir] = $open_basedir |
541 |
+php_admin_flag[allow_url_fopen] = on |
542 |
+php_admin_flag[file_upload] = on |
543 |
+;php_admin_flag[session.cookie_httponly] = on |
544 |
+;php_admin_flag[allow_url_include] = off |
545 |
+;php_admin_value[session.save_handler] = files |
546 |
+;php_admin_flag[output_buffering] = off |
547 |
+ |
548 |
+_EOF |
549 |
+ |
550 |
+ } |
551 |
+ else{ |
552 |
+ $OUT .= '; Cacti is disabled'; |
553 |
+ } |
554 |
+} |
555 |
+} |
556 |
+ |
557 |
+ |
558 |
+ |
559 |
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 |
560 |
--- smeserver-cacti-1.1.19.old/root/etc/e-smith/templates.metadata/etc/cacti/db.php 2014-06-16 11:53:01.000000000 -0400 |
561 |
+++ smeserver-cacti-1.1.19/root/etc/e-smith/templates.metadata/etc/cacti/db.php 2022-07-26 00:44:20.988000000 -0400 |
562 |
@@ -1,3 +1,3 @@ |
563 |
-UID="cacti" |
564 |
+UID="root" |
565 |
GID="www" |
566 |
PERMS=0640 |