/[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.3 - (show annotations) (download)
Tue Jul 26 04:53:30 2022 UTC (2 years, 3 months ago) by jpp
Branch: MAIN
Changes since 1.2: +70 -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
- 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/e-smith/sql/init/80cacti smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/e-smith/sql/init/80cacti
89 --- 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
90 +++ smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/e-smith/sql/init/80cacti 2022-07-26 00:48:18.028000000 -0400
91 @@ -1,9 +1,9 @@
92 {
93 - my $db = $cacti{DbName} || 'cacti_sme';
94 + my $db = $cacti{DbDatabase} || 'cacti_sme';
95 my $user = $cacti{DbUser} || 'cacti';
96 my $pass = $cacti{DbPassword} || 'changeme';
97 $OUT .= <<END
98 -#! /bin/sh
99 +#!/bin/bash
100 if [ -d /var/lib/mysql/$db ]; then
101 exit
102 fi
103 @@ -13,10 +13,10 @@
104 use mysql;
105 GRANT ALL PRIVILEGES ON $db.* TO $user\@localhost
106 IDENTIFIED BY '$pass';
107 - GRANT SELECT ON `mysql`.`time_zone_name` TO '$user'@'localhost';
108 + GRANT SELECT ON mysql.time_zone_name TO '$user'@'localhost';
109 flush privileges;
110 EOF
111 /usr/bin/mysql_tzinfo_to_sql /usr/share/zoneinfo/ 2>/dev/null |/usr/bin/mysql mysql
112 /usr/bin/mysql $db < /etc/e-smith/db/configuration/migrate/80cacti_sme.sql
113 END
114 -}
115 \ Pas de fin de ligne à la fin du fichier
116 +}
117 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
118 --- 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
119 +++ smeserver-cacti-1.1.19/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/86Cacti 2022-07-26 00:30:15.300000000 -0400
120 @@ -5,32 +5,19 @@
121 SSLRequireSSL
122 Options -Indexes
123 AllowOverride None
124 - order deny,allow
125 - deny from all
126 -
127 -{
128 - my $cactiaxs = $cacti{'access'} || "private";
129 - if ($cactiaxs eq "private")
130 - {
131 - $OUT .= " allow from $localAccess $externalSSLAccess";
132 - } else {
133 - $OUT .= " allow from all";
134 - }
135 -}
136 - Satisfy all
137 - AddType application/x-httpd-php .php .php3
138 - php_flag magic_quotes_gpc on
139 - php_flag track_vars on
140 + Require { (($cacti{'access'} ||"private") eq "public") ? "all granted" : "ip $localAccess $externalSSLAccess"; }
141 + AddType application/x-httpd-php .php
142 + <FilesMatch \.php$ >
143 + SetHandler "proxy:unix:/var/run/php-fpm/php74-cacti.sock|fcgi://localhost"
144 + </FilesMatch>
145 </Directory>
146
147
148
149 <Directory /usr/share/cacti/log>
150 - Order deny,allow
151 - Deny from all
152 + Require all denied
153 </Directory>
154 <Directory /usr/share/cacti/rra>
155 - Order deny,allow
156 - Deny from all
157 + Require all denied
158 </Directory>
159
160 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
161 --- 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
162 +++ 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
163 @@ -0,0 +1,68 @@
164 +{
165 +
166 +if ($PHP_VERSION eq '74'){
167 + if (($cacti{'status'} || 'disabled') eq 'enabled'){
168 + my $max_upload_size = ($cacti{MaxUploadSize} || '4096');
169 + $max_upload_size .= 'M' if ($max_upload_size =~ m/^\d+$/);
170 + my $memory_limit = ($cacti{MemoryLimit} || '512M');
171 + $memory_limit .= 'M' if ($memory_limit =~ m/^\d+$/);
172 + my $open_basedir= $cacti{PHPBaseDir} || '';
173 + $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";
174 + my $id = 'cacti';
175 + my $max_children = $cacti{'PHPmaxChildren'} || 20;
176 + my $min_spare_servers = $cacti{'PHPminServers'} || 4;
177 + my $start_servers = $cacti{'PHPstartServers'} || 6;
178 + my $max_spare_servers = $cacti{'PHPmaxServers'} || 8;
179 + my $max_requests = $cacti{'PHPmaxRequests'} || 1000;
180 + $min_spare_servers = ( $min_spare_servers > $max_spare_servers ) ? printf("%.0f",$max_spare_servers/2) : $min_spare_servers;
181 + $start_servers = ( $start_servers > $max_spare_servers ) ? printf("%.0f", $max_spare_servers /2 + $min_spare_servers/2 ) : $start_servers;
182 +
183 + $OUT .=<<_EOF;
184 +
185 +[php$PHP_VERSION-$id]
186 +user = www
187 +group = www
188 +listen.owner = root
189 +listen.group = www
190 +listen.mode = 0660
191 +listen = /var/run/php-fpm/php$PHP_VERSION-$id.sock
192 +pm = dynamic
193 +pm.max_children = $max_children
194 +pm.start_servers = $start_servers
195 +pm.min_spare_servers = $min_spare_servers
196 +pm.max_spare_servers = $max_spare_servers
197 +pm.max_requests = $max_requests
198 +php_admin_value[session.save_path] = /var/lib/php/$id/session
199 +php_admin_value[session.gc_maxlifetime] = 86400
200 +php_admin_value[opcache.file_cache] = /var/lib/php/$id/opcache
201 +php_admin_value[upload_tmp_dir] = /var/lib/php/$id/tmp
202 +php_admin_value[error_log] = /var/log/php/$id/error.log
203 +slowlog = /var/log/php/cacti/slow.log
204 +php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f php@{ $DomainName }
205 +php_admin_flag[display_errors] = off
206 +php_admin_flag[log_errors] = on
207 +php_admin_value[error_log] = syslog
208 +php_admin_value[memory_limit] = $memory_limit
209 +php_admin_value[max_execution_time] = 3600
210 +php_admin_value[post_max_size] = $max_upload_size
211 +php_admin_value[upload_max_filesize] = $max_upload_size
212 +php_admin_value[disable_functions] = system, show_source, symlink, exec, dl, shell_exec, passthru, phpinfo, escapeshellarg, escapeshellcmd
213 +php_admin_value[open_basedir] = $open_basedir
214 +php_admin_flag[allow_url_fopen] = on
215 +php_admin_flag[file_upload] = on
216 +php_admin_flag[session.cookie_httponly] = on
217 +php_admin_flag[allow_url_include] = off
218 +php_admin_value[session.save_handler] = files
219 +php_admin_flag[output_buffering] = off
220 +
221 +_EOF
222 +
223 + }
224 + else{
225 + $OUT .= '; Nextcloud is disabled';
226 + }
227 +}
228 +}
229 +
230 +
231 +
232 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
233 --- smeserver-cacti-1.1.19.old/root/etc/e-smith/templates.metadata/etc/cacti/db.php 2014-06-16 11:53:01.000000000 -0400
234 +++ smeserver-cacti-1.1.19/root/etc/e-smith/templates.metadata/etc/cacti/db.php 2022-07-26 00:44:20.988000000 -0400
235 @@ -1,3 +1,3 @@
236 -UID="cacti"
237 +UID="root"
238 GID="www"
239 PERMS=0640

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