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

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

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