/[smecontribs]/rpms/smeserver-cacti/contribs10/smeserver-cacti-1.1.19-sme10.patch
ViewVC logotype

Contents of /rpms/smeserver-cacti/contribs10/smeserver-cacti-1.1.19-sme10.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.5 - (show annotations) (download)
Wed Jul 27 19:12:45 2022 UTC (22 months ago) by jpp
Branch: MAIN
Changes since 1.4: +0 -80 lines
* Mon Jul 25 2022 Jean-Philippe Pialasse <tests@pialasse.com> 1.1.19-2.sme
- update httpd 2.4 to syntax [SME: 12039]
- initial import to SME10 [SME: 11307]
  cacti-1.2.21
  dedicated php-fpm pool 74
  update event
  ldap available
  auto install install_cacti.php --accept-eula --install
- fix sql init [SME: 10972]

* Wed Dec 11 2019 Jean-Philipe Pialasse <tests@pialasse.com> 1.1.19-1.sme
- update to cacti-1.1.19 [SME: 8434]

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

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed