1 |
diff -Nur --no-dereference smeserver-smeadmin-1.6.old/createlinks smeserver-smeadmin-1.6/createlinks |
diff -Nur --no-dereference smeserver-smeadmin-1.6.old/createlinks smeserver-smeadmin-1.6/createlinks |
2 |
--- smeserver-smeadmin-1.6.old/createlinks 2020-10-15 07:31:28.000000000 -0400 |
--- smeserver-smeadmin-1.6.old/createlinks 2020-10-15 07:31:28.000000000 -0400 |
3 |
+++ smeserver-smeadmin-1.6/createlinks 2021-03-25 01:33:42.522000000 -0400 |
+++ smeserver-smeadmin-1.6/createlinks 2021-03-27 22:41:19.452000000 -0400 |
4 |
@@ -22,10 +22,11 @@ |
@@ -2,16 +2,8 @@ |
5 |
|
|
6 |
|
use esmith::Build::CreateLinks qw(:all); |
7 |
|
|
8 |
|
-# Start and stop links |
9 |
|
-service_link_enhanced("smeadmind", "S99", "7"); |
10 |
|
-service_link_enhanced("smeadmind", "K97", "6"); |
11 |
|
-service_link_enhanced("smeadmind", "K20", "0"); |
12 |
|
-service_link_enhanced("smeadmind", "K20", "1"); |
13 |
|
|
14 |
|
|
15 |
|
-# Start and stop links to lm_sensors |
16 |
|
-service_link_enhanced("lm_sensors", "S99", "7"); |
17 |
|
- |
18 |
|
# Links for the panel |
19 |
|
panel_link("smeadmin", "manager"); |
20 |
|
#system("mkdir -p root/etc/e-smith/web/panels/manager/html/smeadmin"); |
21 |
|
@@ -22,10 +14,11 @@ |
22 |
#Creation of the event smeadmin-update |
#Creation of the event smeadmin-update |
23 |
for my $event (qw( |
for my $event (qw( |
24 |
smeadmin-update |
smeadmin-update |
31 |
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/smeadmind"); |
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/smeadmind"); |
32 |
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/lm_sensors"); |
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/lm_sensors"); |
33 |
} |
} |
34 |
|
@@ -39,3 +32,5 @@ |
35 |
|
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/lm_sensors"); |
36 |
|
} |
37 |
|
|
38 |
|
+#expand template |
39 |
|
+templates2events("/etc/e-smith/sql/init/smeadmin", "smeserver-smeadmin-update") |
40 |
diff -Nur --no-dereference smeserver-smeadmin-1.6.old/root/etc/e-smith/db/configuration/migrate/smeadmin smeserver-smeadmin-1.6/root/etc/e-smith/db/configuration/migrate/smeadmin |
diff -Nur --no-dereference smeserver-smeadmin-1.6.old/root/etc/e-smith/db/configuration/migrate/smeadmin smeserver-smeadmin-1.6/root/etc/e-smith/db/configuration/migrate/smeadmin |
41 |
--- smeserver-smeadmin-1.6.old/root/etc/e-smith/db/configuration/migrate/smeadmin 2020-10-15 07:31:28.000000000 -0400 |
--- smeserver-smeadmin-1.6.old/root/etc/e-smith/db/configuration/migrate/smeadmin 2020-10-15 07:31:28.000000000 -0400 |
42 |
+++ smeserver-smeadmin-1.6/root/etc/e-smith/db/configuration/migrate/smeadmin 2021-03-25 01:29:34.607000000 -0400 |
+++ smeserver-smeadmin-1.6/root/etc/e-smith/db/configuration/migrate/smeadmin 2021-03-25 01:29:34.607000000 -0400 |
58 |
if ( -e "/etc/e-smith/web/panels/manager/html/smeadmin/_smeadmin.conf" ){ |
if ( -e "/etc/e-smith/web/panels/manager/html/smeadmin/_smeadmin.conf" ){ |
59 |
diff -Nur --no-dereference smeserver-smeadmin-1.6.old/root/etc/e-smith/sql/init/smeadmin smeserver-smeadmin-1.6/root/etc/e-smith/sql/init/smeadmin |
diff -Nur --no-dereference smeserver-smeadmin-1.6.old/root/etc/e-smith/sql/init/smeadmin smeserver-smeadmin-1.6/root/etc/e-smith/sql/init/smeadmin |
60 |
--- smeserver-smeadmin-1.6.old/root/etc/e-smith/sql/init/smeadmin 2020-10-15 07:31:28.000000000 -0400 |
--- smeserver-smeadmin-1.6.old/root/etc/e-smith/sql/init/smeadmin 2020-10-15 07:31:28.000000000 -0400 |
61 |
+++ smeserver-smeadmin-1.6/root/etc/e-smith/sql/init/smeadmin 2021-03-25 01:31:40.870000000 -0400 |
+++ smeserver-smeadmin-1.6/root/etc/e-smith/sql/init/smeadmin 1969-12-31 19:00:00.000000000 -0500 |
62 |
@@ -1,7 +1,7 @@ |
@@ -1,153 +0,0 @@ |
63 |
#!/bin/bash |
-#!/bin/bash |
64 |
|
- |
65 |
# mysql |
-# mysql |
66 |
-if [ -d /var/lib/mysql/sme8admin ] && [ ! -d /var/lib/mysql/smeadmin ]; then |
-if [ -d /var/lib/mysql/sme8admin ] && [ ! -d /var/lib/mysql/smeadmin ]; then |
67 |
+if [ -d /var/lib/mysql/sme9admin ] && [ ! -d /var/lib/mysql/smeadmin ]; then |
- echo "Migrating existing sme8admin MySQL database." |
68 |
echo "Migrating existing sme8admin MySQL database." |
- mysqladmin create smeadmin |
69 |
mysqladmin create smeadmin |
- mysqldump sme8admin | mysql smeadmin |
70 |
mysqldump sme8admin | mysql smeadmin |
- PASS=$(/sbin/e-smith/db configuration getprop smeadmind DbPassword) |
71 |
@@ -17,10 +17,10 @@ |
- mysql -e " grant all privileges on smeadmin.* to 'smeadmin'@'localhost' identified by '$PASS'" |
72 |
fi |
- mysqladmin flush-privileges |
73 |
|
-elif [ -e /var/lib/mysql/smeadmin ]; then |
74 |
# rrd |
- # c'est une mise jour, on fait une upgrade de la base si besoin |
75 |
|
- sh /usr/share/doc/smeserver-smeadmin/update-mysql.sh |
76 |
|
-else |
77 |
|
- #si c'est une freshinstall on cree la bd mysql |
78 |
|
- sh /usr/share/doc/smeserver-smeadmin/create-mysql.sh |
79 |
|
-fi |
80 |
|
- |
81 |
|
-# rrd |
82 |
- # migrating previous sme8admin rrd |
- # migrating previous sme8admin rrd |
83 |
- if [ -d /var/lib/sme8admin ] && [ ! -d /var/lib/smeadmin ]; then |
- if [ -d /var/lib/sme8admin ] && [ ! -d /var/lib/smeadmin ]; then |
84 |
- echo "Migrating existing sme8admin RRDs files." |
- echo "Migrating existing sme8admin RRDs files." |
85 |
- cp -vr /var/lib/sme8admin /var/lib/smeadmin |
- cp -vr /var/lib/sme8admin /var/lib/smeadmin |
86 |
|
- fi |
87 |
|
- |
88 |
|
- #ADD more DS for version 1.5-10 |
89 |
|
- #first we test if these DS are already in the sensors.rrd |
90 |
|
- if [[ -f /var/lib/smeadmin/sensors.rrd ]]; then |
91 |
|
- rrdtool dump /var/lib/smeadmin/sensors.rrd > /tmp/new_file.xml |
92 |
|
- testDS=$(grep -w 'fspd2\|thd3\|thd4\|thd5\|thd6' /tmp/new_file.xml) |
93 |
|
- rm -f /tmp/new_file.xml |
94 |
|
- fi |
95 |
|
- # then since the DS are not in the sensors.rrd we create it |
96 |
|
- if [[ -d /var/lib/smeadmin ]] && [[ ! $testDS ]]; then |
97 |
|
- #if (fspd2,thd3,thd4,thd5,thd6) don't exist, then we create it without nuked the data already existent |
98 |
|
- /usr/share/doc/smeserver-smeadmin/add_ds_to_rrd.pl /var/lib/smeadmin sensors.rrd fspd2:GAUGE:600:0:10000 |
99 |
|
- /usr/share/doc/smeserver-smeadmin/add_ds_to_rrd.pl /var/lib/smeadmin sensors.rrd thd3:GAUGE:600:0:100 |
100 |
|
- /usr/share/doc/smeserver-smeadmin/add_ds_to_rrd.pl /var/lib/smeadmin sensors.rrd thd4:GAUGE:600:0:100 |
101 |
|
- /usr/share/doc/smeserver-smeadmin/add_ds_to_rrd.pl /var/lib/smeadmin sensors.rrd thd5:GAUGE:600:0:100 |
102 |
|
- /usr/share/doc/smeserver-smeadmin/add_ds_to_rrd.pl /var/lib/smeadmin sensors.rrd thd6:GAUGE:600:0:100 |
103 |
|
- |
104 |
|
- |
105 |
|
- elif [[ ! -d /var/lib/smeadmin ]]; then |
106 |
|
- #si c'est une freshinstall on cree les rrd |
107 |
|
- sh /usr/share/doc/smeserver-smeadmin/create-rrd.sh |
108 |
|
- fi |
109 |
|
- if [[ ! -f /var/lib/smeadmin/qpsmtpd.rrd ]]; then |
110 |
|
- # si le rrd qpsmtpd existe pas (nouveauté SME9) |
111 |
|
- rrdtool create /var/lib/smeadmin/qpsmtpd.rrd -s 300 \ |
112 |
|
- DS:check_basicheaders:GAUGE:600:0:U \ |
113 |
|
- DS:check_goodrcptto:GAUGE:600:0:U \ |
114 |
|
- DS:clamav:GAUGE:600:0:U \ |
115 |
|
- DS:karma:GAUGE:600:0:U \ |
116 |
|
- DS:tls_failed:GAUGE:600:0:U \ |
117 |
|
- DS:rhsbl:GAUGE:600:0:U \ |
118 |
|
- DS:check_earlytalker:GAUGE:600:0:U \ |
119 |
|
- DS:resolvable_fromhost:GAUGE:600:0:U \ |
120 |
|
- DS:dnsbl:GAUGE:600:0:U \ |
121 |
|
- DS:fcrdns:GAUGE:600:0:U \ |
122 |
|
- DS:spf:GAUGE:600:0:U \ |
123 |
|
- DS:check_spamhelo:GAUGE:600:0:U \ |
124 |
|
- DS:uribl:GAUGE:600:0:U \ |
125 |
|
- DS:dmarc:GAUGE:600:0:U \ |
126 |
|
- DS:total_denied:GAUGE:600:0:U \ |
127 |
|
- DS:spam_denied:GAUGE:600:0:U \ |
128 |
|
- DS:other_denied:GAUGE:600:0:U \ |
129 |
|
- DS:spam_queued:GAUGE:600:0:U \ |
130 |
|
- DS:queued:GAUGE:600:0:U \ |
131 |
|
- DS:total:GAUGE:600:0:U \ |
132 |
|
- RRA:AVERAGE:0.5:1:12 \ |
133 |
|
- RRA:AVERAGE:0.5:1:72 \ |
134 |
|
- RRA:AVERAGE:0.5:1:288 \ |
135 |
|
- RRA:AVERAGE:0.5:6:336 \ |
136 |
|
- RRA:AVERAGE:0.5:24:372 \ |
137 |
|
- RRA:AVERAGE:0.5:288:365 \ |
138 |
|
- RRA:MAX:0.5:1:12 \ |
139 |
|
- RRA:MAX:0.5:1:72 \ |
140 |
|
- RRA:MAX:0.5:1:288 \ |
141 |
|
- RRA:MAX:0.5:6:336 \ |
142 |
|
- RRA:MAX:0.5:24:372 \ |
143 |
|
- RRA:MAX:0.5:288:365 \ |
144 |
|
- RRA:MIN:0.5:1:12 \ |
145 |
|
- RRA:MIN:0.5:1:72 \ |
146 |
|
- RRA:MIN:0.5:1:288 \ |
147 |
|
- RRA:MIN:0.5:6:336 \ |
148 |
|
- RRA:MIN:0.5:24:372 \ |
149 |
|
- RRA:MIN:0.5:288:365 |
150 |
|
- fi |
151 |
|
- if [[ ! -f /var/lib/smeadmin/qmail.rrd ]]; then |
152 |
|
- # nombre et raisons de connexions refusées ou acceptées et file d'attente |
153 |
|
- rrdtool create /var/lib/smeadmin/qmail.rrd -s 300 \ |
154 |
|
- DS:local_failure:GAUGE:600:0:U \ |
155 |
|
- DS:local_deferral:GAUGE:600:0:U \ |
156 |
|
- DS:local_success:GAUGE:600:0:U \ |
157 |
|
- DS:local_total:GAUGE:600:0:U \ |
158 |
|
- DS:remote_failure:GAUGE:600:0:U \ |
159 |
|
- DS:remote_deferral:GAUGE:600:0:U \ |
160 |
|
- DS:remote_success:GAUGE:600:0:U \ |
161 |
|
- DS:remote_total:GAUGE:600:0:U \ |
162 |
|
- DS:local_queue:GAUGE:600:0:U \ |
163 |
|
- DS:remote_queue:GAUGE:600:0:U \ |
164 |
|
- RRA:AVERAGE:0.5:1:12 \ |
165 |
|
- RRA:AVERAGE:0.5:1:72 \ |
166 |
|
- RRA:AVERAGE:0.5:1:288 \ |
167 |
|
- RRA:AVERAGE:0.5:6:336 \ |
168 |
|
- RRA:AVERAGE:0.5:24:372 \ |
169 |
|
- RRA:AVERAGE:0.5:288:365 \ |
170 |
|
- RRA:MAX:0.5:1:12 \ |
171 |
|
- RRA:MAX:0.5:1:72 \ |
172 |
|
- RRA:MAX:0.5:1:288 \ |
173 |
|
- RRA:MAX:0.5:6:336 \ |
174 |
|
- RRA:MAX:0.5:24:372 \ |
175 |
|
- RRA:MAX:0.5:288:365 \ |
176 |
|
- RRA:MIN:0.5:1:12 \ |
177 |
|
- RRA:MIN:0.5:1:72 \ |
178 |
|
- RRA:MIN:0.5:1:288 \ |
179 |
|
- RRA:MIN:0.5:6:336 \ |
180 |
|
- RRA:MIN:0.5:24:372 \ |
181 |
|
- RRA:MIN:0.5:288:365 |
182 |
|
- fi |
183 |
|
- if [[ ! -f /var/lib/smeadmin/altqmail.rrd ]]; then |
184 |
|
- # nombre et raisons de connexions refusées ou acceptées et file d'attente |
185 |
|
- rrdtool create /var/lib/smeadmin/altqmail.rrd -s 300 \ |
186 |
|
- DS:local_failure:GAUGE:600:0:U \ |
187 |
|
- DS:local_deferral:GAUGE:600:0:U \ |
188 |
|
- DS:local_success:GAUGE:600:0:U \ |
189 |
|
- DS:local_total:GAUGE:600:0:U \ |
190 |
|
- DS:remote_failure:GAUGE:600:0:U \ |
191 |
|
- DS:remote_deferral:GAUGE:600:0:U \ |
192 |
|
- DS:remote_success:GAUGE:600:0:U \ |
193 |
|
- DS:remote_total:GAUGE:600:0:U \ |
194 |
|
- DS:local_queue:GAUGE:600:0:U \ |
195 |
|
- DS:remote_queue:GAUGE:600:0:U \ |
196 |
|
- RRA:AVERAGE:0.5:1:12 \ |
197 |
|
- RRA:AVERAGE:0.5:1:72 \ |
198 |
|
- RRA:AVERAGE:0.5:1:288 \ |
199 |
|
- RRA:AVERAGE:0.5:6:336 \ |
200 |
|
- RRA:AVERAGE:0.5:24:372 \ |
201 |
|
- RRA:AVERAGE:0.5:288:365 \ |
202 |
|
- RRA:MAX:0.5:1:12 \ |
203 |
|
- RRA:MAX:0.5:1:72 \ |
204 |
|
- RRA:MAX:0.5:1:288 \ |
205 |
|
- RRA:MAX:0.5:6:336 \ |
206 |
|
- RRA:MAX:0.5:24:372 \ |
207 |
|
- RRA:MAX:0.5:288:365 \ |
208 |
|
- RRA:MIN:0.5:1:12 \ |
209 |
|
- RRA:MIN:0.5:1:72 \ |
210 |
|
- RRA:MIN:0.5:1:288 \ |
211 |
|
- RRA:MIN:0.5:6:336 \ |
212 |
|
- RRA:MIN:0.5:24:372 \ |
213 |
|
- RRA:MIN:0.5:288:365 |
214 |
|
- fi |
215 |
|
- |
216 |
|
diff -Nur --no-dereference smeserver-smeadmin-1.6.old/root/etc/e-smith/templates/etc/e-smith/sql/init/smeadmin smeserver-smeadmin-1.6/root/etc/e-smith/templates/etc/e-smith/sql/init/smeadmin |
217 |
|
--- smeserver-smeadmin-1.6.old/root/etc/e-smith/templates/etc/e-smith/sql/init/smeadmin 1969-12-31 19:00:00.000000000 -0500 |
218 |
|
+++ smeserver-smeadmin-1.6/root/etc/e-smith/templates/etc/e-smith/sql/init/smeadmin 2021-03-25 15:32:13.964000000 -0400 |
219 |
|
@@ -0,0 +1,153 @@ |
220 |
|
+#!/bin/bash |
221 |
|
+ |
222 |
|
+# mysql |
223 |
|
+if [ -d /var/lib/mysql/sme9admin ] && [ ! -d /var/lib/mysql/smeadmin ]; then |
224 |
|
+ echo "Migrating existing sme9admin MySQL database." |
225 |
|
+ mysqladmin create smeadmin |
226 |
|
+ mysqldump sme9admin | mysql smeadmin |
227 |
|
+ PASS=$(/sbin/e-smith/db configuration getprop smeadmind DbPassword) |
228 |
|
+ mysql -e " grant all privileges on smeadmin.* to 'smeadmin'@'localhost' identified by '$PASS'" |
229 |
|
+ mysqladmin flush-privileges |
230 |
|
+elif [ -e /var/lib/mysql/smeadmin ]; then |
231 |
|
+ # c'est une mise jour, on fait une upgrade de la base si besoin |
232 |
|
+ sh /usr/share/doc/smeserver-smeadmin/update-mysql.sh |
233 |
|
+else |
234 |
|
+ #si c'est une freshinstall on cree la bd mysql |
235 |
|
+ sh /usr/share/doc/smeserver-smeadmin/create-mysql.sh |
236 |
|
+fi |
237 |
|
+ |
238 |
|
+# rrd |
239 |
+ # migrating previous sme9admin rrd |
+ # migrating previous sme9admin rrd |
240 |
+ if [ -d /var/lib/sme9admin ] && [ ! -d /var/lib/smeadmin ]; then |
+ if [ -d /var/lib/sme9admin ] && [ ! -d /var/lib/smeadmin ]; then |
241 |
+ echo "Migrating existing sme9admin RRDs files." |
+ echo "Migrating existing sme9admin RRDs files." |
242 |
+ cp -vr /var/lib/sme9admin /var/lib/smeadmin |
+ cp -vr /var/lib/sme9admin /var/lib/smeadmin |
243 |
fi |
+ fi |
244 |
|
+ |
245 |
|
+ #ADD more DS for version 1.5-10 |
246 |
|
+ #first we test if these DS are already in the sensors.rrd |
247 |
|
+ if [[ -f /var/lib/smeadmin/sensors.rrd ]]; then |
248 |
|
+ rrdtool dump /var/lib/smeadmin/sensors.rrd > /tmp/new_file.xml |
249 |
|
+ testDS=$(grep -w 'fspd2\|thd3\|thd4\|thd5\|thd6' /tmp/new_file.xml) |
250 |
|
+ rm -f /tmp/new_file.xml |
251 |
|
+ fi |
252 |
|
+ # then since the DS are not in the sensors.rrd we create it |
253 |
|
+ if [[ -d /var/lib/smeadmin ]] && [[ ! $testDS ]]; then |
254 |
|
+ #if (fspd2,thd3,thd4,thd5,thd6) don't exist, then we create it without nuked the data already existent |
255 |
|
+ /usr/share/doc/smeserver-smeadmin/add_ds_to_rrd.pl /var/lib/smeadmin sensors.rrd fspd2:GAUGE:600:0:10000 |
256 |
|
+ /usr/share/doc/smeserver-smeadmin/add_ds_to_rrd.pl /var/lib/smeadmin sensors.rrd thd3:GAUGE:600:0:100 |
257 |
|
+ /usr/share/doc/smeserver-smeadmin/add_ds_to_rrd.pl /var/lib/smeadmin sensors.rrd thd4:GAUGE:600:0:100 |
258 |
|
+ /usr/share/doc/smeserver-smeadmin/add_ds_to_rrd.pl /var/lib/smeadmin sensors.rrd thd5:GAUGE:600:0:100 |
259 |
|
+ /usr/share/doc/smeserver-smeadmin/add_ds_to_rrd.pl /var/lib/smeadmin sensors.rrd thd6:GAUGE:600:0:100 |
260 |
|
+ |
261 |
|
+ |
262 |
|
+ elif [[ ! -d /var/lib/smeadmin ]]; then |
263 |
|
+ #si c'est une freshinstall on cree les rrd |
264 |
|
+ sh /usr/share/doc/smeserver-smeadmin/create-rrd.sh |
265 |
|
+ fi |
266 |
|
+ if [[ ! -f /var/lib/smeadmin/qpsmtpd.rrd ]]; then |
267 |
|
+ # si le rrd qpsmtpd existe pas (nouveauté SME9) |
268 |
|
+ rrdtool create /var/lib/smeadmin/qpsmtpd.rrd -s 300 \ |
269 |
|
+ DS:check_basicheaders:GAUGE:600:0:U \ |
270 |
|
+ DS:check_goodrcptto:GAUGE:600:0:U \ |
271 |
|
+ DS:clamav:GAUGE:600:0:U \ |
272 |
|
+ DS:karma:GAUGE:600:0:U \ |
273 |
|
+ DS:tls_failed:GAUGE:600:0:U \ |
274 |
|
+ DS:rhsbl:GAUGE:600:0:U \ |
275 |
|
+ DS:check_earlytalker:GAUGE:600:0:U \ |
276 |
|
+ DS:resolvable_fromhost:GAUGE:600:0:U \ |
277 |
|
+ DS:dnsbl:GAUGE:600:0:U \ |
278 |
|
+ DS:fcrdns:GAUGE:600:0:U \ |
279 |
|
+ DS:spf:GAUGE:600:0:U \ |
280 |
|
+ DS:check_spamhelo:GAUGE:600:0:U \ |
281 |
|
+ DS:uribl:GAUGE:600:0:U \ |
282 |
|
+ DS:dmarc:GAUGE:600:0:U \ |
283 |
|
+ DS:total_denied:GAUGE:600:0:U \ |
284 |
|
+ DS:spam_denied:GAUGE:600:0:U \ |
285 |
|
+ DS:other_denied:GAUGE:600:0:U \ |
286 |
|
+ DS:spam_queued:GAUGE:600:0:U \ |
287 |
|
+ DS:queued:GAUGE:600:0:U \ |
288 |
|
+ DS:total:GAUGE:600:0:U \ |
289 |
|
+ RRA:AVERAGE:0.5:1:12 \ |
290 |
|
+ RRA:AVERAGE:0.5:1:72 \ |
291 |
|
+ RRA:AVERAGE:0.5:1:288 \ |
292 |
|
+ RRA:AVERAGE:0.5:6:336 \ |
293 |
|
+ RRA:AVERAGE:0.5:24:372 \ |
294 |
|
+ RRA:AVERAGE:0.5:288:365 \ |
295 |
|
+ RRA:MAX:0.5:1:12 \ |
296 |
|
+ RRA:MAX:0.5:1:72 \ |
297 |
|
+ RRA:MAX:0.5:1:288 \ |
298 |
|
+ RRA:MAX:0.5:6:336 \ |
299 |
|
+ RRA:MAX:0.5:24:372 \ |
300 |
|
+ RRA:MAX:0.5:288:365 \ |
301 |
|
+ RRA:MIN:0.5:1:12 \ |
302 |
|
+ RRA:MIN:0.5:1:72 \ |
303 |
|
+ RRA:MIN:0.5:1:288 \ |
304 |
|
+ RRA:MIN:0.5:6:336 \ |
305 |
|
+ RRA:MIN:0.5:24:372 \ |
306 |
|
+ RRA:MIN:0.5:288:365 |
307 |
|
+ fi |
308 |
|
+ if [[ ! -f /var/lib/smeadmin/qmail.rrd ]]; then |
309 |
|
+ # nombre et raisons de connexions refusées ou acceptées et file d'attente |
310 |
|
+ rrdtool create /var/lib/smeadmin/qmail.rrd -s 300 \ |
311 |
|
+ DS:local_failure:GAUGE:600:0:U \ |
312 |
|
+ DS:local_deferral:GAUGE:600:0:U \ |
313 |
|
+ DS:local_success:GAUGE:600:0:U \ |
314 |
|
+ DS:local_total:GAUGE:600:0:U \ |
315 |
|
+ DS:remote_failure:GAUGE:600:0:U \ |
316 |
|
+ DS:remote_deferral:GAUGE:600:0:U \ |
317 |
|
+ DS:remote_success:GAUGE:600:0:U \ |
318 |
|
+ DS:remote_total:GAUGE:600:0:U \ |
319 |
|
+ DS:local_queue:GAUGE:600:0:U \ |
320 |
|
+ DS:remote_queue:GAUGE:600:0:U \ |
321 |
|
+ RRA:AVERAGE:0.5:1:12 \ |
322 |
|
+ RRA:AVERAGE:0.5:1:72 \ |
323 |
|
+ RRA:AVERAGE:0.5:1:288 \ |
324 |
|
+ RRA:AVERAGE:0.5:6:336 \ |
325 |
|
+ RRA:AVERAGE:0.5:24:372 \ |
326 |
|
+ RRA:AVERAGE:0.5:288:365 \ |
327 |
|
+ RRA:MAX:0.5:1:12 \ |
328 |
|
+ RRA:MAX:0.5:1:72 \ |
329 |
|
+ RRA:MAX:0.5:1:288 \ |
330 |
|
+ RRA:MAX:0.5:6:336 \ |
331 |
|
+ RRA:MAX:0.5:24:372 \ |
332 |
|
+ RRA:MAX:0.5:288:365 \ |
333 |
|
+ RRA:MIN:0.5:1:12 \ |
334 |
|
+ RRA:MIN:0.5:1:72 \ |
335 |
|
+ RRA:MIN:0.5:1:288 \ |
336 |
|
+ RRA:MIN:0.5:6:336 \ |
337 |
|
+ RRA:MIN:0.5:24:372 \ |
338 |
|
+ RRA:MIN:0.5:288:365 |
339 |
|
+ fi |
340 |
|
+ if [[ ! -f /var/lib/smeadmin/altqmail.rrd ]]; then |
341 |
|
+ # nombre et raisons de connexions refusées ou acceptées et file d'attente |
342 |
|
+ rrdtool create /var/lib/smeadmin/altqmail.rrd -s 300 \ |
343 |
|
+ DS:local_failure:GAUGE:600:0:U \ |
344 |
|
+ DS:local_deferral:GAUGE:600:0:U \ |
345 |
|
+ DS:local_success:GAUGE:600:0:U \ |
346 |
|
+ DS:local_total:GAUGE:600:0:U \ |
347 |
|
+ DS:remote_failure:GAUGE:600:0:U \ |
348 |
|
+ DS:remote_deferral:GAUGE:600:0:U \ |
349 |
|
+ DS:remote_success:GAUGE:600:0:U \ |
350 |
|
+ DS:remote_total:GAUGE:600:0:U \ |
351 |
|
+ DS:local_queue:GAUGE:600:0:U \ |
352 |
|
+ DS:remote_queue:GAUGE:600:0:U \ |
353 |
|
+ RRA:AVERAGE:0.5:1:12 \ |
354 |
|
+ RRA:AVERAGE:0.5:1:72 \ |
355 |
|
+ RRA:AVERAGE:0.5:1:288 \ |
356 |
|
+ RRA:AVERAGE:0.5:6:336 \ |
357 |
|
+ RRA:AVERAGE:0.5:24:372 \ |
358 |
|
+ RRA:AVERAGE:0.5:288:365 \ |
359 |
|
+ RRA:MAX:0.5:1:12 \ |
360 |
|
+ RRA:MAX:0.5:1:72 \ |
361 |
|
+ RRA:MAX:0.5:1:288 \ |
362 |
|
+ RRA:MAX:0.5:6:336 \ |
363 |
|
+ RRA:MAX:0.5:24:372 \ |
364 |
|
+ RRA:MAX:0.5:288:365 \ |
365 |
|
+ RRA:MIN:0.5:1:12 \ |
366 |
|
+ RRA:MIN:0.5:1:72 \ |
367 |
|
+ RRA:MIN:0.5:1:288 \ |
368 |
|
+ RRA:MIN:0.5:6:336 \ |
369 |
|
+ RRA:MIN:0.5:24:372 \ |
370 |
|
+ RRA:MIN:0.5:288:365 |
371 |
|
+ fi |
372 |
|
+ |
373 |
|
diff -Nur --no-dereference smeserver-smeadmin-1.6.old/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/smeadmin smeserver-smeadmin-1.6/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/smeadmin |
374 |
|
--- smeserver-smeadmin-1.6.old/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/smeadmin 1969-12-31 19:00:00.000000000 -0500 |
375 |
|
+++ smeserver-smeadmin-1.6/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/smeadmin 2021-03-27 22:39:01.822000000 -0400 |
376 |
|
@@ -0,0 +1 @@ |
377 |
|
+PERMS=0750 |
378 |
|
diff -Nur --no-dereference smeserver-smeadmin-1.6.old/root/etc/e-smith/web/functions/smeadmin smeserver-smeadmin-1.6/root/etc/e-smith/web/functions/smeadmin |
379 |
|
--- smeserver-smeadmin-1.6.old/root/etc/e-smith/web/functions/smeadmin 2020-10-15 07:31:28.000000000 -0400 |
380 |
|
+++ smeserver-smeadmin-1.6/root/etc/e-smith/web/functions/smeadmin 2021-03-27 22:31:54.326000000 -0400 |
381 |
|
@@ -368,13 +368,13 @@ |
382 |
|
#liste des services et classification |
383 |
|
my @services = ("#".gettext("Web services"),"httpd-e-smith","httpd-admin","squid", |
384 |
|
"#".gettext("Administrative services"), "sshd", "smeadmind", |
385 |
|
- "#".gettext("Network services"),"wan","dhcpd","pptpd","ippp", |
386 |
|
+ "#".gettext("Network services"),"wan","dhcpd","pptpd","ippp","bridge","openvpn-s2s","openvpn-routed","openvpn-bridge","wireguard","ipsec","vpnserver", |
387 |
|
"#".gettext("File-sharing services"),"smb","smbd","nmbd","ftp", |
388 |
|
- "#".gettext("E-mail services"),"pop3","pop3s","dovecot","imaps","imap","qmail","altqmail","qpsmtpd","sqpsmtpd", "clamd", "freshclam","spamd",#mail |
389 |
|
+ "#".gettext("E-mail services"),"pop3","pop3s","dovecot","imaps","imap","qmail","altqmail","qpsmtpd","sqpsmtpd","smtp-auth-proxy", "clamd", "freshclam","spamd",#mail |
390 |
|
"#".gettext("DNS services"),"tinydns","dnscache", #dns |
391 |
|
- "#".gettext("Authentication services"),"oidentd","ldap","smtp-auth-proxy","radiusd", #auth |
392 |
|
- "#".gettext("Misc. services"),"mysqld","ntpd","lpd", #misc |
393 |
|
- "#".gettext("System services"),"crond","rsyslog","ulogd","acpid","raidmonitor"); #sys et materiel |
394 |
|
+ "#".gettext("Authentication services"),"oidentd","ldap","smtp-auth-proxy","radiusd","cvm-unix", #auth |
395 |
|
+ "#".gettext("Misc. services"),"mariadb","ntpd","lpd", #misc |
396 |
|
+ "#".gettext("System services"),"crond","rsyslog","ulogd","acpid","raidmonitor","local", "yum"); #sys et materiel |
397 |
|
|
398 |
|
#hack pour la mise en forme : a) debut 1er case a gauche |
399 |
|
print $q->start_table,$q->start_Tr,$q->start_td; |
400 |
|
@@ -396,24 +396,27 @@ |
401 |
|
#si c'est un 'header' |
402 |
|
if ($svc=~/^#(.*)/) |
403 |
|
{ |
404 |
|
- print $q->Tr(),$q->Tr($q->th($1),$q->th(gettext("State")),$q->th(gettext("Action")),$q->th("DB Status"),$q->th("DB Action")); |
405 |
|
+ print $q->Tr(),$q->Tr($q->th($1),$q->th(gettext("State")),$q->th(gettext("Action")),$q->th("DB Status"),$q->th("DB Action")); |
406 |
|
} |
407 |
|
else |
408 |
|
{ |
409 |
|
- #si c'est un service pour lequel on a des infos complementaires... |
410 |
|
+ #si c'est un service pour lequel on a des infos complementaires... |
411 |
|
if($svc=~/^(httpd-e-smith|httpd-admin|smb|smbd|nmbd|squid|pptpd|dhcpd|sshd|ftp|pppoe|pppd|wan|altqmail|qmail|qpsmtpd|sqpsmtpd)$/) {$details=1;} |
412 |
|
if ( -d "/service/$svc") {$cmd = "/usr/bin/sv s $svc";} # was -d /var/service or -d /service/ |
413 |
|
- elsif ($svc=~/^(imaps|imap)$/) { $cmd = "/usr/bin/sv s dovecot"; } |
414 |
|
- else {$cmd = "/sbin/e-smith/service $svc status|/bin/grep $svc";} |
415 |
|
+ elsif ($svc=~/^(imaps|imap|pop3|pop3s)$/) { $cmd = "/usr/bin/systemctl is-active dovecot"; } |
416 |
|
+ else {$cmd = "/usr/bin/systemctl is-active $svc";} |
417 |
|
my @res=`$cmd`; |
418 |
|
- foreach (@res) |
419 |
|
+ |
420 |
|
+ foreach (@res) |
421 |
|
{ |
422 |
|
+ my $dbsv=$smedb->get("$svc") ||next; |
423 |
|
# workaround to see db config status |
424 |
|
my $dbstatus="not defined"; |
425 |
|
+ |
426 |
|
if ( length(`/sbin/e-smith/db configuration show $svc`) > 1 ) |
427 |
|
{$dbstatus=$smedb->get("$svc")->prop('status');} # trouver un moyen de verifier que le nom du service est bien trouvé dans liste |
428 |
|
else |
429 |
|
- {$dbstatus=""; } |
430 |
|
+ {$dbstatus="";} |
431 |
|
#print "$svc :".length(`/sbin/e-smith/db configuration show $svc`)."<br>"; |
432 |
|
|
433 |
|
#print $q->p($_); |
434 |
|
@@ -424,42 +427,39 @@ |
435 |
|
#Warning !! Only on sme6 |
436 |
|
#proftpd est arrete |
437 |
|
|
438 |
|
- if ($svc=~/^(imaps|imap)$/) |
439 |
|
- { |
440 |
|
- print $q->Tr((($details==1)? $q->td($q->a({href=>"$progname?state=service_detail&service=$svc"},"$svc")) : $q->td("$svc")), |
441 |
|
- $q->td(""),$q->td( "dovecot" ) ,$q->td("$dbstatus"), $q->td( ( ("$dbstatus" ne "") ? (("$dbstatus" eq "enabled" )? $q->submit(-name=>"disabled_$svc",-value=>'disable'): $q->submit(-name=>"enabled_$svc",-value=>'enable')) : " ") ) ); |
442 |
|
+ if ($svc=~/^(imaps|imap|pop3|pop3s)$/) |
443 |
|
+ { |
444 |
|
+ print $q->Tr( |
445 |
|
+ (($details==1)? $q->td($q->a({href=>"$progname?state=service_detail&service=$svc"},"$svc")) : $q->td("$svc")), |
446 |
|
+ $q->td(""),$q->td( "dovecot" ) , |
447 |
|
+ $q->td("$dbstatus"), |
448 |
|
+ $q->td( ( ("$dbstatus" ne "") ? (("$dbstatus" eq "enabled" )? $q->submit(-name=>"disabled_$svc",-value=>'disable'): $q->submit(-name=>"enabled_$svc",-value=>'enable')) : " ") ) |
449 |
|
+ ); |
450 |
|
|
451 |
|
|
452 |
|
- } |
453 |
|
- #si le service est arrete^:il ya down ou il n'y a pas de () pour le pid et ca ne fini pas par ... |
454 |
|
- elsif(/^down:/ || /^([a-zA-Z0-9]*) [^(^)]*([^.]{3})$/) |
455 |
|
- { |
456 |
|
+ } |
457 |
|
+ #si le service est arrete^:il ya down ou il n'y a pas de () pour le pid et ca ne fini pas par ... |
458 |
|
+ elsif(/^down:/ || /^([a-zA-Z0-9]*) [^(^)]*([^.]{3})$/ || /^failed/ || /^unknown/) |
459 |
|
+ { |
460 |
|
#on fait une conditionnelle pour savoir si on met le nom du service en lien ou pas |
461 |
|
print $q->Tr((($details==1)? $q->td($q->a({href=>"$progname?state=service_detail&service=$svc"},"$svc")) : $q->td("$svc")), |
462 |
|
$q->td(gettext("Stopped")),$q->td( (("$dbstatus" eq "enabled" || "$dbstatus" eq "" )? $q->submit(-name=>"start_$svc",-value=>'start'): "disabled") ) ,$q->td("$dbstatus"), |
463 |
|
$q->td( ( ("$dbstatus" ne "") ? (("$dbstatus" eq "enabled" )? $q->submit(-name=>"disabled_$svc",-value=>'disable'): $q->submit(-name=>"enabled_$svc",-value=>'enable')) : " ") ) ); |
464 |
|
- } |
465 |
|
- |
466 |
|
- #MATCHE: |
467 |
|
- #/service/raidmonitor: run (pid 1629) 5747 seconds, normally down |
468 |
|
- #clamd (pid 2221) en cours d'exécution... |
469 |
|
- #atalkd (pid 6445) is running... |
470 |
|
- #Warning !! Only on sme6 |
471 |
|
- #/service/popd: up (pid 22340) 101687 seconds, normally down |
472 |
|
- #sme6admind (pid 14320) en cours d'execution |
473 |
|
- |
474 |
|
- #si le service tourne |
475 |
|
- elsif (/^run:(.*)\(pid ([\d\s]+)\)/ || /^([a-zA-Z0-9]*) \(pid ([\d\s]+)\).*\.\.\.$/ ) |
476 |
|
- { |
477 |
|
+ } |
478 |
|
+ elsif (/^run:(.*)\(pid ([\d\s]+)\)/ || /^([a-zA-Z0-9]*) \(pid ([\d\s]+)\).*\.\.\.$/ || /^active/ ) |
479 |
|
+ { |
480 |
|
#$2=liste pids |
481 |
|
- my @pids=split(/ /,$2); |
482 |
|
+ my @pids; |
483 |
|
+ @pids=split(/ /,$2) if defined $2; |
484 |
|
|
485 |
|
- print $q->Tr((($details==1)? $q->td($q->a({href=>"$progname?state=service_detail&service=$svc"},"$svc")) : $q->td("$svc")), |
486 |
|
- $q->td(gettext("Started")),$q->td($q->submit(-name=>"stop_$svc",-value=>'stop')) ,$q->td("$dbstatus"), |
487 |
|
- $q->td( ( ("$dbstatus" ne "") ? (("$dbstatus" eq "enabled" )? $q->submit(-name=>"disabled_$svc",-value=>'disable'): $q->submit(-name=>"enabled_$svc",-value=>'enable')) : " ") ) ); |
488 |
|
- } |
489 |
|
- } |
490 |
|
- } |
491 |
|
+ print $q->Tr( |
492 |
|
+ (($details==1)? $q->td($q->a({href=>"$progname?state=service_detail&service=$svc"},"$svc")) : $q->td("$svc")), |
493 |
|
+ $q->td(gettext("Started")), |
494 |
|
+ $q->td($q->submit(-name=>"stop_$svc",-value=>'stop')) ,$q->td("$dbstatus"), |
495 |
|
+ $q->td( ( ("$dbstatus" ne "") ? (("$dbstatus" eq "enabled" )? $q->submit(-name=>"disabled_$svc",-value=>'disable'): $q->submit(-name=>"enabled_$svc",-value=>'enable')) : " ") ) ); |
496 |
|
+ } |
497 |
|
+ } |
498 |
|
+ } |
499 |
|
} |
500 |
|
|
501 |
|
#service_control est le parametre qui prend le nom du service a arreter/demarrer |
502 |
|
diff -Nur --no-dereference smeserver-smeadmin-1.6.old/root/etc/rc.d/init.d/smeadmind smeserver-smeadmin-1.6/root/etc/rc.d/init.d/smeadmind |
503 |
|
--- smeserver-smeadmin-1.6.old/root/etc/rc.d/init.d/smeadmind 2020-10-15 07:31:28.000000000 -0400 |
504 |
|
+++ smeserver-smeadmin-1.6/root/etc/rc.d/init.d/smeadmind 1969-12-31 19:00:00.000000000 -0500 |
505 |
|
@@ -1,59 +0,0 @@ |
506 |
|
-#!/bin/sh |
507 |
|
-# Smeadmin - script shell pour l'arret/demarrage du service |
508 |
|
-# Copyright (C) 2006 |
509 |
|
-# This file is distributed under the GPL license. |
510 |
|
-# Landry Breuil <landry@firewall-services.com>, 2006. |
511 |
|
- |
512 |
|
-# description: service de surveillance du systeme |
513 |
|
-# chkconfig: 345 97 03 |
514 |
|
- |
515 |
|
-# Source function library. |
516 |
|
-. /etc/rc.d/init.d/functions |
517 |
|
- |
518 |
|
-RETVAL=0 |
519 |
|
- |
520 |
|
-# See how we were called. |
521 |
|
-case "$1" in |
522 |
|
- start) |
523 |
|
- echo -n "Starting smeadmin daemon: " |
524 |
|
- # Not shutdown correctly ? |
525 |
|
- if [ -f /var/run/smeadmin.pid ]; then |
526 |
|
- kill `cat /var/run/smeadmin.pid` >/dev/null 2>&1 |
527 |
|
- rm -f /var/run/smeadmin.pid >/dev/null 2>&1 |
528 |
|
- rm -f /var/lock/subsys/smeadmin && rm -f /var/lock/smeadmin |
529 |
|
- fi |
530 |
|
- daemon /usr/bin/smeadmind |
531 |
|
- RETVAL=$? |
532 |
|
- echo |
533 |
|
- [ $RETVAL -eq 0 ] && touch /var/lock/subsys/smeadmin |
534 |
|
- ;; |
535 |
|
- stop) |
536 |
|
- echo -n "Stopping smeadmin daemon: " |
537 |
|
- killproc smeadmind |
538 |
|
- RETVAL=$? |
539 |
|
- rm -f /var/lock/subsys/smeadmin && rm -f /var/lock/smeadmin |
540 |
|
- echo |
541 |
|
- ;; |
542 |
|
- status) |
543 |
|
- status smeadmind |
544 |
|
- RETVAL=$? |
545 |
|
- ;; |
546 |
|
- restart) |
547 |
|
- $0 stop |
548 |
|
- $0 start |
549 |
|
- RETVAL=$? |
550 |
|
- ;; |
551 |
|
- reload) |
552 |
|
- echo -n "Smeadmin configuration reloaded: " |
553 |
|
- # A VOIR !! |
554 |
|
- kill -1 `cat /var/run/smeadmin.pid` |
555 |
|
- RETVAl=$? |
556 |
|
- echo |
557 |
|
- ;; |
558 |
|
- *) |
559 |
|
- echo "Usage: $0 {start|stop|status|restart|reload}" |
560 |
|
- exit 1 |
561 |
|
-esac |
562 |
|
- |
563 |
|
-exit $RETVAL |
564 |
|
- |
565 |
|
diff -Nur --no-dereference smeserver-smeadmin-1.6.old/root/usr/bin/smeadmind smeserver-smeadmin-1.6/root/usr/bin/smeadmind |
566 |
|
--- smeserver-smeadmin-1.6.old/root/usr/bin/smeadmind 2020-10-15 07:31:28.000000000 -0400 |
567 |
|
+++ smeserver-smeadmin-1.6/root/usr/bin/smeadmind 2021-03-27 22:30:13.364000000 -0400 |
568 |
|
@@ -89,17 +89,18 @@ |
569 |
|
|
570 |
#ADD more DS for version 1.5-10 |
#tableau des chemins des logs qui nous interessent |
571 |
|
#TO SEE |
572 |
|
-my @logs= ( "clamd/current", # pour les VIRUS ??? |
573 |
|
- "spamd/current", #pour les SPAMS |
574 |
|
- "sshd/current", #pour les connexions ssh |
575 |
|
- "messages", |
576 |
|
- "qmail/current", #pour les mails IN/OUT |
577 |
|
- "altqmail/current", #pour les mails OUT |
578 |
|
- "qpsmtpd/current", #pour les SPAM/VIRUS ?? |
579 |
|
- "sqpsmtpd/current", #idem pour les connexions securisées |
580 |
|
- "proftpd/current", #pour la date de fin de connection FTP |
581 |
|
- "secure", #pour les connexion FTP avec le username authentifie |
582 |
|
- "xferlog"); #pour les details des transferts ftp |
583 |
|
+my @logs= ( "clamd/current", # VIRUS ??? |
584 |
|
+ "spamd/spamd.log", # SPAMS |
585 |
|
+ "sshd/sshd.log", # ssh connections |
586 |
|
+ "messages", # afpd pppd and others not with dedicated logs |
587 |
|
+ "dhcpd/dhcpd.log", # dhcpd |
588 |
|
+ "qmail/current", # mails IN/OUT |
589 |
|
+ "altqmail/current", # mails OUT |
590 |
|
+ "qpsmtpd/current", # SPAM/VIRUS ?? |
591 |
|
+ "sqpsmtpd/current", # SPAM/VIRUS ?? |
592 |
|
+ "proftpd/proftpd.log", # start and end of ftp session |
593 |
|
+ "secure", # FTP session with usernam auth |
594 |
|
+ "xferlog"); # file transfer with ftp |
595 |
|
|
596 |
|
#handle bd mySQL |
597 |
|
my $bd; |
598 |
|
@@ -296,6 +297,9 @@ |
599 |
|
my $cont=0; |
600 |
|
while(1) |
601 |
|
{ |
602 |
|
+ #step 0 let's reread the logs, so we do not need to restart |
603 |
|
+ readConf(); |
604 |
|
+ |
605 |
|
# etape 1 : parsage des logs |
606 |
|
parse_logs(); |
607 |
|
|
608 |
|
@@ -358,7 +362,8 @@ |
609 |
|
$DomainName = $smedb->get('DomainName')->value; |
610 |
|
$SystemName = $smedb->get('SystemName')->value; |
611 |
|
$SystemMode = $smedb->get("SystemMode")->value; |
612 |
|
- |
613 |
|
+ $DEBUG = $smedb->get('smeadmind')->prop('DEBUG') || "0"; |
614 |
|
+ |
615 |
|
#on n'a une external ip que si on est en server-passerelle |
616 |
|
if ($SystemMode =~ /servergateway/) { |
617 |
|
$ExternalIP = $smedb->get("ExternalIP")->value; |
618 |
|
@@ -480,9 +485,11 @@ |
619 |
|
# ici on met a jour volume connexion meme si pas fini si pppoe et si pas trouvé de fin dans log |
620 |
|
my $smedb=esmith::ConfigDB->open; |
621 |
|
my $ppoeif = $smedb->get("ExternalInterface")->prop('Name'); |
622 |
|
+ my $ppoemode = $smedb->get("ExternalInterface")->prop('Configuration'); |
623 |
|
|
624 |
|
#for sme9 in server-only, the external interface is set to none |
625 |
|
- if ($ppoeif ne 'none') { |
626 |
|
+ #for sme10 we add test we are using pppoe |
627 |
|
+ if ($ppoeif ne 'none' && $ppoemode eq 'pppoe') { |
628 |
|
|
629 |
|
my $recBytes=`cat /proc/net/dev|grep $ppoeif|cut -d ':' -f2|tr -s ' '| sed -e 's/^[ \t]*//'|cut -d ' ' -f1`; |
630 |
|
my $senBytes=`cat /proc/net/dev|grep $ppoeif|tr -s ' '| sed -e 's/^[ \t]*//'|cut -d " " -f9`; |
631 |
|
@@ -550,13 +557,15 @@ |
632 |
|
#parsage de la difference entre les 2 logs |
633 |
|
#si la difference a donne qqch |
634 |
|
#parse SSHD log to catch ssh connections/bruteforce |
635 |
|
- if ($nom eq "sshd/current") { |
636 |
|
+ if ($nom eq "sshd/sshd.log") { |
637 |
|
+ debug "sshd: "; |
638 |
|
while ( defined(my $l = <$fh>)) { |
639 |
|
chomp $l; |
640 |
|
#Match: @TAI64 Accepted password for user from ip port prt mode |
641 |
|
# "@4000000043a7f6970980de74 Accepted password for root from 10.246.200.10 port 60693 ssh2" |
642 |
|
# "@4000000043a800192a7e131c Accepted publickey for root from 10.246.200.10 port 46322 ssh2" |
643 |
|
- |
644 |
|
+ # SME10 |
645 |
|
+ # "Mar 23 16:57:38 sme10 sshd[9666]: Accepted publickey for root from 192.168.12.70 port 60224 ssh2: RSA SHA256:uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu" |
646 |
|
if($l =~ /^(@[0-9a-f]{24}) Accepted (password|publickey) for (\w+) from (\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/) { |
647 |
|
#$1:date $2:methode $3:login $4.$5.$6.$7:ip |
648 |
|
#open connexion ssh reussie |
649 |
|
@@ -564,9 +573,20 @@ |
650 |
|
my $date=tai2strftime($1,"%F %T"); |
651 |
|
my $reslt=execute_sql_query("SELECT * FROM ssh WHERE ip='$ip' and debut='$date' and login='$3'"); |
652 |
|
#si on a trouve pas trouve une ligne ==> insert |
653 |
|
+ debug "SELECT * FROM ssh WHERE ip='$ip' and debut='$date' and login='$3'\n"; |
654 |
|
execute_sql_query("INSERT INTO ssh VALUES ('$date','$ip','$3','1')") if ($reslt eq "0E0"); |
655 |
|
next; |
656 |
|
} |
657 |
|
+ elsif ($l =~ /(\w{3}\s{1,2}\d{1,2} [0-9:]{8}) $SystemName sshd\[(\d+)\]: Accepted (password|publickey) for (\w+) from (\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/) { |
658 |
|
+ #$1:date $2:methode $3:login $4.$5.$6.$7:ip |
659 |
|
+ #open connexion ssh reussie |
660 |
|
+ my $ip=ipdot2ipnum($5,$6,$7,$8); |
661 |
|
+ my $date=mkmysqldate($1); |
662 |
|
+ debug "SELECT * FROM ssh WHERE ip='$ip' and debut='$date' and login='$4'\n"; |
663 |
|
+ my $reslt=execute_sql_query("SELECT * FROM ssh WHERE ip='$ip' and debut='$date' and login='$4'") ; |
664 |
|
+ execute_sql_query("INSERT INTO ssh VALUES ('$date','$ip','$4','1')") if ($reslt eq "0E0");; |
665 |
|
+ next; |
666 |
|
+ } |
667 |
|
|
668 |
|
#Match: @TAI64 Failed password for (|invalid user) user from ip port prt mode |
669 |
|
#matche ces 2 lignes |
670 |
|
@@ -583,6 +603,17 @@ |
671 |
|
execute_sql_query("INSERT INTO ssh VALUES ('$date','$ip','$3','0')") if ($reslt eq "0E0"); |
672 |
|
next; |
673 |
|
} |
674 |
|
+ elsif ($l =~ /(\w{3}\s{1,2}\d{1,2} [0-9:]{8}) $SystemName sshd\[(\d+)\]: Failed for(| invalid user) (\w+) from (\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/) { |
675 |
|
+ #$1:date $2:methode $3:login $4.$5.$6.$7:ip |
676 |
|
+ #open connection ssh failed |
677 |
|
+ my $ip=ipdot2ipnum($5,$6,$7,$8); |
678 |
|
+ my $date=mkmysqldate($1); |
679 |
|
+ debug "SELECT * FROM ssh WHERE ip='$ip' and debut='$date' and login='$4'\n"; |
680 |
|
+ my $reslt=execute_sql_query("SELECT * FROM ssh WHERE ip='$ip' and debut='$date' and login='$4'"); |
681 |
|
+ execute_sql_query("INSERT INTO ssh VALUES ('$date','$ip','$4','0')") if ($reslt eq "0E0");; |
682 |
|
+ next; |
683 |
|
+ } |
684 |
|
+ |
685 |
|
} |
686 |
|
} |
687 |
|
|
688 |
|
@@ -614,7 +645,7 @@ |
689 |
|
} |
690 |
|
} |
691 |
|
#ici on matche les fins de connexion ftp (reussies ou non) |
692 |
|
- elsif ($nom eq "proftpd/current") { |
693 |
|
+ elsif ($nom eq "proftpd/proftpd.log") { |
694 |
|
while ( defined(my $l = <$fh>)) { |
695 |
|
chomp $l; |
696 |
|
#@4000000043973d2916bb3c9c tcpsvd: info: end 9952 exit 0 |
697 |
|
@@ -658,10 +689,12 @@ |
698 |
|
if ($l =~ /FOUND/) {$net_virus++;next;} |
699 |
|
} |
700 |
|
} |
701 |
|
- elsif ($nom eq "spamd/current") { |
702 |
|
+ elsif ($nom eq "spamd/spamd.log") { |
703 |
|
while ( defined(my $l = <$fh>)) { |
704 |
|
chomp $l; |
705 |
|
#@4000000043a1c3ab1ff72c94 2005-12-15 19:27:29 [4838] i: identified spam (997.2/3.0) for qpsmtpd:1005 in 2.2 seconds, 557 bytes. |
706 |
|
+ # SME10 |
707 |
|
+ #Mar 25 18:40:17 sacrum check[12093]: spamd: identified spam (98.8/4.0) for qpsmtpd:1005 in 17.4 seconds, 211566 bytes. |
708 |
|
if($l =~ /identified spam/) {$net_spam++;next;} |
709 |
|
} |
710 |
|
} |
711 |
|
@@ -723,10 +756,10 @@ |
712 |
|
$cntaqmlocal{total} = $cntaqmlocal{total} + $cntaqmlocal{$_} if $_ !~ /total/; |
713 |
|
} |
714 |
|
## add qmail local queue |
715 |
|
- $localaqueue=`find /var/service/altqmail/root/var/qmail/queue/local/ -type f | wc -l`; |
716 |
|
+ $localaqueue=`find /var/service/altqmail/root/var/qmail/queue/local/ -type f 2>/dev/null| wc -l` || "0"; |
717 |
|
$localaqueue=~ s/\D+//g; |
718 |
|
### add qmail remote queue |
719 |
|
- $remoteaqueue=`find /var/service/altqmail/root/var/qmail/queue/remote/ -type f | wc -l`; |
720 |
|
+ $remoteaqueue=`find /var/service/altqmail/root/var/qmail/queue/remote/ -type f 2>/dev/null| wc -l` ||"0"; |
721 |
|
$remoteaqueue=~ s/\D+//g; |
722 |
|
$net_amail_out=$cntaqm{total}; |
723 |
|
|
724 |
|
@@ -789,7 +822,7 @@ |
725 |
|
|
726 |
|
} |
727 |
|
|
728 |
|
- elsif ($nom eq "messages") { |
729 |
|
+ elsif ($nom eq "/dhcpd/dhcpd.log") { |
730 |
|
while ( defined(my $l = <$fh>)) { |
731 |
|
#Baux DHCP |
732 |
|
#/var/log/messages:Nov 28 19:34:14 sme7b5 dhcpd: DHCPACK on 192.168.1.250 to 00:e0:4c:39:03:a5 via eth0 |
733 |
|
@@ -811,7 +844,10 @@ |
734 |
|
$net_dhcp++; |
735 |
|
next; |
736 |
|
} |
737 |
|
- |
738 |
|
+ } |
739 |
|
+ } |
740 |
|
+ elsif ($nom eq "messages") { |
741 |
|
+ while ( defined(my $l = <$fh>)) { |
742 |
|
#Connexion afp (beta test ??) 1-ouverture session (548==>port afpovertcp) |
743 |
|
#Jul 13 11:50:02 sas afpd[30668]: ASIP session:548(2) from 192.168.150.12:49278(0) |
744 |
|
#Match: mmm dd hh:mm:ss hostname afpd[pid]: ASIP session:548(xxxx)?? from ip:port(xx?) |
745 |
|
@@ -1355,41 +1391,45 @@ |
746 |
|
# cette fonction met a jour les RRDs. Elle a ete "factorisee" pour plus de lisibilite |
747 |
|
sub update_rrd { |
748 |
|
#DEBUG !! |
749 |
|
-# print "sensors_temp1=$sensors_temp1,sensors_temp_hd1=$sensors_temp_hd1,sensors_temp_hd2=$sensors_temp_hd2,"; |
750 |
|
-# print "sensors_temp2=$sensors_temp2,sensors_fan_speed=$sensors_fan_speed,sensors_fan2_speed=$sensors_fan2_speed\n"; |
751 |
|
-# print "hd_total=$hd_total,hd_used=$hd_used,hd_free=$hd_free,hd_log=$hd_log,"; |
752 |
|
-# print "hd_files=$hd_files,hd_squid=$hd_squid,hd_mysql=$hd_mysql,hd_blkread=$hd_blkread,hd_blkwrite=$hd_blkwrite\n"; |
753 |
|
-# print "if_loc_bin=$if_loc_bin,if_loc_bout=$if_loc_bout,if_loc_pin=$if_loc_pin,if_loc_pout=$if_loc_pout\n"; |
754 |
|
-# print "if_ext_bin=$if_ext_bin,if_ext_bout=$if_ext_bout,if_ext_pin=$if_ext_pin,if_ext_pout=$if_ext_pout\n"; |
755 |
|
-# print "net_samba=$net_samba,net_minlatency=$net_minlatency,net_avglatency=$net_avglatency,"; |
756 |
|
-# print "net_maxlatency=$net_maxlatency,net_loss=$net_loss,net_spam=$net_spam,net_virus=$net_virus,"; |
757 |
|
-# print "net_dhcp=$net_dhcp,net_mail_in=$net_mail_in,net_mail_out=$net_mail_out\n"; |
758 |
|
-# print "cpu_total=$cpu_total,cpu_idle=$cpu_idle,cpu_system=$cpu_system,cpu_user=$cpu_user\n"; |
759 |
|
-# print "cpu_nice=$cpu_nice,cpu_plist=$cpu_plist,cpu_runq=$cpu_runq"; |
760 |
|
-# print "cpu_load1=$cpu_load1,cpu_load5=$cpu_load5,cpu_load15=$cpu_load15,cpu_uptime=$cpu_uptime\n"; |
761 |
|
-# print "mem_memtotal=$mem_memtotal,mem_memused=$mem_memused,mem_memfree=$mem_memfree"; |
762 |
|
-# print "mem_memactualused=$mem_memactualused,mem_memactualfree=$mem_memactualfree\n"; |
763 |
|
-# print "mem_membuffers=$mem_membuffers,mem_memcache=$mem_memcache"; |
764 |
|
-# print "mem_swaptotal=$mem_swaptotal,mem_swapused=$mem_swapused,mem_swapfree=$mem_swapfree\n"; |
765 |
|
-# print "httpd cpu=$httpd_cpu, mem=$httpd_mem, nb=$httpd_nbproc\n"; |
766 |
|
-# print "samba cpu=$samba_cpu, mem=$samba_mem, nb=$samba_nbproc\n"; |
767 |
|
-# print "afp cpu=$afp_cpu, mem=$afp_mem, nb=$afp_nbproc\n"; |
768 |
|
-# print "squid cpu=$squid_cpu, mem=$squid_mem, nb=$squid_nbproc\n"; |
769 |
|
-# print "sessions_ftp=$sessions_ftp,sessions_ssh=$sessions_ssh,"; |
770 |
|
-# print "sessions_vpn=$sessions_vpn,sessions_netbios=$sessions_netbios\n"; |
771 |
|
-# print "check_basicheaders=$mail_in_check_basicheaders,check_earlytalker=$mail_in_check_earlytalker,check_goodrcptto=$mail_in_check_goodrcptto,check_spamhelo=$mail_in_check_spamhelo," |
772 |
|
+ debug "sensors_temp1=$sensors_temp1,sensors_temp_hd1=$sensors_temp_hd1,sensors_temp_hd2=$sensors_temp_hd2,"; |
773 |
|
+ debug "sensors_temp2=$sensors_temp2,sensors_fan_speed=$sensors_fan_speed,sensors_fan2_speed=$sensors_fan2_speed\n"; |
774 |
|
+ debug "hd_total=$hd_total,hd_used=$hd_used,hd_free=$hd_free,hd_log=$hd_log,"; |
775 |
|
+ debug "hd_files=$hd_files,hd_squid=$hd_squid,hd_mysql=$hd_mysql,hd_blkread=$hd_blkread,hd_blkwrite=$hd_blkwrite\n"; |
776 |
|
+ debug "if_loc_bin=$if_loc_bin,if_loc_bout=$if_loc_bout,if_loc_pin=$if_loc_pin,if_loc_pout=$if_loc_pout\n"; |
777 |
|
+ debug "if_ext_bin=$if_ext_bin,if_ext_bout=$if_ext_bout,if_ext_pin=$if_ext_pin,if_ext_pout=$if_ext_pout\n"; |
778 |
|
+ debug "net_samba=$net_samba,net_minlatency=$net_minlatency,net_avglatency=$net_avglatency,"; |
779 |
|
+ debug "net_maxlatency=$net_maxlatency,net_loss=$net_loss,net_spam=$net_spam,net_virus=$net_virus,"; |
780 |
|
+ debug "net_dhcp=$net_dhcp,net_mail_in=$net_mail_in,net_mail_out=$net_mail_out\n"; |
781 |
|
+ debug "cpu_total=$cpu_total,cpu_idle=$cpu_idle,cpu_system=$cpu_system,cpu_user=$cpu_user\n"; |
782 |
|
+ debug "cpu_nice=$cpu_nice,cpu_plist=$cpu_plist,cpu_runq=$cpu_runq"; |
783 |
|
+ debug "cpu_load1=$cpu_load1,cpu_load5=$cpu_load5,cpu_load15=$cpu_load15,cpu_uptime=$cpu_uptime\n"; |
784 |
|
+ debug "mem_memtotal=$mem_memtotal,mem_memused=$mem_memused,mem_memfree=$mem_memfree"; |
785 |
|
+ debug "mem_memactualused=$mem_memactualused,mem_memactualfree=$mem_memactualfree\n"; |
786 |
|
+ debug "mem_membuffers=$mem_membuffers,mem_memcache=$mem_memcache"; |
787 |
|
+ debug "mem_swaptotal=$mem_swaptotal,mem_swapused=$mem_swapused,mem_swapfree=$mem_swapfree\n"; |
788 |
|
+ debug "httpd cpu=$httpd_cpu, mem=$httpd_mem, nb=$httpd_nbproc\n"; |
789 |
|
+ debug "samba cpu=$samba_cpu, mem=$samba_mem, nb=$samba_nbproc\n"; |
790 |
|
+ debug "afp cpu=$afp_cpu, mem=$afp_mem, nb=$afp_nbproc\n"; |
791 |
|
+ debug "squid cpu=$squid_cpu, mem=$squid_mem, nb=$squid_nbproc\n"; |
792 |
|
+ debug "sessions_ftp=$sessions_ftp,sessions_ssh=$sessions_ssh,"; |
793 |
|
+ debug "sessions_vpn=$sessions_vpn,sessions_netbios=$sessions_netbios\n"; |
794 |
|
+# debug "check_basicheaders=$mail_in_check_basicheaders,check_earlytalker=$mail_in_check_earlytalker,check_goodrcptto=$mail_in_check_goodrcptto,check_spamhelo=$mail_in_check_spamhelo," |
795 |
|
#."clamav=$mail_in_clamav,dmarc=$mail_in_dmarc,dnsbl=$mail_in_dnsbl,fcrdns=$mail_in_fcrdns,karma=$mail_in_karma,other_denied=$mail_in_other_denied,queued=$mail_in_queued,resolvable_fromhost=$mail_in_resolvable_fromhost," |
796 |
|
#."rhsbl=$mail_in_rhsbl,spam_denied=$mail_in_spam_denied,spam_queued=$mail_in_spam_queued,spf=$mail_in_spf,tls_failed=$mail_in_tls_failed,total=$mail_in_total,total_denied=$mail_in_total_denied,uribl=$mail_in_uribl\n"; |
797 |
|
-# foreach (keys %denied,@others){ print "$_: $cnt{$_},";}; print "\n"; |
798 |
|
-# print join(':', map {$cnt{$_}} keys %denied,@others); print "\n"; |
799 |
|
- print "qmail "; |
800 |
|
- foreach (@resultsqm){ print "local_$_:$cntqmlocal{$_},";}; foreach (@resultsqm){ print "$_:$cntqm{$_},";}; |
801 |
|
- print "localqueue=$localqueue,remotequeue=$remotequeue\n"; |
802 |
|
-# print join(':', map {$cntqmlocal{$_}} @resultsqm) .":". join(':', map {$cntqm{$_}} @resultsqm); print ":". $localqueue .":". $remotequeue; print "\n"; |
803 |
|
- print "altqmail "; |
804 |
|
- foreach (@resultsaqm){ print "local_$_:$cntaqmlocal{$_},";}; foreach (@resultsaqm){ print "$_:$cntaqm{$_},";}; |
805 |
|
- print "localqueue=$localaqueue,remotequeue=$remoteaqueue\n"; |
806 |
|
-# print join(':', map {$cntaqmlocal{$_}} @resultsaqm) .":". join(':', map {$cntaqm{$_}} @resultsaqm); print ":". $localaqueue .":". $remoteaqueue; print "\n"; |
807 |
|
+ foreach (keys %denied,@others){ debug "$_: $cnt{$_},";}; debug "\n"; |
808 |
|
+ # print join(':', map {$cnt{$_}} keys %denied,@others); print "\n"; |
809 |
|
+ debug "qmail "; |
810 |
|
+ foreach (@resultsqm){ debug "local_$_:$cntqmlocal{$_},";}; foreach (@resultsqm){ debug "$_:$cntqm{$_},";}; |
811 |
|
+ debug "localqueue=$localqueue,remotequeue=$remotequeue\n"; |
812 |
|
+ # print join(':', map {$cntqmlocal{$_}} @resultsqm) .":". join(':', map {$cntqm{$_}} @resultsqm); print ":". $localqueue .":". $remotequeue; print "\n"; |
813 |
|
+ if (defined $localaqueue) { |
814 |
|
+ debug("altqmail "); |
815 |
|
+ foreach (@resultsaqm){ debug "local_$_:$cntaqmlocal{$_},";}; foreach (@resultsaqm){ debug "$_:$cntaqm{$_},";}; debug "\n"; |
816 |
|
+ debug("localqueue=$localaqueue,remotequeue=$remoteaqueue\n"); |
817 |
|
+ # print join(':', map {$cntaqmlocal{$_}} @resultsaqm) .":". join(':', map {$cntaqm{$_}} @resultsaqm); print ":". $localaqueue .":". $remoteaqueue; print "\n"; |
818 |
|
+ } else { |
819 |
|
+ $localaqueue=""; $remoteaqueue=""; |
820 |
|
+ } |
821 |
|
|
822 |
|
my %rrds=( |
823 |
|
"sensors"=>"$sensors_temp1:$sensors_temp2:$sensors_temp_hd1:$sensors_temp_hd2:$sensors_fan_speed:$sensors_fan2_speed:$sensors_temp_hd3:$sensors_temp_hd4:$sensors_temp_hd5:$sensors_temp_hd6", |
824 |
|
diff -Nur --no-dereference smeserver-smeadmin-1.6.old/root/usr/lib/systemd/system/smeadmind.service smeserver-smeadmin-1.6/root/usr/lib/systemd/system/smeadmind.service |
825 |
|
--- smeserver-smeadmin-1.6.old/root/usr/lib/systemd/system/smeadmind.service 1969-12-31 19:00:00.000000000 -0500 |
826 |
|
+++ smeserver-smeadmin-1.6/root/usr/lib/systemd/system/smeadmind.service 2021-03-27 22:31:08.730000000 -0400 |
827 |
|
@@ -0,0 +1,21 @@ |
828 |
|
+[Unit] |
829 |
|
+Description=SME Admin Monitor Agent for Koozali SME Server |
830 |
|
+Before=shutdown.target |
831 |
|
+Conflicts=shutdown.target |
832 |
|
+ |
833 |
|
+[Service] |
834 |
|
+Type=forking |
835 |
|
+Restart=no |
836 |
|
+TimeoutSec=1min |
837 |
|
+IgnoreSIGPIPE=no |
838 |
|
+KillMode=process |
839 |
|
+RemainAfterExit=yes |
840 |
|
+ |
841 |
|
+PIDFile=/var/run/smeadmin.pid |
842 |
|
+ExecStart=/usr/bin/smeadmind |
843 |
|
+ExecReload=/usr/bin/kill -HUP $MAINPID |
844 |
|
+Restart=always |
845 |
|
+RestartSec=5 |
846 |
|
+ |
847 |
|
+[Install] |
848 |
|
+WantedBy=sme-server.target |