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

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